|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ g+ n0 G* \% J' ?$ J+ N- [code]EDMA sample test application) M; ]- i& T% w& J1 O0 S! A
- /*
2 Y$ _6 {8 p5 A' }8 W% X' p - * edma_test.c/ }4 `% C/ P3 t; ?0 C7 J/ T
- *( G% c0 H( G% c2 c- A% w+ u/ n- l
- * brief EDMA3 Test Application, t3 s& U2 w9 L& R) J! ]
- *. X5 D$ |' ]2 f& {1 p0 v5 Z
- * This file contains EDMA3 Test code.: n4 a2 K- E. F3 S
- *
" _7 X1 [6 ]9 A, E$ ~( R6 ?2 o% K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' N1 C2 B) H6 b0 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: @/ B& D) u0 r! z1 o- @- @% M - * TO CHANGE.
2 H5 u+ j) b- a! P) t! Q1 ] - *
6 l, F$ F* M+ I" h# [! d- r; W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; E' e3 b; w0 O' D+ d - *$ m* D8 ?3 g6 ]: N7 y
- * This program is free software; you can redistribute it and/or
( F5 J% t4 k8 l" r7 b' R$ S - * modify it under the terms of the GNU General Public License as- I) w. f; {0 H9 f4 i- S
- * published by the Free Software Foundation version 2.- G. Z5 i0 j1 t7 y
- *' b! K" ^! r- j6 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 G' ]4 n# t8 u2 ^" ]! B - * kind, whether express or implied; without even the implied warranty- G5 }' i% f P( B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 K0 O1 \+ B1 a1 @% M) e. v9 Y - * GNU General Public License for more details.# ]& w) g/ V- A0 Q$ T
- */; Q6 d3 w0 s0 L0 W5 Q: J
- / e+ S4 h; [0 ^. C$ J! K
- #include <linux/module.h>
% U' Z1 M9 F& x% e - #include <linux/init.h>
c* z; W4 M7 C# u& k- h2 h$ o8 Y - #include <linux/errno.h>6 s' j5 k- P T, a) j+ ^/ ^
- #include <linux/types.h>+ n6 s- k9 T; a: P! i2 S
- #include <linux/interrupt.h># @# l- {4 w {1 _' \
- #include <asm/io.h>
- n' t( B% W' _" \6 } - #include <linux/moduleparam.h>
. Y! S e9 |& b - #include <linux/sysctl.h>& N/ X& e& m5 x8 M. C: m
- #include <linux/mm.h>
8 }$ h6 M" z1 ^- F5 B' r7 G - #include <linux/dma-mapping.h>
# ^9 n4 }& y! A. T( U4 A - * Q) G$ X4 Y) g9 M
- #include <mach/memory.h>
& u: i( e; A7 t4 k# V" P4 S - #include <mach/hardware.h>6 } }1 C i9 M$ F$ H# w
- #include <mach/irqs.h>% }5 d2 X( S7 s. x0 }
- #include <asm/hardware/edma.h>0 _) {( H' ^9 O7 L8 {
- 5 I; t8 o( V6 Q- W+ c# \3 \
- #undef EDMA3_DEBUG" P7 [3 w& q! X0 w% K( k
- /*#define EDMA3_DEBUG*/, P! Y1 U# d+ M: f! k
- ; j( \* T* F5 [' P/ r! f: O7 [
- #ifdef EDMA3_DEBUG2 L i2 I( w$ \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. I) \. H; ]0 r$ W. V, Z9 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- O' r! I) h: f/ Y ]( @8 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. E J& p' y4 R4 k) a - #else% N( c5 o0 n( n, F) ^
- #define DMA_PRINTK( x... )
/ R, ^3 N0 K0 C8 X9 l3 u$ `* o - #define DMA_FN_IN
2 r4 {: b4 Q% |" z+ t - #define DMA_FN_OUT1 i, F: }2 H; ]( A9 u1 l. T
- #endif
* Y/ N- f7 _0 j* J0 @ - 1 H4 J7 w2 Z2 t; q' \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 @$ x) S9 E* P7 B - #define STATIC_SHIFT 3
% k9 V) K7 ?' i9 D - #define TCINTEN_SHIFT 20& V9 v a. ? j s
- #define ITCINTEN_SHIFT 21: p* A; ]: K; b) p8 p- f
- #define TCCHEN_SHIFT 22: R" [' E2 k# ~" u
- #define ITCCHEN_SHIFT 23
8 m$ }* c0 d/ l) S
% Y1 c. v0 ` y- static volatile int irqraised1 = 0;1 i. E# d' H+ l. j0 Q$ ^
- static volatile int irqraised2 = 0;
& A7 A* z2 d5 g; e/ P2 h) G+ C
- `) |: l5 g1 \( N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y8 R6 K& L. e' T* b2 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l, [9 H% d" d; B5 G* e4 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q2 F' c2 _8 M
% K4 n: `3 g3 B' D8 f2 S9 A- dma_addr_t dmaphyssrc1 = 0;
0 T2 X0 Q' r2 ~+ I - dma_addr_t dmaphyssrc2 = 0;* q& |' P# s6 h7 a- [ o2 L0 |! p
- dma_addr_t dmaphysdest1 = 0;' N" K" B; h8 S$ B: d
- dma_addr_t dmaphysdest2 = 0;/ s. e, c* m3 M/ Q) X; \
5 E2 K' }2 U" J" b6 U- g* k# Z- char *dmabufsrc1 = NULL;. _) r: m* m9 o& R5 d
- char *dmabufsrc2 = NULL;
S4 ]6 H: [- q# e - char *dmabufdest1 = NULL;
4 X9 t% ^: _. v0 e- L. t- R - char *dmabufdest2 = NULL;5 i7 K' r' b o2 V% @+ I
- J6 G: P! O4 z- e, O+ E% ]7 O- static int acnt = 512;
+ C: P; [7 }6 h7 i - static int bcnt = 8;. q& L9 D8 `' K* X' s0 U
- static int ccnt = 8;
, b5 h: a, j. `$ } - & B: G8 ~6 K+ Q" k3 q
- module_param(acnt, int, S_IRUGO);
" y9 {5 ~! ?. w1 j - module_param(bcnt, int, S_IRUGO);# G8 f+ m* J) X+ N9 x
- module_param(ccnt, int, S_IRUGO);
复制代码
( P* C; o: ~1 g5 z6 i; {/ C0 |+ c8 E1 e* C* d2 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 o5 b/ b- D- X4 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 X% h h, M! k" a5 j, V1 c4 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! C, u6 q5 j) p
) d0 a8 k5 @. j( L' M z& @5 I. G) B- ?
|
|