|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ^' x, A# J3 a0 T$ K" G
- [code]EDMA sample test application
! u& R8 N+ v& C- K - /*: Z# I9 P5 O6 h8 M
- * edma_test.c0 K. y: i2 L9 [" h/ C
- *( U/ n u. J0 x" y
- * brief EDMA3 Test Application
2 k/ h" p. _" Q2 x3 [4 G, d5 L! n - *
& u$ R* f1 s2 ?$ v) v3 N - * This file contains EDMA3 Test code.0 d ^9 I3 G- ^1 T
- *& X9 O' \' ^% `8 x J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ @% g/ j) E% d. Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT ?4 l; g- ?/ m( P
- * TO CHANGE.
* l; p! |. i% q& N* b - *5 t' B1 b- A" n1 I. y. @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# t: d0 I6 _& S: C6 y7 q, T7 L - *( H i$ ?) T7 U2 r6 R& l% n
- * This program is free software; you can redistribute it and/or4 Q1 g: h6 o# F5 d
- * modify it under the terms of the GNU General Public License as2 ]# Y' f3 m! }; R
- * published by the Free Software Foundation version 2.6 E) `! ^5 n6 {0 I
- *5 Q# N7 p- }8 [* D' ?/ K1 x( p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 \1 k" ?( |* j+ d, f
- * kind, whether express or implied; without even the implied warranty
5 c0 I* \( A% {+ B1 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, Q! S9 \ D B) K/ o8 S - * GNU General Public License for more details.
/ B5 p! ?' b2 G' {5 x - */4 m! h$ U6 c; ^' P* _/ `1 ^
- P# C, ]# _, s" @9 [- #include <linux/module.h>
. Z+ c) ~9 f0 B9 K/ R - #include <linux/init.h># e3 R, D- L: k; X; N: F* g
- #include <linux/errno.h>9 ~" P, F7 ]1 N* C1 B; F, Z) ~
- #include <linux/types.h>/ l% k* N) O9 ~7 m0 o1 d C3 L0 k
- #include <linux/interrupt.h>
, e" P6 h6 h/ k4 f1 @; G3 S - #include <asm/io.h>' O. a$ Q; K* i; G8 ]) j" R
- #include <linux/moduleparam.h>5 N* I5 _0 I% r( T" G: V4 R
- #include <linux/sysctl.h>
& f/ a4 _2 R3 @, a& W/ ] - #include <linux/mm.h>
0 w+ E) s8 W( A5 J' {9 p& N - #include <linux/dma-mapping.h>
" W. H- I0 q4 a* C P/ v9 c
3 k5 x- b0 t) b& g' d) E- #include <mach/memory.h>
* W: X1 N e/ Z4 L' ^% e - #include <mach/hardware.h>7 I: W" |' i" n' a+ y( T
- #include <mach/irqs.h>
& }4 H! P: m1 F7 G( H% ^$ z - #include <asm/hardware/edma.h>
! _0 H- [ G, Y1 Y1 ~$ Z. Q$ k - " Q! Q$ D6 r. Y3 f* L: J5 V
- #undef EDMA3_DEBUG
- k5 p1 n3 M9 w" u4 n- { - /*#define EDMA3_DEBUG*/
5 F& f/ K8 K2 e" |) m# T- m - 2 A% b) x% A+ z
- #ifdef EDMA3_DEBUG
" q, [% }1 E( _; A# E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) T/ B4 U5 ~, C2 v( i& T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y8 x3 h# C& ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 g% s) B) c8 u5 U6 N
- #else
- v9 z" [" K0 C! p4 p - #define DMA_PRINTK( x... )+ ~- M- v8 G' ]+ g) M9 w
- #define DMA_FN_IN
" M8 D' _' r; Q2 h6 P: u! n) P - #define DMA_FN_OUT) a* R* Z2 ^8 z7 p0 _
- #endif6 i9 @/ _" T( r) R& i
- 0 d4 Y6 D+ m+ n/ m. O1 ~+ n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 y" n9 l# k7 U; u9 l
- #define STATIC_SHIFT 3
: U# G4 h; [( |- i) O% R- i - #define TCINTEN_SHIFT 20! h/ w" K1 _$ d* e' W6 Y
- #define ITCINTEN_SHIFT 21
) c, I. [+ F, u' h6 E5 ~% E6 P* C - #define TCCHEN_SHIFT 22
+ [+ J7 |9 D8 d* U6 i: L/ k7 y4 X6 B - #define ITCCHEN_SHIFT 23
9 q9 @# A* W$ Q7 L, _+ A1 h - / @+ M6 \' t2 q- _& P
- static volatile int irqraised1 = 0;2 ?" h1 I G6 \: K% B6 v P
- static volatile int irqraised2 = 0;! j5 w4 l3 ?* j( E6 J3 t' x
- 4 o2 T; q+ `( ?0 U6 O- i+ r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z1 B+ k3 A" Q% t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~1 n( U' C# q! G. Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~ p' a8 r( j& W+ |
/ j# Y) C2 D- k9 B1 |- dma_addr_t dmaphyssrc1 = 0;1 }9 n6 A1 v c7 I
- dma_addr_t dmaphyssrc2 = 0;
& ^9 j% p! k) |% N5 B& J; k& F( ? - dma_addr_t dmaphysdest1 = 0;4 w& r1 I7 f8 w4 g4 R
- dma_addr_t dmaphysdest2 = 0;
' x d$ w( z0 Q$ {+ ?. M' P3 G4 i - / w/ H7 i" y: \& R! B
- char *dmabufsrc1 = NULL;
2 K% t+ C) {2 {( W) A" y - char *dmabufsrc2 = NULL;
, U- ~" X. S1 ?7 d) @ - char *dmabufdest1 = NULL;
" W$ n/ ~- v1 @: P - char *dmabufdest2 = NULL;
% e; w5 w# l K8 o - 0 {7 \: G, |9 s5 x+ c' g" R7 ?
- static int acnt = 512;
2 t3 V+ ?1 C$ H - static int bcnt = 8;8 C8 r) P( B3 H* c& a# ~7 ?
- static int ccnt = 8;
# d) t7 |* k( p0 } - / M- z9 ]; ` D- Q
- module_param(acnt, int, S_IRUGO);
3 j: j R, w/ j6 h! `; o* Z V - module_param(bcnt, int, S_IRUGO);4 v! v* G m5 X. F E! O! [
- module_param(ccnt, int, S_IRUGO);
复制代码 # B: H9 P. [6 e& U
' ]8 B5 B0 a# O6 u0 B2 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( [9 U: x% I2 U- i3 W( U! @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% c8 ~; x$ `, q' s! A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* g- I) ^! E' a" U4 ^
3 m6 X, E9 S2 |
3 |" q& f! o' s |
|