|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 h, l; g7 `# z1 _0 \2 E- L H1 L* x- [code]EDMA sample test application8 @+ `" d+ D1 V( F u
- /*
3 N; r. a5 O9 ]- f2 o! p4 X4 o - * edma_test.c
- E. U9 [2 d( T/ e, G) |3 `& k/ [ - *0 F/ P; Z9 ^7 Y' C# |
- * brief EDMA3 Test Application: \$ C& G& C' H% Z. o( p
- *6 N" [4 g' t! T5 Q9 o7 l
- * This file contains EDMA3 Test code.
) d+ a& x8 ?; ]" j - *6 P" M3 q! z$ [& R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( L7 E" b$ Y, M9 \, n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& k( z- Q( @5 i; M( O3 R. d* l: ^ - * TO CHANGE.% @/ X% @9 Q$ U& T! T& W. t& }
- *
7 y; W# Z: j* m6 q1 _5 z2 @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 ]! t2 g4 y) W- P - * O3 D$ y+ B% B9 T$ ` d
- * This program is free software; you can redistribute it and/or/ s& h& X" `, C# R, @& _
- * modify it under the terms of the GNU General Public License as4 x: v! G6 |+ l, [& _+ n: ^; U
- * published by the Free Software Foundation version 2.
/ v A1 x5 @. x5 a0 l7 ^+ M# c: B - *: k' s% q7 s* [3 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 u# c" j& u& I1 ]8 X6 {( [; l- z/ \
- * kind, whether express or implied; without even the implied warranty
3 p, S+ M |9 `7 F* @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# {4 I$ u, V7 {+ P - * GNU General Public License for more details.4 d, K2 y d4 J7 j g& m
- */1 s: k- v; z, X; {& H! u! Q2 Z
- 0 h* [9 ]! o0 {1 Z9 D
- #include <linux/module.h>
4 v9 O8 U9 x8 h - #include <linux/init.h>
0 o1 D1 e1 J) G; w% f - #include <linux/errno.h>
7 k/ [" S1 _( }% q) _: e - #include <linux/types.h>" i! p) R/ L( C4 Y
- #include <linux/interrupt.h>& A4 h1 F& g) C. T/ v
- #include <asm/io.h>
# A/ A: h8 u6 t& r, _. i - #include <linux/moduleparam.h>
' P# v/ S5 P( w* o h1 _3 ] - #include <linux/sysctl.h>
- y9 Q, i$ i0 J) {2 U9 C" { - #include <linux/mm.h>
* o; [1 W1 F- j6 V/ j% n' N - #include <linux/dma-mapping.h>
/ j a& C4 A( w+ L' Z - 7 U3 a7 l5 X. m( o0 K$ B
- #include <mach/memory.h>
, u( H" Q" T; t o - #include <mach/hardware.h>: w6 u2 C, v' B. } p4 s( J
- #include <mach/irqs.h> G! z( @% _. B0 }5 p! e
- #include <asm/hardware/edma.h>" ^ Z2 G, z, g* _; a ?
+ j d8 r! [4 A' L8 _- #undef EDMA3_DEBUG" K. Q. I6 f4 L2 p- ?' z Z
- /*#define EDMA3_DEBUG*/: c+ ]5 m# B2 S: h) t
- 6 M& ?3 i$ v) ?) [( M! v
- #ifdef EDMA3_DEBUG0 L" `1 D4 {' t: C6 J) j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) \0 W* t3 \! c5 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 C! D/ Q. t" t7 T' p t) ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" J7 ]$ r* k* n( ~ - #else1 X9 \$ W6 i; V3 g1 Q3 q6 A
- #define DMA_PRINTK( x... ) y S q% Q7 k
- #define DMA_FN_IN
$ l2 r3 I/ i& E1 A# R8 p - #define DMA_FN_OUT
5 p- X4 e# Z' t, `. w- h - #endif& x9 Y% G7 Y8 y f
- . ?* X/ Y5 i& ~5 D1 f. g: ^" w! i* C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 n, W9 h+ L' P" l, d' K! r - #define STATIC_SHIFT 34 }6 h/ v( `, C2 h; S! ~% t
- #define TCINTEN_SHIFT 20
3 d/ ~' w. D8 r/ G/ C5 C8 | - #define ITCINTEN_SHIFT 21
( r3 x: w$ y+ l3 E) D* T6 R - #define TCCHEN_SHIFT 22) s; f' k6 J8 Z2 A4 @7 h' V
- #define ITCCHEN_SHIFT 23
$ H9 `* P* |% _
, j. _7 Z& t6 Q" s6 O- static volatile int irqraised1 = 0;
! Q3 t7 |8 R& \4 Q( f - static volatile int irqraised2 = 0;* P" J. }1 O( v$ s0 S- U
- % Q3 m ?' N+ P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ X; x3 x7 r& u8 C) Z8 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~% \* h e1 f6 P% ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# |( {" s$ ^0 u$ I - & Y6 D$ q0 o8 R, p x+ N* M9 @" R
- dma_addr_t dmaphyssrc1 = 0;
: j9 B9 B& a/ ~; R0 q2 B1 _2 N - dma_addr_t dmaphyssrc2 = 0;1 D0 _# j% r% z/ { [3 Q# a+ k
- dma_addr_t dmaphysdest1 = 0;) ?4 k0 }( s0 n& I, |# b
- dma_addr_t dmaphysdest2 = 0;; n& F! ~, O9 W, i) E) g) U2 p
# |5 I0 s! E5 O5 B- char *dmabufsrc1 = NULL;/ S& L. Y- z- f9 R6 d
- char *dmabufsrc2 = NULL;* y( o: B0 F+ ^! \ `8 K
- char *dmabufdest1 = NULL;
3 t! }. F# J/ [ - char *dmabufdest2 = NULL;
* T( z8 Z P- M) K6 ?$ V8 f3 N - : b& G/ e% O" L
- static int acnt = 512;
7 n3 [+ T/ d) v - static int bcnt = 8;1 R! b4 P" d1 |5 x6 y8 q
- static int ccnt = 8;
5 w( ? a& d. a3 v, J0 z
Z D! {# k5 A( A. D4 A1 h- module_param(acnt, int, S_IRUGO);
; \' ^' I8 D# `. Q - module_param(bcnt, int, S_IRUGO);/ q# Y: x% o( [' d
- module_param(ccnt, int, S_IRUGO);
复制代码 / z5 F$ V9 a' o, G, }! a, ?1 w1 G
# e% J) W. p; L' A/ y+ ^ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ O* Y; p; X+ j, ?4 G }) `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 W) a! G5 o* S$ n, c; ?6 h' ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& t1 Q ] Q5 H- c: p! e! |9 h F. ^( K, K) u( K8 Z* O% k
2 G* x) B" ` Y. O! P2 | |
|