OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 L! G$ [4 q+ W, n2 m, D
  1. [code]EDMA sample test application# ^3 r* D2 o6 s! @) p
  2. /*+ J: j. i9 z0 l& w% q7 Y% g
  3. * edma_test.c6 a- a; y/ A4 s- V* m4 Q* |
  4. *6 _8 D1 ?! Z2 ^
  5. * brief  EDMA3 Test Application8 c! d0 a. Y- X5 o; M9 k& I
  6. *' G7 h6 y* f2 Z0 P" D6 x
  7. *   This file contains EDMA3 Test code.! C" F; v! X2 `2 w* s
  8. *& \0 i+ D9 c: {/ k0 X+ d0 Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K3 H. v3 `% c4 G0 r4 a, w( F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( {" I/ U3 V. g7 [. J8 T3 O7 ^
  11. *         TO CHANGE.* \. L6 e. L: F: n
  12. *
    ; m; n# @2 H* U5 A1 \$ w/ j  t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# g( p/ y+ p& \
  14. *
    & w' H+ Z$ M' f  ^; X
  15. * This program is free software; you can redistribute it and/or8 [$ p7 x: V( z! t' E# Y# S# N
  16. * modify it under the terms of the GNU General Public License as
    1 \- k* O$ y5 \
  17. * published by the Free Software Foundation version 2./ T3 S, f) R, T! K6 o
  18. *  U. B$ N4 v  G1 [6 W: E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( h2 V% r! A. g; w/ U$ ?( m
  20. * kind, whether express or implied; without even the implied warranty- |' U- e8 G% G- L3 @( g3 x+ W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ {+ B  Y. }: ]) ]- o- A3 |+ S
  22. * GNU General Public License for more details.# m+ B& t7 {3 v4 P; P( V4 ]
  23. */
    + A, c& Z, C. |5 l6 H7 ^4 B# s/ F
  24. ' `3 Y. n, B& w, Y
  25. #include <linux/module.h>. J& {1 V8 D! |7 K6 w
  26. #include <linux/init.h>- Q' _0 k0 d# L4 @- u
  27. #include <linux/errno.h>
    1 @" I- a3 Z) U% z" ]; w  n
  28. #include <linux/types.h>, f* E8 Q6 b$ v$ }( w2 T$ r: e
  29. #include <linux/interrupt.h>
    , I6 Y* V8 z. s1 B) s
  30. #include <asm/io.h>( o2 |% S  |4 M1 F
  31. #include <linux/moduleparam.h>2 T. ]3 }: W! r0 w" ?
  32. #include <linux/sysctl.h>
    - ?' d. v5 q) M  ?+ a" `
  33. #include <linux/mm.h>. K: T. c9 Q& f) D/ I
  34. #include <linux/dma-mapping.h>* |% O+ Z0 d5 P* [4 U
  35. 1 ^2 W1 b( ?, b
  36. #include <mach/memory.h>
    5 U# V) @7 g) j7 e6 z
  37. #include <mach/hardware.h>7 J8 F6 N8 K! ^
  38. #include <mach/irqs.h>
    ' v8 A. y" n& F: K# ~
  39. #include <asm/hardware/edma.h>, ~( Z( V- Z, j  W$ j

  40. / @* |" f2 u6 }4 h2 k
  41. #undef EDMA3_DEBUG
    / D/ x# e# G2 o* r" @
  42. /*#define EDMA3_DEBUG*/
    % \& p% \. }& y) ?

  43. ; O! ~0 e0 z6 E1 \/ e
  44. #ifdef EDMA3_DEBUG2 q1 i& E/ v8 R. s" i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U& I$ j5 O9 ?0 x/ u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' C. s, ~2 G) f) y: Q8 Z! W. x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 S8 y  w" D* a2 b
  48. #else
    4 e, D6 d: c4 w: e2 q/ t# U
  49. #define DMA_PRINTK( x... )
    , E  k- \8 V* ]6 M8 u- i! y
  50. #define DMA_FN_IN8 y$ |; l  s) Y6 p
  51. #define DMA_FN_OUT
    & p0 V" ^" N$ h) p8 `
  52. #endif: `4 a. e2 _& I( j1 U4 |  X4 h- U
  53. 9 C4 X) Q$ U: n7 S. i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % U6 Q' _5 H; b+ o2 H& ]0 `. r( R" r/ x
  55. #define STATIC_SHIFT                3  a/ j* i0 Z1 L
  56. #define TCINTEN_SHIFT               20+ _* A3 ^/ M1 M) i$ u0 r5 T
  57. #define ITCINTEN_SHIFT              21
    # h; D) R/ T. G7 ?$ q
  58. #define TCCHEN_SHIFT                22
    8 }' D2 V" i5 p
  59. #define ITCCHEN_SHIFT               23
    ; b% y9 O, m) I1 |4 n3 y; e/ F; e

  60. - {/ G( b8 c- X& a; N, \
  61. static volatile int irqraised1 = 0;  @; n- T; R8 {3 j2 y" S
  62. static volatile int irqraised2 = 0;' |8 G& B& Z9 R" I; l2 ], j
  63. 2 P* F1 E8 k( B/ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 d8 I3 M3 i8 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - l2 O5 J0 \2 l, ^* W2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # \% q( ^5 H1 A: ~- Y' v
  67. + F1 G+ R8 U5 T. {+ D; L! C4 r: W
  68. dma_addr_t dmaphyssrc1 = 0;% p- z/ x' q9 a8 R
  69. dma_addr_t dmaphyssrc2 = 0;- \0 n2 i- \+ U% C" V
  70. dma_addr_t dmaphysdest1 = 0;) x; C' e$ n+ r* a7 y5 T3 b% I; u" J
  71. dma_addr_t dmaphysdest2 = 0;1 f( y- I# @" S* i7 l  x

  72. , B4 D+ v$ `: v. Y  l/ ~
  73. char *dmabufsrc1 = NULL;7 v# X2 z: i- y+ R% l4 y5 \9 T7 k' c
  74. char *dmabufsrc2 = NULL;+ p4 O4 G1 }1 H
  75. char *dmabufdest1 = NULL;
    # _9 e* z$ U9 B8 x- N+ Q
  76. char *dmabufdest2 = NULL;
    ; ^+ w6 x( t9 a) l+ K/ a2 `

  77. 9 m! O. h) T' R: l0 i0 X
  78. static int acnt = 512;
    ; u4 a' B$ F# d  t2 Q
  79. static int bcnt = 8;. {2 ^. |: M1 f# r. K7 b
  80. static int ccnt = 8;" T: e3 v9 c1 N9 s; l/ y$ h
  81. . `, x+ R0 Q" X- @( _0 {. c
  82. module_param(acnt, int, S_IRUGO);4 i% N  q: l; f$ g. ]" }: Q
  83. module_param(bcnt, int, S_IRUGO);
    , Y- U, F/ q- C! p+ X5 A) `+ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 l) {& Z* s5 p9 U

  G1 O, I) o. V6 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- X* L) ]: u9 X9 U' iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 F8 |2 }4 ~/ t1 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g1 w; u. O; Q2 n
( e3 U' p4 O8 O" g6 k3 `1 c
( r/ g; D3 g4 x" I9 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-10-25 10:26 , Processed in 0.063148 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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