|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 u7 S0 B+ c. x6 j% j5 M- [code]EDMA sample test application
$ _( q* O; s) Y8 h - /*' M$ @+ P0 r& u; z+ ]+ F, d/ q5 `
- * edma_test.c& G" B% D) M. c3 M
- *) \- k# x( C# t5 S5 M
- * brief EDMA3 Test Application
" B! m: L0 ]# x& }! B - *7 h& T, Y1 C, O* [ u2 v
- * This file contains EDMA3 Test code./ X) m* @/ C4 R9 V8 F
- *
" H1 P6 ]4 C7 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* \+ _$ z, Z8 r+ q+ b0 m+ ]) C - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) C9 H4 B& y; P
- * TO CHANGE.0 {# |: v2 n' S; z& Q
- *! ~; Q6 s( x% b; G+ [& ~* N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& d! y a& P0 M - *; Q" R4 y# p8 D& M/ I: ^
- * This program is free software; you can redistribute it and/or
# O% Y2 E, V$ \+ d9 H, s6 B/ Q7 v - * modify it under the terms of the GNU General Public License as
" ]3 n) L- C. B$ H. o8 d - * published by the Free Software Foundation version 2.
; ^% X& S" h, `) n- f5 m# I* c. r1 d - *
7 p4 ]3 s% V. I2 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 p+ H8 R, \$ y. [' S9 X& }% E) ~ - * kind, whether express or implied; without even the implied warranty
, ^- N0 T1 Y+ \/ W0 W5 n8 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& \* a/ \' J* C9 g
- * GNU General Public License for more details.0 O* K. h/ k1 L1 F
- */
1 |1 H2 p1 M, V( i' @ - . ]+ m' u/ [1 u' {" l* T8 A
- #include <linux/module.h>
3 t5 f& P5 E) Q6 J - #include <linux/init.h>6 @7 i4 N8 R0 d7 v9 p
- #include <linux/errno.h>
C6 p3 x, b7 m* x+ V3 q- B! U - #include <linux/types.h>
/ s. I0 D4 H0 {$ }% t+ D+ a9 ` - #include <linux/interrupt.h>8 u( _: b% S9 ~* a
- #include <asm/io.h>
& F$ R! A/ f0 R - #include <linux/moduleparam.h>$ e2 g S. x) a+ Q
- #include <linux/sysctl.h>
" m3 r( a1 Z- Q6 E% I7 h& i8 Y - #include <linux/mm.h>/ d# g: G5 m# S. L/ Y
- #include <linux/dma-mapping.h>
, W7 Q. v; C% t0 u" c
" l* S. E# t$ D; ^. J8 q0 T3 f& d- #include <mach/memory.h>
. S7 S3 P# Z O$ H4 @5 f, N - #include <mach/hardware.h>
4 E; Y/ ^* J! T: K( a - #include <mach/irqs.h>* r5 i& s. t6 M4 x% m
- #include <asm/hardware/edma.h>9 U1 X) K' b+ F% L) l( {
- 7 q/ z7 G( ~* h0 W0 O0 C% P
- #undef EDMA3_DEBUG& u3 ]- r6 e) A$ v: D$ ?& W$ ~
- /*#define EDMA3_DEBUG*/
7 z) ]. [* ^! h7 h - . a+ R7 E& G( e1 g3 I
- #ifdef EDMA3_DEBUG
' z% e, m1 R6 E Z+ [+ Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ w6 t4 T! M3 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 u4 j* N" N, ~: O% k2 p9 L2 M' g- a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( w9 L! ^' R1 l i5 ~' ` - #else
2 z/ p3 \& t1 k+ ]8 B! _9 k - #define DMA_PRINTK( x... )1 P$ r* i% x0 {% W5 {
- #define DMA_FN_IN/ X0 V* A6 m# d; d! }4 P- `1 D$ `
- #define DMA_FN_OUT$ ]( I1 p7 m) A6 S0 a: k( ?
- #endif
! E p6 t3 l1 E; z; ^
- p! w+ Y# [/ q; w s1 B# V7 i1 @: p3 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) l% Q( | V b9 A) m
- #define STATIC_SHIFT 3
6 ]5 O' E( w& L3 x - #define TCINTEN_SHIFT 20
4 N" |# N& ^* |# |. _; ? - #define ITCINTEN_SHIFT 216 S; g/ @* ]8 c
- #define TCCHEN_SHIFT 22
/ s2 C2 p: h( @% m; Q - #define ITCCHEN_SHIFT 23
9 E q3 h( s y+ S
% a" {% Q7 c! ^! o, n- L) R& t' l- static volatile int irqraised1 = 0;7 P) E; s4 Y% V ^- A
- static volatile int irqraised2 = 0;0 O6 p8 g- K7 f4 \' z
6 g# u3 l0 Y2 N; s3 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F/ ~) _) H" B5 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, q- G* C& ^! }# g* G* p: p( V! h; g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q3 n" s) C3 d) w9 [; U
/ i8 S7 z8 m2 t% N- dma_addr_t dmaphyssrc1 = 0;
# L+ e7 D. e; T" u0 f - dma_addr_t dmaphyssrc2 = 0;. p6 R5 K# y6 I$ U5 M6 ~
- dma_addr_t dmaphysdest1 = 0;
7 @0 r3 @7 O7 N% A8 k- }* C - dma_addr_t dmaphysdest2 = 0;
- g5 Z, a( ^ O" C2 x) j
1 w+ G4 C) h0 z) e6 V' Y- char *dmabufsrc1 = NULL;
, P4 h! x U. G$ F9 e* n& ~( u, D - char *dmabufsrc2 = NULL;( z4 O6 C! r2 o; j
- char *dmabufdest1 = NULL;
1 m3 o9 K% P0 Y# S( u - char *dmabufdest2 = NULL;
1 m7 v2 @, b8 k+ l4 Z
* }4 z; h8 Z/ U: }! Y. Q3 H7 ~- static int acnt = 512;+ Z# t- B4 s) u4 E0 k9 e0 \+ u
- static int bcnt = 8;, s6 Z. X* s1 r3 G' w' T
- static int ccnt = 8;9 D3 l: V4 x- d1 v9 n
- & y5 }; f5 C( m8 a0 _$ G4 }
- module_param(acnt, int, S_IRUGO);
+ G8 C' [6 M1 Y( y+ n/ A& i - module_param(bcnt, int, S_IRUGO);" e& J$ b& b# H. D# m% N* C. M
- module_param(ccnt, int, S_IRUGO);
复制代码
9 R2 P# R$ l7 I6 _* x
. s1 a+ x+ V% z ~% |* y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: V1 j W% ?0 u' a/ _2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( f( O3 o& i' B' R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h. v! c) W- Q9 h8 W# U" G5 O3 G
' b1 B: g% c2 L1 z5 d b' X% ^
/ @. }3 g d" u* Q, ^ E# \ |
|