OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8247|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Z0 ?0 C5 }6 x. A
  1. [code]EDMA sample test application2 o# U/ s4 u- R: V
  2. /*
    6 e6 F% l: X- U% R3 d1 b
  3. * edma_test.c
    - u1 }: \  @; Y$ A- z
  4. *5 Z  O* m1 Y3 t0 |" v( F0 S
  5. * brief  EDMA3 Test Application
    ! L  e. Z. [9 o: h* }) X$ q3 j& E
  6. *
    4 O" z& L' e" t$ [) k: w
  7. *   This file contains EDMA3 Test code.
    ) g+ C( q7 s7 i2 _# a( ~5 g$ p
  8. *
    . ]/ d# E1 }9 _0 v5 m: N  S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 `" u% }; P1 _6 ]* o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ^$ K9 E3 V" T( G/ o4 U! O1 N3 |
  11. *         TO CHANGE.3 K2 T. M2 U; |, o. k
  12. *4 H% Y5 G* E; h  e0 w8 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 R/ A  `+ [, K/ L: T
  14. *7 X" B: t& S0 a+ Z6 u* A
  15. * This program is free software; you can redistribute it and/or
      d' S0 M& {/ d9 X; y$ |+ _
  16. * modify it under the terms of the GNU General Public License as) v+ [+ H- R# G6 H/ h; z
  17. * published by the Free Software Foundation version 2.
      s* l9 D, G* `4 }2 E; B
  18. *  F3 r- z1 W! E' a& O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 [7 ~0 u: S( e, G. m) R6 n& E$ z
  20. * kind, whether express or implied; without even the implied warranty
    2 y, K/ G+ H; F# N: k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 w+ |* `8 l( ]: k/ {
  22. * GNU General Public License for more details.& m3 M& x" i, @5 r
  23. */
    9 T& F7 a) s/ i- g0 g$ ^& u
  24. ) \4 Y4 S' N" q0 Q" Q
  25. #include <linux/module.h>. X! k. C/ ~3 A3 V8 E. T- ^4 h
  26. #include <linux/init.h>
    # m& i- S# W. g4 T1 o& v
  27. #include <linux/errno.h>
    " {% R( N8 _6 N( O" d7 r: y
  28. #include <linux/types.h>
    % H$ V2 d4 V( i7 T& H6 F3 e4 s
  29. #include <linux/interrupt.h>
    ' q7 E. N: J- B3 ^4 d0 _+ V$ ~
  30. #include <asm/io.h>
    * K8 d2 l, H& M, u- h' T
  31. #include <linux/moduleparam.h>& D/ I# ~3 J5 E3 f3 h( A
  32. #include <linux/sysctl.h>- M1 W9 l- g2 \% e/ H# k9 W7 f
  33. #include <linux/mm.h>; p1 q1 [, D1 n& e# H  J" @* v7 \6 x
  34. #include <linux/dma-mapping.h>) A; F4 C, j- N$ ^0 U9 M$ |4 u
  35. + j4 ^, E2 f* V5 e8 h8 l
  36. #include <mach/memory.h>
    5 C* O, ^4 t) S* ?8 F" U# Y; r
  37. #include <mach/hardware.h>, }8 d) K# D) m6 y' Z
  38. #include <mach/irqs.h>7 ]: M. `( E$ b" ~1 ]5 z4 X
  39. #include <asm/hardware/edma.h>/ M8 @8 u% Y' p& z* s

  40. 5 M! H; ~( q, h- M
  41. #undef EDMA3_DEBUG
      t1 \+ \; u! @+ t$ _3 F
  42. /*#define EDMA3_DEBUG*/
    ( M' G" X1 ~0 e/ o5 q% l9 @8 z
  43. # W; n! k( v5 d4 A' o8 N
  44. #ifdef EDMA3_DEBUG8 W. f. x4 ^1 C! Y0 M3 l9 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ]0 \9 w5 ]8 P% @- W1 r; J1 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  K# v9 O/ }0 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J, N3 y6 r  u
  48. #else+ U* T/ b3 b. G2 {8 }# F
  49. #define DMA_PRINTK( x... )
    6 o# a7 }8 _  M+ ?7 v/ R% C
  50. #define DMA_FN_IN9 _4 h' M3 {# N1 ^
  51. #define DMA_FN_OUT
    5 o: m5 k$ w) [  W- g
  52. #endif) e3 o1 p/ r4 h) d

  53. 2 Q5 c& q5 [" f& c8 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 U  V% C% F; V! f1 y
  55. #define STATIC_SHIFT                31 d7 C$ H2 i2 N6 w+ J' P
  56. #define TCINTEN_SHIFT               20
    # x4 ], h. Q# I: ?: W. e' q9 s5 S
  57. #define ITCINTEN_SHIFT              21( k' x/ W" U5 c+ c4 v* l" `2 m* \1 J
  58. #define TCCHEN_SHIFT                22. X5 Q, Q) g2 w2 X3 P" k' b) U* Z
  59. #define ITCCHEN_SHIFT               234 _  v; K- P& t9 v
  60. & I+ C: T# k6 y# M  T
  61. static volatile int irqraised1 = 0;
    " N5 A6 I& i% }! A# y
  62. static volatile int irqraised2 = 0;
    $ J( |- [9 U! R; r0 d3 I) Q

  63.   }) b5 L. d4 u7 h8 {' D: w  X0 f; _* l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# r+ w0 E; k) O5 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 r; T$ S$ f7 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K4 d! v5 U' `) v9 C3 ]' a

  67. % W- _7 a9 G0 `5 \# J
  68. dma_addr_t dmaphyssrc1 = 0;
    / ^! M! U* i$ h* X/ f6 z0 f: `; J
  69. dma_addr_t dmaphyssrc2 = 0;' x. R7 Z; v; |( \; [& i# i
  70. dma_addr_t dmaphysdest1 = 0;5 B' W6 C* S7 C! R
  71. dma_addr_t dmaphysdest2 = 0;" u; |9 I1 Y, m# b1 s5 n, f. y

  72. & w0 c8 I+ e6 Z6 @, M$ @
  73. char *dmabufsrc1 = NULL;
    # Z' c& N8 C) q, K  O3 h2 B
  74. char *dmabufsrc2 = NULL;$ E. h9 K+ J; ~* ^9 N  @" _6 |
  75. char *dmabufdest1 = NULL;1 c0 Q# \8 y8 b* j% ?
  76. char *dmabufdest2 = NULL;
    ' ?' j% {4 Y* @5 M1 h, m0 W
  77. : m( A: g" a0 B# ]* d9 H* {
  78. static int acnt = 512;% @5 S" B8 g, E& s
  79. static int bcnt = 8;
    7 Z/ Y1 y7 V6 B
  80. static int ccnt = 8;* {, ~/ o/ h) t6 H* R

  81. 5 M" K" Y9 O' N3 m/ Y+ |
  82. module_param(acnt, int, S_IRUGO);
    + m+ v  T: _3 C6 G& P
  83. module_param(bcnt, int, S_IRUGO);4 v  F7 [" M" B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( \0 f9 a$ e+ P4 [$ g2 C9 o2 [1 V
8 _7 A# X2 y2 j. m1 j. B# p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- z' P7 ^) ]9 G% {. l9 N, E/ U
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 }6 j: w6 X; R, G# @9 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ m1 R7 e( c' n. g0 p

! |* p* o2 S) @" o
* _4 ^3 X+ M+ h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-11-11 22:06 , Processed in 0.037441 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表