|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" b( A5 u9 ^( y+ c- Y3 X7 X- [code]EDMA sample test application7 ^+ t6 r. L8 y; ^# e5 N+ W
- /*
4 k) k! E6 g' b - * edma_test.c
2 h5 n# o2 |" f3 B7 T: I& R3 B, i) ]( a - *
) T1 w% Q) X6 Q& Q3 P& g - * brief EDMA3 Test Application
) f/ e3 K9 E( Y: z( S - *
Z9 N7 N5 z4 t9 b - * This file contains EDMA3 Test code.- ~" ~( L& i) r7 B% O
- *
1 q% \0 M8 b6 \% l: P6 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. f2 N; x1 a9 _0 ^+ T) r& e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( @0 H- }% w: B" t8 w
- * TO CHANGE. j; }4 D5 \' N6 B% C" d* @
- *3 e% p# `2 B, X( N9 P$ W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; ?' R) D V6 b1 R. ? - *: z- B% M3 t; H; Z& g) X
- * This program is free software; you can redistribute it and/or: }8 T0 ^! [) K! Z: Y9 D
- * modify it under the terms of the GNU General Public License as
- x ^: r- p" I7 |& g+ i - * published by the Free Software Foundation version 2.
# H4 F) l% w4 Z+ U' m; x: R- K; P* e - *
/ \- {0 p& R, z3 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( p; v3 q. O1 m( h - * kind, whether express or implied; without even the implied warranty
3 I4 n6 q6 x7 } q5 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
o2 T+ a- D7 [/ a4 E: R8 j - * GNU General Public License for more details.
' u! b/ Z; c) y. M - */
6 N& s' |5 \8 E6 X+ r/ Q" Q( G2 r' E
1 L, a# X/ V; _1 e- #include <linux/module.h>
0 C Z, y/ Q- G4 s! [2 { - #include <linux/init.h>
: h4 x. r3 F+ \- `: x& s7 a - #include <linux/errno.h>% ~) w7 `7 r. \; [4 ?
- #include <linux/types.h>
" M; a4 C% N' }- J; S9 w0 o - #include <linux/interrupt.h>
4 r& ]; n( S' X! ] - #include <asm/io.h>$ y9 Z- ?8 m+ y+ R
- #include <linux/moduleparam.h>- Y5 ~" B" W1 k5 i4 n6 x# n) n1 q1 J
- #include <linux/sysctl.h>
) T% h4 ~0 `3 P- s- ~9 @ - #include <linux/mm.h>% T0 u% l) w7 N0 ?) c" W6 A
- #include <linux/dma-mapping.h>1 p9 b/ P3 r. r5 v
% P6 ?! N! m$ h* L# o- #include <mach/memory.h>
5 H/ E% x* T5 g7 t. j) i - #include <mach/hardware.h>
& o; u, ]3 K0 R3 l0 Q+ V( p2 V - #include <mach/irqs.h>
* C) a" S5 w7 e# r6 |7 \) |& \ - #include <asm/hardware/edma.h>
q7 d+ h" I# R% J% X" ]( |: ^& R7 m) U - % y0 {) T1 ]* V D
- #undef EDMA3_DEBUG+ D6 E+ y8 ?7 ]# L% m- u
- /*#define EDMA3_DEBUG*/
! B8 G2 q2 ]* w' V/ O3 B - 6 j* j! W" H& j# |& q7 ]- f2 ?
- #ifdef EDMA3_DEBUG5 e6 { L' \. ], V$ y7 C, ?* T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- s) O8 x6 C* o) } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! y! f/ d2 Q- v- p. p3 _& U9 z6 y& G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' m2 |# v7 j5 X8 O; [' m - #else2 c; H' `+ x" `7 H
- #define DMA_PRINTK( x... )
* }. m" n( T6 E - #define DMA_FN_IN
0 o7 [" `8 d2 | - #define DMA_FN_OUT: K2 M9 S' R7 R/ x2 T2 G% u
- #endif0 h3 }, v) Z8 L5 U' T7 l) f4 Q
- 8 `, u$ e4 s q7 Y. s7 d1 C3 a( v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, Y! u0 [0 P3 \+ \+ s ` - #define STATIC_SHIFT 3
+ E9 h: i- H4 ?* n - #define TCINTEN_SHIFT 20
+ m/ H- @( J1 E8 T0 }8 t$ m6 [1 \ - #define ITCINTEN_SHIFT 21
8 z/ a* [; Z4 ~7 w0 r0 | - #define TCCHEN_SHIFT 22% n: h9 _ L% G& I* C
- #define ITCCHEN_SHIFT 236 }% A* s' Z( T) E; T
- 9 w! s/ e; b( K1 H; b6 m
- static volatile int irqraised1 = 0;
' O& j# W$ n5 } - static volatile int irqraised2 = 0;) E& b& ^; b9 n! O9 P
R; E( x A6 [- 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 - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& m/ j" a; P7 u' L4 u - 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
- , ?. ?$ o- E, E0 C& T
- dma_addr_t dmaphyssrc1 = 0;% M; q3 R, ]/ `+ D7 d: D" }9 Q
- dma_addr_t dmaphyssrc2 = 0;' _: M% Q: R3 N T/ G3 {
- dma_addr_t dmaphysdest1 = 0;
$ C6 W0 @9 ~' R3 T - dma_addr_t dmaphysdest2 = 0;
- n4 d2 s( ?% t% x% x6 C9 }! L) N - 2 m$ d0 r. s7 Q: T7 P( r, ~
- char *dmabufsrc1 = NULL;: o x+ }! x8 N6 Z& ?( s f6 H: h
- char *dmabufsrc2 = NULL;
% K% f4 |2 W8 U. R! Z/ a - char *dmabufdest1 = NULL;
7 _$ N3 d1 z7 j `# b5 p. ^ - char *dmabufdest2 = NULL;1 P! ^4 z& A7 }0 t. X( l
- : G% s% j B& R+ Q/ R
- static int acnt = 512;0 t8 I( `( m+ O
- static int bcnt = 8;
' T* f9 f' O4 C4 \! | - static int ccnt = 8;
s$ A [+ o+ ^0 x8 \ - 2 O2 B; |) ?6 g7 c" T' x( c
- module_param(acnt, int, S_IRUGO);
9 J: b7 y4 u1 X) X - module_param(bcnt, int, S_IRUGO);$ \, Z5 _# N6 t* y$ x: |) I
- 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" ~
|
|