|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z- C9 W! P9 o% J# t4 j
- [code]EDMA sample test application
% s( N2 T; e8 C$ L3 O, C* H( O - /* q& T" F; t1 J) g- W0 |
- * edma_test.c( n, g$ F, y4 v$ J( L6 d8 o: r/ r
- ** g/ z, p+ J i- f( J1 p- g
- * brief EDMA3 Test Application
+ s6 a' Q" V: w+ l8 F( m# q5 h; t7 v - *- u' b9 W, ?8 ?
- * This file contains EDMA3 Test code.. o& O3 h/ q3 a$ `/ j
- *! C2 f$ I3 s" W/ j. Q& P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 \0 @% }" A9 G1 P7 @3 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z {6 l/ K& ^
- * TO CHANGE.
. c5 c% v2 U9 ]/ A' C0 T- C5 } - *+ p5 {- U, Q5 J/ J+ N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* {0 E7 s+ y3 k) R - *
6 D' I1 {4 y8 b' F - * This program is free software; you can redistribute it and/or/ a" e" L; w5 ^" \
- * modify it under the terms of the GNU General Public License as
$ ^- @" w$ B& {; M7 w - * published by the Free Software Foundation version 2.
8 p4 C4 w6 Y% y3 ^( b' B! K x - *) [9 }2 o/ n2 T; j/ G9 z( l& ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V6 p; F ]/ N; Y
- * kind, whether express or implied; without even the implied warranty
7 f. ?+ l; _$ s& @) v2 L5 `7 v- ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( j. Y! Y# q) Z - * GNU General Public License for more details.
0 c7 j& @4 k( H* o0 y - */
. ]" A# v& i" R" l - ' ?4 y' Y0 R5 \0 \9 R* @
- #include <linux/module.h>
. D: ?' |8 `( l1 B+ H - #include <linux/init.h>
' e8 M/ \/ y# [& o9 X5 b$ i - #include <linux/errno.h>, k1 F4 D j' e# A9 V
- #include <linux/types.h>: X/ Y% B* T7 h5 F$ @3 w
- #include <linux/interrupt.h>
! ?& ]0 t+ Q8 O6 k6 b: W - #include <asm/io.h>
n0 _: T* w3 N0 [ f - #include <linux/moduleparam.h>1 \6 Y& M5 n7 W, I) V
- #include <linux/sysctl.h>0 @2 Q1 _( Y/ X& g
- #include <linux/mm.h>, P: I8 O+ o9 m' {* H. S4 m a9 g4 g
- #include <linux/dma-mapping.h>" l. _' P: u! T3 b
0 L9 s* F4 P$ U) c. {$ Q& v, }- #include <mach/memory.h>( u5 L1 f$ H- L1 u# [- n/ ^; k
- #include <mach/hardware.h>
- V8 J$ M* V/ R" K - #include <mach/irqs.h>) z; Q/ g4 b x* U; R
- #include <asm/hardware/edma.h>7 g# B3 l% N/ q+ Q$ q
- 3 U2 I& |) N2 F& F2 L; H9 h
- #undef EDMA3_DEBUG
2 {/ M* y1 y% F - /*#define EDMA3_DEBUG*/; L& `; y# M( C! u
! r& t" D# N; P/ j5 N6 |- #ifdef EDMA3_DEBUG/ K3 g$ N, p+ j4 S. y, b, t) v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 d3 ~# X0 {8 j W6 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- ]& V2 ~ \4 h2 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" T9 Y* w! ^% H4 [
- #else
2 C2 M, k7 x; P1 i: v# P H - #define DMA_PRINTK( x... )
! B+ o# Z1 P4 h7 H$ B+ M - #define DMA_FN_IN
+ M& z0 y2 U9 Q6 T' G* w9 [$ _ - #define DMA_FN_OUT
1 N! J$ ?/ t: N& B. U/ T - #endif1 L% R1 w# e3 [* S
d' ?3 |4 s: i9 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" g. p8 w/ m n# k
- #define STATIC_SHIFT 3
$ ]- B J6 E0 `3 P - #define TCINTEN_SHIFT 20' Q" ]- a* T1 y, N4 ^9 u" ]
- #define ITCINTEN_SHIFT 21: i$ n+ n2 U6 v1 m6 M% s
- #define TCCHEN_SHIFT 222 A D' P- w9 J7 {( ?, X
- #define ITCCHEN_SHIFT 23+ Z' X) u X* O
- 6 B+ [# {2 a2 Q C p# Q. a% ]) i# ?
- static volatile int irqraised1 = 0;
7 b2 k5 W5 p- B - static volatile int irqraised2 = 0;5 K" m/ r+ ^( h
6 M7 ]5 @6 u" M4 Q7 u3 N; E. C) a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* U6 q# U N, b! n" r' g, \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 N1 M$ m2 u% _2 C& k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& S- ~. H$ U: O) m6 C, a4 N& d
; y: a) Q3 W3 s2 H' K7 y1 ~: O7 ?- D- dma_addr_t dmaphyssrc1 = 0;' N8 l ^& T5 R4 F. ?
- dma_addr_t dmaphyssrc2 = 0;6 {" E5 b9 }# @7 I- Y; U% E9 Z
- dma_addr_t dmaphysdest1 = 0;
# d4 R' |1 |% W8 [1 ^9 T - dma_addr_t dmaphysdest2 = 0;
$ E: x0 K; i) y0 l - " P: D% F8 I/ v v0 t
- char *dmabufsrc1 = NULL;4 h/ o9 v( q7 t$ c& ^
- char *dmabufsrc2 = NULL;
6 B) k, V4 @# V/ x3 [ - char *dmabufdest1 = NULL;
' Z l: L) o: S K l P, i - char *dmabufdest2 = NULL;: e# F0 g8 v1 F4 i2 @) \3 e
# {' _: ]& H! X! A& i- static int acnt = 512;
$ \/ m* r) {( E! D3 w& Y - static int bcnt = 8; b% D) N- a% W: X, N9 _6 N# ]( q/ p6 a
- static int ccnt = 8;
* B( D* i. z8 C1 Y( |) u - $ Z* l4 P- v% W; p8 v
- module_param(acnt, int, S_IRUGO);: I, f H7 i3 j$ _, ]
- module_param(bcnt, int, S_IRUGO);# Z ~1 f+ `! r! @/ v
- module_param(ccnt, int, S_IRUGO);
复制代码 . a! }) c' e& G& W! s# a' P
' L* w- l( F* z6 G+ t& |( K3 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 D5 k7 j$ e+ I* R" B: karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i3 l0 j) s7 ]0 m/ V$ A7 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" [" U9 V9 O/ d) q! R/ n( K, B
/ y( O) q e5 O1 B! Q0 s1 L% k" ~7 B
|
|