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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" b( A5 u9 ^( y+ c- Y3 X7 X
  1. [code]EDMA sample test application7 ^+ t6 r. L8 y; ^# e5 N+ W
  2. /*
    4 k) k! E6 g' b
  3. * edma_test.c
    2 h5 n# o2 |" f3 B7 T: I& R3 B, i) ]( a
  4. *
    ) T1 w% Q) X6 Q& Q3 P& g
  5. * brief  EDMA3 Test Application
    ) f/ e3 K9 E( Y: z( S
  6. *
      Z9 N7 N5 z4 t9 b
  7. *   This file contains EDMA3 Test code.- ~" ~( L& i) r7 B% O
  8. *
    1 q% \0 M8 b6 \% l: P6 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. f2 N; x1 a9 _0 ^+ T) r& e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( @0 H- }% w: B" t8 w
  11. *         TO CHANGE.  j; }4 D5 \' N6 B% C" d* @
  12. *3 e% p# `2 B, X( N9 P$ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; ?' R) D  V6 b1 R. ?
  14. *: z- B% M3 t; H; Z& g) X
  15. * This program is free software; you can redistribute it and/or: }8 T0 ^! [) K! Z: Y9 D
  16. * modify it under the terms of the GNU General Public License as
    - x  ^: r- p" I7 |& g+ i
  17. * published by the Free Software Foundation version 2.
    # H4 F) l% w4 Z+ U' m; x: R- K; P* e
  18. *
    / \- {0 p& R, z3 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( p; v3 q. O1 m( h
  20. * kind, whether express or implied; without even the implied warranty
    3 I4 n6 q6 x7 }  q5 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      o2 T+ a- D7 [/ a4 E: R8 j
  22. * GNU General Public License for more details.
    ' u! b/ Z; c) y. M
  23. */
    6 N& s' |5 \8 E6 X+ r/ Q" Q( G2 r' E

  24. 1 L, a# X/ V; _1 e
  25. #include <linux/module.h>
    0 C  Z, y/ Q- G4 s! [2 {
  26. #include <linux/init.h>
    : h4 x. r3 F+ \- `: x& s7 a
  27. #include <linux/errno.h>% ~) w7 `7 r. \; [4 ?
  28. #include <linux/types.h>
    " M; a4 C% N' }- J; S9 w0 o
  29. #include <linux/interrupt.h>
    4 r& ]; n( S' X! ]
  30. #include <asm/io.h>$ y9 Z- ?8 m+ y+ R
  31. #include <linux/moduleparam.h>- Y5 ~" B" W1 k5 i4 n6 x# n) n1 q1 J
  32. #include <linux/sysctl.h>
    ) T% h4 ~0 `3 P- s- ~9 @
  33. #include <linux/mm.h>% T0 u% l) w7 N0 ?) c" W6 A
  34. #include <linux/dma-mapping.h>1 p9 b/ P3 r. r5 v

  35. % P6 ?! N! m$ h* L# o
  36. #include <mach/memory.h>
    5 H/ E% x* T5 g7 t. j) i
  37. #include <mach/hardware.h>
    & o; u, ]3 K0 R3 l0 Q+ V( p2 V
  38. #include <mach/irqs.h>
    * C) a" S5 w7 e# r6 |7 \) |& \
  39. #include <asm/hardware/edma.h>
      q7 d+ h" I# R% J% X" ]( |: ^& R7 m) U
  40. % y0 {) T1 ]* V  D
  41. #undef EDMA3_DEBUG+ D6 E+ y8 ?7 ]# L% m- u
  42. /*#define EDMA3_DEBUG*/
    ! B8 G2 q2 ]* w' V/ O3 B
  43. 6 j* j! W" H& j# |& q7 ]- f2 ?
  44. #ifdef EDMA3_DEBUG5 e6 {  L' \. ], V$ y7 C, ?* T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - s) O8 x6 C* o) }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! y! f/ d2 Q- v- p. p3 _& U9 z6 y& G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' m2 |# v7 j5 X8 O; [' m
  48. #else2 c; H' `+ x" `7 H
  49. #define DMA_PRINTK( x... )
    * }. m" n( T6 E
  50. #define DMA_FN_IN
    0 o7 [" `8 d2 |
  51. #define DMA_FN_OUT: K2 M9 S' R7 R/ x2 T2 G% u
  52. #endif0 h3 }, v) Z8 L5 U' T7 l) f4 Q
  53. 8 `, u$ e4 s  q7 Y. s7 d1 C3 a( v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , Y! u0 [0 P3 \+ \+ s  `
  55. #define STATIC_SHIFT                3
    + E9 h: i- H4 ?* n
  56. #define TCINTEN_SHIFT               20
    + m/ H- @( J1 E8 T0 }8 t$ m6 [1 \
  57. #define ITCINTEN_SHIFT              21
    8 z/ a* [; Z4 ~7 w0 r0 |
  58. #define TCCHEN_SHIFT                22% n: h9 _  L% G& I* C
  59. #define ITCCHEN_SHIFT               236 }% A* s' Z( T) E; T
  60. 9 w! s/ e; b( K1 H; b6 m
  61. static volatile int irqraised1 = 0;
    ' O& j# W$ n5 }
  62. static volatile int irqraised2 = 0;) E& b& ^; b9 n! O9 P

  63.   R; E( x  A6 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ?3 Q6 k6 A* Y8 j% r' s6 G/ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & m/ j" a; P7 u' L4 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( _8 \, J" s8 Y- Z" _6 Q4 h
  67. , ?. ?$ o- E, E0 C& T
  68. dma_addr_t dmaphyssrc1 = 0;% M; q3 R, ]/ `+ D7 d: D" }9 Q
  69. dma_addr_t dmaphyssrc2 = 0;' _: M% Q: R3 N  T/ G3 {
  70. dma_addr_t dmaphysdest1 = 0;
    $ C6 W0 @9 ~' R3 T
  71. dma_addr_t dmaphysdest2 = 0;
    - n4 d2 s( ?% t% x% x6 C9 }! L) N
  72. 2 m$ d0 r. s7 Q: T7 P( r, ~
  73. char *dmabufsrc1 = NULL;: o  x+ }! x8 N6 Z& ?( s  f6 H: h
  74. char *dmabufsrc2 = NULL;
    % K% f4 |2 W8 U. R! Z/ a
  75. char *dmabufdest1 = NULL;
    7 _$ N3 d1 z7 j  `# b5 p. ^
  76. char *dmabufdest2 = NULL;1 P! ^4 z& A7 }0 t. X( l
  77. : G% s% j  B& R+ Q/ R
  78. static int acnt = 512;0 t8 I( `( m+ O
  79. static int bcnt = 8;
    ' T* f9 f' O4 C4 \! |
  80. static int ccnt = 8;
      s$ A  [+ o+ ^0 x8 \
  81. 2 O2 B; |) ?6 g7 c" T' x( c
  82. module_param(acnt, int, S_IRUGO);
    9 J: b7 y4 u1 X) X
  83. module_param(bcnt, int, S_IRUGO);$ \, Z5 _# N6 t* y$ x: |) I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% i# |+ {/ c8 e3 _
5 A. u4 _7 Q( v3 O5 x: _1 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 o( q2 Z% f1 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L4 A8 t  u% x% @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' b  h9 L( p- @# ~  V8 @; }
% J. ^* e) f- J, C+ _% R7 ?: R+ K3 E9 B3 B" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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