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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( Q; d/ a$ F  y* g# j3 |% B
  1. [code]EDMA sample test application
    % D8 y5 M7 @$ P- f+ V* b# h5 d; S
  2. /*
    # ]( ~1 C8 @% Z
  3. * edma_test.c
    2 B8 ^2 U1 Q, ~" S; ]2 w7 u( w
  4. *
    0 ^0 y% J5 V' J1 W/ x% R
  5. * brief  EDMA3 Test Application' J2 ]; S# w' ?8 w+ X6 y, K2 T
  6. *7 h  y' S" u5 K8 {
  7. *   This file contains EDMA3 Test code.
    ; ]4 R2 D8 N* g
  8. *+ x1 Z5 b' e, r% \6 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 B, M$ Q3 V6 y8 a; g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" \/ z9 C3 S! x7 @) f
  11. *         TO CHANGE.5 B9 c. H; b# f. g8 K: ?3 ^
  12. *6 K1 B7 X4 s( r% g. f1 B" C2 N/ c3 I5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      P8 S) a5 y; }# |/ B2 j
  14. *
    0 X1 B9 }3 _- q/ Y4 I& u3 n" T
  15. * This program is free software; you can redistribute it and/or5 c7 h0 N/ K& |
  16. * modify it under the terms of the GNU General Public License as
    6 r! a) Z9 |2 j0 [( _- R
  17. * published by the Free Software Foundation version 2.% C5 E1 f0 R# C. v' y" u' p
  18. *
    2 `  x6 J9 h. d6 q: f1 ~' T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * S, B8 Z" V! y: Y9 I6 ?$ e
  20. * kind, whether express or implied; without even the implied warranty; I6 G+ |3 g! p2 ^" I) X6 f4 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" M. B: P/ @+ Z2 D: C
  22. * GNU General Public License for more details.
    ) n! A+ _/ W2 u) g8 p5 B
  23. */& [5 f8 w9 M9 J# V! j3 \  T- N
  24. % ~: Z4 p1 R' s% B6 K
  25. #include <linux/module.h>. K  Q) n3 T" c$ a, w+ U
  26. #include <linux/init.h>
    $ s6 [1 v6 g6 n* L
  27. #include <linux/errno.h>. M0 \& \0 S* ^6 H' E/ J% H& Z
  28. #include <linux/types.h>
    * H7 S/ U# o2 L
  29. #include <linux/interrupt.h>
    4 x7 T8 T1 w% R# H' C9 e- i0 b
  30. #include <asm/io.h>/ n+ h6 ~4 L: @
  31. #include <linux/moduleparam.h>
    1 ~( d' ?1 E9 |  _, C* u% b
  32. #include <linux/sysctl.h>' _# r2 o3 H3 A- K7 }
  33. #include <linux/mm.h>/ I, M* n6 n. c) U' W. F7 K$ @
  34. #include <linux/dma-mapping.h>5 V& X8 {# N: R+ G

  35. 0 O+ G3 Y% h+ k
  36. #include <mach/memory.h>1 w4 r  U0 t& A( l! J9 G: J4 h
  37. #include <mach/hardware.h>
    % C, `  B/ u3 o! Q! Z; |6 F
  38. #include <mach/irqs.h>
    . w; Q& ?) P1 I
  39. #include <asm/hardware/edma.h>, g( G8 R# n4 m, v. s$ o
  40. $ B0 B& y6 w. |2 ~- `
  41. #undef EDMA3_DEBUG
    & u/ G; A& q& @9 r0 A
  42. /*#define EDMA3_DEBUG*/
    ( a1 `$ s5 _7 N& n/ q
  43. * N6 v' ~; f; k, m( x' A8 }0 d
  44. #ifdef EDMA3_DEBUG
    2 H0 C- |# j  w8 ?- z1 e; E& w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . g8 }! c! {6 @3 C$ ]& E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , e6 \! R1 ?; U7 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ {+ ]- Y. o6 Y7 x5 Z' E% K8 D1 S
  48. #else
    ' B' ^; [& X+ w' |# X( n
  49. #define DMA_PRINTK( x... )/ ^8 {) q! }$ v* J' w7 Z" Q( @
  50. #define DMA_FN_IN$ T. J! A( t: h: D
  51. #define DMA_FN_OUT
    " x2 N2 Y0 [' B7 O9 I: l6 I2 O' l
  52. #endif6 _3 V; \6 f" _+ G& R% j

  53. ( z: v) b% H- H+ r: T' x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # J/ _4 |6 G$ ]+ `- L2 d
  55. #define STATIC_SHIFT                3
    " w# e- z$ j- o: G1 V& h8 z" s0 h
  56. #define TCINTEN_SHIFT               20
    3 R! D' @( N! q& h* H: H( A
  57. #define ITCINTEN_SHIFT              21
    ' m2 @7 y& J& Y! x; J- C
  58. #define TCCHEN_SHIFT                22  X! G# V, o, D6 q+ }* y2 ^6 w
  59. #define ITCCHEN_SHIFT               23
    - \8 ]1 i( ]* G# i
  60. 1 S' j2 B9 x( N3 b" X6 `
  61. static volatile int irqraised1 = 0;8 x2 c! t+ u) p! d! b4 h' n) U: e
  62. static volatile int irqraised2 = 0;1 _( b! i0 D, |3 H; j* t
  63. & x7 ^5 [5 e  Z; R7 m8 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# o, P! F- z1 d" p0 N6 y1 w( |" A9 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) J( O# W8 q3 @7 p, F& D: D6 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 A6 d) }0 N, n7 R- S
  67. ! [1 @5 L) n' T9 ^6 `' J" q3 r  `. q
  68. dma_addr_t dmaphyssrc1 = 0;) F' t! \0 V7 c) H% f! u( @
  69. dma_addr_t dmaphyssrc2 = 0;
    7 N: C! N6 U9 P* b6 ~
  70. dma_addr_t dmaphysdest1 = 0;
    3 w3 k3 ~" Y% L0 i) `
  71. dma_addr_t dmaphysdest2 = 0;5 f1 q4 |1 c# j" q
  72. * t6 z0 @' f8 y8 ~- |
  73. char *dmabufsrc1 = NULL;% H- R" n& M4 m- T* \
  74. char *dmabufsrc2 = NULL;5 k, D: I: ^, ~3 R4 M% P6 p
  75. char *dmabufdest1 = NULL;* U! @) F' T. s% _3 d
  76. char *dmabufdest2 = NULL;- D( G: s8 q) U  K& _# t

  77. ' t2 [6 m6 _7 x+ k
  78. static int acnt = 512;
    + c2 ?9 {$ |5 D
  79. static int bcnt = 8;' V) V  o' k5 a0 A, C4 X3 y
  80. static int ccnt = 8;
    ' z, L. F+ v; N) S* D' ^
  81. ' U! L/ X2 y5 G( r6 {
  82. module_param(acnt, int, S_IRUGO);' m8 n1 Q- ^5 o
  83. module_param(bcnt, int, S_IRUGO);
    8 m/ V" @( m/ F2 D' B( t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# o; Q9 K9 x# D6 z
7 [1 e. N& I& ^. W# A& {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* T+ ?, ~7 }+ ]; Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" d* T5 m7 a" Q. l  e2 d; L7 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, [8 x6 T1 e; _6 s; K3 g7 B0 ~
+ n2 ~) m# w0 u" Q. h( k/ H
/ ~) e( j* X  b, |3 D8 Q6 Z2 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 15:01 , Processed in 0.042008 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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