|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ]# f- r* c" A6 O- [code]EDMA sample test application# O' h/ x8 B/ X1 p" i' ?9 a
- /** ]: A' v$ T- i9 `! M+ J! c. X
- * edma_test.c5 j& e; W1 O2 B* A8 t
- *! y- Z0 n. p& p8 l
- * brief EDMA3 Test Application. B& J/ u& _: x1 X L% Y
- *
3 |6 {1 o: }! E+ u& _9 t - * This file contains EDMA3 Test code." p) U; W! h. W$ p6 O0 V: ?7 ^; X
- */ P" z$ N* b! W4 L5 @! N7 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Q/ z& |. S. q- U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ [+ ?" u H* _+ ?' l: Z - * TO CHANGE.& @/ N% Q% \" P$ S
- *: P. [# V0 A" c W" u& N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' E3 S! m8 z% j - *
( y' H/ m. P, a% X E. j( ` - * This program is free software; you can redistribute it and/or
|; x* b4 F$ B0 H! ` - * modify it under the terms of the GNU General Public License as- l+ ]; }' i* O8 W
- * published by the Free Software Foundation version 2.
4 t% V1 W; O. d2 O5 D/ } - *; f. d9 @$ h& Y6 M5 X! x0 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 W0 }- R9 G G4 ~1 v - * kind, whether express or implied; without even the implied warranty
% B- U9 k3 E# Y z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; X6 c8 l0 I! z4 M( y5 y q# _: S
- * GNU General Public License for more details.4 ?! l w* D; ?7 P5 I+ A+ g2 y
- */: @( G) p; m1 V* ?( T! Z+ Y# ~
- $ h8 |& r7 [' m! P4 k4 i& j
- #include <linux/module.h>" c7 u4 Q: l, `# }% k9 E6 J
- #include <linux/init.h>
* O$ k2 K/ [2 f - #include <linux/errno.h>( ?7 v0 O# y2 i: x# ~" L2 D
- #include <linux/types.h>4 N- B6 B& @/ V- o' n
- #include <linux/interrupt.h>0 K* n0 ?9 k5 W
- #include <asm/io.h>
) K# W6 e' ~. E4 b' J - #include <linux/moduleparam.h>
0 Z) B! j6 S' y' \ - #include <linux/sysctl.h>
, Z( c- l. n3 J9 A1 E, \ - #include <linux/mm.h>
9 w/ v6 U a8 {0 j - #include <linux/dma-mapping.h>4 B# ?. O. j% z& p5 M5 n
' q3 t$ f) W, d- #include <mach/memory.h>
& H+ ~( o9 D! M# G8 D0 Z; S6 h - #include <mach/hardware.h>( {1 V" ?, R. z$ s0 y
- #include <mach/irqs.h># ^3 i( [+ a" k5 b! j" N% f# ]
- #include <asm/hardware/edma.h>3 ~2 u0 U5 @% Y& a- t( S
3 P3 N6 L) h/ b0 b9 G$ Q- #undef EDMA3_DEBUG, X. M1 o+ ]2 ~2 h0 l+ D9 K
- /*#define EDMA3_DEBUG*/
9 {: K ]! t' }/ z8 i - 6 h! u7 K y7 y9 j
- #ifdef EDMA3_DEBUG) Q" O3 I: n& Q" J( {% |# q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! {2 T% y- e8 W! X# V1 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s) S8 e8 o' f' m4 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( R7 c% J7 C4 J+ ?9 j6 f% o - #else
K+ m' n0 B; b - #define DMA_PRINTK( x... )
/ H3 E6 {, v8 z4 _ - #define DMA_FN_IN
Z) F6 h4 f: T$ s - #define DMA_FN_OUT
( C- R6 f* J) c3 S) w/ i - #endif. j" |7 C, p9 d# u2 r7 O p+ j9 z
: `6 {2 H+ k. t6 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768): }% g* `/ I& p) b
- #define STATIC_SHIFT 3 B1 w3 S, r6 Q
- #define TCINTEN_SHIFT 20
9 N2 p+ J2 }. X" P _ - #define ITCINTEN_SHIFT 21) e1 J8 b s% x7 D; m- n: ~' |
- #define TCCHEN_SHIFT 22
$ U4 z; u5 H9 D0 F: n8 ` - #define ITCCHEN_SHIFT 238 U+ q$ r6 W. ?' K: @. X1 \2 x
. N$ R) A/ a8 y2 u0 @- static volatile int irqraised1 = 0;- Q5 G$ M# p& ]8 O6 i& [: P( c6 i
- static volatile int irqraised2 = 0;2 g2 d- n3 @( B. k% z; G" [
- ( a: F; z- ]- {2 k, n [" U0 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T6 E$ Y& q6 i* T6 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X( [" R. z- s. p I6 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X; v5 G& g4 t9 r+ L - 8 h' W: {( a- g0 z
- dma_addr_t dmaphyssrc1 = 0;5 p) f$ C, H0 r g
- dma_addr_t dmaphyssrc2 = 0;
, M& {; b( h' ?5 V - dma_addr_t dmaphysdest1 = 0;7 L; e% l8 A9 x" t5 `
- dma_addr_t dmaphysdest2 = 0;
9 k0 r4 i9 e+ ?! L6 l6 k
; ?! r4 E, X2 Y) z( D0 T- char *dmabufsrc1 = NULL;
- @* t8 [0 F: w+ i - char *dmabufsrc2 = NULL;
/ v' P" Q1 w& X$ W. o" v2 q, S) p; r - char *dmabufdest1 = NULL;, j8 m, H( \9 | t8 _
- char *dmabufdest2 = NULL;
E+ x/ i6 x) w9 J ^
' N" q5 O" F1 m7 T' b- static int acnt = 512;
v n3 c" \0 i5 F - static int bcnt = 8;
; X4 }: ]- z+ }' {* R. V - static int ccnt = 8;
+ m; r, Z6 N/ H: q
( b( ]4 P& _( ?) V/ s: _- module_param(acnt, int, S_IRUGO);3 U7 ? @/ C5 V2 @3 V4 X7 m
- module_param(bcnt, int, S_IRUGO);& ~3 S) W0 K. R% k. Z: [) R) r
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ?; |) c7 ~1 G4 p
. g: N E5 I. e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 |0 A/ u: v$ I: x. M- W. s+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ v+ p( h( g2 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 D4 c% e$ Y1 v& a9 F
6 z+ `9 P8 C9 Q) r* i, ]+ i: d+ r5 L) w
# k8 g9 x* a4 L4 A; Y |
|