|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h" P! T) r6 s5 a! l0 v- [code]EDMA sample test application
8 K8 X5 P/ I; m. u7 S: W - /*
# N5 t: {2 Z0 e/ W- M - * edma_test.c. W1 h) h' W2 i# u2 ]2 n
- *4 q" w$ X/ v, v4 M3 _' G) v
- * brief EDMA3 Test Application+ p% ^" O& ^2 _; K# L
- *( j" p8 u; e* p! p
- * This file contains EDMA3 Test code.
5 f* N2 y- v1 I$ H+ y/ n( x5 j& F - *$ W; P9 J4 m/ L. j9 `' @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. L) B: i8 p x& j6 m" H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 g9 z2 }8 Q) x1 M. G6 e$ e
- * TO CHANGE.
& S Q# U6 L% }9 z - *3 Q$ Y& m( J% f5 a a# P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 @* f8 ^; s( T% |2 I4 M/ U - *
: R' \3 ^1 W/ o8 d9 Q( K9 h6 { - * This program is free software; you can redistribute it and/or) H; X. q& {: p- s: D$ O
- * modify it under the terms of the GNU General Public License as* n. S9 v& r3 q) u: w: ^
- * published by the Free Software Foundation version 2.
0 E0 m# e: I( \" S9 u - *
: }6 R. s' b% Y" c0 }$ A" P4 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W5 s! G7 O" d) ~2 P
- * kind, whether express or implied; without even the implied warranty5 v: \9 {+ N5 Z% K8 o6 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% k0 ?' ~) e1 l" y( U& P - * GNU General Public License for more details.% V' G, t; x$ R* T+ \2 u
- */
9 `- B b' W# L( f( _/ \* r+ v
H* c+ i' D0 v7 C! P8 h8 K* h9 n) s- #include <linux/module.h># S6 J/ b3 }+ r; k9 b# h5 V+ `
- #include <linux/init.h>
! C8 P5 Q% b( l& M& Q - #include <linux/errno.h>
) [! ^3 H; x% w& C5 Q - #include <linux/types.h>
, Q1 n1 Z6 z- H1 f# ]: b - #include <linux/interrupt.h>1 T6 S# e5 |2 W3 q
- #include <asm/io.h>, j4 ~2 O% j$ \0 U" r# F7 ~$ }3 B
- #include <linux/moduleparam.h>' V3 _# }- V- l, p2 E/ N
- #include <linux/sysctl.h>
2 k' b+ u/ U. h9 ], k3 V! a - #include <linux/mm.h>
4 [( y! C' X* w! D% G0 C - #include <linux/dma-mapping.h>
) B! E, ?/ Q6 S" B3 C# r
- b5 u+ `/ k& S+ M- #include <mach/memory.h>
0 I! a* L- z w9 L% _: Y* B! `$ A - #include <mach/hardware.h>& J- [$ ^1 Q. W, C1 l B
- #include <mach/irqs.h>0 Y* X9 y0 d" Q2 r( E9 @+ z/ N
- #include <asm/hardware/edma.h>
0 f% z* n( I, | x0 X; k6 ^
T1 \9 W0 c8 S5 h/ k% p- #undef EDMA3_DEBUG4 m+ W0 A0 w7 x$ i
- /*#define EDMA3_DEBUG*/
% ^/ c1 a5 }5 Y" r% G, @4 C - ( w2 ^: q) n: M# J* U5 S6 c" t# W
- #ifdef EDMA3_DEBUG E0 \1 a5 e) K% L8 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! K" M, L/ p( s- l+ P* z' u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 |; X+ b- K) |' t P0 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& T6 ^% t5 H0 n2 v - #else
a& g/ g4 Y& ? u - #define DMA_PRINTK( x... )) O4 ~9 q0 V" Z5 w, T& f5 A$ l+ z
- #define DMA_FN_IN
0 z+ t* a H$ I2 q. ~5 } - #define DMA_FN_OUT8 F. ?' h9 T4 c7 E, n! f( r+ `
- #endif7 S: s4 u. H( Z" R% }! M
- ) t+ K* _# C6 [2 ^9 a; k0 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). l2 ?' K4 b. w; m+ H9 ]" ?# J
- #define STATIC_SHIFT 3
7 f* X* @+ @. f+ L& \6 U8 X) C - #define TCINTEN_SHIFT 204 j: \6 X9 l5 [* _& O9 N
- #define ITCINTEN_SHIFT 21. x/ v2 T0 z6 t
- #define TCCHEN_SHIFT 226 z' {( g5 b3 l$ G, q1 g
- #define ITCCHEN_SHIFT 23
: F$ L) J4 l/ S3 I' N - ! i) m, K; s& X' Q4 J
- static volatile int irqraised1 = 0;' n6 t0 E( A% U
- static volatile int irqraised2 = 0;
" ~& S5 X: |/ Z( j
$ s! Z, f7 _' q& O3 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^/ G2 q; W- z/ m H( U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f( x+ B/ M; w' i; Y& k7 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" C- K* w/ b: S5 W! I; U: t( J - 1 i+ h( N! S' {& l% b# v
- dma_addr_t dmaphyssrc1 = 0;
% O0 S, e( _* R, ^( \2 X; r - dma_addr_t dmaphyssrc2 = 0;8 n+ O4 V& x1 u
- dma_addr_t dmaphysdest1 = 0;
9 x7 L9 e) N- m, T, x; z8 X - dma_addr_t dmaphysdest2 = 0;# |6 x0 I4 I& p* j. d+ g
3 Z+ y0 L9 l: M- char *dmabufsrc1 = NULL;
0 Q) r9 Y; f, a+ \$ m - char *dmabufsrc2 = NULL;
6 n, a2 q9 G. _0 F: l( f - char *dmabufdest1 = NULL;
0 F0 V4 o* t- T: g9 [- s& E - char *dmabufdest2 = NULL;" _# u, Q- u: x
- ; N( E0 e) b0 d( a, O
- static int acnt = 512;
# L8 Q% B0 \/ F$ G - static int bcnt = 8;# Y A. d% z% S, c$ k8 Z8 O C
- static int ccnt = 8;8 Q4 W x' `6 O
3 ?! p7 b/ ~. M3 @3 K/ h- module_param(acnt, int, S_IRUGO);
' k. E5 f1 ~# X% M3 |6 E - module_param(bcnt, int, S_IRUGO);! c: s! `$ o$ B' V4 o9 O
- module_param(ccnt, int, S_IRUGO);
复制代码
# t" f# Z4 W9 \5 T# Q. [" c! k
+ e% f1 D U* G4 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) }- _) W+ x# u5 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 {3 |2 p: A; l2 ^+ s2 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 U$ ?5 f, T# Z( K- ?9 j/ l+ B; Q* C2 c- `. T7 f0 ^1 H
# k) Y- V, G( t* N) Q5 \) R |
|