|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% r/ R# G. i8 x" G* J8 `$ B! k% c# k- [code]EDMA sample test application$ I9 \- V: \/ G. [+ Q! M3 r
- /*! B" p+ R& N# j U# f* p
- * edma_test.c
* n" _+ y) \1 I1 R8 g - *; `5 X- ~: l: ]7 ]; K0 Z3 Z
- * brief EDMA3 Test Application3 }! s- |! j* [% W2 R0 i' I0 F# b
- *
+ r: t; W! n' [* S - * This file contains EDMA3 Test code.9 x! O% i' Q. ^! I) i t
- *0 B4 n6 g" p$ ]' y1 ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) s- w" J) \5 e$ G7 l# }8 h) g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. C ?, y6 s8 S' [. D
- * TO CHANGE.! n% q+ z$ @6 t! q6 u: K( L: o
- *3 N1 v( e, N! S1 I' J: C1 b. q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; P- j" V* Y" v2 A - *
- E9 _7 n z' a( k - * This program is free software; you can redistribute it and/or
% X: [7 o4 [5 A: {4 Y - * modify it under the terms of the GNU General Public License as
Z( f6 t7 E/ Z - * published by the Free Software Foundation version 2.
# r+ _$ {& t0 \ - * \& L, \6 ?: O$ p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' _# P( o- z; p- h - * kind, whether express or implied; without even the implied warranty
: T9 |' w: ]# V# I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: Q% `, G j; A4 b7 T; _5 Z - * GNU General Public License for more details.; H7 W5 ] l8 _" [9 f
- */8 h; t* u: X8 H) v! S( g
- I8 A T5 v/ e% H- #include <linux/module.h>: s: d2 W" H) T( h
- #include <linux/init.h>( x* Y- t+ n2 m/ `- B
- #include <linux/errno.h>
; V" X" s* V% l! l. R - #include <linux/types.h>
5 d, W. O: d) Q7 ?4 x - #include <linux/interrupt.h>
, Q! |; G4 R/ M' Q$ W0 L& f - #include <asm/io.h>
( b- O8 V2 c8 {, e: R0 B* A+ W - #include <linux/moduleparam.h>
9 `: N1 }& n, C - #include <linux/sysctl.h>, X% w1 u# J2 n( Z+ G9 V3 X
- #include <linux/mm.h>
5 X' D/ Q9 W( L; ]3 [2 W$ v& k9 ] - #include <linux/dma-mapping.h>
; T! }! b+ J. T/ U, J4 W( N
8 n- x$ `; e c; t" O) _/ i- #include <mach/memory.h>
7 S$ h. i, w9 y$ Y$ p2 f - #include <mach/hardware.h>) ~4 J% a# y- L C6 y
- #include <mach/irqs.h>2 o; s$ o% m* C3 _3 u s
- #include <asm/hardware/edma.h>5 _5 q2 j: `6 Q# I1 a
+ @9 y/ L, A1 h+ T4 U3 P- #undef EDMA3_DEBUG
7 A! K0 u' ~- R' u! `7 x3 A - /*#define EDMA3_DEBUG*/
& i; V# U3 ~/ u8 i8 S& n - " R, ~0 O/ V8 P% k+ F# x
- #ifdef EDMA3_DEBUG E) O( N" h( B& D2 ^" f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 V' z2 g* l% E L$ f. h( u e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 l8 n4 _$ r; U( p$ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* h7 [4 l0 q# C - #else& R! g7 ]! k" [8 n
- #define DMA_PRINTK( x... )
. B7 @, U) E7 e - #define DMA_FN_IN2 W! }2 @3 z/ Y
- #define DMA_FN_OUT1 t9 U* R) b+ A& \
- #endif) X+ G; K# r9 e& `1 i9 O. H# x
- ! ~( {3 Z% a& a9 X' H, A; ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 N) c) \7 n! R9 j
- #define STATIC_SHIFT 3
* V6 [: L* }% ]. v$ T" B3 W - #define TCINTEN_SHIFT 20
7 i8 B# v. E# Z1 V4 T9 F; H; `7 J - #define ITCINTEN_SHIFT 21
3 C; u8 `+ F/ ]0 E( Q2 a - #define TCCHEN_SHIFT 22
+ L- J9 T" t; Z - #define ITCCHEN_SHIFT 23
# d; N* ~1 ^& V9 ?& m - ' q& P" E- Y5 V& @' Y$ i4 {1 t2 X
- static volatile int irqraised1 = 0;# f8 W- r# [/ ], Z
- static volatile int irqraised2 = 0;
2 E5 @ @2 z& v. y9 \+ C. X0 `
- ?. O. @4 O1 N' L/ w3 g" m5 J8 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 i& x y8 ?% ^/ b @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 R# j: c( s- {6 T. _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, C+ m* {5 e2 F0 o* H; U/ h
- # Y* g/ W4 J7 Q9 P* i) o F
- dma_addr_t dmaphyssrc1 = 0;- N" P5 T% f3 D% h d
- dma_addr_t dmaphyssrc2 = 0;6 E- f5 n) I5 Q3 S& I& p+ d# Z
- dma_addr_t dmaphysdest1 = 0;* f. G1 R$ V, n) U6 c; P
- dma_addr_t dmaphysdest2 = 0;5 y8 y1 f5 v( Z2 W: B7 O$ W
' }/ z% y& V7 a5 M) Y& C- char *dmabufsrc1 = NULL;
2 ]/ E8 _0 j# x - char *dmabufsrc2 = NULL;
8 u" q1 I% O7 |: @8 s" n1 q) f - char *dmabufdest1 = NULL;
- Q" Q* d- ]1 f; ?, @0 H( u - char *dmabufdest2 = NULL;
8 M8 B/ U9 U& Z5 \. L& O, d - ! K8 K" r" e! E7 `" A' s2 ~, q; r4 ^
- static int acnt = 512; n5 v' K, h! U4 y, W7 V
- static int bcnt = 8;" E \5 L0 H4 A3 Y5 L6 K
- static int ccnt = 8;
& {) |' N) j) y T0 b) `7 }6 j' v
5 H8 q$ D8 P' I( @+ Y) {, y- module_param(acnt, int, S_IRUGO);/ W0 I1 K% p( s) l0 t/ q
- module_param(bcnt, int, S_IRUGO);2 q+ R! Q7 ^) A$ c! O
- module_param(ccnt, int, S_IRUGO);
复制代码
1 q. u' W7 b; g. G
8 H0 c# h: R2 j# G" D( I } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T! {5 j: W- W, `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Y. `, N% G: i, j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ^ p3 _1 }$ S4 ^2 C- y- C7 A3 X8 \% c0 ~" \; w/ B. t5 G& y
: t- n% p- \" \8 T8 E |
|