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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 l$ ^: q( u) C# z
  1. [code]EDMA sample test application
    ; w6 h' U5 i  r+ U1 I  P) i
  2. /*
    6 b1 A6 B$ x- b( _  o7 a1 s
  3. * edma_test.c4 X0 Z7 J/ ]1 a5 O
  4. *5 H& |0 e1 g! W) X+ o. g- h
  5. * brief  EDMA3 Test Application
    7 @- W+ |6 x5 j2 F
  6. *, ^9 k. q9 x$ n; I
  7. *   This file contains EDMA3 Test code.
    & a# {& w2 f. f; A
  8. *
    0 O! U: M: z7 P( `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. I& e) @6 p5 x- u1 n- y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 }/ Q* R, m7 B
  11. *         TO CHANGE.
    % G' G7 [6 o* S# [5 y& R4 D( y* l8 M+ L
  12. *! F/ M9 x9 A; B- ^7 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 g' u, P+ @- r; C; B1 e# q  v
  14. *' h' r, \# J% c# H+ R) {
  15. * This program is free software; you can redistribute it and/or
    $ a' _8 o9 a+ |" {+ ?" A& c  H9 d6 Q
  16. * modify it under the terms of the GNU General Public License as/ y4 D( l; P) A1 D  P3 \
  17. * published by the Free Software Foundation version 2.6 A+ F; Q# a3 B2 m, e# m! X8 I/ Y
  18. *% x& p# T( c% I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# |5 A( ?$ v/ C9 H
  20. * kind, whether express or implied; without even the implied warranty& J0 X1 i4 F: y1 q8 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( x! m6 J: U2 y7 A1 R5 H
  22. * GNU General Public License for more details.
    " y, K% m6 w8 s5 h
  23. */
    / O, F3 f& S3 b" ~7 V5 z8 |

  24. 0 u( [6 S6 ]; W! J+ C
  25. #include <linux/module.h>
    ! R3 y6 E- L( k9 f+ k  w
  26. #include <linux/init.h>
    % U( x; \- R6 A+ e
  27. #include <linux/errno.h>
    6 o" p9 Q0 `+ G% W
  28. #include <linux/types.h>$ E/ t! a4 o7 ^( s: D) }1 P) f3 W
  29. #include <linux/interrupt.h>
    ) @, ^! u1 y, m5 r$ A
  30. #include <asm/io.h>" ~$ n8 I" o: @( q3 Q2 \$ U  `
  31. #include <linux/moduleparam.h>
    : `% {* e7 _5 a$ z1 k) V/ r
  32. #include <linux/sysctl.h>: D. N, q4 O$ p3 P6 S+ {# E
  33. #include <linux/mm.h>
    4 _0 _4 g9 J. P( F  k- Y
  34. #include <linux/dma-mapping.h>" \  ]* [$ ~6 w% k1 C' t/ ?

  35. - O" P5 ?7 k7 n; F; \0 H/ G
  36. #include <mach/memory.h>  E4 E3 A* l2 ~: V3 a5 R/ ~
  37. #include <mach/hardware.h>
    1 [4 z5 B2 |) k! f0 x1 \) A
  38. #include <mach/irqs.h>
    : P6 l4 Y- u2 s; v4 A
  39. #include <asm/hardware/edma.h>! [1 u: h8 F. ?( F8 E
  40. ( w$ E/ a7 |3 a- @' ~: ^
  41. #undef EDMA3_DEBUG7 |; _# _" m. o1 u  s8 t
  42. /*#define EDMA3_DEBUG*/
    ; c2 s0 s6 ]: N  S0 X: C

  43. . m& y5 m$ k6 U/ H1 a2 z% D" O
  44. #ifdef EDMA3_DEBUG
      G( ^5 U. S: c! j# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% J5 R6 F- [- w0 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 R& M4 o# L+ |# ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % @" t+ f6 p4 u: T  \/ v2 C
  48. #else- H0 D% D1 x: H$ }0 u- ^1 ~' g
  49. #define DMA_PRINTK( x... )% x6 R& Z8 N, ^7 \# y
  50. #define DMA_FN_IN7 e4 B& T9 M8 [/ r, x/ i: t
  51. #define DMA_FN_OUT' }9 F, Y+ X1 W$ J3 R* D
  52. #endif
    * l+ F+ ?8 p7 E  J: O
  53. / Z! k  e7 u( I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 T* d1 `; Q( |, L) ?; }
  55. #define STATIC_SHIFT                3
    6 k) |+ X6 m+ p* l
  56. #define TCINTEN_SHIFT               20
    : B- Q" ?0 u* R/ ~$ v4 I
  57. #define ITCINTEN_SHIFT              21
    % Q& a- S6 _: _0 a; ~) ]
  58. #define TCCHEN_SHIFT                22
      }& r+ n# _+ W, n/ X* T" j( N: _
  59. #define ITCCHEN_SHIFT               23
    4 Z: k& `$ j+ X( ^# f" L8 u

  60. , C0 K' O1 O$ h4 Q! {; d% x1 A
  61. static volatile int irqraised1 = 0;
    / f% J; o+ Q7 U5 Q
  62. static volatile int irqraised2 = 0;& \( d3 j& R4 ]% H& U+ ^/ P# J

  63. 4 k6 i! R" C( M, E! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X( T+ \$ U" h+ B7 O, Q$ R( w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g# [+ u! B' H+ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 D4 f. d* \  @$ A5 F9 N7 i$ P
  67. ! _, B5 O  C* k, G5 G+ N* Z5 R, I
  68. dma_addr_t dmaphyssrc1 = 0;, M) k. F! j4 d* h( x. p1 r4 |
  69. dma_addr_t dmaphyssrc2 = 0;6 c* a9 E# @  n3 a, G
  70. dma_addr_t dmaphysdest1 = 0;7 k" q8 @0 @8 B, w( ~
  71. dma_addr_t dmaphysdest2 = 0;
    8 i0 N5 N  b* z

  72. 6 }7 w3 c% Q. o  z3 q3 ?9 i
  73. char *dmabufsrc1 = NULL;; M: x$ R* z8 s! w" O" ~! _! V
  74. char *dmabufsrc2 = NULL;
    1 b2 _: d1 v/ U
  75. char *dmabufdest1 = NULL;! ?$ }* n% a8 F0 h* I4 @, [" m( C7 J
  76. char *dmabufdest2 = NULL;. t. q( ~2 f9 s/ s5 ~$ O0 f

  77. ! c; c+ {8 c7 K& W2 |2 w2 d
  78. static int acnt = 512;) M; U0 J* _& Q) s/ z. A
  79. static int bcnt = 8;
    5 ?! g; j: v. e$ K' D1 [$ k
  80. static int ccnt = 8;7 U0 ~, x( v: a, l. C

  81. + i: x! V; H: r# x0 S$ N
  82. module_param(acnt, int, S_IRUGO);
    ! o9 j/ M1 q2 f* E. P2 L: H
  83. module_param(bcnt, int, S_IRUGO);8 G/ ~' R/ B4 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 N5 M7 a0 J+ B+ }2 n* C+ z

; c6 ~% A) u5 f2 _) X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" s/ ~0 R5 u. i" U- K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 L% y0 o. Q/ ?8 B. I1 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |& N% c& ]# X( X
4 x9 N. v3 S) N, n' Z

( h& M, m7 w/ w( k" X2 O1 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-20 10:13 , Processed in 0.041609 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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