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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ |% W3 `" G( n# D; g  @+ }' d) ]
  1. [code]EDMA sample test application
    5 Y# G: ~+ f( _0 u/ H3 Z( b4 h% b' o+ r
  2. /*
    ; l8 J4 j$ `) o0 _
  3. * edma_test.c. y  G+ h. d& ]' _
  4. *
    - ~. U3 ^( R- P. y0 E
  5. * brief  EDMA3 Test Application- e5 W6 u6 K4 Z: ]7 x
  6. *
    4 q: m$ k% M6 ^
  7. *   This file contains EDMA3 Test code.' ?. p; Q6 |+ U7 [; d2 b
  8. *
    1 A) X5 |9 N+ {9 m4 H, f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ ^  s2 Y0 a3 J4 e, @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) A5 t7 b" j! f9 n, p! g4 N- L. w$ q
  11. *         TO CHANGE.- ^  {! k) t3 Y) i. \" N
  12. *
    3 D" j$ m/ }1 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ^9 w+ G: Y2 T
  14. *
    3 v6 Q3 [; _* y' ]
  15. * This program is free software; you can redistribute it and/or
    0 X7 ?. Y3 N, W) x. H3 v
  16. * modify it under the terms of the GNU General Public License as$ q! @' v6 [/ e9 X. I; ?8 K
  17. * published by the Free Software Foundation version 2.
    ( ?2 C' H& e* a4 T( E! e* j
  18. *# D7 r: U, F: Z7 T* p! g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! R4 {$ M$ s7 g. U  O- ?9 E
  20. * kind, whether express or implied; without even the implied warranty
    ' N# y8 y  s0 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) G2 C2 i) s; T
  22. * GNU General Public License for more details.: l) B, i  H0 O6 t9 H+ F
  23. */' C: n7 O* V- A: G% V, o  v

  24. 4 _4 s% b: B) r' y( X( s2 Q1 a! ~1 a
  25. #include <linux/module.h>
    2 ]! L% N+ Y+ H" g$ [
  26. #include <linux/init.h>
    0 C2 j/ f, }5 V
  27. #include <linux/errno.h>( V) W% ~" f/ g+ x4 D1 R
  28. #include <linux/types.h>& t, X+ b# @9 s& Z1 S( O& c
  29. #include <linux/interrupt.h>
    " B* ~. R' T& {/ a/ f
  30. #include <asm/io.h>7 k2 j: K" O* r1 P( s- h  U
  31. #include <linux/moduleparam.h>% U; _  q6 j* m- l+ g
  32. #include <linux/sysctl.h>2 ~; L) i1 Q  o5 {; ~1 B
  33. #include <linux/mm.h>
    7 P1 a3 S0 Z! l4 ~2 G+ u4 l
  34. #include <linux/dma-mapping.h>
    # q" ~* d, D, H0 m  I$ L# J2 r% u' k

  35. 2 v: P) S/ C; z4 b# z
  36. #include <mach/memory.h>
    9 [$ u" X  V) n4 B9 r, p
  37. #include <mach/hardware.h>
    ( ]4 G& b9 j, A+ v) f
  38. #include <mach/irqs.h>
    9 O. Y" Y2 K+ M+ K4 o" Z
  39. #include <asm/hardware/edma.h>
    . W% Y, Q0 b5 `; f
  40. / u% ]6 n" y+ C+ R4 N
  41. #undef EDMA3_DEBUG$ p4 D, `8 X0 t& T6 b6 S& ]
  42. /*#define EDMA3_DEBUG*/7 c5 h( B1 f, W7 C/ E

  43. 1 T/ a4 l# P+ U9 E2 ~
  44. #ifdef EDMA3_DEBUG3 E0 `6 Z+ w: v' l# b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , h$ q8 M8 [: z" Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ y: C* X9 B' Y+ _- y" t; A, o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& J  D( u" W/ m! R3 y
  48. #else
    . t4 Y' ]5 z7 S7 t6 ~9 {0 U
  49. #define DMA_PRINTK( x... )$ e5 [+ O6 [8 h# @2 I1 r# [
  50. #define DMA_FN_IN
    & R5 L* m/ [  i* V8 h) z
  51. #define DMA_FN_OUT
    9 m* N. K- R; E) e
  52. #endif
    : a0 k" ]7 D! g
  53. . v( P& f! U  w2 P* s) O7 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), e: ^( s! w9 U, ?" z
  55. #define STATIC_SHIFT                3& Z4 [& ^- m2 i$ L
  56. #define TCINTEN_SHIFT               20& \+ E' u3 g6 Q1 _1 x
  57. #define ITCINTEN_SHIFT              21
    ! e5 T  t" k0 @3 M) a
  58. #define TCCHEN_SHIFT                22$ U- u8 z+ @5 o2 y  {/ g
  59. #define ITCCHEN_SHIFT               23: ?; x; w# t+ ~) V8 ]" f
  60. 6 a) _2 u+ k# `# U1 v0 ~0 X8 d' m5 z" K
  61. static volatile int irqraised1 = 0;
    - ?2 z2 |5 ]4 |3 q
  62. static volatile int irqraised2 = 0;- f, G; e2 d% T3 k) k) k

  63. $ p4 D! M' K! [- t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 x4 J- u9 [* G$ R* ~# E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " C2 S# i1 \7 `3 |+ @+ H* T! a4 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B$ M/ i, s8 w. u6 m" a3 P

  67. 9 T; ]8 O! ]/ ?8 @6 [
  68. dma_addr_t dmaphyssrc1 = 0;
    * ~* r6 Y# j, J- G! Q3 e5 W4 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    # y! o; \* }% V0 a+ M) G. _: N: `
  70. dma_addr_t dmaphysdest1 = 0;
    ( J3 m5 i( E6 z" V
  71. dma_addr_t dmaphysdest2 = 0;
    ; f% H& M/ }1 p1 N2 c
  72. / C) W3 P7 S$ Z. _4 }
  73. char *dmabufsrc1 = NULL;0 u6 c" D+ u* G5 ^, a! Z; ]0 z
  74. char *dmabufsrc2 = NULL;
    % u) D" H7 I: @4 I3 p
  75. char *dmabufdest1 = NULL;
    . U5 F; \( h8 x0 V: |+ T* i4 y8 Q6 V
  76. char *dmabufdest2 = NULL;
    / L/ x* G6 ]+ b3 ]( P1 r

  77. 7 ^3 o- S5 e: e' u" F, F( I
  78. static int acnt = 512;9 R4 F( F$ U9 S4 g; N
  79. static int bcnt = 8;# t4 Q) e1 y: N" y, u5 J: b
  80. static int ccnt = 8;: d2 \  \1 O' s* L9 d$ V5 l' d

  81. $ b) r( w. m: c' m% ?: g8 V
  82. module_param(acnt, int, S_IRUGO);8 H  h) m5 u3 w/ o8 Y
  83. module_param(bcnt, int, S_IRUGO);& ~7 a: L& W1 S" F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( n% m* g. p" |3 U- j: t; b: u$ l. k

7 `: e; L4 N; C0 U6 o) ^  Z% K# I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" t5 R1 ?7 r4 _$ ^% q5 ~6 I8 p+ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* Y8 S  q+ u% J" U" q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; z( w! q! h- {& Q6 r7 ^8 @4 J9 h/ W

5 h1 h6 Y1 B/ J$ E" D  C0 g5 D% m" |. f" f( b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 22:59 , Processed in 0.039233 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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