|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 X& l+ |, w) g. ^
- [code]EDMA sample test application
! M! p* d+ a2 _ T9 Y - /*, b" B8 p5 e+ ?( P+ J
- * edma_test.c5 h$ t$ b1 q. m( @6 A! f
- *3 M7 \0 w) n" i7 o
- * brief EDMA3 Test Application
9 x0 U2 m0 |' l# x' W& B$ { - *
. \! t2 {4 i0 o/ I' _, m# i - * This file contains EDMA3 Test code.
9 [9 u: r& g' Z - *+ t H. u% a; y, N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. L5 ~4 Z# T- G1 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! [ N. }2 v4 ~
- * TO CHANGE.. l; `6 j- J9 }+ H+ H
- *0 a8 Z5 ]6 P: _8 W! U9 E7 }7 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% c4 p/ u* [+ t
- *, N4 f+ b. ?# n8 i" a* ]" G. E9 |
- * This program is free software; you can redistribute it and/or
* ]: ]' b* B$ J9 ` - * modify it under the terms of the GNU General Public License as
5 @! }6 G- M+ R- d/ R - * published by the Free Software Foundation version 2.6 a1 O8 `+ Y' }; Y
- *
" S# r9 K9 H; S5 W7 q8 C, R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 d6 k2 r/ q8 z - * kind, whether express or implied; without even the implied warranty6 w2 q( s1 h' [1 f& g- Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ h% i( m( ~3 p4 o! n - * GNU General Public License for more details.. A( N7 B/ g1 C7 Q+ f- o9 @7 D
- */
; F# X' S: w! h# ?
% W! m6 _6 E0 }8 m3 r- #include <linux/module.h>- }- n; }+ o3 G& v
- #include <linux/init.h>
* w$ P3 c; z7 p( q( b - #include <linux/errno.h>8 C8 ], O' `7 h$ c& [' Q; S# x
- #include <linux/types.h>
* i" u7 g! ~; t - #include <linux/interrupt.h>
) {8 t) b/ i5 }8 @0 x3 z1 e' u - #include <asm/io.h>) A+ k: |( e. ?, g5 s; y
- #include <linux/moduleparam.h>1 H0 p6 f3 ~" x
- #include <linux/sysctl.h>
7 G; _) M5 W# y& O) {2 n - #include <linux/mm.h>
0 K3 r- F/ ^. {: k9 y1 }6 Z% h - #include <linux/dma-mapping.h>
B* o: Y3 G8 S7 |, e# z6 s3 c - 0 Z6 O1 [( B7 M) u; j- X& P. z; P
- #include <mach/memory.h>
" ^: E, C+ F$ E1 U0 [7 u - #include <mach/hardware.h>* R+ Q! t* k! Q3 M7 m! `
- #include <mach/irqs.h>
7 ^6 ~ l1 y2 }) t. A- R - #include <asm/hardware/edma.h>
S8 P i' R* h - " f4 E$ o z" K7 N7 i2 h
- #undef EDMA3_DEBUG! I% L1 o5 m% p; ]# e
- /*#define EDMA3_DEBUG*/
* I: p! W |8 w3 [/ M" ^
# b# ~4 }/ \' t/ o7 m- #ifdef EDMA3_DEBUG
& F; \7 }& Y; u7 ^* s! Z5 A/ E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 J) S4 f W0 J+ g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% Y1 d, D) d6 p$ K$ l: G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 Y. ^& f" ^+ Y$ j5 w" ^ - #else
0 o5 `! N. @2 @6 ~/ i9 L - #define DMA_PRINTK( x... )
- T& T7 s: H. Q: A+ e7 B - #define DMA_FN_IN
: D E7 [; z3 p$ M: B) Q4 g - #define DMA_FN_OUT
7 g3 J8 q8 m+ {7 s) X - #endif
+ M1 P. t9 b; q$ Y+ e- Z* p
& Q3 n5 n7 J( g6 N$ ^5 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 \. a! W0 x. r$ h2 c) m3 H - #define STATIC_SHIFT 3+ o5 j/ x( O' d }' s
- #define TCINTEN_SHIFT 20
# ]& |0 m% T/ f - #define ITCINTEN_SHIFT 21. ]. I$ J: V" z2 \7 ^/ ~5 {6 P
- #define TCCHEN_SHIFT 22" u; s1 U! m! i: y! ?( v
- #define ITCCHEN_SHIFT 23
6 x* L2 n+ ~, m' X! U% ?: s2 d
8 l: A# }0 @$ P8 u5 Z/ y- static volatile int irqraised1 = 0;
( h- I# d+ R4 |: G( e - static volatile int irqraised2 = 0;
: p8 [6 T, z8 i( Z8 r
! K3 d7 y6 e$ C# a0 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ |3 [# }0 C. Z: N5 }) u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) W7 q6 I- l" \; Z' j0 ~6 O0 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ |( q+ _, h8 A1 n
4 |' f+ }5 i. o, y3 ?+ `/ n) h- dma_addr_t dmaphyssrc1 = 0;
3 C8 j+ @6 r: [' l. Y0 r2 m1 k - dma_addr_t dmaphyssrc2 = 0;
2 o/ l( d# L3 k* U0 b - dma_addr_t dmaphysdest1 = 0;/ F7 j' w$ l9 F% G
- dma_addr_t dmaphysdest2 = 0;
: C. g! {- M5 j% q2 N( o
8 A9 h* u& _5 v# @) `- char *dmabufsrc1 = NULL; \* _/ i' m9 Z( ~! u- c3 z- ^
- char *dmabufsrc2 = NULL;. C& _ Q9 Z( j6 D! U' X) b" `- S
- char *dmabufdest1 = NULL;
6 J6 T7 K6 ]+ G2 `- A0 M$ H/ g+ ` s - char *dmabufdest2 = NULL;
- b5 ^9 L9 h! `! L# T. [
2 _5 K2 t2 ^ H0 y3 Y# x- static int acnt = 512;
! s9 [3 t9 S7 W H$ x0 f$ |+ _ - static int bcnt = 8;
: o: V/ L* H7 H4 |' v: W - static int ccnt = 8;
( C0 S, ^. _3 n+ }& `1 Z) k* q - " Z" M, F" L+ H" }
- module_param(acnt, int, S_IRUGO);
3 L; h. Z* g6 I) G0 n+ O ` - module_param(bcnt, int, S_IRUGO);/ T* g; q5 C+ z2 D6 Y J
- module_param(ccnt, int, S_IRUGO);
复制代码 ( g7 W$ J2 s! j
0 L) ^( W) a- F$ H" b- q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }" K* t/ v) V3 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |) d: O7 e+ e: G% C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Y3 |2 X' I: H1 y; G
2 J: U& t4 e% h, S4 d# e- j/ S
1 P: ^/ y0 n1 M5 F) v: i/ @ |
|