|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & g' M. m& f3 f5 U, l
- [code]EDMA sample test application+ x* d0 |+ D! L& R; G
- /*
. g$ q% n3 h& L' s' p+ H3 L - * edma_test.c
& W& l8 F3 p$ f( h6 C7 c$ u - *! S% b5 ^2 o9 |; E6 F1 V
- * brief EDMA3 Test Application
& a2 z2 v: y$ o J9 | - *6 Y1 T7 J$ {: A: l
- * This file contains EDMA3 Test code.
* X' O' A% I" a0 O+ U - *
' b, K% ^, O: y L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 V) H1 V" {8 ^. h9 t* [7 l/ b6 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 J& ~+ k( T; F! a
- * TO CHANGE.8 L2 h6 J8 v1 m3 \
- *
! `2 M2 Z4 }+ O5 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* ~9 y+ u8 Z6 U# B r; r+ ]5 U - *
8 D8 ]7 h, \2 k" ^* U - * This program is free software; you can redistribute it and/or
' o. `* v+ a2 r" @ - * modify it under the terms of the GNU General Public License as* p# j# Y( m6 q$ }( I6 l0 g
- * published by the Free Software Foundation version 2.
2 w; G5 G; E- H i9 V7 f4 ~ - *) g+ M+ V2 t1 U& ~& S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' }9 ?8 n6 n; D+ a& l0 y- ~4 C
- * kind, whether express or implied; without even the implied warranty
4 d) a4 l W' [& u7 \% I' \$ L' ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: p# w8 m6 N2 A) X- h9 R5 U6 N8 u( _ - * GNU General Public License for more details./ K4 Z: Z6 b D& C$ K2 ?
- */8 Y$ K) Q- h r6 j; q: S {
- 4 @5 y& i. f) M3 b
- #include <linux/module.h>
! Y: R, Q; ]9 @, p# L: X; X - #include <linux/init.h>
+ u4 B4 \) H, S! c7 V6 T - #include <linux/errno.h>
5 k( \9 `# I6 b+ Z% l# r i - #include <linux/types.h>
2 Q" a* S6 n v' C+ S7 w. \+ A - #include <linux/interrupt.h>
1 F0 n: l0 v7 l( U; X$ `( Q, ^ - #include <asm/io.h>
7 U1 c4 e6 b, V m7 b - #include <linux/moduleparam.h>$ T3 k7 ?8 ?- t% X' j6 V
- #include <linux/sysctl.h>
1 N3 c7 {* M" q# U& B/ |% N/ O - #include <linux/mm.h>! O4 r' E# G5 l- M' O$ o) Y
- #include <linux/dma-mapping.h>
, j/ b& e: Y* p6 }# w
- |$ L, W2 C5 |" F- #include <mach/memory.h>- h: M$ Q! C9 j& | D. x: N
- #include <mach/hardware.h># S7 `; Q: C+ @, L5 f3 y) z5 s f
- #include <mach/irqs.h>
6 [5 ^) o1 O# F; n0 w, V - #include <asm/hardware/edma.h>9 r7 ^# F" E. J6 G
+ k2 S _! T; c' T9 ^- #undef EDMA3_DEBUG0 \. z9 A G' A$ ?3 c
- /*#define EDMA3_DEBUG*/
" t. M" R3 @* q b! a: ]: m6 l1 T: M - 7 k' o$ x" X5 Y9 c2 G2 W
- #ifdef EDMA3_DEBUG3 Q; n: C# A! K; j' A7 V7 m" C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' {1 W7 O4 ~& }8 E' y8 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( q) @5 O7 J3 W+ t" d4 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ h$ g. |; F- R$ x6 c
- #else- b+ \% J3 i9 n
- #define DMA_PRINTK( x... )
6 s9 \+ f# Y& p' i- W - #define DMA_FN_IN
7 h, Q: t) R) z/ q5 n - #define DMA_FN_OUT
, M+ P" q9 V$ r) J" G* o5 {: H% h - #endif8 \- V8 z! \' _2 V# Z+ V
- * |) s9 P4 ~- ?! U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 I* A0 ^; z5 s1 X. c a8 ?
- #define STATIC_SHIFT 38 N! M6 `; }2 p
- #define TCINTEN_SHIFT 20& \- ~8 X( A$ W* r7 m* q
- #define ITCINTEN_SHIFT 21
6 u- P5 S) a+ f6 E - #define TCCHEN_SHIFT 22
3 |8 H( m. a- M) r& ^- k q - #define ITCCHEN_SHIFT 231 q4 w+ _* c1 M3 r6 a% N }. n; G
+ ]; {7 ^( t8 s+ } E- static volatile int irqraised1 = 0;
6 `; C* ~4 ?0 P" k! ] - static volatile int irqraised2 = 0;
* P$ C8 g2 Q( z - 4 D+ G+ g8 r8 s/ Q* a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: N X. I$ D9 f7 r. Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w! n6 j6 F( o4 y a+ c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! E, S+ r X- J( d- | - % H3 v. q7 n' ]* J
- dma_addr_t dmaphyssrc1 = 0;
" R: ]0 M6 q2 P6 I - dma_addr_t dmaphyssrc2 = 0;" A4 c% ?" z3 T, m% [# D4 N
- dma_addr_t dmaphysdest1 = 0;% y# s4 w% c) h- J
- dma_addr_t dmaphysdest2 = 0; M( G& N. T) u* q+ C
8 K, _7 y1 S) W) a Y1 p- char *dmabufsrc1 = NULL;
$ P( ~% X6 w+ Q- G. o - char *dmabufsrc2 = NULL;, D$ Y' I: {, z) ~, a# I
- char *dmabufdest1 = NULL;
+ K! d, C1 _, C* b6 W2 h - char *dmabufdest2 = NULL;( \3 n( }3 ^# F, Q ]3 x4 r
- 4 G6 j, J' B5 ~7 w& ?+ `
- static int acnt = 512;
& q. m4 [1 Q, _, T$ F* i - static int bcnt = 8;2 e* [- g S4 ~9 ^* d" A. p
- static int ccnt = 8;
# y1 k5 o6 B1 [& w& r1 F4 ^
0 e% C6 Y/ ~6 S8 t( P) n- module_param(acnt, int, S_IRUGO);2 P7 K! p$ V/ ]& E$ v
- module_param(bcnt, int, S_IRUGO);$ Q; v& a* R" {& }6 ?
- module_param(ccnt, int, S_IRUGO);
复制代码 9 w6 _/ _3 Z# q4 ]3 C" g
$ ^" F, D( K% a0 `$ A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; X: E q+ C3 x! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x. g6 Z& v' W: [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s5 l. F/ e' F+ } `+ V4 J, Z. c9 ]+ {
' G0 s: Y9 K% d! C |
|