|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" \" z0 R3 v2 f0 L* {" T- [code]EDMA sample test application
& H" L0 {5 x, d! M. c& y7 P; Q7 g - /*% t+ @! ]# Z( u
- * edma_test.c: Z8 v% ^! P L% b0 x
- *
* N* Z( ?2 X' ]- P/ B - * brief EDMA3 Test Application6 _' `4 Q" E# a7 R( @! ]
- *
8 M5 _& ~; B; G% _) Q% i$ J - * This file contains EDMA3 Test code.
3 w# |. C3 y1 P& ~8 [) c( A - *
* h5 F( z6 D2 _, n8 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 N& R8 O( }# W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ o8 x/ C) F8 {: k/ k' l& ~1 U8 |9 w6 B - * TO CHANGE.
' `( G* S" S! R' k# D( i - *
9 z4 _$ I7 ]5 U$ V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" N0 f* |7 F+ Q3 e9 g
- *8 i: l* h5 g: K: L4 t( i6 d& V
- * This program is free software; you can redistribute it and/or
, a) H8 L4 u# x6 h; Q7 W7 m - * modify it under the terms of the GNU General Public License as
- A3 a) p4 E! z; H& O5 K1 K! X - * published by the Free Software Foundation version 2.
, q' I4 v: N( m* L5 }4 [ - *' |/ x) l( g3 |: p/ Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ N+ h' a; M1 G- Q5 i
- * kind, whether express or implied; without even the implied warranty6 `6 C% x6 H$ ^$ c0 g* K, A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) W% t. t0 o9 @1 ]* n - * GNU General Public License for more details.' @1 T* j+ o* t8 q8 f
- */
: h6 X1 l4 W: o1 J. W/ u - - S' K% X, d6 p$ p
- #include <linux/module.h>4 |2 m# C: p! [
- #include <linux/init.h>% D: ?+ L L% N/ I0 h: j
- #include <linux/errno.h>
( l, E+ s( \( {5 x/ C# Q% I - #include <linux/types.h>4 q* A8 g7 O& T* Y) Z; I
- #include <linux/interrupt.h>
; G4 }& @1 @- [* u& d - #include <asm/io.h>
4 W4 [ ^) q# k2 a - #include <linux/moduleparam.h>
8 d0 P6 `$ |; U' y - #include <linux/sysctl.h>
+ e" d6 j1 W1 t9 w" i0 J6 g6 a - #include <linux/mm.h>8 o7 t% s# ^0 u7 D4 ]* Y( @5 x
- #include <linux/dma-mapping.h>
* Q, k0 C5 c9 h: L2 l h; y
& o, b y8 _1 w* Q l& L- #include <mach/memory.h>
2 q5 ]" X6 j( C0 M9 X% f# x - #include <mach/hardware.h>+ p8 F+ M) h# ]2 z; A5 Y
- #include <mach/irqs.h>
2 o) v, \+ j: I" Y, S& \' { - #include <asm/hardware/edma.h>
/ C! o! B o, } - $ T6 _1 [/ f' b2 z
- #undef EDMA3_DEBUG/ o+ [3 Z! v0 v! V
- /*#define EDMA3_DEBUG*/
, `% [1 F, f6 c( _. | E- ` - 1 Y$ _ a% X# |3 ?6 B
- #ifdef EDMA3_DEBUG
) H( }6 }" v' h# q$ V, V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 X/ _1 X- N: {6 K' ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 m o5 `/ G' u' B& c* ?, a8 s2 A& W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- n4 u+ K; F% f5 N& _5 | - #else
: ]7 u5 ? q3 c6 m; b+ D3 Q6 r - #define DMA_PRINTK( x... ) J/ C% N! H6 N r/ g5 y
- #define DMA_FN_IN- `' B9 i h z
- #define DMA_FN_OUT6 S( _2 ~5 d' x; d& _
- #endif
3 c8 R" b' J r5 j5 A
$ W+ {+ t3 g9 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
z' ^- o! _/ ]" \2 Q% B4 b - #define STATIC_SHIFT 37 j! S" H1 K9 R2 H# k
- #define TCINTEN_SHIFT 20
5 t2 |. ^7 S" `3 m4 y5 L S' ~ - #define ITCINTEN_SHIFT 21
) X# e: c r/ R% n1 y M - #define TCCHEN_SHIFT 22
9 F) y& m% Q% ~) d - #define ITCCHEN_SHIFT 23
8 Z/ h5 T% K8 n& v
1 B; M. ]+ @1 E1 f1 v: e- static volatile int irqraised1 = 0;) K- U7 N1 P+ i! t8 \1 D4 P6 E
- static volatile int irqraised2 = 0;
, G& y; N* D8 m- Q* R - . K; w" R. Y% p# C1 m; ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^+ r$ _1 t& f" p D4 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Y- H! p0 N1 r0 B* p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b7 D4 n$ W e; Q$ U
5 B7 O; x4 a* L; I" [+ \2 ?0 m/ r- dma_addr_t dmaphyssrc1 = 0;: j f+ [- [+ J% j5 u
- dma_addr_t dmaphyssrc2 = 0; m8 E' o+ ]/ W+ a- R
- dma_addr_t dmaphysdest1 = 0;
. l0 j( a* R4 T) f+ d3 q. p! S - dma_addr_t dmaphysdest2 = 0;6 ^+ w$ A1 Z7 u% K
- 0 D6 ?) z+ b2 ?4 d* w% D
- char *dmabufsrc1 = NULL;
5 S$ ]1 H7 i8 ~% @3 R2 n ^ - char *dmabufsrc2 = NULL;
, ~. [0 e' Z1 g. ~ - char *dmabufdest1 = NULL;
2 t' k* Y) s4 Q% b9 m - char *dmabufdest2 = NULL;
$ {4 T4 i, ?2 ?! N
6 p3 k3 M8 t- V1 V7 P' A- static int acnt = 512;! x7 ~. v7 T' F7 s& ?2 \6 L
- static int bcnt = 8;
% g' D1 r4 {% u% Z8 B - static int ccnt = 8;3 w `5 c1 R0 u1 D7 J; o* Q
- 6 [, I! T7 o) z$ ?9 J4 H2 {
- module_param(acnt, int, S_IRUGO);8 G3 B6 J4 I+ J; [
- module_param(bcnt, int, S_IRUGO);
" ]+ x$ \7 f0 N4 j( T - module_param(ccnt, int, S_IRUGO);
复制代码 2 }; s2 {. y# k
: k, Z, C; A! B3 n7 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 x: x* ], s/ s% m; @2 r R' ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( V7 [- ^0 o1 l1 |5 a6 J3 y' S) G" m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" T& v( ?- r0 ^# W7 l7 T5 k" H7 A+ `! f4 f' |- B* Z3 e
: Z; D2 r* F( d6 @ }& C; i5 h |
|