|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 p) s: U0 m6 Z: }* \6 |* ?) l- [code]EDMA sample test application
4 `6 V& p% z+ a- B3 r* w - /*$ i- s$ J& D# \1 ]
- * edma_test.c
5 \, v4 f/ g4 K. v - *# W* \. Q; c J2 D
- * brief EDMA3 Test Application) a0 _- ~1 H f5 g; j
- *$ X, `: P4 p; I! O
- * This file contains EDMA3 Test code.( k+ b3 J" v" W3 a2 H: B
- ** R* V1 j$ L3 r% A; C0 _3 s% t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z. g% z5 O" N2 c; k- \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT V1 L+ t' z. e9 }2 ~
- * TO CHANGE.# I- j0 i Y" l4 [7 J' m
- *
0 ]5 J, `6 h( i2 C8 j+ J" S$ A2 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- m( d; H) {+ J! f7 N. J2 j5 D, s - ** W% |- q' x$ {( Z
- * This program is free software; you can redistribute it and/or
* d/ g4 c9 ?& `! D5 @. d - * modify it under the terms of the GNU General Public License as
. [3 D! q: a, {) `. e - * published by the Free Software Foundation version 2.9 ~: B A! C* M6 C4 ^
- *
9 c' y9 e0 i$ C8 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any S2 E' W+ g0 m3 L* B5 b5 B
- * kind, whether express or implied; without even the implied warranty
1 H: R( N* E9 y8 O: d7 n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 B9 E) A1 A+ B; }9 F) Q% I% t - * GNU General Public License for more details.
( D5 ^. Q- v, q1 R2 v - */% v- s" K- h7 \( d- s8 R1 o
6 H1 D/ _& ^! n( O2 \6 v; W3 N; r- #include <linux/module.h> J8 }4 X$ x, `" C" M: Q9 H
- #include <linux/init.h>, W' c5 j0 u' ?! ^- O! q8 G N+ \
- #include <linux/errno.h>
+ D& k$ a: c2 o7 o - #include <linux/types.h>' h! `9 z- \% L% a
- #include <linux/interrupt.h>9 G7 N! R8 z! d
- #include <asm/io.h>8 M7 i! E. p& ?+ `$ l6 N3 W
- #include <linux/moduleparam.h>
2 s' ]4 r! R7 N - #include <linux/sysctl.h>6 G' Z3 W' U( n2 V
- #include <linux/mm.h>2 e4 G9 h# _2 J! i
- #include <linux/dma-mapping.h>. t r! M. c6 U' j! M$ c
: \: L/ N- S- o0 l5 h" ~3 r8 Z" X( ]- #include <mach/memory.h>
7 x% L" F) x5 M% d" } - #include <mach/hardware.h>% C4 M6 j: I: R; b$ p7 V
- #include <mach/irqs.h>
% ?5 }8 d4 h% n* t$ |/ B - #include <asm/hardware/edma.h>7 z; J, x2 Q5 |! X7 @
2 c# R# W8 x# r3 o, |& k- #undef EDMA3_DEBUG
/ b2 E, b# a; x2 g7 ~ - /*#define EDMA3_DEBUG*/9 P- q8 P( `0 K- Z2 h- Q. p) j
# _( W% p* N7 @, S% `' L; @- #ifdef EDMA3_DEBUG
: h, N( \& M# v2 P, h% V1 w! [1 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): P+ {( h Q8 f/ V4 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- `) z, Q' f4 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& T$ f( F% D9 w7 z1 r - #else
& W( L- X6 |0 ^ - #define DMA_PRINTK( x... )5 O) ]+ h/ W( \8 e {& [
- #define DMA_FN_IN
! _" z, _- G( ?- E& o6 j - #define DMA_FN_OUT
6 w4 n( f1 `5 z4 I1 g - #endif- I& `" r8 v" Q3 W+ V5 @5 K# u* X/ @
- % h/ m* J+ l7 X7 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& U* Q( ~. w! J) `
- #define STATIC_SHIFT 33 k) e* \ m5 O" _
- #define TCINTEN_SHIFT 20
0 }. o1 q+ B# B- B5 r' Z - #define ITCINTEN_SHIFT 217 X) h! ?% ]3 @7 [7 j p! N
- #define TCCHEN_SHIFT 22# o3 O; |+ K& k! r: \
- #define ITCCHEN_SHIFT 23
9 D. b7 X+ c) {, q7 b
8 Z0 Q. l2 F) H$ V- static volatile int irqraised1 = 0;4 Q6 w# W) k2 `8 j2 f
- static volatile int irqraised2 = 0;" J6 P( o! _, C; e# y T* }! Z
1 F$ y. `( @2 A- D0 e' i! \" U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 D4 A! k$ K1 [% \) R# P5 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 h b( N% b# Y& }: c& g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 y6 e( k% S, p& }
2 ]% `( ?6 S# p# g- dma_addr_t dmaphyssrc1 = 0;9 {0 U- e) l+ k7 p4 B5 p/ F8 x
- dma_addr_t dmaphyssrc2 = 0;+ F. d! Y: t5 P3 z8 _9 ]+ P- \5 ?
- dma_addr_t dmaphysdest1 = 0;
3 T- f5 H8 A, i$ q" } - dma_addr_t dmaphysdest2 = 0;- _ a! a4 a4 L0 Z) z3 @2 t1 W; Z
- 3 }& K! o$ [4 Q( X2 z
- char *dmabufsrc1 = NULL;
w* n$ O' Q+ o - char *dmabufsrc2 = NULL;
1 ~1 i5 v% \/ O3 i! _- J- P - char *dmabufdest1 = NULL;
# W6 c( I) c; { - char *dmabufdest2 = NULL;7 |' h, F! l% m/ s! L4 w
) s! x% }/ R. R- static int acnt = 512;
5 N/ h6 t0 g$ l1 H# G+ I - static int bcnt = 8;3 l. O% p0 w8 p8 t: R" v/ O1 b
- static int ccnt = 8;! g, w' l4 d! o7 r4 }
- . c/ s! X2 r+ Q) i# v( f8 d' v
- module_param(acnt, int, S_IRUGO);, W1 E) H, h# u& f [* A+ k
- module_param(bcnt, int, S_IRUGO);# ^2 P0 q6 l" R* B' g1 H
- module_param(ccnt, int, S_IRUGO);
复制代码
& r6 I8 R8 [* B& n4 l( W& [' Q1 C* N+ g& N( P6 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" f% y& K- n- t( B! b( V, r9 S1 g; o5 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ^, W( a5 \% m3 ?9 u) `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u$ v% H3 Y, d! t" `, C" G# {. w0 X; F5 @- g/ }$ ]
' V, q( O& n, p |
|