|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 E. G9 [1 P* w, U1 h
- [code]EDMA sample test application
. y5 V8 D K2 s z2 H" [/ R/ G - /*
0 d5 I# `) P& U. ^ - * edma_test.c. @+ ?- F( h7 [6 ?
- *# V# b, ]' F- \1 O/ r+ _7 ~0 _
- * brief EDMA3 Test Application' z+ r9 \8 n* e" R" K y# ~1 j9 s
- *# }- ], Z) n+ e/ w5 |
- * This file contains EDMA3 Test code.
$ `5 `# m7 O! E( c0 Z: W - *
& g7 }4 v4 ^* u n: q5 B0 o9 M- i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 F' J. c/ k1 m' \2 `+ g* g1 R' L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! Y2 Y N; h+ ?) t4 W1 _: u - * TO CHANGE.1 J& l9 {) z3 g7 N' V; H( m
- *; `" Q" r2 X# S* x1 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( y, Z( L2 p0 q# w1 v - *
0 {7 V1 \; e( E - * This program is free software; you can redistribute it and/or5 n$ q* o; J! `" _, _- h- V$ `
- * modify it under the terms of the GNU General Public License as! u+ p7 m$ }7 Z' m- X
- * published by the Free Software Foundation version 2.
) r' v% c8 t, x - * Y" M R: i' j% k: @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ~4 @4 z7 Q( d$ K7 T% ] - * kind, whether express or implied; without even the implied warranty' }: K+ h$ f5 F9 y9 Z" I# r5 E$ b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ]% E, @* u9 B6 ^) y1 U$ {1 c
- * GNU General Public License for more details.& a9 x S. V$ V0 o, ]
- */
- m1 Z3 J/ n' _1 m6 ]' a - + j9 K! W* k/ h' w/ G0 ^4 r
- #include <linux/module.h>
: ?% Z7 H! `) ^7 s0 y - #include <linux/init.h>2 P. n* J# t+ x1 N" C1 T" X
- #include <linux/errno.h>
" s' z0 E8 D0 g: ]. D- H - #include <linux/types.h>
( z+ U7 x- p$ l6 C - #include <linux/interrupt.h>* _# X: b% Q3 u9 P" i
- #include <asm/io.h>; ?$ Q& A3 |. a/ Y5 Y* b
- #include <linux/moduleparam.h>
( j V% ^& T- F ]9 s9 L4 J4 ~ - #include <linux/sysctl.h>
0 L# B6 o% s9 g# K( F9 v8 a, N - #include <linux/mm.h>/ T7 N: O9 M) S* }9 c
- #include <linux/dma-mapping.h>6 N% I( m2 X( Z0 B! F: d% A
- 3 r8 [- ?, Z% m4 E
- #include <mach/memory.h>
- N$ F' [" I* v2 R - #include <mach/hardware.h>
% w: a D2 a$ a9 v5 p G - #include <mach/irqs.h>
4 s! R; s' R' Q2 o- Z% |+ q - #include <asm/hardware/edma.h>& }% |% W+ R, x0 O1 @: K" C+ B- M
* |3 c% E+ @3 m- ~. P- #undef EDMA3_DEBUG
/ j8 u& } ~* P( ?7 M, j - /*#define EDMA3_DEBUG*/
( o5 r8 R. A7 N1 ~$ g - 5 t: H6 D$ h$ @3 Y; U/ v# S, \; E
- #ifdef EDMA3_DEBUG# [: R5 ?/ J5 A: O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): p; _" d3 ]. b. \9 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 J) g5 K$ T7 Y+ s2 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 b) G8 W1 H9 L: \9 @+ Y
- #else
7 ?* R) F1 r8 X X - #define DMA_PRINTK( x... )
, D; t5 ]* }4 P# H; I; e - #define DMA_FN_IN3 f4 r: O3 ^3 s" ^
- #define DMA_FN_OUT
3 s) ~- I/ l) ?# n& T6 a, d4 ^ - #endif
9 J0 A& m @* s; I3 y k% G
! g* Z9 Y# b7 K/ p* R3 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' d( p1 Q+ g( S5 k. m3 [5 \
- #define STATIC_SHIFT 3( {" |$ Z$ l+ e+ z% [+ b p! j
- #define TCINTEN_SHIFT 203 h, {* p4 C( ^1 I/ [
- #define ITCINTEN_SHIFT 21
5 b6 ~6 {( H" S) S/ L9 A - #define TCCHEN_SHIFT 22
8 {9 j9 P$ ?7 g5 @ - #define ITCCHEN_SHIFT 23
, {) Y4 K/ B$ a U
7 K: a& P2 ]4 s6 e: j$ J- static volatile int irqraised1 = 0;
/ X2 N% ]- }! y: ]' Q8 c, l( Q - static volatile int irqraised2 = 0;1 q/ h" i1 q0 }' p4 i" Z
( @- n' x, d3 V: t [ {6 m1 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {% I% G' p: k$ y( e1 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" E& ]0 E: a$ o; x) z2 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; I) l, f$ w; C. p" b9 c% l
+ b# o& X+ B# Q; r- dma_addr_t dmaphyssrc1 = 0;
( k! m1 a. h5 u+ C - dma_addr_t dmaphyssrc2 = 0;
$ O- C- i/ i: ~" S2 g2 J- k$ p - dma_addr_t dmaphysdest1 = 0;( K# F6 [6 }$ Q4 j$ z! { \
- dma_addr_t dmaphysdest2 = 0;: J6 H, q. f* ?* S3 t
3 [( |5 T: v( L+ i" o3 j( p3 X- char *dmabufsrc1 = NULL;# k. ]& m4 l2 A' R
- char *dmabufsrc2 = NULL;9 A2 S- d* M+ q
- char *dmabufdest1 = NULL;. D- [' b: q* H6 l# N* z! {" `
- char *dmabufdest2 = NULL;
. \4 X2 v) W: W& c5 `) v - & N- m v+ v+ u
- static int acnt = 512;/ Y4 x: @/ T" G. f
- static int bcnt = 8;9 e; J: C" k4 S: U+ B5 \% W% m
- static int ccnt = 8;
6 v& w6 e4 z/ D9 [+ U - 9 W0 n3 ?" e9 t$ R; t
- module_param(acnt, int, S_IRUGO);
' d* i- ^( B; e! W: W - module_param(bcnt, int, S_IRUGO);/ q) I2 o- H+ o/ t+ g
- module_param(ccnt, int, S_IRUGO);
复制代码 ; r* @0 }9 _7 \: e
6 B; R9 f' T9 W8 h5 @' f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 }- d) e/ ]3 k$ L( Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 J7 x+ o2 x% }% e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& M0 D0 ?+ F4 f- J. X3 D2 g1 A
0 W8 Q, O( [% C* M
1 p+ e) c) Q9 k6 K3 E& Q8 d: E
|
|