|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ]1 g. V' Z1 m s
- [code]EDMA sample test application. S' c, M, t7 C$ t# e
- /*$ H2 S4 I6 O/ o0 W& s. S
- * edma_test.c, }# A* X, U# J& F+ i& h
- *
1 @ Q% q2 j$ b- t) n! N& l! T) O - * brief EDMA3 Test Application
x( w& k& g9 O9 `. ]# K - *' O6 O% O% T4 S2 E. y
- * This file contains EDMA3 Test code.
+ q, x8 Y# ?- M' } - *
: }, ^6 F, Q; `. D# Y+ C1 n. a; b& [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE d/ P5 V# p5 K5 w& y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* t+ c9 K; ^9 [) g1 u7 S - * TO CHANGE.* G* n4 g! g# b. [8 d( L: e
- *: |: F# E- p5 \/ H$ o3 B1 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, o2 B- R0 _# Y) K/ M& u E
- */ e' z! J- O( a6 _3 C4 u9 p7 J
- * This program is free software; you can redistribute it and/or% r! X& Z9 Q: F0 J" Q: J$ J
- * modify it under the terms of the GNU General Public License as
: K# `5 _, o; X" @/ P - * published by the Free Software Foundation version 2.9 X4 _; [5 x% w- k& [. O. ]
- *
; S* R7 `2 o" b/ t& F8 O3 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ P9 f2 Z/ A) @ - * kind, whether express or implied; without even the implied warranty
1 d# b- t. p3 R2 E' p5 H* d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 E" }8 K2 p# p& a$ j: ?
- * GNU General Public License for more details.6 I2 B# j" c D; s* x* }, Y6 T" W5 c
- */
- F4 |5 D) R( ^8 X7 [
: a' P5 N. f) q2 R- #include <linux/module.h>
4 K5 Y( m% m/ x; L h2 i4 n: ^ - #include <linux/init.h>$ \8 a% i8 \3 V& }/ C0 c
- #include <linux/errno.h>
9 U1 C' v0 A" e: w% z$ N1 ]6 P( F - #include <linux/types.h>
$ W3 U8 v* a4 O7 N$ z. S$ C5 A - #include <linux/interrupt.h>
# s7 I4 c+ K0 P# i) d+ t - #include <asm/io.h>
- O! U- h0 S/ w( t9 c, @ - #include <linux/moduleparam.h>
8 h* s! w5 v" g5 m! P I - #include <linux/sysctl.h>
: }$ t* ^) d2 O/ ~1 p - #include <linux/mm.h>9 ]/ F; c- x( e" v
- #include <linux/dma-mapping.h>
/ T' {) |- c" z
! j% K+ V' n6 Q' B' C- #include <mach/memory.h>8 Y& g+ k: f; |
- #include <mach/hardware.h>$ }3 T5 g# x \- q. K9 W" e- g: e
- #include <mach/irqs.h>
+ B. R; E# J, I; q2 @ - #include <asm/hardware/edma.h>
# g9 [/ y* n3 }+ _( x2 |! q& j% W0 E - $ H1 F! Q3 Y/ R5 Z
- #undef EDMA3_DEBUG3 R# b$ d( v2 E0 Z
- /*#define EDMA3_DEBUG*/* R1 ~) M' e4 |+ {- u; P
- 2 G' N+ e2 O5 i: ^
- #ifdef EDMA3_DEBUG2 s5 G( G' ?* Q5 B/ U1 O7 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. t E J; T& d2 h5 O/ x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& d8 F' W, v* ?% |" ~% Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 r# \6 w2 F8 S/ q+ e6 a* P. X - #else
+ x# P/ j$ C: T4 o! [ - #define DMA_PRINTK( x... )
) W* h& ^, c; x! l$ P; q$ [8 { - #define DMA_FN_IN& }$ ?6 i7 T& l! o I, ~& l$ T
- #define DMA_FN_OUT
1 c5 S) k3 N' o2 S8 {1 G. i/ l - #endif
8 ?; d" Y3 A) A0 x; ~ s - ) |6 v# T( s" O$ {0 \6 j+ T l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' K* [' \7 }, n- M1 {4 p Y
- #define STATIC_SHIFT 3& S) p" H" H5 G) |9 K) J3 u
- #define TCINTEN_SHIFT 20
4 B: }6 M8 k& V( s - #define ITCINTEN_SHIFT 21+ C5 S5 G/ ]3 P) R; X
- #define TCCHEN_SHIFT 220 }# s6 @( ~2 D# e( y
- #define ITCCHEN_SHIFT 23
2 \0 l; X" Y l6 w0 y. I - ' W0 T1 `6 m4 [; e8 B, C. N f
- static volatile int irqraised1 = 0;
; w6 M# z$ \* s5 V: D- O. U; V( S - static volatile int irqraised2 = 0;
8 A9 Q/ N) _+ n3 {7 } - 1 J; j$ x( @$ X* g! K4 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Z- o, d# r+ x! G. G; j# \( g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k8 h7 x9 M2 p4 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% s0 e8 T2 V+ O2 Z0 E
7 E7 P5 \$ ?: p2 q2 E5 x- dma_addr_t dmaphyssrc1 = 0;* v# |" D1 _5 L! v* _, M4 a
- dma_addr_t dmaphyssrc2 = 0;
+ a! j7 {# U0 l9 U8 [! b% a - dma_addr_t dmaphysdest1 = 0;: ~$ x/ P, P& O! a
- dma_addr_t dmaphysdest2 = 0;1 L" [+ u |; }+ B" _1 T# Z. u
- 1 N8 Y _& H c) ~- a8 ?! c
- char *dmabufsrc1 = NULL;
7 s) T6 s( |' L - char *dmabufsrc2 = NULL;# I; ^5 R- M9 d" Z Z$ v5 E
- char *dmabufdest1 = NULL;
h, V% R5 w, k; U6 F2 F0 r - char *dmabufdest2 = NULL;
8 h# P, z! @+ [; J y3 L - . z# ^% N% {2 e/ z& k; m5 s( }
- static int acnt = 512; u5 x' P2 C8 ^/ Q" W5 M
- static int bcnt = 8;6 k, V3 }$ \, C' f
- static int ccnt = 8;
1 {. o& G5 F- k7 Q9 q - 1 w9 a$ m) b- P$ w$ u! o
- module_param(acnt, int, S_IRUGO);
& c+ V. e) d8 z5 i5 T+ h - module_param(bcnt, int, S_IRUGO);
" n$ }9 S+ K8 o: Y - module_param(ccnt, int, S_IRUGO);
复制代码
+ p7 ?1 J( @ L1 W! M# j; [. F' a4 f5 P! p1 \8 ?- |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L( q3 v; X, U& S" k: S" E h) d" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: \% g0 w( P7 D% E$ Y$ E, l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, U; D8 q) u: h" p% \
$ A f: W6 F5 z% C( B) I
* Q, x2 {% G4 L% a+ O |
|