|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 h" p, X0 X$ m5 {$ X/ @; o- [code]EDMA sample test application
6 r4 a4 I9 w( l - /*
9 g5 Z/ i1 I7 _$ ] - * edma_test.c
' O# |7 R7 T) A2 Y0 q. H - * W# O* K, o x& O
- * brief EDMA3 Test Application7 t# V. P) i7 L" }
- *8 f- c+ C& r5 J' c3 a
- * This file contains EDMA3 Test code.
8 Q5 B& C+ f9 ] u7 S# L - */ m0 h# x. l0 I3 z! G) `7 f$ o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p8 `1 D. S3 C, @5 H! n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
p. _# N5 c0 [7 W - * TO CHANGE.
5 m3 F0 S1 D3 o' S U, } - *+ f0 t) v2 U$ h' ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _) h/ u- R! Z3 }
- *
( H& e' H% D8 n- V - * This program is free software; you can redistribute it and/or0 M4 M- b5 m, G3 J! X
- * modify it under the terms of the GNU General Public License as
/ t1 ~+ G4 f$ c% O - * published by the Free Software Foundation version 2.
: P( h3 J2 _, z4 D5 V* H) M - *3 N4 H. z5 t i F9 h$ s" w& c! F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b) G, V O& _. _2 E* Q6 b8 B
- * kind, whether express or implied; without even the implied warranty6 L' X) l8 _: e( z9 n5 ~" @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 x) C+ P+ B! k' J8 B9 y7 t - * GNU General Public License for more details.
5 B D& J" e" u, A - */ B8 E+ ?) U9 H7 H9 i4 s
4 K) y d! u( n- #include <linux/module.h>. m8 L% h6 F* v
- #include <linux/init.h>- q, V7 Y% g+ c
- #include <linux/errno.h>
: Q& I b5 C8 ?9 w2 B0 ~ - #include <linux/types.h>8 {7 R# k( s3 ?: h( c
- #include <linux/interrupt.h>
/ T& k6 I/ a" K y7 F8 s - #include <asm/io.h>3 e1 n1 b8 @& a% p o; E
- #include <linux/moduleparam.h>
: s1 }1 N+ {( f3 i - #include <linux/sysctl.h>- O( P, X" g4 n$ z2 u% s1 n2 Y% U" L
- #include <linux/mm.h>- i7 n' M, Y' s% g5 x
- #include <linux/dma-mapping.h>
6 ^9 |8 O0 w8 u3 v) P - 6 |; y& c! h, w: L# ]% q( E
- #include <mach/memory.h>: Q3 o5 X% s' Z: G
- #include <mach/hardware.h>: F" s# l2 h/ i' _4 H, b8 f* a
- #include <mach/irqs.h>$ I3 `& L! Z8 m' n2 _
- #include <asm/hardware/edma.h>* C& [' m7 `* f
- ' ]8 j. L/ M" u/ O7 f8 `. _9 |
- #undef EDMA3_DEBUG
7 X' V: o2 o% W! p& r - /*#define EDMA3_DEBUG*/
9 s( N% v8 v( x - # l; ^0 z. A9 L0 R( b- q Q
- #ifdef EDMA3_DEBUG3 N1 g% Y. j" K8 g. U' h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- a2 H9 A+ L1 L( M8 _9 R' @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# L" |5 E; b7 _' p6 o2 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 b7 u+ R. M8 g& B- K$ ^) P, j, t - #else
?( u) k( g% T2 }; a- r1 c, F& X1 J2 [& R - #define DMA_PRINTK( x... )
( y9 l+ v! \3 b1 T0 c - #define DMA_FN_IN
6 K; C _" L% q& B) T - #define DMA_FN_OUT9 q" g7 O* U( X1 q2 f% I
- #endif
, D! ~; z4 ~( P$ b, H - 9 \4 c) _) q C% C- U8 c$ ~0 e i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. d& x; m" w6 }7 k1 |& u- d8 c. y I% w - #define STATIC_SHIFT 38 }" T# X% f! Z' D3 R. h
- #define TCINTEN_SHIFT 20# _$ N+ T& b1 z: b
- #define ITCINTEN_SHIFT 21
& |* G! X8 Z2 k z% z - #define TCCHEN_SHIFT 22
: Z4 n# M% C3 ], c( V8 Z - #define ITCCHEN_SHIFT 23
; l+ X. `) s7 E2 Y
1 N+ ^$ Q7 k" |: N0 O- static volatile int irqraised1 = 0;1 S% e7 z9 K' f" U
- static volatile int irqraised2 = 0;3 k, B# n) D3 v4 V0 E3 t/ C3 e
8 n- M0 b5 V# {5 i5 a& F4 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 z' A+ y. g7 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e% P8 y v% K, u1 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D" S8 T# f" h- y/ d
- * \8 I6 `8 j) ]0 s8 v+ Y
- dma_addr_t dmaphyssrc1 = 0;
$ M( {2 @- B! b" l - dma_addr_t dmaphyssrc2 = 0;+ F) [/ Z& Q4 q ]9 N8 D* c+ O; f( Q
- dma_addr_t dmaphysdest1 = 0;
; B( V2 n4 ?$ N! r# u) b1 Y - dma_addr_t dmaphysdest2 = 0; y) O- N3 p: M# I4 T# {! Y3 a
- 5 ~# l. e3 N8 L; Z0 n6 n
- char *dmabufsrc1 = NULL;# f8 S `! `) _
- char *dmabufsrc2 = NULL;
* O2 y$ `1 l. `; v* o - char *dmabufdest1 = NULL;
. ^: t, ~5 [0 @0 F! f, m, `/ \ - char *dmabufdest2 = NULL;
F# \8 |9 K- j9 ?; d* A4 j
W+ H2 ?( H6 ~4 \- static int acnt = 512;$ Z. k4 Y1 P5 F- p7 M. J) @9 r
- static int bcnt = 8;
+ U' ]! W, ]( f- s# {2 Z8 `2 i _ - static int ccnt = 8;
4 x' n, n+ r; K! B6 ?6 ?4 n* w
, `/ M L% P1 g( r; A4 k- module_param(acnt, int, S_IRUGO);( B2 B' @8 `! x* C, I0 h
- module_param(bcnt, int, S_IRUGO);1 r1 H; a) g7 v) C' \0 f" l
- module_param(ccnt, int, S_IRUGO);
复制代码 0 u: a& v0 |3 p) V- Y2 b/ v6 @
7 U3 Z2 z/ M$ H% [$ L& }, W( F0 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) w4 M4 D9 {) x' ]arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 L/ b! Y' g3 Q- W# y, T0 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ t/ \! L& j, y
6 B$ o0 \# q5 Z% C4 ?* B- b" e" f; Z; q- C" U" [% \
|
|