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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! l8 x0 b7 w: m! @. b
  1. [code]EDMA sample test application
    + O. W& ]+ G) \5 s! k
  2. /*
    # Q8 Z- L/ X4 T, D
  3. * edma_test.c
    6 |( o# m% ?1 K' O; Y: _
  4. *
    & A5 Y2 p7 \! m5 V% ^3 m/ ~
  5. * brief  EDMA3 Test Application
    5 ]) _7 Q4 K- g; ~7 d) h* h' @5 J5 o$ }
  6. *2 q: T; o& D8 b" `# K* [5 M8 C3 l
  7. *   This file contains EDMA3 Test code.
    " h% S4 U. f7 R4 y
  8. *  Y( @+ X. X' [# K7 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ]& s: h$ h0 m6 A5 m( R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      w% I- a0 ~" j- J8 N+ i, g
  11. *         TO CHANGE.
    3 {7 G9 r8 R% E: Q
  12. *
    ( o& M7 u7 P, H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! z" \( [& ~& q$ H# e% M! Z/ j
  14. *
    3 ]/ _3 k. h( c
  15. * This program is free software; you can redistribute it and/or4 B& X. ?5 Q) @0 b. [* L. k5 j
  16. * modify it under the terms of the GNU General Public License as3 Y! A) t1 w( F- }9 ~  y
  17. * published by the Free Software Foundation version 2.
    $ `" I; m$ u' F) a  A0 M
  18. *5 F1 g! C1 k& `# O; f+ f$ n7 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 K: r$ ?+ K0 D, ^
  20. * kind, whether express or implied; without even the implied warranty
    % d5 ~/ x0 Z5 h0 a5 u! p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " k3 i- o( H: C1 E
  22. * GNU General Public License for more details.
    ' }. U: g+ R/ r6 O2 P4 I
  23. */
    & J: l$ y" H; ~; O

  24. 6 w: {+ c" [1 Q. s
  25. #include <linux/module.h>
    " e' z* i4 m7 o2 t& `# {1 e0 ]) E0 G
  26. #include <linux/init.h>6 u+ g4 C* s7 J) B$ y- O5 j* f
  27. #include <linux/errno.h>
    . `- ?/ a0 b/ h" i# ]% q! c8 l
  28. #include <linux/types.h>! J+ B, x$ n/ z! W! w( W
  29. #include <linux/interrupt.h>
    3 f. ]8 y2 i4 i; i
  30. #include <asm/io.h>
    9 {% n5 k5 r4 P8 Q4 E( M0 o' e; F
  31. #include <linux/moduleparam.h>
    & E- C) c  w. `* m; }2 F
  32. #include <linux/sysctl.h>
    . R6 g8 W& b& v2 p$ `& y1 B
  33. #include <linux/mm.h>; x) g( C4 x+ g$ h, _+ z- K+ o
  34. #include <linux/dma-mapping.h>& f' o3 o5 s" o( w3 R) _

  35. 9 P$ h) J! x6 A0 {+ R
  36. #include <mach/memory.h>* u, h! N. P6 m7 x- [* m, L
  37. #include <mach/hardware.h>9 c. _0 b/ g& F6 q; W7 S7 R
  38. #include <mach/irqs.h>" s0 G3 L0 Z9 |! v, ^5 a: J
  39. #include <asm/hardware/edma.h>
    ' n: t9 e! T' o2 Q& N: W9 y, I) b
  40. % c8 q* z6 _5 h4 h+ J- f9 O
  41. #undef EDMA3_DEBUG
    ' j. s3 M# P$ K, Q' _, v$ b: |
  42. /*#define EDMA3_DEBUG*/
    1 `7 Q- w( z7 b

  43. , m! I' _* z# j7 a% E
  44. #ifdef EDMA3_DEBUG
    7 \$ |8 {. t6 q3 D4 E+ r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 `  Z) ^4 e. g* e4 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # ~4 [7 e# q" ]- U3 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); u) M$ H' s9 B' Q( u; T
  48. #else0 H2 G9 y6 N% e4 e
  49. #define DMA_PRINTK( x... )
    ) S! N- B- `+ p$ }( Y! ?
  50. #define DMA_FN_IN' H* {  q; S6 b# H9 L9 Z
  51. #define DMA_FN_OUT
    ! x3 d& F1 @7 K  Z. A
  52. #endif
    ! v5 V  q* i+ v0 d4 _* y* c' t0 T
  53. 9 y$ ^' v3 o4 O2 z* I. N  m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( r; q1 L9 n! @2 x  e0 [6 N( Z( i1 G
  55. #define STATIC_SHIFT                3; S2 a% T. Y% {& @5 [
  56. #define TCINTEN_SHIFT               20
    - a4 c0 ]9 I% K
  57. #define ITCINTEN_SHIFT              21; g6 x& q% i) Y3 w0 r! V( B
  58. #define TCCHEN_SHIFT                22
    9 L3 A* S" F7 h) p  @
  59. #define ITCCHEN_SHIFT               23/ v6 v7 M# m9 A4 n5 y, ^* N

  60. 8 ~8 l: f1 P1 w, @' q8 g, v
  61. static volatile int irqraised1 = 0;
    ' i. r! O8 ]1 s+ Y
  62. static volatile int irqraised2 = 0;$ Z2 ^+ G9 y. ]# f1 l0 d; O9 E2 |

  63. & ]! a% L, z" J! S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 q: a# m  i" F% o3 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d3 D  M: O+ p( Z0 K4 K% F: }& ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f; b) z: A8 k9 ?) d0 j/ Q
  67. ; N8 b9 i4 M* \) x4 }, T$ p
  68. dma_addr_t dmaphyssrc1 = 0;
    ! q  U( c* |/ O2 M/ C$ K
  69. dma_addr_t dmaphyssrc2 = 0;! p' @6 H. {* D, r
  70. dma_addr_t dmaphysdest1 = 0;" \( T' P& T; }8 J, H+ O! ]
  71. dma_addr_t dmaphysdest2 = 0;
    " u2 }& |' ^1 s9 r( {, h& r
  72. 5 \6 s5 H7 I/ o
  73. char *dmabufsrc1 = NULL;( q# D2 s/ R; Y2 `; k: h+ o( [; y
  74. char *dmabufsrc2 = NULL;
    . p* n+ r' y8 Z. e( b
  75. char *dmabufdest1 = NULL;
    / ~$ ~4 ?/ R( i1 B! }
  76. char *dmabufdest2 = NULL;
    ' l. q- j: ^/ b1 f

  77. % J$ Q6 s, ~+ A; v4 f$ i: }! e
  78. static int acnt = 512;1 V6 [. r2 n7 A; C
  79. static int bcnt = 8;
    2 h0 f; [  `1 P. Y# \
  80. static int ccnt = 8;
    2 k9 T  D9 o" w( K1 N4 X7 v6 j

  81. ! }" |& ^6 W, s: X, J& o
  82. module_param(acnt, int, S_IRUGO);4 a0 C! h+ m  @: W! b; ~
  83. module_param(bcnt, int, S_IRUGO);8 N8 a$ ^+ X8 r' s2 b4 S, R7 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ |; b2 W' ?! Y
% `9 `8 d! M  W: m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 B1 P+ N( f1 x, U$ @' e' B, B% C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o8 B0 W5 C& v: z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 W3 N8 h  V" o" J+ U* R  {8 n

/ O2 L5 t+ _' l7 w$ _+ S5 T6 k
0 R! ?: b: }" n5 o6 ^7 t6 |$ i2 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 08:24 , Processed in 0.067349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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