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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U: H0 Y  v# x/ A* y
  1. [code]EDMA sample test application
    % _/ g* v  d6 w
  2. /*+ i5 e: A8 b0 r6 ?  a
  3. * edma_test.c' y. Q. E( [4 L3 t* z0 W( l$ r6 I
  4. *
    . l) p& ]$ s, ~+ r! \8 M8 F
  5. * brief  EDMA3 Test Application
    ) [9 n9 i( t6 Y
  6. *
    ) R! V6 |9 K5 E8 K3 a
  7. *   This file contains EDMA3 Test code.
    , Z8 `. o) w: j- [0 {
  8. *
    ; G/ {# D/ z. s! Q0 D+ W& T3 J4 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 k% I* ~- H& W; ]$ n0 S# S) {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |4 H+ D* R' ^( v) u
  11. *         TO CHANGE.
    " b% O2 D9 s6 w3 N" F4 a8 |& M( `, F
  12. *. ?3 n  ^- w8 Y- q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % |' j8 w' x: u  f  `3 j% `$ b
  14. *  s1 U4 V; W( R+ e( S
  15. * This program is free software; you can redistribute it and/or
    4 c, A2 R4 x: r- g$ f' O
  16. * modify it under the terms of the GNU General Public License as
    & \1 _  \/ {3 J, W( y+ L
  17. * published by the Free Software Foundation version 2.
    . H, e* n, Z: S+ C: W( s! f
  18. *9 @# r0 A# R6 \8 n- u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      [7 s* A1 {0 Y/ s+ R
  20. * kind, whether express or implied; without even the implied warranty; G7 B/ ]! E: p: x. p3 G. G$ t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 p8 F4 k3 a5 d- w- l# {% P
  22. * GNU General Public License for more details.
    1 d; w0 M; s; L8 Q, D
  23. */
    4 @3 `9 n5 [% @1 H. Z1 r: w( T  @

  24. + r5 s& e4 D! J- S' }! o
  25. #include <linux/module.h>
    4 l- h7 v! X  }! D1 h) K
  26. #include <linux/init.h>
    3 G1 Q0 R0 {+ A. B9 d
  27. #include <linux/errno.h>2 U4 K* c4 x4 s0 B8 F0 |
  28. #include <linux/types.h>
    , z8 S. T' P8 i; [
  29. #include <linux/interrupt.h>+ h% D5 E0 `' N+ c8 f0 H
  30. #include <asm/io.h>
    ) ?: Q- f% o$ a9 P  w  m
  31. #include <linux/moduleparam.h>
    : _  _. T( I. B: P
  32. #include <linux/sysctl.h>0 W+ v, m, V( K/ e9 B2 e
  33. #include <linux/mm.h>7 A& U+ _  u. N2 R& R, y
  34. #include <linux/dma-mapping.h>
    ) {/ u- K2 I/ P& r- ?" k
  35.   h# a; }1 q0 P0 I* g+ Z
  36. #include <mach/memory.h>7 u3 ?# w$ a" X9 g! |
  37. #include <mach/hardware.h>
    * Z, e4 S* E' g/ {! T
  38. #include <mach/irqs.h>
    + |2 c' j6 h' n
  39. #include <asm/hardware/edma.h>% r8 H4 ~' Q/ C! p$ T& w8 j+ X: W1 {  E$ g6 k
  40. 7 i8 ^/ v! ]2 i" \/ g! F8 t; u
  41. #undef EDMA3_DEBUG
    & g8 y/ s* ]; M2 w
  42. /*#define EDMA3_DEBUG*/
    + j8 N. L7 ?- r$ \% S
  43. : X8 P& D9 A+ U# M) ?
  44. #ifdef EDMA3_DEBUG
    5 ~+ m2 l9 V% b6 _5 j1 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C! f, n! y6 I, V2 R$ e8 u7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* V0 F. p0 }$ X1 v4 D! e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 R/ G, V8 q" \. |0 O& C, l
  48. #else4 e5 @7 g1 ]( ], W
  49. #define DMA_PRINTK( x... ): G( u' j2 D& [' g
  50. #define DMA_FN_IN- Z% i3 F3 w9 ]% K; R8 @8 Q! U* |
  51. #define DMA_FN_OUT! N, q# E* S& v5 `: ?- ?
  52. #endif
    1 ]* t, o2 x* Q: t

  53. 1 G; b; ?, `/ ^$ A$ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' Q* o7 |- g- p3 U( w$ m
  55. #define STATIC_SHIFT                3
    ! e( p  [3 N- D+ G
  56. #define TCINTEN_SHIFT               200 A# c# N8 P# H) Y! C: m' |
  57. #define ITCINTEN_SHIFT              21
    0 W( |  w- s% _* h
  58. #define TCCHEN_SHIFT                22
    1 F$ G$ R+ ?. ^) _, P4 ^1 L. x
  59. #define ITCCHEN_SHIFT               23
    ( C+ i, T% z: l- i
  60. 9 ?2 x4 }, R0 x; _) V: t$ b
  61. static volatile int irqraised1 = 0;
    4 E3 A1 p- w# L7 S& ^. q
  62. static volatile int irqraised2 = 0;
    - N  Y/ M( v  }5 e( f( S$ e3 K
  63. 5 V0 J: X9 h) p/ s, C  Y$ n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s+ Q& G% ~8 F7 @) Y; l  [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Q6 t( a% @5 C5 a8 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F: G6 h% k' V- C7 ]+ X

  67. ; c" U  `  r& m2 ^5 v! N, N
  68. dma_addr_t dmaphyssrc1 = 0;3 \$ m3 |' ?. f1 q! b+ p
  69. dma_addr_t dmaphyssrc2 = 0;8 Q8 ~/ ]. D4 Q( k& W, [$ [+ Q
  70. dma_addr_t dmaphysdest1 = 0;
    , s9 n' W  e5 q/ [' v+ s6 m
  71. dma_addr_t dmaphysdest2 = 0;
    " B; ]4 A# G/ d0 n% M

  72. 2 l! Q% s/ M) c4 o3 t& H3 t2 y
  73. char *dmabufsrc1 = NULL;! i$ d1 m8 t$ A* w
  74. char *dmabufsrc2 = NULL;
    / z& R2 |: V( ~  u9 q( A% R. r) W- K
  75. char *dmabufdest1 = NULL;
    / m$ x1 n! I( p1 B
  76. char *dmabufdest2 = NULL;
    7 [9 R: N5 q# s( C% Z- p# N' P

  77. ; ~% P2 H9 _, o: S8 K
  78. static int acnt = 512;$ P  e  {9 R5 p- _5 `- N* S
  79. static int bcnt = 8;+ y0 V& `1 D/ x# |' O( ~
  80. static int ccnt = 8;& x* i& {5 y; o) w, [
  81. 3 c8 ^" u7 W( d  ~. f! N; E, L4 L7 g% \
  82. module_param(acnt, int, S_IRUGO);
    , T6 [* r' X2 |2 X. z4 g- y. x
  83. module_param(bcnt, int, S_IRUGO);
    3 [$ n, `1 C; i- _6 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 R! F$ f, J+ n( I, r
" k# l" i/ z8 w& O$ p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ?2 A4 X/ N/ [% Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. `) ]$ v& T, B- D& @; _, q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" \) X/ M5 ?- c4 P' Z$ {' C4 @
) k6 B& {, {7 @9 \8 z
3 |4 l  M# D$ E5 y* u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 21:43 , Processed in 0.039267 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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