|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , d& g0 o! q3 m+ r) S* P4 q
- [code]EDMA sample test application" B! P* n- d! S1 o R3 ?
- /*
/ w, A$ B3 Y" t2 t+ g2 K) ]+ n# @ - * edma_test.c( p9 B5 K) f/ |
- *% ^! W) s0 C; x9 {( [
- * brief EDMA3 Test Application4 i2 ]7 J" V7 a- K" r2 L
- *
: J+ s e1 L% f4 e/ c }! b8 X% s - * This file contains EDMA3 Test code.
4 G% N. ~8 G; A R8 R u - *( o4 g9 i, e4 v2 r* N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ R' Q. i; D$ A* ?, Y3 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" ^- y+ f& G7 [# x" q, d - * TO CHANGE.
" J' m& l- j* R0 S+ J3 Z& A) J - *
1 I; X1 x" [0 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" b, O! N+ C- R ~8 f! ?* n, k4 ?
- *, ?; d& A" Q5 A
- * This program is free software; you can redistribute it and/or* P; g B8 m7 d
- * modify it under the terms of the GNU General Public License as; O) K, V1 S+ b) `/ l
- * published by the Free Software Foundation version 2.$ a' M# ?/ [$ q# U+ o* E' q
- *' `3 ?: A" L9 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J h) j% c( l+ t1 L" A
- * kind, whether express or implied; without even the implied warranty8 ^( v( t/ o) w7 |3 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% p; U3 R8 S. }( l9 `5 ]0 Y0 u+ ] - * GNU General Public License for more details.
o8 n6 G8 C5 N! K m - */
9 |& v- r1 L( Q) i3 Z) ^4 ^ - * @& x: b9 z9 m0 ~
- #include <linux/module.h>
, x+ `( n! W3 M6 h+ a% P - #include <linux/init.h>
! a3 B5 U5 Y9 R5 ]- u - #include <linux/errno.h># F! P1 h5 a; M. g( U
- #include <linux/types.h>+ [+ N& ^( B& f% z5 d& n! e
- #include <linux/interrupt.h>. w) ]; \9 {: j+ h1 _
- #include <asm/io.h>6 }; [! J1 j6 P4 ^
- #include <linux/moduleparam.h>: V1 l$ p: \) V$ e4 X; _( k
- #include <linux/sysctl.h>1 Q. I/ ^: G! V4 e
- #include <linux/mm.h>0 k* ]. b- V ~) X0 }
- #include <linux/dma-mapping.h>1 r5 w3 V S. ?) W" a
- & d3 f, [/ O+ ?+ j$ O2 O" l4 l# x, [
- #include <mach/memory.h>
$ T& `" g5 H' n% S. g# N; o - #include <mach/hardware.h>
$ x' F5 k1 ~% z/ @: s0 u8 a& U - #include <mach/irqs.h>
8 @- A) k) P* S! h8 y! c3 n - #include <asm/hardware/edma.h>
+ l. ?. ]2 {3 [6 Q+ n5 E' K
8 v8 G5 e' p8 P$ c- #undef EDMA3_DEBUG
8 N6 T( s9 k, \ - /*#define EDMA3_DEBUG*/
0 l1 }( q, [4 A3 f' @( J$ Y - 4 L1 v' q& S" f
- #ifdef EDMA3_DEBUG; J" w! ~' w: i8 z& g4 m* C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ z: h; D, Y; k$ Y7 d; D5 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 w. E* v1 A/ L* p# O; J& V9 m A* K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 c0 p- P8 l. C* Y - #else
: s/ Y* h; A" F9 Q7 O9 `0 v - #define DMA_PRINTK( x... )- X) `4 X7 F( f
- #define DMA_FN_IN1 f2 S! L& b3 u
- #define DMA_FN_OUT% h( a6 u7 ?% q/ D! G
- #endif
/ l; ], S9 W5 Z' i0 z2 s1 t - . J( \9 a; d- u u* P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- T% ~% L/ Z. |* I7 d - #define STATIC_SHIFT 38 b2 G+ B% ^# i) D- C/ g& ]# K
- #define TCINTEN_SHIFT 20+ m t! }5 c% P9 p
- #define ITCINTEN_SHIFT 21 ^8 E4 d# ~/ z; Y- O
- #define TCCHEN_SHIFT 22/ J7 B! U- l. P2 I0 u- N; G
- #define ITCCHEN_SHIFT 23
5 c! a: X: [$ [: o' a
5 K- Z8 {5 @# |" d- static volatile int irqraised1 = 0;
* P |) x, p5 k5 ^& k* P - static volatile int irqraised2 = 0;( N1 o9 b% \# A, B3 L2 ~) K' N
9 A, F7 P p* i5 D h4 X b2 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: L6 m+ ^# f8 p. B8 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ]% I& a3 B# s, M; F, P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J5 p# R3 ?9 \. N
+ ?2 d0 P" E' W" _- dma_addr_t dmaphyssrc1 = 0;9 Z" {3 c1 p8 O2 X% b3 L5 A
- dma_addr_t dmaphyssrc2 = 0;9 E! c! Y. ^ f: I
- dma_addr_t dmaphysdest1 = 0;
7 [( h- G- f: J d0 A - dma_addr_t dmaphysdest2 = 0;+ B8 t5 ]* v2 O9 J, ~1 W
- ( Y& c5 c! b& c1 d' u& w6 n' g
- char *dmabufsrc1 = NULL;' z7 z$ B: y" Y. B9 B) M+ p
- char *dmabufsrc2 = NULL;
3 b" h! {, _2 k( E+ v- C& _5 g9 D - char *dmabufdest1 = NULL;2 b) J% I7 K9 M- u" w" |
- char *dmabufdest2 = NULL;
! U* ~+ W; u& z! _' ~7 F2 I2 Z - 5 W# c2 g$ X9 a. d2 l0 \/ V2 }
- static int acnt = 512; F/ {2 h- m4 J/ N9 @ A! Y6 G
- static int bcnt = 8;
9 u, B K! D; m. J: z3 p - static int ccnt = 8;
; ]6 B# N1 G* b! X3 X c/ y+ r - + w! [/ \+ X0 C3 I( G
- module_param(acnt, int, S_IRUGO);
# Q0 \- |6 @2 J0 { - module_param(bcnt, int, S_IRUGO);
: E, m5 f# A, _: x4 E$ t - module_param(ccnt, int, S_IRUGO);
复制代码 2 g* N5 a# L' S3 y1 v- N( |7 A" H: l
# G+ J8 D+ a/ x" ?! L5 n, P4 x/ m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 b) r2 I4 y1 Y0 I; E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G( d+ H& n5 J* |2 d% G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 V9 E1 ]7 j/ V# t* q
+ k6 ?! g0 b8 r3 o* K9 `" n0 N; y- z9 N9 z" k+ v
|
|