|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H( @8 s$ z1 O4 x
- [code]EDMA sample test application
" B4 E3 ^6 K% M$ x - /*5 G @: u( t6 ~8 R4 t
- * edma_test.c
7 m. R5 f8 ]4 e+ _. S: ^ - *$ w2 r5 }$ h) A% D. b: Q
- * brief EDMA3 Test Application w, ^+ }5 q. p; a" p# M! P
- *3 ?0 t0 U( O: f! K1 W
- * This file contains EDMA3 Test code.
1 \" n" t6 P# p' F# j% X4 ] - *' X5 K* z& u/ M* V1 o. G6 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& d3 ]6 K% b( x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ u- |0 r# o( e% h; b - * TO CHANGE.4 T1 }& m& y" q. m# a
- *
* D- U. o8 w N: ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; R0 E: I( Y4 j: ?
- *
* m) c a1 U7 T3 W% Z - * This program is free software; you can redistribute it and/or
% O- ~6 d" m0 Q s - * modify it under the terms of the GNU General Public License as4 a. `' S @+ K) c5 p
- * published by the Free Software Foundation version 2.
$ ^0 {7 l) Z$ q. B - *6 i( a& q0 M* r3 W: N) c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Y4 a" N' \3 \# u
- * kind, whether express or implied; without even the implied warranty
3 d6 u3 ?* Y4 e% D" [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: S% e2 Q/ w, `; d5 ?0 a
- * GNU General Public License for more details.
) c6 ~: A- P2 {- C* P7 o - */6 t, f% `8 \; N
- 1 O/ o0 B$ [: C5 z
- #include <linux/module.h>
) k+ K( `1 c) t - #include <linux/init.h>
1 a4 L9 D# G. C: E/ r; T - #include <linux/errno.h>5 |/ C! {2 Y$ c
- #include <linux/types.h>
9 g( `' r- M$ c8 K' d6 W' h - #include <linux/interrupt.h>
2 R% F6 t' ^4 A0 x5 ^) K G - #include <asm/io.h>! F# G8 Z4 r5 `+ K0 m+ G
- #include <linux/moduleparam.h>
/ W+ O# D, ]8 V7 | - #include <linux/sysctl.h>
* [ w: L% ^6 w- o. C - #include <linux/mm.h> L, R% {/ r$ X9 \2 E
- #include <linux/dma-mapping.h>0 r" N w5 x" p- J! v
- 3 g& O& ]7 P5 w$ H% X$ {
- #include <mach/memory.h>* T4 T1 @: S: |/ F- N" J9 G
- #include <mach/hardware.h>5 E' j8 b3 h' {' x6 S0 n* T. c" R
- #include <mach/irqs.h>; c. k5 D/ z9 k0 C
- #include <asm/hardware/edma.h>
# M' w# E( R! d; }
6 T I& r9 b7 K! F6 j- #undef EDMA3_DEBUG: q/ }' u- H4 _4 C' ]
- /*#define EDMA3_DEBUG*/0 c( g4 B6 x6 o, x3 @
- # u! r0 E+ M1 s- p2 c
- #ifdef EDMA3_DEBUG
* c& {# ?. R$ f: o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 g& e: J3 ?% o, W7 i4 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 O6 t3 W o5 E4 S: O( H& v- R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' ]8 P/ {% w: ]. Q7 i - #else7 P3 t5 H6 u4 ^5 q0 e/ e9 o
- #define DMA_PRINTK( x... )8 O$ f1 N- V' q6 n# @' ~( F
- #define DMA_FN_IN
) f( A2 q5 | [- l- a1 q: w - #define DMA_FN_OUT' E( M; y! v4 Q; q/ \7 x6 K$ p
- #endif; t; j: x8 e3 s$ J0 D
- ( `6 h0 v5 Z" i4 a! A3 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 ^/ r9 p4 ?. t. r0 k' b1 O7 R - #define STATIC_SHIFT 37 A, U! g5 n5 T3 V0 l4 Z4 K
- #define TCINTEN_SHIFT 20( i4 A) ~9 Z/ k* I; N% B
- #define ITCINTEN_SHIFT 210 M/ |. S/ a: Q6 i
- #define TCCHEN_SHIFT 22
7 R% l9 _. s8 a7 X - #define ITCCHEN_SHIFT 231 _' z9 z+ i1 ]; z6 r J; L% a
- $ B4 N) }' [$ h% R, ?; L& R
- static volatile int irqraised1 = 0;
/ P. ?% J; l5 r* `9 c9 ^5 E& L - static volatile int irqraised2 = 0;0 q4 W0 h" D8 o! ~ q) i8 G* U
- ; K5 [3 y. K- w6 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U! v, a$ `: C2 n% D/ T6 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' H, N- ?/ M. X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 u; W6 Y+ Z, B5 x- d8 e
- 5 X7 p7 a @( l4 }; k% e5 S$ A
- dma_addr_t dmaphyssrc1 = 0;8 e. o' Q' `* }8 L
- dma_addr_t dmaphyssrc2 = 0;' {, N+ L1 s; \* e. B* X4 `
- dma_addr_t dmaphysdest1 = 0;
" m7 A3 \! ~% l, x3 L - dma_addr_t dmaphysdest2 = 0;( y1 P0 s! J0 G' U5 M, K0 `
# M, ?2 I9 W$ ?! Z, V- char *dmabufsrc1 = NULL;8 P5 D- l# S# y0 p5 n) Z
- char *dmabufsrc2 = NULL;, e$ {% S+ L5 A' G' X) M. h
- char *dmabufdest1 = NULL;1 S9 ^" g3 a6 e, u
- char *dmabufdest2 = NULL;
, ^ w# D; `2 z- H1 A' Q; B* Q
& l% k" v. n9 e4 }- static int acnt = 512;
3 c# B6 e- N9 b7 \. u' v2 r - static int bcnt = 8;$ @; m! g. f! R7 g' ^
- static int ccnt = 8;
9 ~1 v8 H0 u* i) W+ \0 b, J0 d2 ]
. ]% X; w: i O. W; r7 `- module_param(acnt, int, S_IRUGO);
0 s6 P/ O1 N# a5 P. ? - module_param(bcnt, int, S_IRUGO);
% C+ V9 u" W* u% \0 r2 \6 H! T - module_param(ccnt, int, S_IRUGO);
复制代码
- q4 J5 P8 i3 f. V. B6 J. r) O
) F$ n" L3 W' q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! D. b! o& d5 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 k1 n7 ^, W$ c3 \1 n2 U" w6 O9 X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ]7 a8 [3 \1 C3 V" Q
: s7 H+ L. h/ M! c
; {% D: o e8 [* n# \+ G |
|