|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / p" z9 t& {9 m. _1 ^
- [code]EDMA sample test application" w, z7 p* q: ~/ a3 I1 V% [+ y
- /*
1 n6 [! Y4 Q4 {& o" m! n3 j - * edma_test.c
. o+ K& w% o( X: [0 o, _# t - *6 I: S; u* Q" I' c
- * brief EDMA3 Test Application. w) e, P P3 M" [
- *- T2 ?4 V2 f! o5 V- W) b6 Y, z- n
- * This file contains EDMA3 Test code.
$ g( m" ?0 \ m8 y8 k' Z' U - *8 C+ {& ?5 b, V- e5 W; X( `( K& M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 y6 u- G0 ]( l( @& J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: X' |# h& q- P3 i+ j A
- * TO CHANGE./ |) r0 u* o% P
- *: ?& _* @3 _3 a, G4 ^- E$ N" C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- Y9 ^& Z9 s1 O1 F2 X# x
- *. B. t9 d: ?; C- ~% ]0 r6 J6 ~
- * This program is free software; you can redistribute it and/or
0 y+ M; {6 D9 {2 l4 g - * modify it under the terms of the GNU General Public License as
9 |" a% f5 a$ W. P - * published by the Free Software Foundation version 2.0 \+ K7 _2 Y1 H3 N6 Y4 r
- *
( m# _' A' y" S4 W" b g: c% ]- A: ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* C, k- G) V2 V- `; x& E6 O- f. b
- * kind, whether express or implied; without even the implied warranty
5 V/ C- Z' E! E" H$ t9 g& i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% O) h8 {( P, ?/ }* ^' S
- * GNU General Public License for more details.& l& [) H( |" i; N; o3 r3 N
- */* y0 J9 p1 X# S6 `, Z& r, j" g* L( `
, v3 q. H4 J& _7 i, [- #include <linux/module.h>* c+ p' Z9 Y" w- O3 h* @# f
- #include <linux/init.h>
0 L" ~" S& J7 }5 c - #include <linux/errno.h>
1 J9 T- s, T5 ~8 n! y, \# K - #include <linux/types.h>
: R$ m4 d! d$ q5 L$ o - #include <linux/interrupt.h>
9 ~" ?, O2 M' ] - #include <asm/io.h>
z T" T/ ?! j$ l - #include <linux/moduleparam.h>9 d$ _" @- R1 Q3 @
- #include <linux/sysctl.h># t- G3 D5 Y T+ M. T1 ~
- #include <linux/mm.h>4 c- k" p7 R" }& ]
- #include <linux/dma-mapping.h>
5 g8 a: s) M8 s - + }+ G% E* m% }( N! y- p
- #include <mach/memory.h>! ~/ ]' [' ?. g# ]. g1 t0 ?: w
- #include <mach/hardware.h># U2 J% o. t' z$ e0 U h' X
- #include <mach/irqs.h>' {& F% v8 y' R5 o6 J% p5 k
- #include <asm/hardware/edma.h>
$ d$ |6 h/ J" D" @ - + X% k$ U" H0 W
- #undef EDMA3_DEBUG9 `7 B9 @, g3 m" G0 J
- /*#define EDMA3_DEBUG*/
. [6 i( B6 a! H( l9 Q* T1 h$ l. {
4 r. N: F4 u4 P+ u5 S- #ifdef EDMA3_DEBUG
o6 S2 g' ~1 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- Z& _+ e6 ^! \# Y5 h( }. j/ ^7 r1 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 G; y7 k0 L% N! n2 E+ h( C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ x/ q- ]8 L: `# m9 a0 T t6 i2 e - #else; o4 V$ l: u. G, f9 i
- #define DMA_PRINTK( x... )4 E0 [: ~# S% P. K0 [. s; T( a9 Q
- #define DMA_FN_IN
) \/ Q4 r( U4 L( y& W - #define DMA_FN_OUT
! p; V/ R! r. Y5 _8 }/ j - #endif
" {: f5 b6 x( ]5 H A
4 @' z1 P9 |; G% n8 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 W' K- C/ ^4 G% S8 s2 ~& {% u
- #define STATIC_SHIFT 3
) f5 G3 f/ w! v, L" H# n' ~ - #define TCINTEN_SHIFT 20
9 P2 |) ^( V; b( w( B4 D - #define ITCINTEN_SHIFT 210 t! Z9 o+ s: R3 v, \3 c* @! k
- #define TCCHEN_SHIFT 228 u |, w* R8 D: ^7 O
- #define ITCCHEN_SHIFT 23
[: v& D& p6 I. y - o4 J; [' u- t
- static volatile int irqraised1 = 0;( C. g1 `0 z0 r$ D
- static volatile int irqraised2 = 0;4 t w$ O7 o2 T
8 m6 W' `" k: g! J; Q( f. f2 P; t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m$ C$ ]- l# D2 l" v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t# Y7 ~* u+ Z" v t, B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F7 {* |9 F1 a3 Z* G - 5 q3 B2 p2 w: B k+ m
- dma_addr_t dmaphyssrc1 = 0;" A! e6 |! F% C+ S9 v
- dma_addr_t dmaphyssrc2 = 0;
( z2 ]0 j! c l - dma_addr_t dmaphysdest1 = 0;
1 b7 ~# m1 [% o* g- {4 a - dma_addr_t dmaphysdest2 = 0;% U5 f0 g$ H9 t
- J9 n! g; F% q, u+ }; w5 ^
- char *dmabufsrc1 = NULL;
# {, E! K" a# u9 d( | - char *dmabufsrc2 = NULL;
; R9 z6 x. R5 C - char *dmabufdest1 = NULL;
; H" F& C9 T& `1 L - char *dmabufdest2 = NULL;( {: q# e7 C7 R9 D% ^
+ p$ C( r3 K9 ?$ K+ S. A' }- static int acnt = 512;. i$ Q. o5 T0 N1 B( r/ o3 G0 A
- static int bcnt = 8;) N$ r! X5 ?7 D5 c
- static int ccnt = 8;3 o" U/ E$ Y7 \, I. F* l% g
( q% i; M- S$ M( }0 r" C7 j5 p- module_param(acnt, int, S_IRUGO);* T3 Q( A; E" v3 b
- module_param(bcnt, int, S_IRUGO);& e8 A- I. l: S5 j% x
- module_param(ccnt, int, S_IRUGO);
复制代码 5 v3 h! h; ^+ y+ O5 i* ~
3 Y" y. d) K, v8 J* [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 P C/ l' F, ^' f/ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' l- p& [- t$ d$ o! R \( M5 s" m" m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 h5 t6 S- w. c3 w9 [! k/ t3 \/ ~9 ~' a' h- f
4 S- g$ L# T ]" g# q% e: z8 q/ x, U |
|