|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H/ }6 n) q; V5 p
- [code]EDMA sample test application
0 t4 x& p( }& n; R# ~. D- g - /*$ P7 d0 e- S! f8 Q
- * edma_test.c2 o2 \. g9 R5 v" f$ U! d, h
- *4 Y- g6 F! {/ o
- * brief EDMA3 Test Application# E4 ?$ ]& G" ?( |* w- R
- *% x. ^. j y6 I- b: I
- * This file contains EDMA3 Test code.& m$ n/ d) Z p, V: r
- *0 ~$ \' ?# U$ f5 Y! {2 E9 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 i4 m/ z' X3 `1 I( H% E" P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 z* Z. v9 j$ [. B7 R$ ?1 g/ p
- * TO CHANGE.
: ~9 I7 Q! y- d* u, W6 R - * q i. }$ m9 X2 v" B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 |: i1 V( c% r9 [ - *3 E2 I! M ?- Q
- * This program is free software; you can redistribute it and/or
4 D9 r: H% {( z5 H - * modify it under the terms of the GNU General Public License as; L& ]* N/ S a, M
- * published by the Free Software Foundation version 2.
: p, d P0 N) Q6 C- o - *
* Z: t9 L0 O" o( s8 U- U6 C7 W" F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: z a! i y$ s' a, E
- * kind, whether express or implied; without even the implied warranty, { h8 N# K" X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 a* r" p% X! i' [; L - * GNU General Public License for more details.
& ~% }) S& a) t. c - */
" W q! J$ f* S9 D7 B- l( N! {: @ - 2 k$ p9 {1 i: d7 i) d& D
- #include <linux/module.h>
& h% S$ x! Q$ k% I- k! x, C: T" | - #include <linux/init.h>" n! b' @* L5 N o. w
- #include <linux/errno.h>+ r. U9 Q) k/ X& p
- #include <linux/types.h>
3 v2 g7 Q. b: A2 m0 [ - #include <linux/interrupt.h>/ d; [& H3 Y2 N) Q! z
- #include <asm/io.h>- K# ]2 W4 } A0 @- o9 s; i! P
- #include <linux/moduleparam.h>
+ E5 S* k( Y2 n7 K5 O4 ?1 U- e - #include <linux/sysctl.h>) Y2 Y9 {& U- H5 p, M1 I
- #include <linux/mm.h>: f# F- `; b! A) R. v
- #include <linux/dma-mapping.h>& ]7 h) u# E( @- O3 J" B0 R! `. w
2 O, s4 K8 ^7 C- #include <mach/memory.h>
- ]" B. m3 N& N. s. C - #include <mach/hardware.h>
: T& d( f& ?! j. n! w: A7 L6 L - #include <mach/irqs.h>/ s( C- G! d, _/ S
- #include <asm/hardware/edma.h>% W5 T& n: E t* K1 J) f
- + m4 T" _3 f/ y" {, u# y3 \& t& r+ k
- #undef EDMA3_DEBUG8 _1 a+ g ^$ J o
- /*#define EDMA3_DEBUG*// o' A7 H/ t# |. u ~/ y* w
3 h; h) J. e7 h. N- #ifdef EDMA3_DEBUG
9 A$ E2 W* e8 H- W/ B; M" X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r, a2 n! V# B% C" _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- _' I6 H- i* H$ _; l" i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Q2 B( z& q8 |4 r
- #else
v, b( ?8 t0 v s - #define DMA_PRINTK( x... )2 R$ @* t. Z6 `0 m4 ?7 o& |7 j
- #define DMA_FN_IN
/ d2 m5 X3 `. X - #define DMA_FN_OUT% ?2 {0 z7 a; W
- #endif
. |& x4 c4 j0 I* }
) w, l* M, L/ L/ | u6 r) R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" ^8 k" Z" ~* D& B6 y0 U; R
- #define STATIC_SHIFT 3! y6 D7 h; z' ~
- #define TCINTEN_SHIFT 20, ?2 {5 A, g6 Y5 c: T$ V% V: ^
- #define ITCINTEN_SHIFT 21
1 P. ]- J9 x L- x& R' s* d5 I* ^! z - #define TCCHEN_SHIFT 22
& ?9 r( U: Z% n4 F# D3 E - #define ITCCHEN_SHIFT 23
2 x+ m! J8 A7 a7 s/ a - % O! ]0 G3 T4 w, n. a( O; Z
- static volatile int irqraised1 = 0;
$ f( W) r2 M0 D' G' c) w - static volatile int irqraised2 = 0;0 z. L/ r1 W9 m1 C* `
# A$ W$ X5 o B3 t& A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K9 ` o2 R$ J4 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R3 n; D2 F6 u( U, k! w0 B3 p9 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 g" ~) g1 N# k5 _/ c* K - 9 ~. x: O. l0 J7 V
- dma_addr_t dmaphyssrc1 = 0;
2 s5 n7 K2 T" S7 P7 U8 Q8 K( h+ A% J - dma_addr_t dmaphyssrc2 = 0;# w, N- W. d7 b: W7 j4 Z D& c! @
- dma_addr_t dmaphysdest1 = 0;5 T2 u3 Z/ N. w6 V6 s
- dma_addr_t dmaphysdest2 = 0;! T3 K( ~* f- {1 M( I% R' {, V5 U
- - w, `* u/ ^8 f' A0 {
- char *dmabufsrc1 = NULL;
" w# ?1 ?' \/ b2 | - char *dmabufsrc2 = NULL;9 s1 R9 S9 G3 _" B9 o. B2 ?
- char *dmabufdest1 = NULL;
G0 l4 J. k5 l- y" @& I - char *dmabufdest2 = NULL;
5 l4 ?! \; e( z, ~ - - W& _& M Z0 F7 i0 ^
- static int acnt = 512;
% X0 l; c3 M# e* P$ y - static int bcnt = 8;
* K! r& [9 Z: y9 m0 g4 \! s$ n - static int ccnt = 8;7 m: m Y" \4 w1 V4 l
3 v# Q' G' ^7 M {9 }0 ~- module_param(acnt, int, S_IRUGO);
- ?* V( t! ^! M4 _- _+ ]+ n( F - module_param(bcnt, int, S_IRUGO);% K0 o2 x' A7 z! b; R2 F! G; U4 U
- module_param(ccnt, int, S_IRUGO);
复制代码
, |4 Y& i5 o/ u! A
9 a! I( K9 q7 c' U l0 h% A! G( ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s& G9 ~8 p; s+ S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) o) ^ C" M9 b3 @0 H5 p1 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; {) N/ b( s1 i! V1 `
6 O2 s3 n5 V8 G8 Q/ S9 r/ A C: D2 E7 u$ X3 \( {$ f6 i
|
|