|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & i! ?3 n0 i+ @* V% U
- [code]EDMA sample test application7 k! C2 u& z/ N; D
- /*2 Q- O5 C7 l$ |6 }
- * edma_test.c" |7 y& c% U8 y; S
- *6 j) v1 M" c7 U
- * brief EDMA3 Test Application2 C! D2 a7 b8 Z# N; i. q
- *
- ^# ], u3 ~$ O8 Y; h6 v& Q - * This file contains EDMA3 Test code." B: V2 I: n+ D9 Z& f; x1 x* L: O
- *! h" C8 X$ p: z: V2 l$ S% H; B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 R5 g5 z% S" e, y3 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 C7 H/ Y: n$ O. Q9 x
- * TO CHANGE.
7 U' B& ]# L. ~" I! Q - *
2 o# ^4 h. R+ j+ U' g7 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ |/ Q/ b5 W7 X* ^2 Z5 w - *( I% _0 Y& r# C- U O' ~7 L( `
- * This program is free software; you can redistribute it and/or
$ V) z" H' }' `3 y1 v6 V - * modify it under the terms of the GNU General Public License as
2 G4 r' c6 o6 T3 i1 M - * published by the Free Software Foundation version 2.
% l# [" |5 U0 J - *
3 M; W# n+ a2 h# H: z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. }' W# O7 M3 f6 }1 [ - * kind, whether express or implied; without even the implied warranty9 X& p i+ Y0 @! Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. M; [8 [, g a( T3 S0 C1 u - * GNU General Public License for more details.* ^& v; ]$ Y9 p/ r6 G5 H9 t' L
- */
; H: d6 G7 ^/ ?( i
. a) P; E2 B. q9 Q2 ^8 A1 A; q- #include <linux/module.h>" A- [- X& ~4 K+ G1 F4 a
- #include <linux/init.h>& b$ `% E% Z5 P- T7 \
- #include <linux/errno.h>
k/ [( H, a1 N9 x& a1 r" z' g. E+ Q - #include <linux/types.h>) [3 n' d7 Z# X
- #include <linux/interrupt.h>- J1 j- R/ p2 l F* L
- #include <asm/io.h>& ?! w) E9 F/ l% V
- #include <linux/moduleparam.h>2 z4 N+ _3 j% C9 C5 c
- #include <linux/sysctl.h>7 U) n' P+ _$ `# i0 F
- #include <linux/mm.h>) \6 K% f* ^, i8 e& H P: v. F- x
- #include <linux/dma-mapping.h>
; j; L+ a B J5 G+ G
: c6 `0 O* P! l! z0 W; E- #include <mach/memory.h>
5 }/ B1 G ^! g1 U! z1 n! j9 G# W$ { - #include <mach/hardware.h>
$ ]3 P; L7 ?9 m5 e% u9 X - #include <mach/irqs.h>
6 {$ U: M! C# e - #include <asm/hardware/edma.h>% D3 M6 ^+ P5 O. Y
- 0 [# Z# C$ K* c
- #undef EDMA3_DEBUG
9 Z u' L! s* q2 d4 D - /*#define EDMA3_DEBUG*/
% l& U$ F* ^1 j8 k' I+ @ - & R7 d( Z2 [7 k- v
- #ifdef EDMA3_DEBUG
" ?& B! l6 i5 i7 X$ ^& c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 ]" K7 T4 w/ A! l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). E3 i6 S. r Z. `* l- U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 {+ p s/ }1 R* k' a: z - #else
1 M9 X/ g1 _+ G: S. H+ c- I4 o3 J1 r - #define DMA_PRINTK( x... )/ Z( p" R! j; H
- #define DMA_FN_IN
/ k4 U ]( D( l! S ~ - #define DMA_FN_OUT) l$ b ~. b7 c" W
- #endif' o/ j# t% o# y- B) L2 V
- s: k' Q: Y' C: H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 Q5 P- Z6 m+ W - #define STATIC_SHIFT 3
% L, Z( G% P O) H y# r9 a - #define TCINTEN_SHIFT 20
?# U0 C# Z+ I y0 o# h9 @6 h) G - #define ITCINTEN_SHIFT 21) V- `9 i* W+ H( Y4 r$ J$ j
- #define TCCHEN_SHIFT 22
) H1 r. W% e# c: k$ j - #define ITCCHEN_SHIFT 23
- p2 L7 u' e* r - ! W8 G. Z) }3 V7 C$ h0 W1 s
- static volatile int irqraised1 = 0;
_" u9 |- V* O& ~/ M - static volatile int irqraised2 = 0;
4 k1 _- e1 |8 [, d - 9 U9 c. C) V) b! c9 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 j9 \4 @5 C2 i+ F" {8 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l7 ]9 k8 g9 M( m1 Z) y4 `# A! x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P+ B% A/ N% h* r# I2 h
) k/ ?' z! C% w9 o* \- dma_addr_t dmaphyssrc1 = 0;# N$ ^" |/ x, G, p N% ]
- dma_addr_t dmaphyssrc2 = 0;2 e% F& C% _# k, y' r
- dma_addr_t dmaphysdest1 = 0;) I+ R# t& x8 [* ^0 V3 @6 e
- dma_addr_t dmaphysdest2 = 0;
g% e- P% J. D. x0 P/ P
; W$ |7 C6 F& G) V; R0 }- char *dmabufsrc1 = NULL;; ]- S3 q1 n8 ?# q) f7 K6 q
- char *dmabufsrc2 = NULL;9 \% ]4 z% Y5 I ^# l0 T
- char *dmabufdest1 = NULL;
% p2 l3 \( v0 y J7 T - char *dmabufdest2 = NULL;# U9 P, _7 w# C; |+ ^- u% E1 t* E
5 c$ m b$ ]0 y- _$ N7 \- static int acnt = 512;
; t) I. c7 Z" ] - static int bcnt = 8;0 {9 U, D" s9 w( c! B" e- `9 `
- static int ccnt = 8;
5 \5 i! H/ ^/ c* [( c" q
7 F7 m! K. ?# [* X% a+ z- w( ]- module_param(acnt, int, S_IRUGO);8 O3 J! `' G. Q0 ?# }. K6 I
- module_param(bcnt, int, S_IRUGO);
% E, T7 p" M% `. {( E0 H0 v - module_param(ccnt, int, S_IRUGO);
复制代码
4 ]) Z% j$ S: b9 e1 k
( T( h- w$ }& i# I W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 ^ D% o* y, k n) v( Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. m( y7 h5 u: r6 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 u) o+ ]1 @% w4 R* A" t0 K5 S- _+ `8 [0 L; J: U; a" Z( ?
8 C O7 m; M/ y. d
|
|