|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 J& o% ~( x6 {$ c4 [
- [code]EDMA sample test application1 |+ [! J7 ?, J& Z! Z# J
- /*+ T) g5 v; J) R f4 Q9 v7 Q& D1 i/ w4 E" |
- * edma_test.c
$ O. t8 ` J* w* F, y0 b, j - *3 P( Z( v& \! h& W
- * brief EDMA3 Test Application
J4 D H k* Q! C - */ C- e/ z. s9 o" H
- * This file contains EDMA3 Test code.! `* y$ n# V8 |. L# z
- *2 |! f# C' I! {! N/ b5 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 C+ ~3 p( k& q% s7 A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 u1 {$ B" C/ ]$ @3 U - * TO CHANGE.
* w( y+ j! x+ O0 d - *
' \$ g1 d" y: T, i3 f) ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" c) p" E& N Q. _; S' ]/ \! D
- *
* O0 Y# V1 A( l - * This program is free software; you can redistribute it and/or5 n0 W& U2 p; \9 G: A4 p5 L
- * modify it under the terms of the GNU General Public License as
$ B# Z B9 q5 ^6 N* Q - * published by the Free Software Foundation version 2.1 K* M: h7 H h. @
- *2 ]2 b/ g+ M. S+ l- s" G8 \: p2 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z/ j: _* {: q& ?6 I2 p3 o
- * kind, whether express or implied; without even the implied warranty
7 b. K6 U# u- r5 L# X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 h1 w' q$ _7 S - * GNU General Public License for more details.7 A# n) r7 m0 D( Q5 N6 K3 _9 S
- */* c% G, [) O1 [+ I3 t
- 9 Y. B3 E. G( C
- #include <linux/module.h>
2 W$ \2 O |! K- ` - #include <linux/init.h>
; z$ [8 | ~5 N8 d+ h7 I - #include <linux/errno.h> }0 x" s* S: Q. L6 [6 a
- #include <linux/types.h>
6 H7 s, V, J$ y# D; `& s - #include <linux/interrupt.h>* @8 t( I& k- W; Z
- #include <asm/io.h>
8 w" s2 Z4 M( ~ - #include <linux/moduleparam.h>* _6 U4 z. i$ N
- #include <linux/sysctl.h>
; q9 \" Z7 Q8 b) h" \ E - #include <linux/mm.h>
( m" u/ Y0 |: n8 G4 B - #include <linux/dma-mapping.h>
, d, k- X3 T5 l" ?# I
* u- B. Q3 W: [- #include <mach/memory.h>
% v; A) U) w. A/ c6 C7 D - #include <mach/hardware.h>* O6 L, B2 W# c3 b( D3 o
- #include <mach/irqs.h>: K$ O, a) \ S x4 P* v
- #include <asm/hardware/edma.h>: ]) X9 I n" ~! X" D
- 6 K' l6 N& I: Y, n5 \/ h
- #undef EDMA3_DEBUG
* c0 s5 A- D: S7 L/ b8 U6 j2 A! n2 N - /*#define EDMA3_DEBUG*/* W( E; c( i% c& B# o4 O$ n" J( f1 A
- 0 I6 ]" N- Y3 Y& G( W4 ^% ]
- #ifdef EDMA3_DEBUG, P$ V" H5 q0 G5 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% q! r K, c; X/ I; L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J" C* f$ v( F) n- f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& r( x, f5 A I6 C6 @ - #else
6 ?. A H5 R+ e - #define DMA_PRINTK( x... )
# u5 e0 @& \3 a, \ - #define DMA_FN_IN
3 K3 b3 W: ?7 s. Q; k$ E6 R8 r6 F M - #define DMA_FN_OUT) z2 X$ M6 p( t4 f
- #endif
6 T4 Y0 I) G2 b2 D - ; V: D; `& }9 B* o$ Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ R& R& g5 {" I7 w2 ^
- #define STATIC_SHIFT 3
; J8 G1 |3 e5 Q7 } - #define TCINTEN_SHIFT 20
3 C5 w$ P1 J* T) w$ e5 b6 M8 d2 { - #define ITCINTEN_SHIFT 21* G" k' b/ a# z& G
- #define TCCHEN_SHIFT 223 ]' O: ] n, X, J- E3 t0 I
- #define ITCCHEN_SHIFT 234 g! P' P/ E6 M+ p* ]+ C6 D5 h% ?
+ q1 D& W# |+ Q# v7 x9 h- static volatile int irqraised1 = 0;, v6 T* w1 n$ @- h! H
- static volatile int irqraised2 = 0;
0 a! J$ |( `$ O0 {3 \
* B& p& b! R0 |7 W: |' ?' `9 T4 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
T+ m L5 I1 N+ i$ Y4 N7 g/ E# \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 @7 V& ^7 y+ U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 g9 m; G4 p5 L& f- ~
; T/ O- ^, I# H- M) h& c* b- dma_addr_t dmaphyssrc1 = 0;% d; ]) A, Y# F; E M4 V
- dma_addr_t dmaphyssrc2 = 0;- Q K* |' o, L- r
- dma_addr_t dmaphysdest1 = 0;
: i4 J9 g' Z! U' l$ ~7 B3 W - dma_addr_t dmaphysdest2 = 0;
1 m, N8 I! y1 U0 c! D - 3 ?% V1 |5 |( g T+ ]7 q
- char *dmabufsrc1 = NULL;1 D& \ N: w3 `1 h
- char *dmabufsrc2 = NULL;1 f: E: |, p4 L0 M- e
- char *dmabufdest1 = NULL;6 B8 t' W' f* ]/ {, F7 I
- char *dmabufdest2 = NULL;& D( ?. R1 X& a$ G1 z5 X
- " }) C. t) y) v# s E$ L
- static int acnt = 512;1 @* m, _% ~$ k
- static int bcnt = 8;
4 d# k6 U! s* W9 i - static int ccnt = 8;
) c9 r4 U9 q6 V5 L; ]0 q0 f
0 @6 j) c f7 Y! H& g1 i- module_param(acnt, int, S_IRUGO);
' [4 J+ l7 C' E1 z, p8 K7 k$ ` - module_param(bcnt, int, S_IRUGO);8 r( _6 D$ d( q% J
- module_param(ccnt, int, S_IRUGO);
复制代码
) L% a5 R& n7 O8 P* e5 I# c) [" g7 K+ V: r8 t( Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 q7 Y2 y6 I& ~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 N! I, [/ s; m. K# |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L, C( z, B0 B# x* @5 ^$ ^ S
) a" L2 `& z/ |1 ^
' c" f% t5 ?6 a" a( t |
|