|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 G2 S( M; a; c' `! P5 v
- [code]EDMA sample test application
* y8 ^0 L* j. ~5 }2 c* {7 l - /*
$ P7 O; B" N& O7 N' X - * edma_test.c
- { v! ^8 c# c - *) R) X% Z( @6 F( `- @
- * brief EDMA3 Test Application
, A) n% ]5 l1 S9 h4 H) k9 ]6 x" [ - *
) g y3 N, S4 y1 ` - * This file contains EDMA3 Test code.
" v/ H7 d* G+ `: _! N; u, t - *. Z- [% X: d0 k' k3 `3 q; E0 B; i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 k, e, ~+ _* @+ K3 j/ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ b8 o1 ?' J: l$ e: g
- * TO CHANGE.
5 p7 [: B, l* M" M$ ~/ `8 E4 z! C - *! I+ @- _# V% S2 }5 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ g' O" y! K% T8 a$ v, M( b
- *" C1 Y* g1 d3 B# D' \; |; r
- * This program is free software; you can redistribute it and/or
. s5 ]6 g9 E6 R4 \7 u$ l# H# ] - * modify it under the terms of the GNU General Public License as+ k. W. I$ b' O" y' t! ^* f
- * published by the Free Software Foundation version 2.- a# Y4 e0 ^" i |4 e# g
- *
* H3 k# w2 C" H( k# H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A4 _$ \& ~8 l+ [
- * kind, whether express or implied; without even the implied warranty
/ Q) k p+ v& m) R8 ~* q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# l/ \; r- H4 s1 J3 {- K9 H - * GNU General Public License for more details.
4 C6 o( t% n: h# |4 P: H7 \ - */; p$ O/ y! E4 O B {6 j
9 C. o- m0 k# V. _! K- #include <linux/module.h>) k3 q" V L* L7 U9 H
- #include <linux/init.h>
4 V( V& H+ @# h% c! v6 v" q8 Q - #include <linux/errno.h>
7 Y( H+ z: E- r$ q3 I - #include <linux/types.h>
: {" t* J0 Q3 d. ?6 G - #include <linux/interrupt.h>
8 f) r" }& X* q4 O7 S/ }) f' O) K - #include <asm/io.h>" S: C2 ]/ z; |) I6 W3 W; i4 N
- #include <linux/moduleparam.h> M7 |4 R% Y1 o6 Q
- #include <linux/sysctl.h>
% q4 V8 p( R/ `7 H" | - #include <linux/mm.h>; P6 \. [+ J, E+ \. K
- #include <linux/dma-mapping.h>& \1 k, e9 u/ ^3 `! y" n+ k
- ' O: t. k: G! v6 l5 W
- #include <mach/memory.h>$ |% r& u1 N) Z
- #include <mach/hardware.h>
+ k: P* M0 ?. o7 Q4 Y) o& \ - #include <mach/irqs.h>
! n% D0 m2 b2 _3 V9 G - #include <asm/hardware/edma.h># |1 G, [9 T/ k0 m& R& F" x
- & ]. [; m9 a, Y- p
- #undef EDMA3_DEBUG1 H$ d, _0 H7 ]6 t
- /*#define EDMA3_DEBUG*/+ y& u; X( g7 F: l; l" S5 Z$ Q1 w
2 {/ q) h, _# D3 M: u5 P( I6 U- #ifdef EDMA3_DEBUG' {# b7 G& V3 N' n6 a Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" J; `8 F$ y0 T6 v! \0 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% j; r6 l* a8 O% q0 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ?9 [ m" U. T5 E# c6 k - #else2 q; [+ {- _4 j. _: j
- #define DMA_PRINTK( x... )
+ x# f3 k( L0 z# X - #define DMA_FN_IN
3 d8 K" V: D/ C8 U - #define DMA_FN_OUT. }) C7 E9 [( d' }# R
- #endif
D4 ]& a1 U* F4 t; \+ t! v" M- B
( o7 l8 r: Q* x3 L, A) Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- f& _1 ]' }9 p- ~" W" z
- #define STATIC_SHIFT 3
4 ~( ]" _% t9 R; w$ F - #define TCINTEN_SHIFT 20
- Y# Z5 z( k1 X& o Y - #define ITCINTEN_SHIFT 21% l+ q1 H/ H. Q/ s% ~: c
- #define TCCHEN_SHIFT 22
; v' y) B0 w7 L" J1 |0 w% ] - #define ITCCHEN_SHIFT 238 K2 M" }& Z+ h2 O5 t L- j
: K# J* ]- N$ k/ Y0 z' w- static volatile int irqraised1 = 0;- c+ A) A7 c2 v, @; \6 I) m
- static volatile int irqraised2 = 0; a" Z. \2 U6 A7 Z ^* d
% I. S; l. t' b9 \2 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U/ J3 C, Y( w* X- b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
@- V9 v/ \2 V+ v: H( N3 I/ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ |1 k: g$ C, {; T0 o+ U& o - , c5 e" _0 W1 e4 I, x u) H. W$ \
- dma_addr_t dmaphyssrc1 = 0;
! u0 i' B. P( X - dma_addr_t dmaphyssrc2 = 0;
# z5 d$ M5 Z' O5 T - dma_addr_t dmaphysdest1 = 0;. I, P/ R7 L0 \% |3 t4 ?5 L
- dma_addr_t dmaphysdest2 = 0;2 a- L' H/ w9 {4 N) H! a
- $ Z0 w3 v% _7 L1 A3 q3 y
- char *dmabufsrc1 = NULL;
+ v7 U! i, g8 N( Q+ w - char *dmabufsrc2 = NULL;
1 l! s& R" t3 y - char *dmabufdest1 = NULL;
" w, F+ G3 q, @1 l - char *dmabufdest2 = NULL;9 ~9 T5 o U2 L$ L( Y
- % I( v6 j* `: ^! g, N& l
- static int acnt = 512;; R7 q, `( J, x7 t+ ~) b6 q
- static int bcnt = 8;9 m' B( U6 v0 n. [/ f6 ^
- static int ccnt = 8;
4 |' F" x4 ~$ |1 r$ z* W i - 3 Z* t0 u% ]/ N
- module_param(acnt, int, S_IRUGO);
5 Q5 A P: B& c - module_param(bcnt, int, S_IRUGO);. p/ M1 i( e9 `/ V
- module_param(ccnt, int, S_IRUGO);
复制代码
4 P* m) e) u3 }; w7 p0 _$ R8 R0 D! k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' ~3 G6 u6 k1 ~' c/ i8 Y, ~6 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. a: c7 Q* n8 K, r4 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 w, z6 j" S1 I$ |3 ]: M
, `. Z3 i5 \2 ?/ F- ~1 r5 d, E5 c- h7 o- M7 O
|
|