|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 h, c8 r% n/ i- k2 I( P
- [code]EDMA sample test application* A% p5 r. l# z2 q D9 W$ O* Y( [
- /*5 h+ U5 X! s, l4 R6 C# A1 e
- * edma_test.c4 W! P; ~: z9 p3 G1 q
- *1 u) N% v* z, H" B: X
- * brief EDMA3 Test Application
% `3 v2 L3 F- H - *
, P5 d& x5 g3 c - * This file contains EDMA3 Test code.: [1 m8 ~# i9 y
- *
9 b; u7 t: s0 h, C7 R \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {, Q% Y( T+ r! r% u7 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) |. m( w% B t6 A- l$ h - * TO CHANGE.
3 R; z) j- s3 a7 A" T5 u3 \, t - *
8 D; q5 o" j, d! U' C' ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- l* M3 |) \; Y: y9 W1 d! @ - *
% f0 V6 G" ?, Y - * This program is free software; you can redistribute it and/or
/ |# X7 z: H1 w+ @: _ - * modify it under the terms of the GNU General Public License as% L4 t6 i' q- a4 e) w$ W1 G
- * published by the Free Software Foundation version 2.
- ?, ^, ]) W3 b( P9 B- \. b0 N1 q8 p - *
$ O0 Q8 k/ c9 P( E& y% ?- z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# g5 R4 L X* R: k - * kind, whether express or implied; without even the implied warranty# z9 @* Z4 ^( v$ H- g/ g/ O$ n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ `9 ]3 x1 I( E3 W+ _2 T
- * GNU General Public License for more details./ U2 d" i1 i% R8 D" q3 w; I8 G
- */
J7 @5 J2 t$ y; r; I$ ~* F - + h5 S! @$ Y: f" W
- #include <linux/module.h>
; p' x$ l. G' H - #include <linux/init.h>
" F) k1 B: v* M2 M5 ]* s - #include <linux/errno.h>
( Q0 f [# f0 v9 z - #include <linux/types.h># V* F$ Z1 s q7 k. p
- #include <linux/interrupt.h>
, q4 d6 _' d- k; c- u$ W7 Z% t - #include <asm/io.h>9 ?2 j" i4 j; |* n" i
- #include <linux/moduleparam.h>: u& m$ _! }) h7 _" z
- #include <linux/sysctl.h>
% h# W; i# e! C& Y( b/ k - #include <linux/mm.h>3 r- K5 b/ g% Q. x3 o5 R) s! g
- #include <linux/dma-mapping.h>3 b1 a' ? k+ \
- 1 M# Y& g& V4 ^+ B- e' C2 B
- #include <mach/memory.h>8 z" a. R: X* F( l6 F+ j# b3 q4 m
- #include <mach/hardware.h># i" \9 o0 J/ m0 M+ N+ Z. \; f
- #include <mach/irqs.h>
' [! \' L6 {7 a8 t, Z8 | - #include <asm/hardware/edma.h>
5 I. P) r* e3 ^ t2 N5 T' O
4 O0 i' j) ^& r1 w5 G' j- #undef EDMA3_DEBUG
1 a% t7 b# U1 |) l) K - /*#define EDMA3_DEBUG*/
' I4 B4 J) v0 ]* O - 0 r F; ]0 Z4 O8 a% a3 G
- #ifdef EDMA3_DEBUG
- P, Q1 s* b/ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c2 b8 _$ E6 B$ J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: p+ [8 ] S* W4 d- F" a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# w8 @5 ^" t0 f) K" F- v/ x1 B - #else
0 c0 t; C" ^6 a/ `) s1 a - #define DMA_PRINTK( x... )
1 Y3 ]; {0 z6 ?/ C; r/ x B5 r - #define DMA_FN_IN
* O0 `) Y9 s" g - #define DMA_FN_OUT% y: v5 m# s6 k, b7 i0 d
- #endif( f* c0 P3 U; ~+ H
- & Q1 z' y( `, h" d" p4 c9 {; A! S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ d, `' z; O1 p A3 h# t! K - #define STATIC_SHIFT 3+ N; k# {2 f: N- ^& g
- #define TCINTEN_SHIFT 20
$ T6 W8 Y6 B5 {' \& S8 ^ - #define ITCINTEN_SHIFT 21
( ]) D% g8 i' n& i. h - #define TCCHEN_SHIFT 22 ], S' r. v k$ g9 y: p0 b
- #define ITCCHEN_SHIFT 23
5 v9 {# r m3 j$ V: D. R - . n4 i) Q0 L6 ]% q& f2 e: O
- static volatile int irqraised1 = 0;& y& u& d% a2 k& n
- static volatile int irqraised2 = 0;1 I4 }/ t5 O) X- E! W
0 u' v( `; t' X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y$ H. i! g) m! L$ z& y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J6 ^; ?. s. h& e) ?" L( E; ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: y1 v3 `4 W6 P" E h9 m3 b0 o; j
' u) @# w8 R6 ^; C3 k- dma_addr_t dmaphyssrc1 = 0;, z1 B$ D7 I) M. q j0 A
- dma_addr_t dmaphyssrc2 = 0;
; A' |1 g2 x9 r3 V' z. ` - dma_addr_t dmaphysdest1 = 0;
& \# g7 j! T% ]3 @0 H* K, ~" O - dma_addr_t dmaphysdest2 = 0;
$ H6 E1 W2 g) A5 O, |1 _% F2 Y; d - & G- ~8 L* j) O5 z+ Z8 E, g- x
- char *dmabufsrc1 = NULL;
" r2 W8 s5 G7 F( `/ I$ P# P* h - char *dmabufsrc2 = NULL;7 Z$ f3 u0 `* k1 R- N3 W
- char *dmabufdest1 = NULL;( X1 z: b, X. S% z F# T( C
- char *dmabufdest2 = NULL;
1 K) _) u2 k- f* @. Z3 C1 r - 1 a' V) T3 {& X3 T ]
- static int acnt = 512;0 \% h6 x- M7 l j [9 r
- static int bcnt = 8;9 u! o# m) d [8 R9 a
- static int ccnt = 8;
* I1 a" v3 e, K+ z, e( f2 I
6 t' k# J" p. g4 c0 Z4 d$ y1 S; u- module_param(acnt, int, S_IRUGO);! D! D; k. q$ w+ w- ?
- module_param(bcnt, int, S_IRUGO);
8 E" l1 Q+ n0 a2 V2 n# z5 | - module_param(ccnt, int, S_IRUGO);
复制代码 o0 G+ g% m* m. \# y
7 O3 r4 Y0 [$ B9 n) F! p1 c6 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! r$ ?* U6 ?- W k+ |. [: d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 h& Z" |; w7 W% R- e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 U1 E( R- T* q6 ^4 J9 b2 Z8 y+ I
* X4 Z! z2 c% X. O
- e2 n5 Y- X/ A6 a" v+ Q |
|