|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : \, i, ?, F$ [. _' V4 C* |1 f2 X
- [code]EDMA sample test application l: p2 D5 Y% S; Q* Y( d( ]
- /*
; E4 [- J. |0 d! x I) Z - * edma_test.c
) S- [* r% t# Y5 K% {9 W2 I - *1 t3 ]& m7 Q! V* O2 E" d" l# c
- * brief EDMA3 Test Application
) C( m* n$ ?7 q# h3 W! [- V - *9 `0 ?) V5 Y( ?# S+ J
- * This file contains EDMA3 Test code.
; E& [; Z. B( V - *% K, @2 L. G6 p1 _9 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 L8 S) l# a* k4 s. k6 e! o0 E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 m9 R$ J) l5 k
- * TO CHANGE.
7 t" f' R, A6 y% A D" o: y - *) }+ J1 z9 U8 G, H( T+ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 q; k# A) F8 k8 w2 F Z - *$ y- P: h, `7 M9 [
- * This program is free software; you can redistribute it and/or: u0 S! ?7 n/ A1 k0 ~9 _4 q
- * modify it under the terms of the GNU General Public License as! Q, c9 a D( n# O
- * published by the Free Software Foundation version 2.
5 w2 Z3 G8 H* V" Y: @- F" ` - *4 ]5 I0 p! o' a" u+ E5 J; h4 p7 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 {$ @ b, M4 T& \" M3 ` - * kind, whether express or implied; without even the implied warranty
# {6 M% \+ f2 F5 V2 U0 b* L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 b7 P. u# w; o$ b( t3 ?% ~# z7 Z - * GNU General Public License for more details.- P1 M4 Z3 C+ q2 |
- */8 O8 q8 |( X7 }4 k' M; \
- / F/ @1 c6 l: [# T: X P
- #include <linux/module.h>: j7 K4 } p5 [. _7 m, |
- #include <linux/init.h>, |" H3 S/ K1 t2 C1 a2 s4 o
- #include <linux/errno.h>: p5 j m# L n; v( N! h
- #include <linux/types.h>
; D; x, I" R. d& {% D - #include <linux/interrupt.h>
7 m5 K! V8 D# t4 d6 Y - #include <asm/io.h>% K! d8 }9 B" \/ {: r* d: \ v. x. T
- #include <linux/moduleparam.h>
7 ^& v3 W" p j - #include <linux/sysctl.h>) e$ L5 }* i7 D/ S0 z/ E9 W
- #include <linux/mm.h>
( e, L" g/ [8 r6 i" s; p - #include <linux/dma-mapping.h>( O' R* x# g1 s5 x) ]3 T# Z
- 9 G) `, M" f0 W, H7 v
- #include <mach/memory.h>( W: Z( D* R& O/ g
- #include <mach/hardware.h>
, b2 |/ U$ U8 H% N: Z" } - #include <mach/irqs.h>
% A: y, S4 U) x - #include <asm/hardware/edma.h># r. y5 F# G3 o4 t
- 5 g7 l- E5 y+ G/ Y" e
- #undef EDMA3_DEBUG
+ ^: e; Z8 k+ D+ C" g! P& N - /*#define EDMA3_DEBUG*/
2 J7 ~" s! o c
, e! m2 G* ]- L- e4 _9 O9 i- #ifdef EDMA3_DEBUG) X3 E, l1 n' k: N( H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 M" N) d H( F, x* e7 {, R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# O8 q) ?& |6 `8 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ y. ~3 a" A+ ]1 j6 h. p/ I6 W - #else0 U8 f1 T* {& _( `, G
- #define DMA_PRINTK( x... )
. R1 A% Y3 l8 c6 Q" C3 U. v& b: H - #define DMA_FN_IN) g( b6 F9 k! W0 a! O7 T a0 o6 F
- #define DMA_FN_OUT
# w! V4 U* }. @ - #endif4 E5 T9 C1 L0 C. o' u" n
- + d1 }" J; v$ ]- X' {+ M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# T% {1 o/ |- s S; M" Q, f - #define STATIC_SHIFT 36 Y2 b1 d- r; ~- W
- #define TCINTEN_SHIFT 20
8 u! D) q! _, v4 z/ y2 {3 J - #define ITCINTEN_SHIFT 21
$ x. W4 ]! c7 m" m: e - #define TCCHEN_SHIFT 22
7 ]2 a) \; O1 q& ~8 f$ n; {4 I! t - #define ITCCHEN_SHIFT 23
# r- F4 y2 L1 G* _5 D: @
! e% ^% `3 w1 ?" g$ s- static volatile int irqraised1 = 0;+ m& s2 A9 e& B3 b2 v
- static volatile int irqraised2 = 0;6 {, P+ L. C+ m# x2 T
. C( T4 Q: W& O% p5 V( X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' a/ c M4 S0 d* a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ i; X* l. A2 C4 g. v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ o' s! w' p" ?5 _
+ O, _( n, E3 p' [- dma_addr_t dmaphyssrc1 = 0;
! M9 h: Y# k0 d9 m - dma_addr_t dmaphyssrc2 = 0;7 V1 k! ]% z$ c0 d8 q0 h+ F' Z
- dma_addr_t dmaphysdest1 = 0;
/ P$ F$ n1 i, x1 ^# E2 n3 r) p - dma_addr_t dmaphysdest2 = 0;, R; a5 }: S. h/ S" N4 E0 \
. p+ a4 V( R/ r+ {' T% N* ^, o- char *dmabufsrc1 = NULL;
. x2 Y5 X" N r, P# K. y. X - char *dmabufsrc2 = NULL;0 _ @0 Z7 O8 T) h5 r0 z7 f
- char *dmabufdest1 = NULL;
/ h# i1 h$ |* I2 v2 y; R - char *dmabufdest2 = NULL;" [/ M& y6 L* v% |5 H
- : r8 f% s- O c- `, V$ c3 e
- static int acnt = 512;! j3 S2 ^/ c& ^
- static int bcnt = 8;
1 {9 y* p$ m) D. h1 u" e1 {& d - static int ccnt = 8;& i( ?1 b- R3 v7 U
- 9 B; [' C1 J9 V L
- module_param(acnt, int, S_IRUGO);# k* `, Q: x# \* T) S" Q' {1 `1 [
- module_param(bcnt, int, S_IRUGO); K- N1 E4 _& J
- module_param(ccnt, int, S_IRUGO);
复制代码
0 t: y2 X x7 m8 X# M
3 {+ m( u5 p$ O/ R9 v4 m2 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 |' w( f1 I, n0 b* e( _: x q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# y1 {. Z0 j% y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& m6 x* D9 u' G: ~' R' a9 s
4 \" [7 C% l( a- C( N
5 h1 ?3 @6 A. w1 T7 U+ @ |
|