|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; L- G3 k' l7 G
- [code]EDMA sample test application% O- G" d5 B) n0 ~, K1 Z
- /*3 p) t8 |* ?3 e8 u% s" _
- * edma_test.c
! ^9 Q: o9 y7 p N* p - *
2 H& [8 y7 s6 c2 Y* V8 q - * brief EDMA3 Test Application2 w; t7 T) g5 q2 @6 R4 q1 [
- *3 ?/ G6 }$ Q! O; D/ ^5 Q
- * This file contains EDMA3 Test code.
1 R; ]8 `$ e4 H. V) K: G - *) G" J8 P. L1 h9 J5 {* a* z5 t5 g6 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 F5 q& `+ f1 C; i8 d* j* b( s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ L( e2 J* q0 j: G/ [) U - * TO CHANGE.7 m2 i- c" a; O
- *
6 S. W0 f C- j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ W6 f- n/ Z X' j/ ?$ i$ t - *
2 `3 ?: S& u, T/ g4 A - * This program is free software; you can redistribute it and/or
, q; a0 N- d1 _ - * modify it under the terms of the GNU General Public License as
0 ^( @8 Z8 w ~; F0 d) v* p( F - * published by the Free Software Foundation version 2.
: R: p6 M, G, Q8 u8 r4 X3 c' ~* G9 x - *
, `( u- y# y1 p8 B- X. I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! z( g2 Q$ ? f( l" H: Q9 a - * kind, whether express or implied; without even the implied warranty3 \. h6 o2 ?9 N; w. |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
G7 ?6 M o. l7 @" ?' X6 W - * GNU General Public License for more details.
0 ^! {2 e) m5 i( d" x/ @9 K - */
8 P4 F3 l) U0 v5 v' w/ S: d: Y
* [6 G/ V: A% ]1 H8 e$ ^- i- #include <linux/module.h>+ q8 I2 l3 h/ r4 y! w5 f1 B
- #include <linux/init.h>- x; r: A8 k* f3 T4 w
- #include <linux/errno.h>% ] F# y8 R4 Q/ o0 V
- #include <linux/types.h>
Q% r$ G7 _( P8 q Z - #include <linux/interrupt.h>* n* ^6 F3 ^: C% b" n* b
- #include <asm/io.h>9 }8 o! k* L9 V$ A
- #include <linux/moduleparam.h>
3 j% n1 D: |3 M9 Z+ R+ q - #include <linux/sysctl.h>3 {4 @. g5 I# c8 {
- #include <linux/mm.h>$ U* ?' `, d, d
- #include <linux/dma-mapping.h>
. L& i$ @$ d* V7 C6 w8 i - & n C2 e; q$ r+ `* K8 N
- #include <mach/memory.h>
+ O7 O7 E% b' M& h - #include <mach/hardware.h>
; l7 \9 K0 u' s, D - #include <mach/irqs.h>
/ b# i. v+ \7 C' o- B - #include <asm/hardware/edma.h>- B4 d$ R5 j2 D8 }. b
( [8 _5 L. d) V) _- #undef EDMA3_DEBUG' U6 N$ C; ?" v8 Z' M
- /*#define EDMA3_DEBUG*/
+ _3 s/ d0 v( o
; j/ O8 x. b5 O I8 k- #ifdef EDMA3_DEBUG+ `& K' L4 \1 O1 [% L. J6 o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: \) a) i, g) p/ ^0 o+ p6 T3 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 P* C. d E: W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 a; c7 }6 S p# z! B, i+ k- w- E+ O - #else' p. b+ A/ T, n8 G
- #define DMA_PRINTK( x... )
5 a& v/ E* P4 {, D3 }" i8 v4 Q - #define DMA_FN_IN
6 R `+ I4 n2 F3 b! _ - #define DMA_FN_OUT3 e" |5 U8 J% X1 O( p. W7 [
- #endif
4 w k! o- r* P! J, i! v/ }+ O1 M
1 p0 q; D+ H' I2 `! j) x/ ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 d) | a/ @% f - #define STATIC_SHIFT 3
/ ?2 [3 N* b$ V- x+ \! Q2 P - #define TCINTEN_SHIFT 20
+ u) E9 c- C/ i% s7 N - #define ITCINTEN_SHIFT 21
4 m; h0 R7 w6 |5 `- M- A - #define TCCHEN_SHIFT 22
+ G- G4 f1 D- ]9 O; {) i - #define ITCCHEN_SHIFT 23( _9 }. G) S1 H9 k
- ; B. a+ d' D" U, v& s% ]/ i6 [
- static volatile int irqraised1 = 0;8 x% B& O0 }9 a. l' o+ i
- static volatile int irqraised2 = 0;
% A% P7 }/ _! V0 i3 N. w0 W7 ]
W' z! ~% P0 z+ t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 }8 R' ~9 i+ K, Q9 E: V6 [. L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 X% |3 Z8 e( Z* ?! T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x. p O$ a9 X8 V
) I4 w: b2 G( S0 J# c. c1 U- dma_addr_t dmaphyssrc1 = 0;
9 ^$ F) c: M1 o& z+ F4 n - dma_addr_t dmaphyssrc2 = 0;$ O% a; u6 h+ V8 \+ G, A
- dma_addr_t dmaphysdest1 = 0;. M7 u9 e! D4 R7 p* f8 }/ L! m( y" {3 j
- dma_addr_t dmaphysdest2 = 0;( y/ {8 F# v8 r) {2 J% M" W7 I
- ( M& j; j5 E- Q2 ~ q, ^
- char *dmabufsrc1 = NULL;
o" w; s6 a' d& ^9 f5 [/ k - char *dmabufsrc2 = NULL;( z4 h( i; y8 e4 q& X
- char *dmabufdest1 = NULL;3 L' g( L7 X( N0 v0 `0 w% S
- char *dmabufdest2 = NULL;! e& V# l; z8 X ]
% R7 H( w" |0 k, C- static int acnt = 512;: F! k. p$ S; ?+ z6 z5 S
- static int bcnt = 8;
( N1 a) x0 O; a# P - static int ccnt = 8;: Z. N7 z6 s0 w# o1 f7 |! a1 R, K
- / Q! R/ _& F2 r: _
- module_param(acnt, int, S_IRUGO);6 k( y7 l! | }" N. ]
- module_param(bcnt, int, S_IRUGO);
3 k( i( Q- k7 | - module_param(ccnt, int, S_IRUGO);
复制代码 ' }" U8 O2 M" F1 x- X ]* U, {
) h9 ^3 \% V8 k. f2 u. B8 z" G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% {; v: M, B* W" i' R3 \* f" Parm-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' g0 G* S' j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O( ?9 K+ J& s8 I
/ T' N$ c/ y5 Q L8 u4 ]
& w- r0 \% {( R: I, y4 Y. U9 U |
|