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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& q; |- n4 l, N" m6 @  s" F/ }. ]4 ~
  1. [code]EDMA sample test application  B+ B* q. q7 ~4 a
  2. /*, L# d# b( x7 o  P4 Y! k
  3. * edma_test.c% I* j6 N8 n  o
  4. *) S$ H/ l8 [+ ]/ S. \0 g$ G( i# h0 w, V
  5. * brief  EDMA3 Test Application6 Y  l: s! M1 o1 ]
  6. *( u+ `! }/ m2 b# m; Y9 E' F7 l6 v
  7. *   This file contains EDMA3 Test code.
    1 a' j" ~4 d& Z* o
  8. *
    ! j0 m. w; ~$ s9 l" ^! Y$ F# Y. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `, {7 {+ z" i& a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 i9 w4 u/ q6 F4 o
  11. *         TO CHANGE.
    & f9 d) ^4 d* H% h  Y+ F* ?
  12. *' Z9 O- w! R4 v: d: z2 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # z  |/ p! ?2 p4 |7 ?" K) ?
  14. *
    ( ~9 }1 t+ q) [8 e  z+ H, Q5 Z
  15. * This program is free software; you can redistribute it and/or3 N, y& N- z# I. A; J! x, U9 d( k# A
  16. * modify it under the terms of the GNU General Public License as
    : D1 A& k* ]! C* d8 i5 A+ y) Z
  17. * published by the Free Software Foundation version 2.9 G: s* i3 d2 t. T
  18. *
    & ~# G9 ]2 G, h  A" V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 a( i( h* q1 h- h  J& x
  20. * kind, whether express or implied; without even the implied warranty
    : z3 ~- P* I( i/ a) V% m- F2 E7 f! f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / z6 F* M2 h1 }* A3 q
  22. * GNU General Public License for more details.2 U9 p* S% u8 ^6 h( }
  23. */( r; a# ^/ y6 [5 r

  24. " X; B7 a1 A$ F
  25. #include <linux/module.h>+ D5 V* F/ a3 {, q
  26. #include <linux/init.h>
    9 y9 r0 @% R; L' U
  27. #include <linux/errno.h>& U  T! A; l0 |$ |; R0 [0 T* ~* D
  28. #include <linux/types.h>
    $ W+ X/ C5 D4 s- k5 f
  29. #include <linux/interrupt.h>
    7 |. i# J2 n! W6 O: G
  30. #include <asm/io.h>
    5 P# g" U# ^* p: u
  31. #include <linux/moduleparam.h>
    5 v8 y# o% n# S5 O( A- T1 T6 }9 J
  32. #include <linux/sysctl.h>
    ; P. H! H, z4 _! |, [
  33. #include <linux/mm.h>
    & B5 L" F, q: Y0 k+ ?( a
  34. #include <linux/dma-mapping.h>
    # p0 k( j1 o1 ~

  35. % s+ |: j5 L/ f$ X& m9 z$ T1 ^/ R
  36. #include <mach/memory.h>; q8 G4 t  O* R- Q% @. r1 y
  37. #include <mach/hardware.h>
    3 \: d3 w- t8 K  I  a. w
  38. #include <mach/irqs.h>4 T6 ~  T$ u9 k. i& O, W! C
  39. #include <asm/hardware/edma.h>
    $ a' F+ p3 }! {5 b; v/ v. P6 B

  40. 8 I$ H$ N2 c. l! a1 h! h# n. f
  41. #undef EDMA3_DEBUG, r! E. }+ O/ w5 M$ X# ?
  42. /*#define EDMA3_DEBUG*/. D# I7 q2 ~2 c5 C* X7 h

  43. . T8 u- p' o; d5 S! ]' ^
  44. #ifdef EDMA3_DEBUG
    1 z! M5 k9 h7 u9 t3 D# x( ~9 t% D8 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ?. W* ]% G* J& g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : S+ c9 F1 l0 l0 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 z% j  a. ^" j9 D
  48. #else( |# T9 k- y- ~; y; U# N1 }
  49. #define DMA_PRINTK( x... )/ }1 {* Q' B- S) u' w* E; \. R- c
  50. #define DMA_FN_IN
    ) `, z% ]' l9 k% L
  51. #define DMA_FN_OUT, y1 B2 [9 |+ O0 B7 {
  52. #endif, r8 p6 c- X, q8 D) l7 f
  53. 0 W& o2 I# L/ o* z0 @: H* @2 L7 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* w* k1 C% I7 B7 t: c5 U
  55. #define STATIC_SHIFT                3
    : I( I+ s* [( m7 P6 |
  56. #define TCINTEN_SHIFT               20
    6 R" ^7 J, [( p; `6 }8 [1 T
  57. #define ITCINTEN_SHIFT              210 [8 N9 M  Z1 S9 Y
  58. #define TCCHEN_SHIFT                22
      {* `9 H& B; ]9 q2 {4 O
  59. #define ITCCHEN_SHIFT               23* V+ b: K( H! H; [# @, K

  60. " M, L4 S5 I2 {( n0 @! B% D
  61. static volatile int irqraised1 = 0;
    ! K+ Y0 v% |; K% r  J2 o! I# U. r
  62. static volatile int irqraised2 = 0;
    ' F- `& Z, w7 {6 e" T6 F! ?

  63. 3 x1 ^2 }& F) e) c& j& ?, ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 |( @. [, }; F. x6 |- @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e: u9 Z( t6 [) Q$ v& `  ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e9 u# W+ o4 i$ q/ O8 k

  67.   Q& ]* p; K0 g/ F( V6 [* r+ K
  68. dma_addr_t dmaphyssrc1 = 0;: w( I  W& n% y% u1 w* J0 K
  69. dma_addr_t dmaphyssrc2 = 0;5 r+ P; k- j  p6 w$ b
  70. dma_addr_t dmaphysdest1 = 0;
    3 [, C3 X6 I( e& b' `! g# }0 v) t
  71. dma_addr_t dmaphysdest2 = 0;( v9 V+ K9 Q4 B$ o  k

  72. - ]. Z% M* f) _" l9 n( Z
  73. char *dmabufsrc1 = NULL;! G. E8 ~1 }9 S  @3 |; D) _
  74. char *dmabufsrc2 = NULL;
    9 H) Y; q, W; T  f
  75. char *dmabufdest1 = NULL;
    + n- H! A5 ]) m) Z+ D7 V, ]
  76. char *dmabufdest2 = NULL;7 W% F0 J% ?% A. m. |
  77. . j# l  p) u) p
  78. static int acnt = 512;
    ( }$ X& f7 D1 q  \) ~
  79. static int bcnt = 8;9 q& U! \9 Y: q7 O# j! Q; X
  80. static int ccnt = 8;5 z# t6 _& ^9 s4 M% O9 [. [2 Q! f

  81. $ _3 C+ ?: b) E5 c. Z* f0 c
  82. module_param(acnt, int, S_IRUGO);
    . O- G. r: y3 q5 T! v7 Z0 ~
  83. module_param(bcnt, int, S_IRUGO);; Q6 ~0 s8 n+ N' V% G0 o3 D9 _) {  c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; n: I; `1 w, z, [

" p& M9 t" X# i/ X- X& |/ ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 q) r# o% m8 G, _/ Q/ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ m/ h8 d. L+ r/ r/ F: s2 v  c' p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) D8 d0 j/ o& K- |+ w* ]
6 o" \( q+ j3 j) ]* I$ N: }
: n/ M! h6 T7 C  ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 16:16 , Processed in 0.041255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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