|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, \# y+ Q, C3 i5 r& v/ I# V9 c Q% k- [code]EDMA sample test application
9 @4 T+ [0 P, W6 P- u - /*7 g- l! r6 {4 s* I! ]( j' @
- * edma_test.c
% R' [$ v( ?9 ? - *
# p& i: x1 b: l& `! Q8 y# {1 { - * brief EDMA3 Test Application0 u4 R9 D: n/ R: A
- *
+ D" a+ A6 U) t. I V& ? - * This file contains EDMA3 Test code.
7 T' K( ?) @, I' {" e% ~" s) x6 D - *- D" @3 @/ G4 P/ }6 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' z5 p7 _9 j, M3 F4 \' s* M9 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( C$ p. Q) d6 q$ D
- * TO CHANGE.2 m* C; A4 S4 _
- *6 w% j& d2 F/ Q( g$ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. f# G" C* l$ Z1 }. n1 |# B - *9 N k4 D$ C" H: e) v/ {$ s
- * This program is free software; you can redistribute it and/or2 Z; \ u4 Y& C/ |1 M
- * modify it under the terms of the GNU General Public License as Z6 L3 I8 n, g) d* ~
- * published by the Free Software Foundation version 2.$ i/ r# q7 D# @" b, u& M
- *2 V' K6 u6 f( T$ t6 R' Y9 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! b: O/ Q: @ k% m4 C. T5 v0 i& @# X
- * kind, whether express or implied; without even the implied warranty' p F) ~+ }. M5 m g6 F% e# ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; w$ B4 {/ k# p - * GNU General Public License for more details.9 W3 z- W* u4 @' k3 l
- */
$ Z" e" N4 T9 o) @: q1 v* E
& }: L0 y3 a" v; B0 ?+ a- #include <linux/module.h>; Q$ \1 }$ k. n" y' q: y
- #include <linux/init.h>
. y( L Y1 ~2 l0 M* i& [ - #include <linux/errno.h># b/ l" y6 l% C
- #include <linux/types.h>
% J/ v. E A' s# F - #include <linux/interrupt.h>
: P& u E$ z% x% [* c( v - #include <asm/io.h>
) L7 F% ^- v1 H3 d - #include <linux/moduleparam.h>
3 ?0 U+ G- P# t0 [( c - #include <linux/sysctl.h>
, I# ~, a, |4 N u- C; y - #include <linux/mm.h>
; C3 N5 J9 V; j! n - #include <linux/dma-mapping.h>! J6 o1 ]: u; `
: u% p" a7 a/ z: f y7 O! {- #include <mach/memory.h>
^& `% {: C8 i3 ? - #include <mach/hardware.h>
r7 L% Z& q3 V1 E. \% j7 a - #include <mach/irqs.h>, `+ s4 ^' ^( `5 ^+ a* t) ]
- #include <asm/hardware/edma.h>
, p% ?8 `% b$ v: m1 G - * i. \& P5 R" L w( }) m
- #undef EDMA3_DEBUG. [; s5 a9 ?/ ?( p
- /*#define EDMA3_DEBUG*/7 O( \" s5 Q& A
7 d$ _3 E& _! e% y3 u- #ifdef EDMA3_DEBUG& Y3 ?3 l" Q$ r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 X3 H& |* ]6 Q! \0 P) Q4 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: o1 ^% U7 y- p; p% ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): n3 Q* q7 w3 x8 m# T4 u2 B
- #else0 ?; o4 _4 T$ |
- #define DMA_PRINTK( x... )
) q( X& z1 ]6 Q: d) G- y* J( n' m# Q - #define DMA_FN_IN
. g2 y$ i- r% S" ]0 k. x - #define DMA_FN_OUT
- ?1 Z, O6 ?! _" ^5 `. T - #endif+ u; K8 s) Y% @
- 6 U- }4 R4 [7 Q* f+ B- L6 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& I' K" q* W/ d
- #define STATIC_SHIFT 3
" ?8 F0 C1 C( O" c- i - #define TCINTEN_SHIFT 20
! }+ `7 ^$ H8 ?9 J3 d - #define ITCINTEN_SHIFT 21
) y6 F) ?; Z x; u% a7 A; n - #define TCCHEN_SHIFT 22
% q- {& y7 H: d2 y+ P4 x - #define ITCCHEN_SHIFT 23/ V# T* F- H$ O8 X2 d3 K
- " K- o! ^: P% P6 I
- static volatile int irqraised1 = 0;
/ Q2 {. ~/ M7 r - static volatile int irqraised2 = 0;% ?/ L7 Y0 t3 n3 T) f: l
- {7 p; t; k# |- h4 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" v; g( u) u2 F1 ^" a3 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _% v6 {; U1 H6 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 G7 b5 f3 t2 h7 ]9 _8 y" L
x: \ }! Z. s- dma_addr_t dmaphyssrc1 = 0;
8 ^. V/ \ w; G4 L8 {; u - dma_addr_t dmaphyssrc2 = 0;3 Z* `# F n4 K4 M+ {
- dma_addr_t dmaphysdest1 = 0;1 z- H& F4 _# ]- m4 j; I; t& K
- dma_addr_t dmaphysdest2 = 0;
$ X9 K4 Y. y8 w
. \; p% F6 r1 `; Q6 ^: u- a- char *dmabufsrc1 = NULL;7 @2 s2 j* |% Q
- char *dmabufsrc2 = NULL;, Z) S; m3 V, A
- char *dmabufdest1 = NULL;
4 C8 ?) c$ k' x6 I - char *dmabufdest2 = NULL;# ?: p. R7 R2 \- @
' \4 k0 H( \# a- static int acnt = 512;
+ n3 V0 @$ C1 e9 f# c3 `0 y - static int bcnt = 8;- Q- b/ s! o9 A4 |$ D2 Z; X8 _
- static int ccnt = 8;* Q2 f/ N- C+ h9 B5 ~ }
- ! A W ^. Z2 @
- module_param(acnt, int, S_IRUGO);* D6 n! N: ]; }' C# @
- module_param(bcnt, int, S_IRUGO);: R7 u- O: D3 r& _/ i% ^
- module_param(ccnt, int, S_IRUGO);
复制代码
5 |2 S( H5 ~* X5 {" A9 _; B1 e, m S( l. C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# f% }) M. X8 q3 p. l
arm-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 l$ }4 @8 `& m% k" C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |; f& U5 q( e; H( m, @
, z/ f( _8 N: }) ?0 v
7 F1 g" B& a* z |
|