|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 g4 s8 A1 \5 L/ H# v3 d" Z
- [code]EDMA sample test application4 [ ]" b& m' o; H
- /*9 z1 V6 v1 z. q5 f, e4 I( W4 |
- * edma_test.c9 I" y0 y; F1 d q) X! ]. v/ o
- *( x, \6 Z7 @- S2 ]
- * brief EDMA3 Test Application
9 Q7 j! M0 ~7 z4 L8 h# v - *3 x! o( q* b) p9 [9 R
- * This file contains EDMA3 Test code.# u9 }& H. V% i5 x
- *
. P2 P; ^1 u" t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% Y6 X$ M1 z) I- ]6 A$ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT X/ Q- s" U$ t8 |( [' z
- * TO CHANGE.6 t& K! m/ j$ U# R; u+ r
- *
, O! M. H: a" Y4 o; j' U) u" w0 l- a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ |% c1 z5 e. K" w. ]1 t: u - */ R+ Z, G1 @9 D9 ` ~5 O+ S$ }& G
- * This program is free software; you can redistribute it and/or
2 |1 i) [8 v* A3 q( x - * modify it under the terms of the GNU General Public License as% A9 ?8 k2 c1 d, S9 q/ k5 Z' \5 T
- * published by the Free Software Foundation version 2.
3 ^) T( [3 l5 p% z - *% B X: w( |* X4 c1 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 l# ?* ~' |, o& ~. x. a* v
- * kind, whether express or implied; without even the implied warranty
0 _$ s3 a( f0 f2 Q3 |' ?, ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' l$ n9 R$ a# J
- * GNU General Public License for more details.; q# m4 T& t" }- c& D
- */6 D; ?1 r6 P7 `. S" s! \
- & ^+ I0 z' f5 Y3 Z2 G6 Y* N- x
- #include <linux/module.h> |' s: g) V- Z" \' X9 m
- #include <linux/init.h>5 ~8 N# e- u% B. l2 F
- #include <linux/errno.h>
! I, I% z: T& ?$ M - #include <linux/types.h>
* G% {2 ~' \0 P5 Z - #include <linux/interrupt.h>
1 E# Q. @# z3 `. Y% W1 G - #include <asm/io.h>
* i. I5 G7 r; v; _$ F& h0 k - #include <linux/moduleparam.h>7 O. j1 c& x1 c& E1 }' {
- #include <linux/sysctl.h>9 W! \0 z( i% V3 w0 [2 {
- #include <linux/mm.h># R1 c/ _8 J! d, _) {
- #include <linux/dma-mapping.h>6 J" t- [3 {$ `# a! k: w2 w9 v
+ y& r, k4 {. }( f, d% R7 P$ n- #include <mach/memory.h>( S; `; y; s y1 D4 X2 l) t7 t6 L
- #include <mach/hardware.h>
B* y$ V+ ^3 {* _2 l - #include <mach/irqs.h>
/ D0 E! {3 d+ D/ O6 R - #include <asm/hardware/edma.h>
! @+ q: o- w3 J$ F - ! }7 i) j1 ]' r- o- z$ U
- #undef EDMA3_DEBUG/ S0 n6 [& [% \- g, P# g
- /*#define EDMA3_DEBUG*/
4 v: V3 F2 s8 u5 A4 E8 \% B - 5 Q) U, Z# a+ q
- #ifdef EDMA3_DEBUG" c7 l! k8 \" H0 d' j) T7 V: E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ x& c }2 K: ]% Z( V, m2 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ p5 a/ r+ \% u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. V; L8 C# e k* U - #else; o5 |3 R0 I8 T7 J) E5 k0 X
- #define DMA_PRINTK( x... )4 P% J+ W% L9 e7 q4 J6 u0 z
- #define DMA_FN_IN B. w3 j( w u' R; A2 `+ d
- #define DMA_FN_OUT/ `' R$ f7 O) {* E
- #endif
8 k3 }; S" Y! d9 T# L
, [) l0 k/ m5 Z' K2 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* e ?* [3 \/ {9 F- V
- #define STATIC_SHIFT 3- r' [& P: o* q( w( h% Q( q$ ] J
- #define TCINTEN_SHIFT 20* O9 h: v3 r: x
- #define ITCINTEN_SHIFT 21- O5 K- Z" o) ~) E/ U
- #define TCCHEN_SHIFT 22
# k0 A! W+ `" |- P: w - #define ITCCHEN_SHIFT 231 O1 w& @* D2 N: n, x6 d
- $ [% C% J; I7 i! C! j& p
- static volatile int irqraised1 = 0;
) T4 }" k' n$ m2 k0 ` - static volatile int irqraised2 = 0;; B9 v7 T8 y( G/ C- ~2 x$ o' r
- 6 e1 ~5 Y0 [# r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q' {; m& A5 ]* B1 z5 M# ^ t9 }# t1 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' C: {( r! S) {8 f5 o( h: ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }' V8 s: }. O% c) c1 J
y+ m4 w! A1 ?( s- dma_addr_t dmaphyssrc1 = 0;7 n2 \4 V0 P0 {9 D4 w
- dma_addr_t dmaphyssrc2 = 0;
2 `, m. P" E8 {+ y4 B7 r - dma_addr_t dmaphysdest1 = 0;. I& m& a) j$ |9 o
- dma_addr_t dmaphysdest2 = 0;
1 Q: K: I- `: e" E - 3 j f% F% W# x. X( d' J7 z
- char *dmabufsrc1 = NULL;
5 f0 s7 b* l. ~3 w& ?; N8 h - char *dmabufsrc2 = NULL;
, `9 c& h# j. _4 c( x - char *dmabufdest1 = NULL;
) t3 c5 e; [& t5 i; E3 g; Y9 T2 i - char *dmabufdest2 = NULL;
7 e6 p8 N4 {0 U( t
) L( B% w+ M3 Z+ b, t. j5 r- static int acnt = 512;' h. G9 C2 z/ P! s* J1 A
- static int bcnt = 8;5 E0 W* e9 C0 w/ L- c: n' N
- static int ccnt = 8;
+ l e; g6 B0 g' ?; D$ X( w - & a8 i% t& Q/ D
- module_param(acnt, int, S_IRUGO);
/ ^9 l) W- E1 Y+ I4 ^* C - module_param(bcnt, int, S_IRUGO);
5 `& Q$ d5 E' J/ W6 e/ ~ - module_param(ccnt, int, S_IRUGO);
复制代码
' j; X3 P# D3 A. c8 T6 K- |: }% b( C& k" x6 G) T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ^( D& t" x( x- w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" |- Y, {2 | P- j& n& U4 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% x$ B- l. _0 ^: W+ [( K; s
( ^, J2 Y+ I/ x* \) P
; z- x, G! u9 y, i6 d4 c: F) ~, b |
|