|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 p" p) e9 S# g+ q. n$ Y) L" S3 m- [code]EDMA sample test application% d3 I5 P5 A+ P2 Y; Q7 q
- /*
% T' S) w1 m/ S6 D- M0 { q* f - * edma_test.c8 J" Y* N+ [8 M" [/ P$ {" b3 \& ~
- *) i. Q2 T! \' k2 k0 Z& E T5 {0 y
- * brief EDMA3 Test Application1 T+ z7 R8 Q& G6 f# R- f: H4 b
- *
8 a3 F: e9 u( M. `$ J6 ? - * This file contains EDMA3 Test code.
' X G4 W, p; N; @5 e* R0 b3 X - *+ n+ d) M7 z1 [1 }/ W0 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) u, C( v( [. G, r3 k4 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! k+ V8 W. y3 N' ^. x3 N. w5 ]/ J - * TO CHANGE." ? D9 C; w p: M- f. b1 n
- *6 ~6 P, `& f0 D' h. }7 p7 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
G3 V$ M, M& q; U! c2 y2 r - *) N: {& g+ B# ~. `' R
- * This program is free software; you can redistribute it and/or/ g% \" i1 Z! ^, M" T- H, X$ j
- * modify it under the terms of the GNU General Public License as9 P9 p- o: w3 f) s
- * published by the Free Software Foundation version 2.9 f8 v2 K: ^, @) a7 [
- *
% C" y/ T4 p: @8 j: `) v1 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* E' Y0 y8 N8 z. |0 [* H0 R
- * kind, whether express or implied; without even the implied warranty0 }! \ g# |' {! t% E' k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 M' `# N. A9 C/ R Y' C. b$ k
- * GNU General Public License for more details.
; f& s) L. f3 i3 s: k8 j - */
5 e/ q- Z7 I( b/ k2 l - % s7 b% n) P2 I" u4 E
- #include <linux/module.h>
3 ?- e, N; ]% `) S3 X& f - #include <linux/init.h>
. c" Q0 r+ t; k" t+ f: S ^ - #include <linux/errno.h>! ?0 s) V; i: ~; p6 S; l
- #include <linux/types.h>) f' @8 y: J0 O' U8 T
- #include <linux/interrupt.h>
7 i! F( z' s+ V; y. ^# \ - #include <asm/io.h>: `9 g/ p. C8 [
- #include <linux/moduleparam.h>* P7 Q- E7 }2 P) \4 J- `" `6 D4 p
- #include <linux/sysctl.h>8 H- g1 T8 X9 U' `# q- R8 F8 Q* k0 y
- #include <linux/mm.h>5 D3 r' M% |* h+ Q, H
- #include <linux/dma-mapping.h>0 M" K |" @- s |9 F& M
4 s5 @. B4 S7 K4 {, V% V- #include <mach/memory.h>5 U5 [# ~5 h& }1 H- a
- #include <mach/hardware.h>: h( n- T" w* Q- ^4 U
- #include <mach/irqs.h>8 y# T* c# f- N8 Y
- #include <asm/hardware/edma.h>
9 z& [) [: q" [' r4 z! J- J - / O' w& @* U9 }0 H9 x b
- #undef EDMA3_DEBUG5 ]: H5 |! n: i% _* Q. {" s
- /*#define EDMA3_DEBUG*/
4 k E1 M# B, [. ?
9 W& I3 c6 M3 a- #ifdef EDMA3_DEBUG
& A" E- ?5 A; p+ T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) v1 v2 e0 ~& [8 N6 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 z% q& G( F1 H# R+ `) @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ \& R# |7 [: e: K* u3 U' k - #else
8 z; \/ I: Y/ r% Q - #define DMA_PRINTK( x... )
" ~- Y) s C9 u1 S; i- F _ - #define DMA_FN_IN' r9 L3 X; V/ a' C$ Q2 k3 j$ M$ {
- #define DMA_FN_OUT
$ m6 C$ ]& t6 a5 [& l - #endif$ R; l/ Y0 W0 Z& S1 W- f
* q4 Z" ]0 d3 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* W- Z: c- Q; k% E: k - #define STATIC_SHIFT 3: b: _0 X7 e/ O U" C7 l
- #define TCINTEN_SHIFT 20
2 i4 o* @# M8 u% w) P - #define ITCINTEN_SHIFT 21
6 V. |6 O$ q1 }9 l) f3 m - #define TCCHEN_SHIFT 228 G7 h& ~2 L$ C
- #define ITCCHEN_SHIFT 23
5 |6 ^& y: e' `
* k1 l2 o/ u2 ?! T. l- static volatile int irqraised1 = 0;3 @ s$ _1 f0 P( f7 e% ~1 {
- static volatile int irqraised2 = 0;
, o' s; W& E" ~. P4 @! N# [ - . r5 V T! G2 P3 W, F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A% y; M) F9 p9 M/ x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! n, ^- X% c+ A( ]6 s5 P8 {' |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" }" z1 M# K+ ^% A+ `( w/ C - 0 I- k6 W" v7 |& j) {+ N: h! r
- dma_addr_t dmaphyssrc1 = 0;+ U% Z& }, l9 k
- dma_addr_t dmaphyssrc2 = 0;
: ]/ r6 t0 z% \& S" Y4 X& h! v8 p - dma_addr_t dmaphysdest1 = 0;& @- {6 u( H0 v* @
- dma_addr_t dmaphysdest2 = 0;
9 R/ g5 `& n* M( U$ N6 D& X - ) N/ X$ W, {; ^; {
- char *dmabufsrc1 = NULL;5 v% k" q! ]2 Q
- char *dmabufsrc2 = NULL;
" b; C) w9 L% c# T6 o; R4 E% P% w$ P - char *dmabufdest1 = NULL;
% r+ A, x( N, V! X - char *dmabufdest2 = NULL;& L& {! Y/ N& }' G. L8 G
- $ O9 M5 a' T8 Z4 l" L
- static int acnt = 512;: A7 g/ N6 K8 u) H0 ^3 D
- static int bcnt = 8;( d7 H; L' F7 w, N
- static int ccnt = 8;9 ^) W( ?* h; z0 ^2 X
$ ~& ~# M6 A9 x& o6 U- m6 v- module_param(acnt, int, S_IRUGO);
2 l x/ e7 q p) w A- ` - module_param(bcnt, int, S_IRUGO);
$ k0 R6 E; w: q# F5 } - module_param(ccnt, int, S_IRUGO);
复制代码 ; ^+ P" d- i" D" W
8 O; v8 W$ @+ }$ w0 b5 x- A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _& i0 |, ^' y7 ~) I/ A6 Z. V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 F& Q$ V; D1 g( K) t/ r6 i) t6 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
W0 ~2 z+ U. R: L4 d; Y6 K& o f9 }4 e
, M5 D. M# r! \* S' i |
|