|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I3 w5 X- t$ e. b: X- [code]EDMA sample test application% B. N5 w; v. o( x9 n6 F& ?9 o
- /*
9 \9 F! ]* W3 j! j* Y: V, j6 l3 g: w0 Y - * edma_test.c1 ^" w- x3 q+ C% {- b1 T5 V, A- e
- *
0 ?- ~1 p* K4 V: B, g. | - * brief EDMA3 Test Application P$ s* M' M( |0 `( }- N
- *# J2 m; m0 h9 {3 I4 j6 T' p
- * This file contains EDMA3 Test code.
/ \, {( V2 D8 k+ l. S7 a' A+ O; z( j - *
0 g; h5 Z ?8 |1 X% H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 g, j0 t% c' H( m* u8 z9 X8 B } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Q* r6 d/ m5 O8 p. f1 q' s - * TO CHANGE.
0 W w8 Q) ^& T" i7 X( N - *6 r) z, L8 F# U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 V7 J: X) V0 p8 A; ~; N
- *- j* I# A& s1 u6 H- |5 S0 B
- * This program is free software; you can redistribute it and/or, _6 U# m1 K/ r4 q* F! w2 V! V
- * modify it under the terms of the GNU General Public License as$ L9 [& c6 K( e# z5 y9 W
- * published by the Free Software Foundation version 2.
% w% D0 } W( ^% f) Q7 U2 T - *+ b/ F g2 ~8 v, y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 e1 U1 b3 p% |: b7 ^2 e4 M+ K
- * kind, whether express or implied; without even the implied warranty
; l, G) _* T) M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 M0 F/ O, y/ ~5 N" O - * GNU General Public License for more details.% l5 f. j, ^, \! O( K9 K) \
- */
+ L7 l2 i$ g& U& ], X
8 v1 [/ Q8 U( a& c- #include <linux/module.h>- `2 y: a$ }* m; p: T
- #include <linux/init.h>
- L4 X" U( R4 U" F- T- v- H - #include <linux/errno.h>
@, `! m5 a% j2 _9 E - #include <linux/types.h>
5 D ^: n R0 F3 R2 l - #include <linux/interrupt.h>
8 M6 c9 O) F: D% Z - #include <asm/io.h>
, D+ I! c) ]& a, F4 m& W+ Q - #include <linux/moduleparam.h>* }. j. F- r/ {- t6 B' y
- #include <linux/sysctl.h>& m* v+ g- k; S
- #include <linux/mm.h>6 _6 p1 T$ n9 q. g! g. b1 G3 q0 n
- #include <linux/dma-mapping.h>, C5 H6 [4 [& ^; a% y
- * T7 \" Q& P6 Z( [
- #include <mach/memory.h>' S/ @! M% `* s
- #include <mach/hardware.h>
, g& F1 }4 Q" ]8 Z0 ] - #include <mach/irqs.h>7 A0 H7 K+ V$ b0 {9 \3 Y, S
- #include <asm/hardware/edma.h>
2 m1 D5 T. S* i0 Z$ z8 o, {% L - $ M0 S* X+ a$ e, z
- #undef EDMA3_DEBUG! z; M' g% Y: c$ D$ m3 p" Z# X
- /*#define EDMA3_DEBUG*/) n0 h" c, W& O& m
2 y. s7 L. a) Q# y* Z- #ifdef EDMA3_DEBUG, n$ [* R9 G/ L; J6 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* G' y5 N2 b' e0 L1 n8 X% O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- V8 D) a" j" B; b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ X2 O+ M* _/ P! c f+ b
- #else
9 f$ F4 A: E1 H, Z e - #define DMA_PRINTK( x... ): k/ d' e1 I1 d" D3 N& t" d
- #define DMA_FN_IN
* e7 E6 }* o+ I' I9 t - #define DMA_FN_OUT
" `/ j. X$ \5 M8 F - #endif/ D. b* d- {/ r' m( t* k% F4 D
% m% x0 H: N9 w; c" i. k) v6 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 u& ?, G) T+ @3 N4 o. U* n1 f
- #define STATIC_SHIFT 3- w T: f$ V, s! a% S, B
- #define TCINTEN_SHIFT 20
6 r5 r: k2 M2 Z+ I k - #define ITCINTEN_SHIFT 219 W5 q( e `& C* l' E
- #define TCCHEN_SHIFT 22
' N# t. f8 @9 |8 S M - #define ITCCHEN_SHIFT 23! _% e, _2 E: K1 |
' s3 m$ g( m( v+ x$ T- static volatile int irqraised1 = 0;
0 b7 }' ]# A m' `% v - static volatile int irqraised2 = 0;' T0 ]; I- v5 F Y
# [/ K; O" q( J8 ~% |$ h+ `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R8 t, F1 ]5 j8 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a& ~% `2 {" Y# x8 L- h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ^8 v2 _! Y, h: c8 ^; a* G- X - % t+ o; M5 m: ~5 G; t9 B! s! Q/ B; g
- dma_addr_t dmaphyssrc1 = 0;6 c0 g2 T8 I/ u
- dma_addr_t dmaphyssrc2 = 0;
; n8 S7 K& |$ H/ E3 F$ d - dma_addr_t dmaphysdest1 = 0;
7 r3 H0 j* O. o7 ^8 V1 o - dma_addr_t dmaphysdest2 = 0;! S9 w6 r9 Y5 C1 I2 E! O' A
- : I B) b% T7 f# J7 H
- char *dmabufsrc1 = NULL;0 M3 s+ ]5 I7 T
- char *dmabufsrc2 = NULL;5 @1 N' O+ _. [( f
- char *dmabufdest1 = NULL;0 P; g9 }9 z \8 N$ w1 L7 G" z
- char *dmabufdest2 = NULL;
. M2 a% t" f" R" R3 P; ]: I
' t1 C8 ^- Y8 F8 v3 j/ S3 H- static int acnt = 512;
& G Y/ ?8 O. K - static int bcnt = 8;& p3 V# {/ d8 G7 r- |
- static int ccnt = 8;
6 j6 k1 E, i" U T- H" r3 ~
/ H3 N k# P( |" P2 v- module_param(acnt, int, S_IRUGO);
: x+ C. J3 J4 L0 F - module_param(bcnt, int, S_IRUGO);
$ g8 M q) w) i5 P0 L - module_param(ccnt, int, S_IRUGO);
复制代码 4 `3 Q6 Z+ R. r1 S8 D
2 q7 [ h$ O& a0 v& g P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 X6 D% e0 [# |* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 g' b; f4 x+ f5 L: X9 U7 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u8 b6 \/ n# n/ t+ \" e
I- \& Y, ^5 ~& L N: K: S; A ]' f/ [6 A6 g/ p' B
|
|