|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z, }* r5 o* v/ y
- [code]EDMA sample test application
- V, j5 U3 w* C' k- C( O - /*
/ \0 }0 T- ~' B2 T6 s! X - * edma_test.c
3 U* V2 X0 _- e- N) z; v; |0 q - *& C7 ]2 p. v0 x5 Y( t3 w1 f
- * brief EDMA3 Test Application
& A) g4 z/ ^/ |* r: l0 B - *1 E. h: z h* R. H9 e2 q) _( ]
- * This file contains EDMA3 Test code.
: A" F5 k. `; U5 Y- L7 u - *( U8 v! f* O4 O. [, x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# S; m. h) C- ] M0 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 W, v" d6 D6 Z& ]; n
- * TO CHANGE.
9 z1 A% a3 p) o - *
8 v- r! k9 l l/ @% d3 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# y' |) t* V! ?8 D - *+ {1 G: i* D0 Y7 v& M, x0 v% H9 o4 q
- * This program is free software; you can redistribute it and/or
% h# \- k( w0 M- ]6 L& @9 A - * modify it under the terms of the GNU General Public License as! R& U4 f$ e" y4 m. u, o& {0 L
- * published by the Free Software Foundation version 2.
, q( H% y. J' f2 ?' l6 w - *
A; `1 ]0 s/ D% n, B1 M. r. G, P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ L; N$ Z2 s; z - * kind, whether express or implied; without even the implied warranty* ~/ Q* E) U0 Y. R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 Y, p/ j3 s o& x+ G
- * GNU General Public License for more details.+ E7 J% I, X6 k( F( g
- */
: J& ?4 F1 c3 f7 a# q - ' U1 N0 y0 o4 g2 ^3 N9 x
- #include <linux/module.h>2 o# T* m7 w. Q l+ o% A7 {
- #include <linux/init.h>
" h* v h1 V2 M. W* A3 H/ y; U- V - #include <linux/errno.h>
L- D ~- A X - #include <linux/types.h>
* i" q- D5 O) P$ e - #include <linux/interrupt.h>
: n' y( F1 d; _# x r* Q# [; y - #include <asm/io.h>, s/ a" k6 C9 Y1 u: b- H
- #include <linux/moduleparam.h>+ W+ r A8 i1 g% j
- #include <linux/sysctl.h>
6 A: Q, R( T; `* v - #include <linux/mm.h>0 R( X0 g& |0 Q) g8 C- Y! n
- #include <linux/dma-mapping.h>
6 y e5 t1 ?0 P$ J - . y5 \" K3 t6 _- ^) w
- #include <mach/memory.h>' _8 ?0 Q( A3 X1 @- B* q
- #include <mach/hardware.h>
" j/ f1 n8 t# `# b9 i$ b - #include <mach/irqs.h>3 G0 c' o" A2 J2 I7 a8 p
- #include <asm/hardware/edma.h>, \% w4 }! I$ G3 M4 V: }+ j
- 1 |8 N0 [0 d6 }6 `+ u" L
- #undef EDMA3_DEBUG& ?% S+ ]9 g0 g8 }+ I
- /*#define EDMA3_DEBUG*/7 Y3 f6 ^* J8 v x# i
$ q' J# ?( A: H, k' p2 R F; E0 d- #ifdef EDMA3_DEBUG2 p( b" W [2 J8 f1 \, u- |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ^; s. Y3 \! B# ?/ o2 ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 K$ _7 Z* z0 a& B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ w( n: X8 ^; ]/ B7 r+ Q* H' u% j+ M
- #else& v1 p* h1 K8 V0 H# j4 x; c6 }
- #define DMA_PRINTK( x... )
4 R1 F V) F0 k4 v, }( F. N - #define DMA_FN_IN# I9 }2 ?9 x. d! Z: [
- #define DMA_FN_OUT
7 T* w( R0 b. l, c- D - #endif' v- P4 m. b% V9 Z, Z7 E- `; l
- / d( x! K9 n8 P- M; n; g; p8 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); _0 s+ u. |) T: l) ]/ l0 P3 S" Z
- #define STATIC_SHIFT 32 S7 k; S T0 V: C% |- }: M
- #define TCINTEN_SHIFT 20% J3 m" h( W1 W$ U8 N
- #define ITCINTEN_SHIFT 21
8 |( @; k6 G' l8 s% i - #define TCCHEN_SHIFT 220 s! `* D1 u& m% n9 Z( ?
- #define ITCCHEN_SHIFT 23! G" b- _+ ^: V! C
6 t% C h7 K. `0 N' _' V% ~+ i# }- static volatile int irqraised1 = 0;
" [4 ?* o' T. I5 J a# e - static volatile int irqraised2 = 0;
6 A# K0 I6 f- q. u% ?% i* _" F - 9 e- x. T; D G! p% h) d8 v$ b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S3 s& q% V8 [8 g, |! z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @+ m9 n& \8 ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @+ ]4 a. s7 V! ^
- " O/ M, v M* Z9 k O# b+ h& z
- dma_addr_t dmaphyssrc1 = 0;, u5 X- P9 ~1 o5 V! L6 O# J. e! K
- dma_addr_t dmaphyssrc2 = 0;! j" L7 U7 v/ F4 z
- dma_addr_t dmaphysdest1 = 0;, ? |3 b- l% e, ]7 w! u
- dma_addr_t dmaphysdest2 = 0;4 P* x6 e/ f' v; u1 e
+ @" K( i/ A, Q# W+ X- char *dmabufsrc1 = NULL;
7 T8 a8 o% x, w7 Z5 V6 H7 q9 H - char *dmabufsrc2 = NULL;
& a3 ^( c. ?; B# Z0 O& x: b - char *dmabufdest1 = NULL;
6 X* G: `/ u- y, K - char *dmabufdest2 = NULL;0 g1 [% y t. c* l
6 b$ t) V( G' m- static int acnt = 512;
) @ r4 h3 R+ i4 h) a! D0 i( W* j9 I - static int bcnt = 8;
l" O0 m* L; A- z3 |. o - static int ccnt = 8;2 |( Q" d5 S. s c
- 2 w; G' j9 j( J9 ?' y3 x( j
- module_param(acnt, int, S_IRUGO);
1 ~ n, a' ^# M* ] - module_param(bcnt, int, S_IRUGO);
9 v6 z& X* B- Q) M7 e - module_param(ccnt, int, S_IRUGO);
复制代码 ) u' {5 c) w, L, J. X
) U' @6 o! r' ~5 J+ g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 M2 F' B/ g( g5 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' n9 |& Q; o/ S& L# s3 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w: r% d* `, w4 _' V ~
% S% f$ {$ r* W; p7 }$ E5 ?5 M. j6 T% J7 [+ r& f
|
|