OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) g: X- i. T7 b$ X
  1. [code]EDMA sample test application
    " C) {4 @0 r3 W
  2. /*
    ) j9 g/ F9 U! m0 V( f; Z
  3. * edma_test.c1 i6 `4 `7 ~' T
  4. *  n8 T$ ?9 e* y% x  X
  5. * brief  EDMA3 Test Application# [  i8 |2 c) r) H9 Y
  6. *
    * p" u1 B0 D$ Y- j$ P
  7. *   This file contains EDMA3 Test code.
    ; L1 I& j$ J. b( d: i* u2 ~
  8. ** [3 q: ~5 N) s1 o6 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ R: D( }0 G0 b; W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Y, a$ V  ?# c
  11. *         TO CHANGE.: H' B5 \) z% w2 T; U* T
  12. *
    , l& ]+ U3 w' P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m  Z* ~* w8 o
  14. *
    8 C' m6 i! R& P, W
  15. * This program is free software; you can redistribute it and/or( x, z7 J6 k& o
  16. * modify it under the terms of the GNU General Public License as
    0 E$ r; @6 p+ E* n1 x: j
  17. * published by the Free Software Foundation version 2.
    5 u+ ?9 ?" l+ x; z8 P
  18. *
    6 b9 A  U; F' b( e6 h8 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) z" S) M5 Y% j7 R# j. X
  20. * kind, whether express or implied; without even the implied warranty
    3 T- ^3 s7 i5 Q( R: F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . C( ~, J! G1 d3 w8 y1 N
  22. * GNU General Public License for more details.- w4 I6 X0 H0 B* J" ?5 r; |5 H& e
  23. */) i6 Z8 Z7 [) i0 `% A* n' q

  24. , @# ?4 c) X# V- j* l2 |  C
  25. #include <linux/module.h>7 z+ G) E$ U" ^$ ?6 d
  26. #include <linux/init.h>/ }3 X# R( X) K
  27. #include <linux/errno.h>
    5 N+ A) J+ `% ^2 ]
  28. #include <linux/types.h>. X: m# {7 k9 N
  29. #include <linux/interrupt.h>/ F6 c0 `5 Q, ^  ^
  30. #include <asm/io.h>
    1 p* L0 z+ J$ C8 X
  31. #include <linux/moduleparam.h>
    ( L" J, j  s* {  n2 L' ^5 @
  32. #include <linux/sysctl.h>6 x) w6 R" E# ]* j$ h7 L
  33. #include <linux/mm.h>
      ^; x4 {2 l6 v* x/ c
  34. #include <linux/dma-mapping.h>, t" b; r8 P5 _7 U

  35. 0 e5 g/ e# p6 E2 X
  36. #include <mach/memory.h>+ ^; q& \& _0 J1 ^( Z
  37. #include <mach/hardware.h>1 ]' e! g3 f! b
  38. #include <mach/irqs.h>
    - K/ f# e9 D. e$ Q8 p3 o# b  N
  39. #include <asm/hardware/edma.h>% v6 U4 s" q' M' T3 l; Q
  40. 3 P9 n: v. ~1 V! T
  41. #undef EDMA3_DEBUG
    # ?" F- t. a8 Y8 D6 @3 e
  42. /*#define EDMA3_DEBUG*/
    . \# K" \& h1 ~1 i( n& P

  43. , c6 [6 H% q; i# H' \7 y& t3 S
  44. #ifdef EDMA3_DEBUG
    5 g# N, A$ {1 Z, [9 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( v: H  y, D+ i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % R/ x' R1 G6 L% q; H4 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @% _- j% @+ m$ ]( [+ j3 Q
  48. #else
    8 w' f  `9 \* S+ e
  49. #define DMA_PRINTK( x... )9 N  g+ Q; n  N" @0 C! V1 J2 Z
  50. #define DMA_FN_IN: W! W& W2 j) s+ d6 _, Q; d! J( A
  51. #define DMA_FN_OUT
    8 k. @2 L+ }' T: ~. R- a: q
  52. #endif
    : t/ a: E! i5 @. p0 U6 |4 L! s

  53. 6 P6 t2 [* l* s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & M$ s; l! L3 j
  55. #define STATIC_SHIFT                37 H8 s! _, P4 j8 w4 _6 g
  56. #define TCINTEN_SHIFT               20' h- h: n, M; @0 @' T2 q" |- Z
  57. #define ITCINTEN_SHIFT              215 a( a; ^' Q  P; \9 u2 o* {( |7 y% Z
  58. #define TCCHEN_SHIFT                22! u. N) Z1 V  m, o' n3 [/ n
  59. #define ITCCHEN_SHIFT               23" g4 s6 e4 U2 q  n  l
  60. " g) A9 ~: |$ G$ l( z; V
  61. static volatile int irqraised1 = 0;
    / D5 C7 Y# _& A) m* |8 U( h
  62. static volatile int irqraised2 = 0;
    . W* R8 Y& ]2 V4 `, ]
  63.   l" |( C. g0 y! x4 s; A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) C* h. z* H+ q; f# u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! i, V5 [9 v% z5 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ _' ]! o, O0 }9 @: }5 l6 t% g

  67. ( ^, g" l: W$ @  V2 X! Q% c
  68. dma_addr_t dmaphyssrc1 = 0;
    % g7 ]3 Q) ^/ T5 u$ J
  69. dma_addr_t dmaphyssrc2 = 0;
    0 A* [2 X; v  P. d, u- x, l, |
  70. dma_addr_t dmaphysdest1 = 0;) f( @8 M. @+ ~2 E
  71. dma_addr_t dmaphysdest2 = 0;
    ( O) x% T# z% a* ]" f. s* |& b: i
  72. 0 X- A1 @- @1 K
  73. char *dmabufsrc1 = NULL;
    / y& l4 j# ~) \, W. H. I3 T
  74. char *dmabufsrc2 = NULL;
    7 T' X  C7 U8 U4 x* H% V
  75. char *dmabufdest1 = NULL;: p1 `4 x* e1 o% n# F: N' g
  76. char *dmabufdest2 = NULL;
    . A" c5 S% a3 A0 I  q; \: g

  77. 2 v9 e9 Y) L! ]0 j  i
  78. static int acnt = 512;2 k% p& Q* p7 B9 U# q3 o6 w; b
  79. static int bcnt = 8;
    ( n: c4 p8 R& C' |; q( {
  80. static int ccnt = 8;6 a& z. L2 W% |8 m, a

  81. - R) N/ s/ w# G6 j/ G4 d: B0 A
  82. module_param(acnt, int, S_IRUGO);8 b5 P( R) I) ~' o! `
  83. module_param(bcnt, int, S_IRUGO);
    % G6 {! u- ]0 R9 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 O  N! [7 i4 ?% g; y
5 }4 V" Y3 F) T6 c/ G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 e2 F# n( z: U' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 S4 ]( S# r/ B5 U  k1 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 x$ x3 u* M* F, E. v

$ h& p: G. ?: ~# }1 H4 y* L+ r3 n% N% K4 r, j1 |6 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 13:17 , Processed in 0.039652 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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