|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; D T; e3 W5 o
- [code]EDMA sample test application
Q# [# ~: c& X6 p, A+ ^ - /*( k5 W3 }& Y* I% @7 A8 i' s6 H
- * edma_test.c+ m) q$ B& a+ B# @* P
- *
9 }: h; e* O" x - * brief EDMA3 Test Application) v' |! q8 a6 W1 `. ~9 I" e _
- *
+ i3 a; T; b+ N& r# P - * This file contains EDMA3 Test code.! N5 \. l5 E: T3 ?4 ^5 x% K
- *
2 ^- T4 t2 T0 }7 t) |3 v) { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& u% @* o/ \+ z: w/ `' F/ b# B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT F* `9 p% p/ e8 Y$ ]+ _7 v
- * TO CHANGE.* X5 T% r2 n4 Q) p4 L
- *
# B% f: E( q5 S/ a( r6 }+ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k3 r0 U, b7 \
- *- g" a. ]0 ?& J$ o2 e
- * This program is free software; you can redistribute it and/or
7 J# Z& ]! ]7 q9 H - * modify it under the terms of the GNU General Public License as
- e' M1 q: K& ` e. s t - * published by the Free Software Foundation version 2. A( L# ~+ H! Y/ `: F2 b% P
- *
$ w" j+ {, o( M) d1 y: X8 M. O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ [0 }7 i2 \0 E: U& q - * kind, whether express or implied; without even the implied warranty
0 f5 G% s& S/ ]7 g4 O1 j, ]( O4 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. o; T& |- D, m* z: w
- * GNU General Public License for more details.
/ z2 l0 j% E+ I$ v, }5 f4 | - */# F, ]! Z {6 j
3 P. s! f1 `$ ^ z* ` o/ D- #include <linux/module.h>7 b- [% c* b3 \: K8 f+ m. z
- #include <linux/init.h>
. Y# m7 e/ _$ x$ n h4 g$ V r - #include <linux/errno.h>
& r8 x4 s: K, R. i8 C! } - #include <linux/types.h>
6 q% l7 X3 `" I. \" R& [% C& Z - #include <linux/interrupt.h>
: d0 D2 l. G% p0 a+ V, ` - #include <asm/io.h>- h( D; J1 Q: `
- #include <linux/moduleparam.h>
/ d' j9 ]" N% g" i - #include <linux/sysctl.h>! B0 Q0 H, I" W; k! ?3 x
- #include <linux/mm.h># C7 `$ m2 c1 I. K" t. l. O( x
- #include <linux/dma-mapping.h>
% q e, X2 Y, t. o9 ~
2 y/ s' F+ O" H( X+ @- #include <mach/memory.h>
' Q1 o m+ n2 R# d- F) a - #include <mach/hardware.h>$ n' l4 ~- {) O
- #include <mach/irqs.h>5 k) L0 O0 s# n5 J9 W L
- #include <asm/hardware/edma.h>9 T2 U1 r1 G! Z, ^& S
- , ^& C* N) Z9 t! Z: D8 ~
- #undef EDMA3_DEBUG& i5 G/ M4 h! N3 A$ r- \
- /*#define EDMA3_DEBUG*/) h; V! X1 [/ J0 @/ [
5 ^2 f9 k9 h6 M* V. w6 j" v- #ifdef EDMA3_DEBUG
& U; ~" b! D e/ x& P) u9 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 I+ S, L4 A% E0 h& E$ X- H+ Z" H; i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ w% ?+ x3 C0 t8 @& O4 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 _( _$ |8 _/ S2 l3 O
- #else
& z1 v( I8 n- J6 H) q. u: e - #define DMA_PRINTK( x... )
+ P, O" j9 Y3 b' ^+ c. W - #define DMA_FN_IN8 t3 N: k( i% I2 @7 g$ D
- #define DMA_FN_OUT
* J$ M5 A; I8 a0 b - #endif/ y8 V/ Z( u6 h% a' L3 Q0 Y2 g
- ~# _9 u- ^6 [0 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ n. a. {( d/ w - #define STATIC_SHIFT 31 z' p* Z- ^$ [/ ?
- #define TCINTEN_SHIFT 20
: M: f( f! ^1 q# \* ~+ o. Z - #define ITCINTEN_SHIFT 21+ E! Q# E$ T% \* Q7 p+ D
- #define TCCHEN_SHIFT 223 W- v. W* T s H W
- #define ITCCHEN_SHIFT 233 ] ^" T+ x0 f' a0 V% a$ |8 f
3 D1 Z) F$ V' h- static volatile int irqraised1 = 0;- o% w, G2 O7 W6 i/ M
- static volatile int irqraised2 = 0;
/ K' Z" v! k4 q1 R m: u$ a - 6 i, z* X) I/ |& X0 d1 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" {: E! Y/ d" b0 { J, ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J( Y* h/ d, }8 h5 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s5 ? B: _- m# R( p - , D$ g9 l: n5 N2 o r2 e6 w6 X
- dma_addr_t dmaphyssrc1 = 0;( G1 o/ f$ l: V* q6 ]& f" w4 r
- dma_addr_t dmaphyssrc2 = 0;! {4 t8 R/ @3 k% J; [
- dma_addr_t dmaphysdest1 = 0;
8 |; I4 e$ Q1 g- Y# A/ ?1 N2 } - dma_addr_t dmaphysdest2 = 0;
- o# S+ ?- s9 H" D
& J; w# q- p! R$ {- char *dmabufsrc1 = NULL;
7 x6 A/ y1 j# M1 X$ u; ^ - char *dmabufsrc2 = NULL;
, j: }9 N' W% D3 N' o/ w$ y( X - char *dmabufdest1 = NULL;
# f# V) F6 D9 X0 a/ ~5 U - char *dmabufdest2 = NULL;
# z! [1 A2 X* K" d; R - ( \6 i, l7 K' X! E2 _
- static int acnt = 512;, _; Z: _, q) ]0 Q- V
- static int bcnt = 8;) r) H, A" p8 g
- static int ccnt = 8;
& o t8 m0 N! f S& K. }
9 j% G N( C# B) w0 l1 q- module_param(acnt, int, S_IRUGO);
; C( }2 S$ V! P1 t9 x; U* G' s* { - module_param(bcnt, int, S_IRUGO);8 X( F7 B7 d9 Y* A- Z: a
- module_param(ccnt, int, S_IRUGO);
复制代码
$ n- h" a. t# t7 @4 @ G
z s+ ?6 X4 U) E8 T k/ _- ~: _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 x6 i6 |4 p* j4 k# a) d) l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 O3 Z: l. ^2 J" S& w" U$ t1 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. T7 {- Q% U+ C; Y. U! N3 R! o! x) R2 _
+ D2 ^3 l0 Z5 u6 R4 P' N0 i( j+ Y
|
|