|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U: H0 Y v# x/ A* y- [code]EDMA sample test application
% _/ g* v d6 w - /*+ i5 e: A8 b0 r6 ? a
- * edma_test.c' y. Q. E( [4 L3 t* z0 W( l$ r6 I
- *
. l) p& ]$ s, ~+ r! \8 M8 F - * brief EDMA3 Test Application
) [9 n9 i( t6 Y - *
) R! V6 |9 K5 E8 K3 a - * This file contains EDMA3 Test code.
, Z8 `. o) w: j- [0 { - *
; G/ {# D/ z. s! Q0 D+ W& T3 J4 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 k% I* ~- H& W; ]$ n0 S# S) {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |4 H+ D* R' ^( v) u
- * TO CHANGE.
" b% O2 D9 s6 w3 N" F4 a8 |& M( `, F - *. ?3 n ^- w8 Y- q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% |' j8 w' x: u f `3 j% `$ b - * s1 U4 V; W( R+ e( S
- * This program is free software; you can redistribute it and/or
4 c, A2 R4 x: r- g$ f' O - * modify it under the terms of the GNU General Public License as
& \1 _ \/ {3 J, W( y+ L - * published by the Free Software Foundation version 2.
. H, e* n, Z: S+ C: W( s! f - *9 @# r0 A# R6 \8 n- u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
[7 s* A1 {0 Y/ s+ R - * kind, whether express or implied; without even the implied warranty; G7 B/ ]! E: p: x. p3 G. G$ t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 p8 F4 k3 a5 d- w- l# {% P
- * GNU General Public License for more details.
1 d; w0 M; s; L8 Q, D - */
4 @3 `9 n5 [% @1 H. Z1 r: w( T @
+ r5 s& e4 D! J- S' }! o- #include <linux/module.h>
4 l- h7 v! X }! D1 h) K - #include <linux/init.h>
3 G1 Q0 R0 {+ A. B9 d - #include <linux/errno.h>2 U4 K* c4 x4 s0 B8 F0 |
- #include <linux/types.h>
, z8 S. T' P8 i; [ - #include <linux/interrupt.h>+ h% D5 E0 `' N+ c8 f0 H
- #include <asm/io.h>
) ?: Q- f% o$ a9 P w m - #include <linux/moduleparam.h>
: _ _. T( I. B: P - #include <linux/sysctl.h>0 W+ v, m, V( K/ e9 B2 e
- #include <linux/mm.h>7 A& U+ _ u. N2 R& R, y
- #include <linux/dma-mapping.h>
) {/ u- K2 I/ P& r- ?" k - h# a; }1 q0 P0 I* g+ Z
- #include <mach/memory.h>7 u3 ?# w$ a" X9 g! |
- #include <mach/hardware.h>
* Z, e4 S* E' g/ {! T - #include <mach/irqs.h>
+ |2 c' j6 h' n - #include <asm/hardware/edma.h>% r8 H4 ~' Q/ C! p$ T& w8 j+ X: W1 { E$ g6 k
- 7 i8 ^/ v! ]2 i" \/ g! F8 t; u
- #undef EDMA3_DEBUG
& g8 y/ s* ]; M2 w - /*#define EDMA3_DEBUG*/
+ j8 N. L7 ?- r$ \% S - : X8 P& D9 A+ U# M) ?
- #ifdef EDMA3_DEBUG
5 ~+ m2 l9 V% b6 _5 j1 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C! f, n! y6 I, V2 R$ e8 u7 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* V0 F. p0 }$ X1 v4 D! e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 R/ G, V8 q" \. |0 O& C, l
- #else4 e5 @7 g1 ]( ], W
- #define DMA_PRINTK( x... ): G( u' j2 D& [' g
- #define DMA_FN_IN- Z% i3 F3 w9 ]% K; R8 @8 Q! U* |
- #define DMA_FN_OUT! N, q# E* S& v5 `: ?- ?
- #endif
1 ]* t, o2 x* Q: t
1 G; b; ?, `/ ^$ A$ J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' Q* o7 |- g- p3 U( w$ m - #define STATIC_SHIFT 3
! e( p [3 N- D+ G - #define TCINTEN_SHIFT 200 A# c# N8 P# H) Y! C: m' |
- #define ITCINTEN_SHIFT 21
0 W( | w- s% _* h - #define TCCHEN_SHIFT 22
1 F$ G$ R+ ?. ^) _, P4 ^1 L. x - #define ITCCHEN_SHIFT 23
( C+ i, T% z: l- i - 9 ?2 x4 }, R0 x; _) V: t$ b
- static volatile int irqraised1 = 0;
4 E3 A1 p- w# L7 S& ^. q - static volatile int irqraised2 = 0;
- N Y/ M( v }5 e( f( S$ e3 K - 5 V0 J: X9 h) p/ s, C Y$ n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s+ Q& G% ~8 F7 @) Y; l [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q6 t( a% @5 C5 a8 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, F: G6 h% k' V- C7 ]+ X
; c" U ` r& m2 ^5 v! N, N- dma_addr_t dmaphyssrc1 = 0;3 \$ m3 |' ?. f1 q! b+ p
- dma_addr_t dmaphyssrc2 = 0;8 Q8 ~/ ]. D4 Q( k& W, [$ [+ Q
- dma_addr_t dmaphysdest1 = 0;
, s9 n' W e5 q/ [' v+ s6 m - dma_addr_t dmaphysdest2 = 0;
" B; ]4 A# G/ d0 n% M
2 l! Q% s/ M) c4 o3 t& H3 t2 y- char *dmabufsrc1 = NULL;! i$ d1 m8 t$ A* w
- char *dmabufsrc2 = NULL;
/ z& R2 |: V( ~ u9 q( A% R. r) W- K - char *dmabufdest1 = NULL;
/ m$ x1 n! I( p1 B - char *dmabufdest2 = NULL;
7 [9 R: N5 q# s( C% Z- p# N' P
; ~% P2 H9 _, o: S8 K- static int acnt = 512;$ P e {9 R5 p- _5 `- N* S
- static int bcnt = 8;+ y0 V& `1 D/ x# |' O( ~
- static int ccnt = 8;& x* i& {5 y; o) w, [
- 3 c8 ^" u7 W( d ~. f! N; E, L4 L7 g% \
- module_param(acnt, int, S_IRUGO);
, T6 [* r' X2 |2 X. z4 g- y. x - module_param(bcnt, int, S_IRUGO);
3 [$ n, `1 C; i- _6 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 1 R! F$ f, J+ n( I, r
" k# l" i/ z8 w& O$ p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ?2 A4 X/ N/ [% Xarm-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& T, B- D& @; _, q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" \) X/ M5 ?- c4 P' Z$ {' C4 @
) k6 B& {, {7 @9 \8 z
3 |4 l M# D$ E5 y* u |
|