|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . |! h( R% U: U* N6 i3 u' L* i5 K
- [code]EDMA sample test application
+ h6 j# ^. o& x, B; a( Q& J8 T. @ - /*
( V8 _6 J! p* c. M - * edma_test.c; @( ^4 \5 m" X3 r: `
- *
; e& u; Q+ G9 O5 O4 }1 k - * brief EDMA3 Test Application( v& P/ j% J" X7 Y) I4 K
- *
$ X6 Y" P: c& b8 k/ h# U - * This file contains EDMA3 Test code.
1 ^. {/ q3 g3 d1 H' B - *
+ u* `# n4 N3 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE y0 _5 v( l/ x. ^, K1 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ @5 T8 Z, ]3 Z/ D - * TO CHANGE.+ |$ U* u" k- [: p
- *
- D* t4 U/ ~' T3 A; ^2 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ H, C0 Z. f* ]9 j0 \" b0 Z
- *
9 l' B1 `& }* P" O F. ~. \ - * This program is free software; you can redistribute it and/or
7 t( _% v+ X( R2 {+ b - * modify it under the terms of the GNU General Public License as! T$ n+ V; u' v; V' U
- * published by the Free Software Foundation version 2.
, E7 k- X" X a( N4 j7 k - *' [& U/ D& Q" F4 e( ~9 G5 u6 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 [: [( s: \2 `& P7 X( W: b
- * kind, whether express or implied; without even the implied warranty
, }6 Q8 C, l0 m+ h3 D6 C! o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 u6 u% q; \# q& ?! u+ ]& d2 h9 G
- * GNU General Public License for more details.7 M. h( ?$ s4 J
- */
2 L1 z6 u; G. Q$ O% O
: s4 i8 n/ J1 h5 P! M* z: n- #include <linux/module.h>9 N( t3 r0 F. b
- #include <linux/init.h>
# f7 {/ Y. C! _, M5 f1 D - #include <linux/errno.h>3 ^; t5 n/ e2 W4 P- O4 X
- #include <linux/types.h>5 k6 O: E8 K& h; ~" I& o) O
- #include <linux/interrupt.h>( M1 \% [! ?1 ~4 O
- #include <asm/io.h>
3 G3 r- y' v6 a- l* _. x6 U* ^% V4 L% v2 d - #include <linux/moduleparam.h>8 N" D/ Q5 _* A+ N
- #include <linux/sysctl.h>
4 d) B( e6 |$ s. w7 Q: | - #include <linux/mm.h>; J! ?6 M4 u) ^+ d( M1 g5 N' Q
- #include <linux/dma-mapping.h>
$ H5 l. P& M/ N. v& @ ~
- S4 l5 O: f2 b) n3 u, s/ a: k- #include <mach/memory.h>) [" S1 S& \ X) q1 `3 q% P
- #include <mach/hardware.h>
3 _0 C3 P0 C, _' E0 \' e - #include <mach/irqs.h>, u, @ [. u/ A3 E3 |( S
- #include <asm/hardware/edma.h>
3 U- {' [* t6 v8 S' _
3 m- M! f6 W: ?7 W- #undef EDMA3_DEBUG k( N, Q6 i7 N* U
- /*#define EDMA3_DEBUG*/
4 C A# P) J8 [9 @/ n& n( V/ Y2 V- p - 7 v1 @; `7 Q( V+ m. y
- #ifdef EDMA3_DEBUG9 C/ a$ l; Y# Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ a* L: e9 B# Z1 e7 V) b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 [! Q0 g% X) H7 c6 o& d, L$ V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" _) W4 D' q1 b p# A2 W
- #else
$ ~7 E/ C# v: b - #define DMA_PRINTK( x... )
( {" j3 F& }; I9 W4 I - #define DMA_FN_IN- n+ I5 k' D3 y* u/ q/ S& N: u7 i
- #define DMA_FN_OUT
9 O5 K& {8 D% q D" p% l - #endif x7 C. T N; d# A5 W4 R0 q$ w
- $ V0 W4 q* q7 J7 f# j$ c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 k2 `4 l& p s b4 x2 u5 Y; N5 U
- #define STATIC_SHIFT 3
- ^1 i; A: D8 j- P! ~ - #define TCINTEN_SHIFT 20
6 E: A. `1 C" m# u7 G! M - #define ITCINTEN_SHIFT 21
" k% `2 @& B( K3 C$ m - #define TCCHEN_SHIFT 223 i) r+ l+ R6 ?; d, P+ u
- #define ITCCHEN_SHIFT 23
4 M/ G6 Y8 }% {1 T - 1 a$ y2 k) V& a' }: f% S
- static volatile int irqraised1 = 0;
8 r8 r: X( B3 R0 d0 ~ - static volatile int irqraised2 = 0;
' X4 o) S6 L: m( Q) H
* K4 B/ C1 Z: z9 U$ r* R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; H% R9 p4 V# O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a/ M9 F, V N1 @+ @4 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S7 ^; I+ \, o - $ p* H. e2 J& ~9 a
- dma_addr_t dmaphyssrc1 = 0;
$ o$ b: e; p; } T8 Z% ~" a - dma_addr_t dmaphyssrc2 = 0;
( @/ u; A% d% s. W. P0 U+ J2 G4 e - dma_addr_t dmaphysdest1 = 0;7 l1 ^2 M& |, d( ]
- dma_addr_t dmaphysdest2 = 0;" L4 V9 d0 Q' |" _3 Q3 i4 K
- . x1 T; a b/ w
- char *dmabufsrc1 = NULL;
5 x4 g% J; Q' g2 _$ c& c4 ~4 W - char *dmabufsrc2 = NULL;
: a3 c. d3 X9 m9 d/ a - char *dmabufdest1 = NULL;
( N6 J, P0 g/ H, o. t - char *dmabufdest2 = NULL;
- V2 U1 }: J' X+ a& I9 w1 S - & y3 x# [2 z2 J+ G: ~( t2 G
- static int acnt = 512;
0 R4 C. l' Q0 h f5 ]( Q) ^ - static int bcnt = 8;
& H8 G2 c4 s# T T; E - static int ccnt = 8;' b6 U$ W) [3 f7 | n& z
: Z2 X7 r- f1 ]1 `' p- module_param(acnt, int, S_IRUGO);; S, ?3 J6 U! }* ~
- module_param(bcnt, int, S_IRUGO);: X1 p* ^2 p1 i6 B+ N. W
- module_param(ccnt, int, S_IRUGO);
复制代码
3 ^* z: K" m3 `! L! t6 x1 Y( P e n3 `6 F- u C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 M ]! I; K- j! `! S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ I& l2 D( l7 _) }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 k' X8 J' Z2 m, Y4 V- q( l9 S% Y) `8 V: J8 C6 x+ J
& I" h8 r# l; K& Y- d' v
|
|