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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c" t6 P$ i# Y% d% Y
  1. [code]EDMA sample test application9 F2 d3 I: p0 h: f" r/ [3 k! W
  2. /*
    % Z# \  h8 Z/ Z9 p1 f% v4 A
  3. * edma_test.c
    ( M& }( p& B6 R
  4. *
    + C2 f. l, J* @+ _6 {2 A
  5. * brief  EDMA3 Test Application( m7 g6 s% \6 p  \  ]
  6. *# s, u) a, h& f& E+ r
  7. *   This file contains EDMA3 Test code.6 c2 ^8 B6 G5 `1 s' B' j' v
  8. *
    ! Z/ o" K; X) e) G& ?3 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ S9 X' B. f% {5 J8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' Q+ i3 h3 Y% N5 H2 x( U
  11. *         TO CHANGE.) W9 Z, ^' c. T" B: z; W% {; a
  12. */ C+ H1 {+ a$ n) F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # C  H$ C& C/ o1 D9 ^1 L% ?
  14. *
    . P9 y2 p3 J) m. l
  15. * This program is free software; you can redistribute it and/or  }9 O$ ?+ B2 p3 O0 v
  16. * modify it under the terms of the GNU General Public License as
    ; ~5 s: m( i( M
  17. * published by the Free Software Foundation version 2.
    ) t0 D0 q0 \2 [! _: ]+ u! X
  18. *
    0 j' o" ^  \( U# z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 `. f" |! {, `3 F8 S
  20. * kind, whether express or implied; without even the implied warranty
    6 p8 C0 ~+ @  s& g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Z0 L8 L* b0 `( y
  22. * GNU General Public License for more details.
    1 g. v3 x  j' c
  23. */
    1 {! Q8 s8 g4 y* {
  24. 7 o! ?8 D$ p' V. B5 V
  25. #include <linux/module.h>
    / H0 D& H9 }8 G4 X5 L1 l' L, G
  26. #include <linux/init.h>
    ) C2 b, n" r* a+ r. @% O7 }
  27. #include <linux/errno.h>
    ! G& ?- l) }' Z4 ^
  28. #include <linux/types.h>! p/ I. Z# g0 Z( Z2 N& |
  29. #include <linux/interrupt.h>6 R( x/ N( ^3 }$ S8 v! D
  30. #include <asm/io.h>
    $ Z, |4 p, M! c
  31. #include <linux/moduleparam.h>
    7 h" u$ T0 L! S4 X0 {- b
  32. #include <linux/sysctl.h>( x8 q3 p7 T/ Z( u# ?7 [: ]( z
  33. #include <linux/mm.h>1 ^) q! Q' g! W" n' b: D! e5 R
  34. #include <linux/dma-mapping.h>' D& M+ Y( A$ b4 W4 P
  35. : ?6 U( E. i: ~, o+ B, ?
  36. #include <mach/memory.h>
    - E9 K% c, w$ I" Z1 w4 N/ w" h
  37. #include <mach/hardware.h>
      x  R. T7 Y' H8 y  t
  38. #include <mach/irqs.h>$ x$ N7 K  \. i1 r# ?6 m& \6 Q9 O
  39. #include <asm/hardware/edma.h>1 e/ a" q  Y( t7 L, G; V" @3 b5 e
  40. : Z7 e9 B: q+ d$ f% L! Z
  41. #undef EDMA3_DEBUG. X4 ?- y& h& K% ?0 D0 k
  42. /*#define EDMA3_DEBUG*/: [+ }  `% ]  V1 s- Y( k; i) }

  43. ( i& m; F5 t2 G$ l
  44. #ifdef EDMA3_DEBUG
    ; Z/ m, n+ B2 r: ~4 q2 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 r8 I/ j  K: O" `6 {% V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + A  r* c; W) @4 X& m) b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# [2 R: J, p2 P5 o9 F! s
  48. #else2 ~6 u4 @5 D$ @  s6 u
  49. #define DMA_PRINTK( x... ). [, I+ b4 A; s
  50. #define DMA_FN_IN" N2 h# ^* j4 z1 p
  51. #define DMA_FN_OUT0 B& k! e' N  A( x" q! o* n" q; ?
  52. #endif9 @! |! u: @, N8 ]
  53. ! H9 a% {! H8 n/ B9 Z! {. }& j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 |3 j7 m  M. B3 u, m7 G
  55. #define STATIC_SHIFT                3, y5 t( [" d7 p! B9 W3 y+ ]& |
  56. #define TCINTEN_SHIFT               20, _2 _* [& |( n& K6 z8 H/ U7 \3 J8 f
  57. #define ITCINTEN_SHIFT              21  C5 L% ]1 S: Q$ a/ e" l# V
  58. #define TCCHEN_SHIFT                22
    - v6 n$ ~. s8 u- `3 p, V; O
  59. #define ITCCHEN_SHIFT               23
    ! j1 T3 h, M, }, w
  60. 3 m3 Y$ e2 h% ?0 t' }
  61. static volatile int irqraised1 = 0;% d& R% B+ Y* K* p& g" ]7 M
  62. static volatile int irqraised2 = 0;& ^+ u2 ]4 |4 r; l. @" ^+ }2 Z
  63.   Y/ S2 A2 H, j9 ?+ W( L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n0 p3 C- j& }" N( B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ]2 [: }/ u8 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( z) g3 M; z' h$ u+ t

  67. & b9 C- h6 E7 \* ?
  68. dma_addr_t dmaphyssrc1 = 0;
    6 Y+ ~! B7 }$ X/ V5 L  ]
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Z+ \7 V# m$ W  I, e3 {
  70. dma_addr_t dmaphysdest1 = 0;
    3 M/ [  v5 j$ [  G7 g# h# A8 p* ]/ G
  71. dma_addr_t dmaphysdest2 = 0;% N! Q$ A% H& ]! L# U
  72. , g! P; x5 a" S' H4 g' U! J% W
  73. char *dmabufsrc1 = NULL;
    : [. u. F- r4 ^8 G
  74. char *dmabufsrc2 = NULL;; S% i0 v% N, x
  75. char *dmabufdest1 = NULL;
    ) m2 D! W0 R! p8 A3 {% t$ S( W
  76. char *dmabufdest2 = NULL;; Y8 W$ M1 u3 l
  77. , E8 g; L) h9 }/ @  U7 C8 j( ~
  78. static int acnt = 512;
    4 b, Z& ~0 ]. Z
  79. static int bcnt = 8;+ t2 r0 O( Y1 e5 |
  80. static int ccnt = 8;
    ! r/ S( _# n; d; r3 m

  81. * _4 C7 G! y# O6 ?1 Z4 t
  82. module_param(acnt, int, S_IRUGO);
    8 C8 P( x3 v5 h+ `/ ~
  83. module_param(bcnt, int, S_IRUGO);) h0 I) P5 [1 i) b/ C" P2 S8 d% ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- b6 V- ], f6 D& Y, E

! }& {  W. L* D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 w; {6 V: e: c& T: Z& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 H4 P$ U- {" ^2 p# Q8 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& o; h8 |: W/ }, E+ w9 L: D
  {( R- |6 _) G) C) d3 l! K* f' A
6 p: \* g! D# w6 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 01:51 , Processed in 0.041609 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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