|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q! y, J- @" [5 ~& m% R- [code]EDMA sample test application" [$ o! G. M% [( h$ E' u
- /* w$ U* V2 C6 E! I$ R3 k* t( J2 t# P
- * edma_test.c
% g5 t3 M( u' O5 ^! I# S1 T9 t - *
) c) G* V$ w, T8 T+ ^2 N1 {$ A( S: n - * brief EDMA3 Test Application
# Q6 \& f4 u3 ~7 c! P2 X - *% T* Q0 G+ g- O8 Q
- * This file contains EDMA3 Test code.
( ~- X, O% D- B2 ^1 @ z. Y - *
7 q% m9 q% K2 L" b% n0 v1 j% L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- \) G8 |! t/ l0 w9 Q @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ]- g. E! C0 f: }7 Q6 D
- * TO CHANGE.% ]2 A. Y2 |; u/ L* R; J
- *
' u! p- m1 r: w! f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 o1 k' Y: }' o* M) g/ v2 |. R - *
$ C8 |' g; u7 G4 s% t$ e4 M. ]2 y/ p - * This program is free software; you can redistribute it and/or
* R# Z' c. J$ _* _* V - * modify it under the terms of the GNU General Public License as
: G, f2 ]. r- I% X' S4 L4 s4 K8 ` - * published by the Free Software Foundation version 2./ f, _& c; L0 W
- *
4 ]% ~7 f" v" u' l0 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 N" m* B0 c3 Z( L) ` - * kind, whether express or implied; without even the implied warranty/ L% I2 F8 G, P/ I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' |9 a* P# x( W$ N - * GNU General Public License for more details.4 c9 ^# P. L6 x) ]( l/ E, o) K
- */. }% }. @8 U; E* S$ b7 `' d
- ; i0 g- X k- l6 P+ t- `. a
- #include <linux/module.h>
/ Z" N7 o; R- J6 m* e' F$ }( K( q, p - #include <linux/init.h>* u6 M" ^$ `' k' e& R
- #include <linux/errno.h>; Q5 r+ E2 y/ O5 G* E. n
- #include <linux/types.h>
r4 k* x3 f% l& \# M }0 ^1 x0 [ - #include <linux/interrupt.h>
T% o" y" e/ V& a; r/ f2 U1 l - #include <asm/io.h> z; `3 J* c' a# K& u5 B
- #include <linux/moduleparam.h>
# `3 d+ [$ h" m9 d - #include <linux/sysctl.h>
7 L( C# \+ X2 x1 x Y+ \ - #include <linux/mm.h>- a2 y6 q0 e) {/ t# p
- #include <linux/dma-mapping.h>) W1 W S. R0 i' M& @- j" C" K
8 x( i9 Q8 I: Z5 @) i4 }4 s- #include <mach/memory.h>
* K5 f& @- _# J' X7 D - #include <mach/hardware.h>) X- o' W" c- N7 H3 G0 F
- #include <mach/irqs.h>
& C- s' o" T7 C1 I! n0 S" | - #include <asm/hardware/edma.h>
7 s5 N$ i5 r2 F
; `. X% J+ `' C. `5 H. U- #undef EDMA3_DEBUG
" y" G* Y/ D" q6 q - /*#define EDMA3_DEBUG*/
5 e" M1 v3 r4 u2 y- g# q1 n& W$ z
* ~9 L( p, L0 Q5 s1 e. K8 \; J- #ifdef EDMA3_DEBUG' R6 h) p8 a1 C/ u Q2 W: S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ [0 x4 [1 r9 m6 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^$ @ t" }2 k8 u3 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 r) [5 w; O4 K1 R% M% j& o) A
- #else$ { [! h) D+ G& G, C
- #define DMA_PRINTK( x... )
D3 u7 x' [+ B6 z' P5 b' d1 l2 @ - #define DMA_FN_IN
! ?& l1 B$ v: R# Y - #define DMA_FN_OUT+ b) U6 Y9 i9 Y/ `
- #endif
5 {: h: j/ v' B
6 Q& M+ C" H, F( k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ A2 A8 t. y X* m( R - #define STATIC_SHIFT 3
$ E" y; T) h/ i1 U6 e0 C7 h - #define TCINTEN_SHIFT 20
9 u9 ~; e6 M9 a. V - #define ITCINTEN_SHIFT 21
; Z. D, q1 A8 B6 v( |9 n) Q - #define TCCHEN_SHIFT 22
) S1 v7 Z; `; `+ q( ?0 @7 Z - #define ITCCHEN_SHIFT 23; h, |: e: J; x6 A9 c% }+ |; a" |
6 g2 s3 ~& q0 x C8 |- static volatile int irqraised1 = 0;8 L! P9 q5 \1 v r* `
- static volatile int irqraised2 = 0;" b4 @, Z8 h8 m3 M4 E! o' y+ n0 w
8 h' N9 b( O* }; a2 K2 a) H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! W3 l' O' p, J6 z' _# x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^, N. Y. V- a+ m/ u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ `( n! H. ?# Z! ^ - * f7 P: t, ~4 N D m
- dma_addr_t dmaphyssrc1 = 0;5 u- e3 {8 t9 w+ b+ ~" N/ x
- dma_addr_t dmaphyssrc2 = 0;; ^( F# \3 L+ U4 ^
- dma_addr_t dmaphysdest1 = 0;
2 r- u2 ?2 X F/ k, @8 w - dma_addr_t dmaphysdest2 = 0;
- y( m3 @ F/ P; T1 l# V8 s - 6 H }3 |+ g8 G/ `* N
- char *dmabufsrc1 = NULL;
j: N7 G q+ ^+ e2 ? - char *dmabufsrc2 = NULL; p* k+ Q. n; L; f" e/ [* |
- char *dmabufdest1 = NULL;
% j% A( x" ^) ^6 K8 Y: i* U - char *dmabufdest2 = NULL;
8 z) B9 q: @# U" G9 d1 _* K - ! G" H; p. x% ]6 w. a
- static int acnt = 512;
5 j3 k4 F- X$ `5 b - static int bcnt = 8;3 C4 e* T# t" L n9 Y4 m
- static int ccnt = 8;
8 }+ h8 [; O& { - 4 ? y7 O7 N' K( ^4 P! ]
- module_param(acnt, int, S_IRUGO);0 w3 Y$ M$ X8 q
- module_param(bcnt, int, S_IRUGO);
. p6 o ?* W9 s7 ]# O2 A% m& Z1 F - module_param(ccnt, int, S_IRUGO);
复制代码
. W5 J6 y5 v" Q- h8 H0 g
" W$ r& Q, z i! e. _) S- I( i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ]6 ]; R9 U, g O- E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ l$ K; p v+ E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d2 o. h1 N3 @4 C [
1 D- E) T5 f6 v9 C0 @0 A" V) Z/ B5 {
! ^5 k1 y! h) k# O6 ? |
|