|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u9 o- C" F2 U! m- [code]EDMA sample test application) ]5 n! j5 K$ |# l# T& Z* \
- /* U1 a: R/ a: U7 k0 N0 t
- * edma_test.c0 N; ]3 J3 z; V/ S7 g# \" E
- *
" D$ J0 H) s' g, X) i - * brief EDMA3 Test Application
" Q' N2 J7 g1 G9 H; `/ j - *
) B1 {. `9 i1 l - * This file contains EDMA3 Test code.
+ E) l( x9 y" Q8 O - *
0 h0 V7 G6 X4 j4 P) M/ z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p6 ^, X& A& h+ A. v, g' ^. [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) W3 g: u: ?7 f, q - * TO CHANGE.
: z8 Q, W: k6 A! V- G - *" ?; E$ _. y( K: }5 p. n" h' W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' z( n% v3 i0 X, r$ o - *
1 T7 g+ t }7 D) r - * This program is free software; you can redistribute it and/or0 ~3 J: Q/ w% ^3 e
- * modify it under the terms of the GNU General Public License as2 T5 w1 C" i, G
- * published by the Free Software Foundation version 2.; E9 P1 o& a( z. U: N! o
- *
1 I% m+ E0 [$ l$ s1 U& x a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 M! o y/ u: e+ E: ~! R' h6 ` - * kind, whether express or implied; without even the implied warranty
- s7 P6 {/ D3 C+ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ E' d) q( V L
- * GNU General Public License for more details.
- W2 A- v! D5 L - */
5 p5 W9 V% z% |9 P$ K
& i5 a4 n2 m8 {( V. m4 j3 h w- U- #include <linux/module.h>. ^7 G" O+ [0 j
- #include <linux/init.h>
6 b. t6 m0 D$ Y) K8 @# P - #include <linux/errno.h>, V9 \& i+ |5 B* s5 [; s& w, M! \; E
- #include <linux/types.h>* B# W5 @+ w+ e5 K
- #include <linux/interrupt.h>9 {1 G( u/ e0 e( Q! M
- #include <asm/io.h>
, d3 A& g2 t3 G6 @3 }& S& { - #include <linux/moduleparam.h>
3 h# o0 g3 Q Y - #include <linux/sysctl.h>; v$ Z3 V% d3 a E
- #include <linux/mm.h>! I, P! U; k$ j7 ^
- #include <linux/dma-mapping.h>! V% ?1 f2 W0 x9 \
/ G( ^8 c! A I! p1 t9 V/ [- #include <mach/memory.h>- X ~3 K+ a" R& y J9 s
- #include <mach/hardware.h>
- V* i3 D- k" `" s* P% h& B m. _9 q - #include <mach/irqs.h>
5 @( `, \) t( c# f5 w8 ^ - #include <asm/hardware/edma.h>
% k, C! {/ n3 y& t) Z% G1 R - Z q1 e* n3 f( L$ C
- #undef EDMA3_DEBUG
4 Y7 v& p' | h - /*#define EDMA3_DEBUG*/
8 J6 u, c3 j, R7 h
; ~1 k; w, k' K) f$ C3 t6 E- #ifdef EDMA3_DEBUG3 m/ O" F+ ~3 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' H' \+ O0 T& A& J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); o1 Y( R$ @$ b) |0 J! B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& u6 P" b3 W9 x7 L4 S: ] - #else
' V! y" o4 g6 f" k& ^ - #define DMA_PRINTK( x... )
5 X; U1 r3 R* |6 v r - #define DMA_FN_IN/ ~5 S3 N) ^; ]. |/ M" y
- #define DMA_FN_OUT
% I* V6 F7 O2 q - #endif
1 R) N5 L- @- }# E1 z6 i0 n2 m) g" K - * I( C9 a7 r" q) K( u- r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% _$ O' |, a* }* n, l+ b) v - #define STATIC_SHIFT 3
9 I, \% Z. d& [. Q - #define TCINTEN_SHIFT 20
6 j* e$ b) q" n! ^% s - #define ITCINTEN_SHIFT 21
' Z1 M# B; N& x1 \" v - #define TCCHEN_SHIFT 22
2 a7 F+ a& e( {9 R+ K% t2 X( I4 M - #define ITCCHEN_SHIFT 23- p; M4 Q: a! ^3 d, |9 q
2 l- D& t* L ^! P; ?+ ]6 H! [) O- static volatile int irqraised1 = 0;
) R% y0 K7 N& I - static volatile int irqraised2 = 0;( {$ U+ \8 E. Z/ J/ l( T
9 F4 o1 ^/ f$ G% J: d3 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* i' p0 I8 k' _# W; n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ^, P3 E+ V) i9 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q% `. W: H" ?7 q8 K; K3 l
- : s* F' R. e/ I8 Z% f
- dma_addr_t dmaphyssrc1 = 0;
5 w' q+ V% \# u' V. l: S - dma_addr_t dmaphyssrc2 = 0;
- f0 v" B6 ~- R8 F- n3 J; I* } - dma_addr_t dmaphysdest1 = 0;# B7 M- D6 r) g0 C) d
- dma_addr_t dmaphysdest2 = 0;! Q \9 e& F; ?( W i' H0 n
6 a# y4 |, ^( V# Y2 R# Y3 P- char *dmabufsrc1 = NULL;
4 g, M2 w9 E+ L - char *dmabufsrc2 = NULL;
4 {: F3 c: j& { - char *dmabufdest1 = NULL;9 v d1 _" V; Q6 B, T- w5 w
- char *dmabufdest2 = NULL;1 A2 m- R/ _! j" L) `/ q- \
" ?# F/ |+ h6 a% \8 d/ T6 m- static int acnt = 512;
$ @+ R w2 C2 ^9 Q0 i2 ~ - static int bcnt = 8;, u( ?/ Z/ A5 j% L8 j5 H9 }. R4 a
- static int ccnt = 8;
2 ~' c% E& X U& a- c W - 5 T& W) \# S! S! K$ T7 I9 k/ c4 f. o
- module_param(acnt, int, S_IRUGO);# K! w* f6 o( G- p& ]
- module_param(bcnt, int, S_IRUGO);
+ ]3 R' E A6 l9 u: |1 b - module_param(ccnt, int, S_IRUGO);
复制代码
% [# Z& n% H5 M2 K0 ~ _/ [& V: ^6 B1 g+ |) |) e# I' k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* x) {4 c) S/ Z0 H. ^0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 b' \) v! `, V5 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ K! y+ h! H4 c( ], ^# `3 a# n5 f! U! m6 o8 z* D
5 I/ V7 V5 ~2 E6 e( I& `8 r5 {
|
|