|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! R! @# W$ @& r3 }0 [5 {3 ?
- [code]EDMA sample test application$ I: m. Q3 Q8 L7 x4 B7 g9 ~
- /*
* E w2 u1 Q9 x& p* ]: Z - * edma_test.c
- u) N) O5 L5 F/ E. o - *
. L9 `2 i$ P0 v6 |! w% u8 f - * brief EDMA3 Test Application
e' m- ]5 q) f - *
; b W" j& a& V8 c+ F6 O - * This file contains EDMA3 Test code.% B, q+ k/ j% H5 c; y
- *9 U9 ~0 a# s; K. U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 M) f! M ]8 ]6 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) W, F. a, B) O% A - * TO CHANGE.
- t9 Z; ^3 ~9 b5 v - *
8 _ Y' q* r9 r& Y5 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; H+ d1 j d, T
- *: @- c" s( g2 ^& u
- * This program is free software; you can redistribute it and/or
' d- \7 ?2 S q" ? - * modify it under the terms of the GNU General Public License as
$ p2 T" d3 ^9 f# b: @* ^+ q - * published by the Free Software Foundation version 2.* }* G/ R" N& m; Z8 c
- *
+ s- b E* _# m* o- s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: V! x2 t8 e# y; s- B* I0 s - * kind, whether express or implied; without even the implied warranty, T4 t" H. O. y5 L- |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 y4 u5 A8 C; n, \, T! l! o - * GNU General Public License for more details.
2 Q% Y. u3 H( R% e' o) B - */
* P- j1 S$ e8 H/ F - 6 J; }; \+ w! R- ?) ~
- #include <linux/module.h>
1 I7 I. z; A/ B% _6 _7 M; b6 W - #include <linux/init.h>) l! C+ q+ V# q4 M8 G7 W
- #include <linux/errno.h>
: R4 K9 Y6 \" S. ^1 [' J" m8 @+ j - #include <linux/types.h> ?# }( _: |2 G- w3 W/ l1 G
- #include <linux/interrupt.h>
( J9 b" R& _$ z8 ]! z. l; z - #include <asm/io.h>
# N4 R* V ^' z3 V0 m$ W - #include <linux/moduleparam.h>3 @8 ]6 a1 T+ H1 [
- #include <linux/sysctl.h>6 L/ |. p0 n1 ^% E& {
- #include <linux/mm.h>+ _" `+ }$ ^6 ?% L8 f
- #include <linux/dma-mapping.h>
% S6 U2 H3 G# |9 P2 W - ! E% v" B4 P7 f$ N; S6 B O5 T
- #include <mach/memory.h>$ H# L+ g6 o8 V; t, l6 R
- #include <mach/hardware.h>' k* `3 ^( d. ~
- #include <mach/irqs.h>4 c0 X8 U. K; X9 `# Q9 K
- #include <asm/hardware/edma.h>
: R. O/ i0 h2 `0 I5 t" ?
* F0 X$ x& }# L- #undef EDMA3_DEBUG
$ a- V7 u+ k% n( i) k# E, v - /*#define EDMA3_DEBUG*// J3 ^1 @4 z. ~' x
$ e+ U c: X& S+ }$ b s) l- #ifdef EDMA3_DEBUG
! R9 J- l& H5 v k2 f& l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G& w. C9 d: `* A3 `- J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 B6 s1 l$ s8 [+ H; V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h6 c+ X+ _6 Z5 R v C5 z
- #else9 {' Q5 N8 r% u+ C) w1 g7 Z
- #define DMA_PRINTK( x... )
* x" v( B: U/ m - #define DMA_FN_IN" X7 t r4 Z8 M% l3 f- `
- #define DMA_FN_OUT/ L8 i/ Q& I7 Y2 U7 Z
- #endif2 L2 h) a* D8 B
# H! x8 U) Q# d) u6 U" \, [. c) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* }3 }5 Z* s( _ | - #define STATIC_SHIFT 3
- M! a9 H9 o- S - #define TCINTEN_SHIFT 20
6 e* c; o Q/ ]) C2 N - #define ITCINTEN_SHIFT 219 G# C9 Z. Z( E8 s6 N$ \$ g
- #define TCCHEN_SHIFT 222 E: P/ n. \9 @+ w5 `
- #define ITCCHEN_SHIFT 237 ]9 v: w5 @9 w( r
' g4 s2 _) |. Y% d0 i3 i- static volatile int irqraised1 = 0;
) u3 F0 j! \# F, a+ | - static volatile int irqraised2 = 0;
" ]4 }+ r( r7 v3 f3 M, v
# d. M/ R: q: n$ P3 U6 J' l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 I6 E2 q1 J+ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r3 j7 g& n. U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w( P: {% _* ?" U7 T' G+ a
4 M; I& I0 o* c7 }; A0 ~0 T; g T4 V" q- dma_addr_t dmaphyssrc1 = 0;
9 x, P5 p9 w6 n# p6 j2 T \ - dma_addr_t dmaphyssrc2 = 0;
( f6 L1 G' p6 s7 p - dma_addr_t dmaphysdest1 = 0;
& o+ \9 h/ w' N8 \5 N+ o/ k, m3 F - dma_addr_t dmaphysdest2 = 0;* P# L. o# k* E @ p g5 n
6 z2 W |8 G# Q. ~/ _& w- char *dmabufsrc1 = NULL;
0 { `, u l5 t' E) h - char *dmabufsrc2 = NULL;, i' e# E- H5 _- r5 `
- char *dmabufdest1 = NULL;
: R. N, ]( S: A3 o, f- W - char *dmabufdest2 = NULL;
5 s. w; S6 F0 Q - $ u" }' \$ x; ~4 z) A- g+ _7 `4 Q
- static int acnt = 512;4 K8 ?$ ~( M4 I0 ~4 ^/ A
- static int bcnt = 8;) F- q9 ]4 B7 h1 [, l$ J6 }. H4 a; r
- static int ccnt = 8;
0 C/ o* e# I: M: I
: m% Q4 _5 \* `. p- module_param(acnt, int, S_IRUGO);
9 i. M0 l$ k! i: ~; } - module_param(bcnt, int, S_IRUGO);' K2 K3 O" } N7 L1 S
- module_param(ccnt, int, S_IRUGO);
复制代码
" U y. v5 e/ z& }9 |
) D# _' C& Q) V9 x5 z: b7 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* E* u0 I/ w, p* y. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c# Q( j3 T8 z& W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G, X/ D! ^& b5 c
1 c4 y/ x2 F; V6 l9 g) n7 T8 E1 _2 Z
/ v7 _; ^% p+ X0 I& H |
|