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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* {" ?+ a. B1 {" f1 E
  1. [code]EDMA sample test application1 [& ]! ]: [! {$ t% H
  2. /*
    " ~4 A$ H: u* X% O( M3 k
  3. * edma_test.c6 r+ M7 e3 ?! P4 m8 k+ r
  4. *
    5 n) i6 [* _- q3 a# M* U
  5. * brief  EDMA3 Test Application
    . S3 ?" y3 y& T' e
  6. *
    1 Y6 H5 }  J1 P  h: a
  7. *   This file contains EDMA3 Test code.
    * |# Z) E2 I* r) h* V1 J
  8. *
    % v0 v! p, @. T( o. j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  |8 ]4 _( G* y1 w, m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( z2 \9 ?) e" L& E, ?6 [% o
  11. *         TO CHANGE.
    7 C* @/ `4 B0 z0 B; c" D+ P: O5 q
  12. *
    + J7 }2 e" K: }5 W/ g/ a" q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  r( @5 ?- C7 D# Y
  14. *
    $ m. [7 ~; U, M/ `1 \" k9 M
  15. * This program is free software; you can redistribute it and/or2 {: j7 A4 A% K0 I8 V& A6 {
  16. * modify it under the terms of the GNU General Public License as
    1 ~) w& Z: z0 M& s
  17. * published by the Free Software Foundation version 2.
    " q* w+ B7 g5 U- y5 k
  18. *
    5 [& U& F, [: Y$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ B  ]0 v. v* X
  20. * kind, whether express or implied; without even the implied warranty  B* c" Y1 s6 c2 S% q: }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / C8 V$ [: C" j0 \
  22. * GNU General Public License for more details.2 m7 ?8 m' _& |+ q2 l: E
  23. */$ g/ k) h  @! X" r1 [
  24. 3 Q' Z: S. Q+ U) ?' t% E: d/ o
  25. #include <linux/module.h>
    3 `: B! i5 v: d) O: m" L
  26. #include <linux/init.h>
    2 O- N) k/ I  a7 `( ]( n" X7 I
  27. #include <linux/errno.h>
    $ ~8 J. u, l. B7 C0 @+ v
  28. #include <linux/types.h>
    + B0 _( r% ~4 B
  29. #include <linux/interrupt.h>% ~7 U- {0 D! Y' O! b6 l  b
  30. #include <asm/io.h>- P; E% ?* Z2 g- Z
  31. #include <linux/moduleparam.h>
    5 _4 \& G, [/ d, h% B8 q- L
  32. #include <linux/sysctl.h>
    8 d* V6 R) e) k5 w5 }) b4 m
  33. #include <linux/mm.h>
    ( [* \* M" z# t. J
  34. #include <linux/dma-mapping.h>8 I: p5 N2 Z1 ^9 p# N
  35. + q  W  s& b5 s+ V
  36. #include <mach/memory.h>
    ' i+ P& c9 ]/ ~7 l9 O6 }/ \+ ]5 _
  37. #include <mach/hardware.h>
    ; J6 a  j- Q6 M9 V1 k  Q/ K& q
  38. #include <mach/irqs.h>% {# d" y- ~% C4 q6 v) v1 P
  39. #include <asm/hardware/edma.h>0 q- g; i9 C; R8 V- p- I) ~

  40. " V: j8 k) B. K; F7 n
  41. #undef EDMA3_DEBUG
    & f: i$ J5 u* q* ~
  42. /*#define EDMA3_DEBUG*/
    0 x# s# E% ^" H6 y

  43. . P# Q+ a8 F3 Z9 l9 A
  44. #ifdef EDMA3_DEBUG9 b) a6 E3 {6 o/ [8 E2 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + B- s9 R6 a( j' J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 k3 q% m) K. X7 v/ Q5 e9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ F7 g0 F% c. w4 I, u& m
  48. #else0 ~  }$ B4 h& ]5 E6 T  D* c
  49. #define DMA_PRINTK( x... )
    0 Q8 E6 G' l, {3 I
  50. #define DMA_FN_IN
    " \* j* ?: |+ L3 v( ]* M
  51. #define DMA_FN_OUT, E7 [: K# Z9 D& s  C. ], _6 {
  52. #endif& M, L6 e, |& X4 M: o
  53. 7 T0 q( ~. {) K8 E/ w" p  d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " }' n, x( T9 ~2 A4 [; H6 R) Z
  55. #define STATIC_SHIFT                3" ?* I- \5 [0 u2 j* \
  56. #define TCINTEN_SHIFT               20) \" o. @  J* E; [  `5 h! d
  57. #define ITCINTEN_SHIFT              21
      S0 T4 K0 h: X# E: _9 w, _
  58. #define TCCHEN_SHIFT                22
    . O9 E( R' ~! z! Q8 p! E
  59. #define ITCCHEN_SHIFT               23& \0 B* s) ]: |* G  a* A/ o
  60. # u' C) d. Z$ J1 V
  61. static volatile int irqraised1 = 0;( a4 ^2 u, d- k. e
  62. static volatile int irqraised2 = 0;6 h0 q& @" O  w" X
  63. ) b/ C, x! M8 C7 `: B" ?0 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " W% _7 Y, ^+ U7 d6 h& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 `- Y1 r4 a' p' ]1 Z  N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # `/ ~* H2 B. O$ n' c0 w3 h

  67. $ d" A* c; x# q1 W8 o/ `; p
  68. dma_addr_t dmaphyssrc1 = 0;' H+ w( w( S9 ?. X+ o
  69. dma_addr_t dmaphyssrc2 = 0;5 e% V- A9 [: |+ V7 T! Q7 N0 U1 X! t, v
  70. dma_addr_t dmaphysdest1 = 0;3 L4 j+ S8 D4 f- }( f% R
  71. dma_addr_t dmaphysdest2 = 0;% I# {, O; U4 l; G! F

  72. 4 H7 I+ s( j: }7 a5 y  @
  73. char *dmabufsrc1 = NULL;. p. ^4 w6 r4 E9 i% Z
  74. char *dmabufsrc2 = NULL;( w5 U+ H& u# Q# P  R# K
  75. char *dmabufdest1 = NULL;
    + V& \% s4 F' Q: S3 ]9 D
  76. char *dmabufdest2 = NULL;
    % L) d" p6 Q8 y3 J, u6 e4 Q0 L& x

  77. / c# _: `) V* r$ Q* E+ f" G
  78. static int acnt = 512;+ ]9 m. c0 y( C& o+ }+ ]4 e6 a
  79. static int bcnt = 8;6 o* e) H6 C* K) ~! e  A; I
  80. static int ccnt = 8;
    * i; R" k' b3 @) u
  81. : P( e/ q; l2 w% j7 J7 D! t8 e
  82. module_param(acnt, int, S_IRUGO);
    - X+ x/ O4 |; k, o
  83. module_param(bcnt, int, S_IRUGO);' }+ \4 _  c; z5 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 t  A3 q; }. W6 G% n- @
8 _& b! H. T5 r9 q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 R5 u, n1 @: K( `" ]1 }1 m; T
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: {  z* ~4 I3 O" U, B3 x9 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ L/ {. s* C& o: _3 t' |) R* x
  t1 S- C# j% m6 u+ U5 _% Q$ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 20:51 , Processed in 0.039935 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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