|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K/ r( n$ \# ^- [code]EDMA sample test application
1 L+ u1 h; Q, G) Z, `. c* ?2 h7 B5 J1 H - /*
$ h% _& w9 N4 S9 h- i; [ D: O - * edma_test.c6 [1 O6 y; t) W! t! b
- *
6 t# A, @5 c6 F9 e8 A$ m9 ^2 x - * brief EDMA3 Test Application6 G) L) _/ i( G7 D
- *6 Z2 N$ i9 K, _$ A5 X: L
- * This file contains EDMA3 Test code.
3 [. m6 q) T1 h) ? - *: m$ J5 w1 r* K: }. N/ K$ h, X& w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 d; n' W s5 g V% }3 y5 w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 A# J: `. Z. v, J v9 }7 p7 ]8 s - * TO CHANGE.& P- G. p, k6 i$ B( a" w1 {
- *) Y" } Q2 p/ r+ Q* y6 f- Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" |" x( e' l) @5 L: Z - *
4 q; K% U$ s+ o! ^7 |3 Q8 m - * This program is free software; you can redistribute it and/or
n. L) `2 ?! ]7 s3 G$ c I - * modify it under the terms of the GNU General Public License as: X F" W$ S: A' ?$ \$ h* a7 E- I
- * published by the Free Software Foundation version 2.
+ y- y, i1 n- h @% V - *
7 f t- d, f$ V" S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. A$ @& R6 B, o+ J
- * kind, whether express or implied; without even the implied warranty0 ^6 U9 K8 t4 Y, o, o7 P/ G5 a: F" k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( q$ r, s2 b1 m: {) ~; G
- * GNU General Public License for more details.
1 A7 m) k) ~) K - */
+ x7 b7 @# g8 l. {: c - c2 c: e( ~0 A$ E( _1 I' s
- #include <linux/module.h>. a' P8 F {' V* E: p( k( ^3 K
- #include <linux/init.h>7 }7 S1 o& B9 U5 s8 Z
- #include <linux/errno.h>" ?, x, `4 @( o1 Y
- #include <linux/types.h>3 X2 r* M8 z# W6 q$ ^, a
- #include <linux/interrupt.h>
& v' A) T$ k l% L' ^7 | - #include <asm/io.h>9 L6 a! x, }9 L# y+ Q5 S0 m0 T
- #include <linux/moduleparam.h># |! Q: E! A6 \6 f$ F% g' U
- #include <linux/sysctl.h>3 L6 P& ^3 \: c. A" Z4 |
- #include <linux/mm.h>
; k. x. y8 [( N3 ^' x0 V% s0 Y - #include <linux/dma-mapping.h>+ e' H" h: U6 u* [" c; \, c
. D/ Y6 B l5 H/ E+ E N% C+ s- #include <mach/memory.h>! @5 c; d8 ~0 x, i
- #include <mach/hardware.h>$ k& N3 t# S+ }' k8 `9 d3 d
- #include <mach/irqs.h>
+ v0 n8 n7 {; t6 z& e# i - #include <asm/hardware/edma.h>
% v2 O2 I0 o5 R* ~3 j
* t6 ~ `% z( x2 F3 v- #undef EDMA3_DEBUG% u5 [0 b* [/ O/ S7 ]/ d- v
- /*#define EDMA3_DEBUG*/
7 [* |! D ~ B) {" I2 G - ( H [% u) u7 g1 Q
- #ifdef EDMA3_DEBUG
: o$ s" T% o% f/ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ ]: H0 m( |- ^ v* U6 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 G" j# y. N, s- u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" b6 W# D+ B5 J3 O# `- a& P - #else
! n& `3 p' i1 F+ o9 m4 ] - #define DMA_PRINTK( x... )
* h% F6 D6 j7 b" B1 m - #define DMA_FN_IN9 a2 S, G' J* T' N6 M# ^( {
- #define DMA_FN_OUT
# p3 }/ R; X# y! ?- A+ Y# S- r - #endif- V1 q5 C: Y# T1 U- Q! L. [
* ~8 v+ E2 e1 a2 s$ I2 C4 H& W& C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% A% x% _6 p0 ?6 g2 A3 D
- #define STATIC_SHIFT 34 {. S1 g( n# A9 g. _2 J, M
- #define TCINTEN_SHIFT 20
. x# @ C* h( S6 Q0 }/ w3 y6 f* _5 K - #define ITCINTEN_SHIFT 215 `* u8 c* ]3 _) g
- #define TCCHEN_SHIFT 22
3 k3 z3 d7 ^6 X! f0 d9 G - #define ITCCHEN_SHIFT 236 z( r% o( L8 ]- i: [" M
- % C+ F; ~ t# Q9 C8 O
- static volatile int irqraised1 = 0;
$ Y1 b* O ^5 W5 _2 `9 c- q% m - static volatile int irqraised2 = 0;4 h/ L' {* ^0 H; Z' j* f# T: X
- 7 x4 n2 l( r, z! G5 z6 z4 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a) c6 I4 @2 [$ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' a5 ?- ?' D) D# o, ^3 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A/ l1 x, s# ]% c! }5 j8 | F
3 l* p. n7 q" a. W+ c5 g+ Q- dma_addr_t dmaphyssrc1 = 0;
2 k7 M+ T G0 X/ [ - dma_addr_t dmaphyssrc2 = 0;: P5 o" \: t3 e9 K& Y" ~* b) @( N
- dma_addr_t dmaphysdest1 = 0;
# g. O# f: _7 b0 {6 J - dma_addr_t dmaphysdest2 = 0;
0 h8 ?% ^1 ~3 v& \5 ?4 z9 T
/ f/ y3 S5 W" v0 F7 M' q3 P6 V& d- char *dmabufsrc1 = NULL;/ u) A+ U: V, I) x
- char *dmabufsrc2 = NULL;- J0 y+ |( w, H6 X6 k" Z
- char *dmabufdest1 = NULL;+ q. z% Y: _7 {( C
- char *dmabufdest2 = NULL;' v1 \9 O& k" b; B3 \
- 9 c3 w, K, T! U, J y$ W& G& @
- static int acnt = 512;+ j5 J U" R' P5 X
- static int bcnt = 8;( o) O6 A, l; v6 k0 I8 E
- static int ccnt = 8;$ ~0 q) b) q- g( w' k* `* e
- 6 d, m3 { u8 I& N* |
- module_param(acnt, int, S_IRUGO);0 j3 V1 g) J9 |/ ^" i; M
- module_param(bcnt, int, S_IRUGO);
1 a7 a( v- Z9 o: g2 l( Z$ F, B - module_param(ccnt, int, S_IRUGO);
复制代码 / u7 q0 y6 V3 Q
# {' s6 d! h9 N, ?6 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 _$ z) ~( {/ U* J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ Z5 {8 A6 F8 v; T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( o- Q$ g; r. h, `$ F! @3 c0 a
2 g3 g) ?" W% u B, B
3 j. O1 j# |0 k( f$ x/ m# z |
|