|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % C' \" G9 T; l- G& c
- [code]EDMA sample test application
V- Z9 x7 _ X* V0 R. `4 U - /*
+ I a; i) O$ k+ \3 k - * edma_test.c0 m. E8 R8 ]1 x3 j2 X" ^& g% D1 ]. Z0 @
- *, @- I3 P2 Z4 N! [* N
- * brief EDMA3 Test Application2 p6 r ]. L& Q. r/ U
- *: ~2 f, Z- _7 L+ q
- * This file contains EDMA3 Test code.
& U U9 f3 L% @+ n2 P8 O' `& F - *% c8 F: |) b: D9 s' p2 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! X* j4 J7 G4 h7 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 b2 r& c: Q6 ]. }
- * TO CHANGE./ |0 K4 ?4 ]2 r4 c# y
- *2 _" R$ ?8 f. E4 w+ j: U0 ]1 z0 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# Q1 q) V: A4 f5 e+ z5 Z; _$ u) _, h8 Y# a
- *
$ i2 e3 c/ q0 t2 v$ J - * This program is free software; you can redistribute it and/or4 y) j( H9 O' n3 O& f$ C/ }2 f i
- * modify it under the terms of the GNU General Public License as a1 d4 A' g4 R5 Q% a
- * published by the Free Software Foundation version 2.! \2 r+ |, R8 h% C4 Z% [
- *
$ k# j* a u* ?! z9 u0 {8 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 @9 }9 h$ s% [( w
- * kind, whether express or implied; without even the implied warranty
/ U! ~+ G. B" @ y- _# S; b3 ]+ x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 h, W. Q) {, C" W$ p
- * GNU General Public License for more details.- ~' ]; z O. y
- */( |' X# u, a& K
- 9 F" G' |5 c: l) w
- #include <linux/module.h>6 Z2 M6 F" b, |/ Z
- #include <linux/init.h>( @4 g1 U! v" ]7 ]7 h
- #include <linux/errno.h>
2 a# r' l% v, _ L - #include <linux/types.h>6 d, Q0 O3 U3 X
- #include <linux/interrupt.h>
8 y0 w+ } b/ b) M - #include <asm/io.h>
, e" P' C6 m6 R* X- ^ - #include <linux/moduleparam.h>
/ Q; `! P5 ?( ]: C( d; {( O1 h d - #include <linux/sysctl.h>9 F! j. X3 C5 g3 F. A
- #include <linux/mm.h>
8 Y) F, ?& x X+ J5 d* f4 z - #include <linux/dma-mapping.h>1 i* O6 i; ^. o3 B
- * x3 R4 H9 O! Z3 g" J& g/ h
- #include <mach/memory.h>/ g& q. A8 i, K4 W
- #include <mach/hardware.h>
o3 ]) H) S8 a; a - #include <mach/irqs.h>& _0 k- X/ [* P+ X# |
- #include <asm/hardware/edma.h>! F9 h" N6 m0 {, L/ A0 t# o: a
- $ @6 A0 T9 r' [5 O; x
- #undef EDMA3_DEBUG
+ h. g$ U W# E3 Z9 x - /*#define EDMA3_DEBUG*/! @# J9 T3 K4 `( K
" d4 g( O a/ d4 z% F, R- U$ q# D0 m- #ifdef EDMA3_DEBUG& t; Q! y8 ]4 d( T& l4 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# P' S |3 o& l D. v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 e& [+ Y0 D1 o# W# w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 e5 K% ^' `2 k9 I/ A - #else/ P1 e; V! a* @6 u/ Q
- #define DMA_PRINTK( x... )* U; \: k/ B" J2 u9 N
- #define DMA_FN_IN
0 R6 ]3 ]: D& X - #define DMA_FN_OUT
. D- m1 ?; k9 b; D: a - #endif/ ]. | x5 J! g! n
5 t7 j0 T8 u6 ~" f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 `1 e& u4 P* Q6 B- w/ q ~4 j' } - #define STATIC_SHIFT 3
. f8 |' L3 G$ e - #define TCINTEN_SHIFT 207 r) k6 d& t1 e8 [& z
- #define ITCINTEN_SHIFT 21/ K# u" P8 N: ?2 N1 u8 Q
- #define TCCHEN_SHIFT 22
1 z0 i& e1 N0 |) n6 ` - #define ITCCHEN_SHIFT 230 s% w/ s/ z+ ?# R1 y: E
- 5 K y5 G: p" s. y) B7 Y
- static volatile int irqraised1 = 0;% ~* v7 W. b& o4 W' s/ }
- static volatile int irqraised2 = 0;9 x: o9 {# T) t' |4 e5 @
- 8 c0 E/ E/ F% v; q$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
I$ Q6 q# V: S4 B. L3 J3 o/ n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% J/ j# a* `) F7 n' f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, m* F2 D, Z' v5 C( v
6 L3 m% ~9 _$ u2 T: S- dma_addr_t dmaphyssrc1 = 0;$ V0 r- }1 f( p" B: o- L
- dma_addr_t dmaphyssrc2 = 0;
6 `1 B5 N, {9 S, e - dma_addr_t dmaphysdest1 = 0;
* m7 N& `7 l5 E - dma_addr_t dmaphysdest2 = 0;2 u5 j6 [$ g; R, K( C
- - \3 ~- @+ f. x2 ]6 l+ ~7 n
- char *dmabufsrc1 = NULL;* A6 |" \( x2 i
- char *dmabufsrc2 = NULL;
& X3 O5 d- |* H: K - char *dmabufdest1 = NULL;
' h, E D8 ~5 \/ @ - char *dmabufdest2 = NULL;
* a6 R/ m7 r0 a - 5 n! K0 _# q6 H4 F
- static int acnt = 512;
6 f* o! a- {9 m" a; z+ M% m' \ - static int bcnt = 8;
; I& g) }* r% ^ T0 M# z - static int ccnt = 8;
( O6 M+ a8 K2 N" h - ; p0 L# N% B! {* `8 t
- module_param(acnt, int, S_IRUGO);' x2 U( Y( ]1 N5 Z7 \' {9 k
- module_param(bcnt, int, S_IRUGO);/ t6 O0 T4 L u) r' t
- module_param(ccnt, int, S_IRUGO);
复制代码
0 ~5 [- U9 H' u. J- A7 N( o$ i9 K+ l3 M! z5 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 c; \$ {" N s6 Y8 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& i. H* C! G$ \ V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Y& D1 {2 X+ n+ z
; `! D/ C8 F- w3 z0 u% }& D8 {2 N
6 V9 ~) x* x4 i$ S+ k4 V4 [ |
|