|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ j& C/ s x1 A- V- [code]EDMA sample test application
. e3 i. T2 ]5 |# S0 D' M - /*
) }0 P6 ]4 p0 R) f% v' g - * edma_test.c3 b3 N, g3 j2 ]( t! K
- *' G% y V: ~: n0 ]" l* x4 L1 a
- * brief EDMA3 Test Application
0 @. o# _1 n8 C2 [# ~ - *8 v- R6 Y6 D! F2 |0 p& m
- * This file contains EDMA3 Test code.
$ E8 t1 x* l W5 A( B - *( M/ \4 S" k) R* A. i" b$ i6 ` Y4 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 s, g6 k$ ?2 @: O8 N Q& t$ W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; y5 k `; R9 S6 Y2 m- f$ } - * TO CHANGE.
) F2 N" q+ K% i' F/ i* ~ O - ** S: K$ z2 c* e/ x N& U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ y7 P2 U$ h8 J7 f8 ?0 l - *8 G W" _1 s3 Q2 ]9 Z
- * This program is free software; you can redistribute it and/or
$ O* s) ?/ ]( H, T1 } - * modify it under the terms of the GNU General Public License as* _; e1 x/ o& H# f) i
- * published by the Free Software Foundation version 2.0 R& l' r! u: x6 S* q
- *6 A$ T. u5 Q% u6 G. ]) L4 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 `. {5 C# ]1 ^( I: [
- * kind, whether express or implied; without even the implied warranty+ G* `; {& Y- P( e+ A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" {" q+ o; P7 Z) M& l2 r+ L7 u
- * GNU General Public License for more details.
2 ?3 T( Z( a, z2 D - */
2 J9 V: B! p# M/ z1 F
1 q- E, `$ ?. ?" y( L- #include <linux/module.h>
3 D$ L; _7 z* W9 @4 r, G( E - #include <linux/init.h>+ t' P. Y' v# d/ z! a
- #include <linux/errno.h>- W2 ?$ O' Q: h e" C
- #include <linux/types.h>" ?3 S! }5 j/ P5 k, G4 g2 @# L
- #include <linux/interrupt.h>! A0 V, r# ]5 D, i+ |' x
- #include <asm/io.h>! Q, m4 F) |* m; w9 q6 B3 f% T0 x
- #include <linux/moduleparam.h>
. C2 f% `/ e* f' g, E9 o - #include <linux/sysctl.h>1 p- ]3 C/ m: f) J
- #include <linux/mm.h>2 _ O+ S6 h6 o& O" ]7 h" [) X* A
- #include <linux/dma-mapping.h>1 N" ]" g& R- k* V$ i( [ ~
- % P" T; f+ z5 w% n
- #include <mach/memory.h>
" q' j- `3 R6 A; f8 F, n& ]! x5 \- g - #include <mach/hardware.h>
# u/ n$ v# I# E! k9 K - #include <mach/irqs.h>4 }2 v+ s4 P( g0 V4 c ]" R8 h% O% B
- #include <asm/hardware/edma.h>
( q; O$ K8 g8 S4 t, }- {4 K1 {$ o - . E# [( X8 B/ m( m* f: p( w
- #undef EDMA3_DEBUG
9 g d! I8 \* [% f% I/ W$ n - /*#define EDMA3_DEBUG*/
, J+ y, Y0 S7 |" x% v6 u - + }1 O* @5 z7 ^/ j+ i
- #ifdef EDMA3_DEBUG
) ?4 t g ^/ S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). z/ X$ t& r/ k5 L7 |7 Z) X6 u3 V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* r: c6 ?) V3 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% `2 \' B- N4 F/ b1 X - #else
$ X/ q) {0 U/ k" ` - #define DMA_PRINTK( x... )& S8 l5 m* b; Y* @
- #define DMA_FN_IN
; w \; }4 }# x) U5 o% ^( v - #define DMA_FN_OUT) ?8 Z1 K8 D% \
- #endif
; l' o+ G: y$ `0 z3 s# v
2 c' y% e$ Y$ Q: l7 n( n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( O7 z$ J' e/ L1 s
- #define STATIC_SHIFT 3
7 g! N; Q' s9 ~ - #define TCINTEN_SHIFT 20
1 Z$ \0 m/ b' y% Q- g5 ?) n5 n - #define ITCINTEN_SHIFT 21& w+ n4 I" u+ F% A0 d5 |: C9 c" w
- #define TCCHEN_SHIFT 22
3 J) g) J: [5 s2 o: N - #define ITCCHEN_SHIFT 23. S: m: ]( U9 _' t" U
+ t* s% n+ X% K% b( k- static volatile int irqraised1 = 0;
4 G! ~! G1 f9 s4 \5 h6 s0 C& T - static volatile int irqraised2 = 0;
' P3 x4 @2 N- q0 q! V3 M/ _
3 N/ y1 P& J6 U0 o3 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [: I7 w' y, V1 f: ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 C9 T) W8 {8 G$ a5 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [! W- {6 t% z. l) q1 z+ Q
3 I. t) B8 {3 o. o! z. j% X- dma_addr_t dmaphyssrc1 = 0;
" t# J1 {! j& h1 d# S1 q - dma_addr_t dmaphyssrc2 = 0;. S% z+ H5 e( A: l
- dma_addr_t dmaphysdest1 = 0;8 q7 @5 p! O g5 M Q* M- [
- dma_addr_t dmaphysdest2 = 0;
8 \3 i: a$ {. g - 2 L$ F. {! o t. E
- char *dmabufsrc1 = NULL;2 i* i$ w6 ~! M1 H0 e
- char *dmabufsrc2 = NULL;6 ^. s- f- [6 x
- char *dmabufdest1 = NULL;
. W8 \% L' H/ F2 _7 C; P - char *dmabufdest2 = NULL;6 O o! D4 \( l i
- & s5 e% b' @9 H& u$ U( f* z& i- u# V
- static int acnt = 512;
' u4 b& p, C. j; I/ a$ c0 }( P - static int bcnt = 8;9 R7 J! U4 _( `- b* j& x, m4 D
- static int ccnt = 8;8 j- K+ v* P( x( B. Q
- % U! T, y* V6 B3 Q
- module_param(acnt, int, S_IRUGO);
+ i1 E8 W- v8 e - module_param(bcnt, int, S_IRUGO);- I+ F- \4 W! K& x; f& c
- module_param(ccnt, int, S_IRUGO);
复制代码
3 t( S u" q$ m: R# ^. {5 | u( t" I5 _8 x/ ]6 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) R4 O+ D7 t. ~8 n/ {% Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 \2 X. ~( P7 y- o7 o- C- c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% m1 ], J. K% U- j% Y5 l
# E. }, @9 ~( s# o" t1 n3 K+ \* ]1 y
|
|