|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 ]8 L7 Q! }" F. b O# B5 T: F
- [code]EDMA sample test application* z/ x8 x2 P3 r: Y6 M( S
- /*
$ }( \* f& h) l. }+ z - * edma_test.c. n# M/ F7 {2 C1 u
- ** L/ Q) A: x3 G' H( y
- * brief EDMA3 Test Application! p% ?8 |* b8 B% E! U' q% Z
- *7 J9 |+ V& {+ W/ {% V
- * This file contains EDMA3 Test code.
; s. \ e6 X2 D: A4 J: X+ S, C$ Y - *
7 z$ L, ^# z. c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( {$ x+ M7 c z) @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% s8 e* x& L6 k8 V6 a) E, ?- y - * TO CHANGE.2 s7 o0 U3 ] g( H
- *& N: B9 ]( |" k4 N! R6 n- t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ], B4 M3 A* K* J9 ?' `, f+ {
- *% r* y* @/ g* C& P6 ?5 T0 g
- * This program is free software; you can redistribute it and/or+ _* `5 [( L K, w6 j+ H
- * modify it under the terms of the GNU General Public License as
T7 k( W( b# ]: B, } - * published by the Free Software Foundation version 2.
6 B* X6 X8 l y1 k8 A - *
O" x. O( u: x( u7 B' ^8 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ]& P8 ]' i$ v9 ]
- * kind, whether express or implied; without even the implied warranty9 U4 Y5 O6 p7 d6 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 { \5 A( X7 p9 n$ @1 L9 b7 X# ~) x7 L# D4 g
- * GNU General Public License for more details.
7 Y6 v' W1 K% Y - */2 D2 j9 [1 e2 k* U9 ~
, Y2 R0 U2 z/ h: C& L- #include <linux/module.h>; l# t2 C- T: W- [/ ~5 A
- #include <linux/init.h>( M. r1 I7 Y4 p- B& D
- #include <linux/errno.h>. t( W7 P8 O; M9 ^$ d/ r, G8 ?
- #include <linux/types.h>
' F9 T" w- o: r: u2 w - #include <linux/interrupt.h>& d8 p; L# j/ v8 `- l6 ?: v
- #include <asm/io.h>6 _/ F1 ?" W6 L" k' E2 i* A; `
- #include <linux/moduleparam.h>
: e5 _! ?! A6 h+ ]- r7 | - #include <linux/sysctl.h>/ {2 N: U) Q+ n8 y. M1 S
- #include <linux/mm.h>
: F: A( y( i$ M - #include <linux/dma-mapping.h>
4 D3 I+ u% i2 s B9 ]
( a9 p; P. e4 j# U& C- #include <mach/memory.h>( k/ Z: C# e# V8 F7 L
- #include <mach/hardware.h>7 k+ V f, T# J# y& c6 F! S
- #include <mach/irqs.h> G/ R2 o$ z4 {. E
- #include <asm/hardware/edma.h>
3 i# W% l! f4 }$ `- Z
3 D! m4 W) j! A9 n1 m7 r- #undef EDMA3_DEBUG- ~) k! ^% f9 ?% N% u3 V7 C9 U& e
- /*#define EDMA3_DEBUG*/6 ]7 P, O @" `
- , w* y* Z) j$ Q- d" h, D+ u
- #ifdef EDMA3_DEBUG
5 z. _/ B8 l6 M* o0 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! s5 X' V6 H' L9 O# n8 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' _, z/ B- }7 y( i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): O0 J4 t: a8 @* V
- #else
0 w! t" O4 I7 m. D5 Z! j& c - #define DMA_PRINTK( x... )# V5 P; e3 W5 b/ W/ q5 m
- #define DMA_FN_IN9 J, B! ~9 U0 s Y7 @& O
- #define DMA_FN_OUT
9 N$ ?8 k+ w: j - #endif
3 t5 B/ x5 A7 t1 z$ Q% ~
3 B# G6 E6 Z- _, _8 a5 N A# z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 p8 q- c% s5 p e
- #define STATIC_SHIFT 3
8 B' K/ w' I! u2 }) _7 s& r, [" H3 f - #define TCINTEN_SHIFT 20/ {( K2 z% r( {8 u7 L- a' O: A
- #define ITCINTEN_SHIFT 21: u2 e1 W1 ]; b8 S
- #define TCCHEN_SHIFT 22
. @# n' r/ O: _7 ~% I! ^5 W - #define ITCCHEN_SHIFT 23% E% U- r) G8 e# x s+ F/ @
- ' y/ `$ w& ~6 i9 Q( [- J: a
- static volatile int irqraised1 = 0;
. c1 E* c# B% Y - static volatile int irqraised2 = 0;
0 u; w! T# Q3 F7 ?
3 f3 U' P4 I! z$ V( d: B- n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ `, P" a. E% v5 t3 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N7 F/ W, }7 k& p* D5 w! y7 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t2 y7 i( s8 c% J6 R - 5 c8 Y2 |5 O$ n( D4 o; v% n
- dma_addr_t dmaphyssrc1 = 0;" G. q3 o x+ q6 \# m& t% m
- dma_addr_t dmaphyssrc2 = 0;
1 _1 l4 l! v1 i" }6 |/ w6 v! a% s5 Z - dma_addr_t dmaphysdest1 = 0;6 t% m0 I6 ]- \) P' Y4 ]
- dma_addr_t dmaphysdest2 = 0;
( P) g% o- `! r# w+ U* Q t
* \2 j% X$ ^ k9 k/ p2 O q- char *dmabufsrc1 = NULL;0 v' ]! m" ~' ~( ~: c+ L$ r
- char *dmabufsrc2 = NULL;7 s# H- F( U* Y: `) d
- char *dmabufdest1 = NULL;
5 u l. _( X6 ?! \$ n- R4 l$ I - char *dmabufdest2 = NULL;
% ~" j% ^) L, c4 A, `) D" { - $ u) c! m9 G& \. ~$ L! }$ w
- static int acnt = 512;
f* O; d! P: X/ r% A2 G- S5 R - static int bcnt = 8;, k K- k3 {9 q" P" k
- static int ccnt = 8;- B0 E% n g9 [5 a; _7 k- M' `
# V& y2 G) r: ~; n) t0 ?- module_param(acnt, int, S_IRUGO);
2 d. O& K0 N0 l3 k5 }1 Z - module_param(bcnt, int, S_IRUGO);
4 h- P; ^" P8 l: q. L7 c" i - module_param(ccnt, int, S_IRUGO);
复制代码 9 h' m0 `" [7 _8 W
$ z2 M, C- i( M. [% D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ v; J# l6 V; N8 }2 P$ Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 f$ k1 ?6 n) o& q! r+ {2 k# ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* r3 ~: v4 i1 R) G9 o8 `) E" Z) X* g" g+ k0 M
J7 v |" T0 T5 l- v |
|