|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ^3 s9 x) Z! a( D* r
- [code]EDMA sample test application3 Z* Z3 D2 B/ j) g7 p& a
- /*
6 \: \( c& o% F - * edma_test.c: z. e7 @: K0 d
- *- w) D* T4 w; U% r( f2 V0 ?
- * brief EDMA3 Test Application
4 ^" ?0 c, o4 |) G' k7 j/ c - *
" j* }1 @/ S( I+ g' W# s3 h - * This file contains EDMA3 Test code.& Q! ~2 R7 _+ n# _
- *
6 s/ B# p: m3 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ d3 h( L& u# t1 Z, d: C4 P# I; O. H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& m2 N; x6 J7 Y- f) I3 K
- * TO CHANGE.
* g( k6 g; x! H" z - *' G& `2 a0 R( U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 {2 n: K- G1 B- W: }/ B1 t* { - *
2 X* K+ u. E) s$ m+ l, C8 K7 G - * This program is free software; you can redistribute it and/or1 z8 e4 A5 z/ ]7 o, }
- * modify it under the terms of the GNU General Public License as' O( J7 J) K: h u
- * published by the Free Software Foundation version 2.
2 U. d" k. t; C( f - *$ P; I* q9 Z0 m" ^2 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* F" K0 H8 ^$ x% q' W2 |
- * kind, whether express or implied; without even the implied warranty+ U/ X2 w$ C) _% x. W/ P2 D1 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ B) |! `" N7 N% i. L% e: _9 Q - * GNU General Public License for more details.( u7 c1 c! x7 c
- */
' X1 C5 N9 N+ _* S+ y8 \
; Z0 F" v. \' |% g+ w. y8 A1 d- #include <linux/module.h>" F+ E y* R2 X7 }8 J* G
- #include <linux/init.h>
0 w9 f8 Y" S' i* ^2 F ? - #include <linux/errno.h>+ s1 B" Z$ w" U- w8 s, i& E
- #include <linux/types.h>
& }; R& R. y, s* E - #include <linux/interrupt.h>
# }$ A: Q; ?. j1 c* }2 [) @ - #include <asm/io.h>
9 b* C: M, X G( {- ~6 |% Q8 n* U - #include <linux/moduleparam.h>
) S, p6 I3 L+ [ - #include <linux/sysctl.h>
/ _1 V; x) C, I( Q5 m - #include <linux/mm.h>2 ]% s! G* y/ E# h: n" ]6 t9 R
- #include <linux/dma-mapping.h>7 V" D# C# \6 i8 O& U( g
6 K6 P0 Z, Y4 `/ n. F: c- #include <mach/memory.h>2 d7 P. n: M, K# f) {9 v. B) @
- #include <mach/hardware.h>0 i& K t' Z! m6 Q) G$ [) N
- #include <mach/irqs.h>
; }( N3 M! |1 \7 |$ M/ d. R( \) x6 Y - #include <asm/hardware/edma.h>: j; ]0 j8 Q! ]; J
- $ S5 I! a- ]& D
- #undef EDMA3_DEBUG
+ J+ Z& \0 w! p8 |3 N - /*#define EDMA3_DEBUG*/
. N7 i4 a4 @# E9 r$ V3 e G+ b
1 g4 ~! n* ~" Y# ?- #ifdef EDMA3_DEBUG
' I. f3 k* C* K2 f4 [& O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 e1 | c/ h3 @ o" M S# i3 C% x+ L1 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! A2 O* D* F( h1 X9 ?1 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( `: P! B- D- K; Y - #else
3 J6 S% M3 z" z3 A# ~% A - #define DMA_PRINTK( x... )7 @# h2 T/ e+ U' ~
- #define DMA_FN_IN
% J) X8 L( ]+ H7 O - #define DMA_FN_OUT
- }, }7 F2 B+ [: o. M5 ^: u - #endif
0 Z# X% X& }( v - 8 c# W$ a; t8 a: o; t" n2 D4 |* m5 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 {6 N) [6 q9 O' ]
- #define STATIC_SHIFT 3
7 Q* @3 ?7 n4 ?0 z. n6 s' v - #define TCINTEN_SHIFT 20- b( K% E' ^% X: B
- #define ITCINTEN_SHIFT 21( [" I. C1 K3 m5 @
- #define TCCHEN_SHIFT 225 A" G# X# r. l6 |/ |5 l
- #define ITCCHEN_SHIFT 23
4 _0 i6 }% A. e, g6 ? - 0 Z1 O( i% h% q5 T7 B
- static volatile int irqraised1 = 0;* {. V; B9 c" F- u& Q( \
- static volatile int irqraised2 = 0;
: @; V0 o" A9 U2 {! d% k
( R! M& N% ]+ h0 E2 m' U; Q% E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N7 z+ `- Q! M* m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' W9 K" i" |4 D6 Q1 F( k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 M' u- e+ Q; m+ C( ]' z
% z+ A' H% A+ H1 R' \: M- dma_addr_t dmaphyssrc1 = 0;
- N- q4 J8 M7 V* X% \3 P3 y9 Q - dma_addr_t dmaphyssrc2 = 0;
3 C/ G! ~" U2 L: y% ]+ F - dma_addr_t dmaphysdest1 = 0;5 K& q1 O# g0 L- P7 a
- dma_addr_t dmaphysdest2 = 0;" ^, v9 i8 i' {# H' L3 w
, i' _) ^' ?0 p/ u( N) n" v' g- char *dmabufsrc1 = NULL;( o4 k* l* \. z' c; n# q
- char *dmabufsrc2 = NULL;3 M2 [9 D4 s z9 \+ Y% N
- char *dmabufdest1 = NULL;; ]) z- Z3 u9 _: s; w* k7 k
- char *dmabufdest2 = NULL;
! b2 A9 f% t4 A5 W0 o9 J q y! X - + k$ ` T$ [% m1 X& @8 {8 _- f& V
- static int acnt = 512;9 ^: C* K+ {& o, [; n
- static int bcnt = 8;# I7 h8 b9 f; V
- static int ccnt = 8;# l {& N3 ?( u+ W3 H4 f; G( @
- ! a4 H# m3 `/ J' E! \/ M6 ]/ T
- module_param(acnt, int, S_IRUGO);0 H' D1 ^! a3 g+ K. G( E
- module_param(bcnt, int, S_IRUGO);
5 V# ?8 Y8 A( \/ D9 ]5 o. g0 t8 R - module_param(ccnt, int, S_IRUGO);
复制代码 8 q# D, l3 A3 B) h/ b: G: ?
# H- }4 j5 ^) w; n. P$ f7 B* [2 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 l* [# Q \% b) u8 b( N7 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N# N$ f; P+ H( o) q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 d& c$ u; q. b' W
# o4 F1 d6 r x
2 |, j: u. H+ e |
|