|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
z" n. b) T) J I; D2 i; t- [code]EDMA sample test application/ n. z4 u* q+ {1 ~8 p1 `
- /*, M/ Z" w, I6 m8 q
- * edma_test.c: a* I, v, F4 b" {; D
- *
. h l0 Y. }$ p; S - * brief EDMA3 Test Application; {. E$ b. A% F/ ?: r) N
- *
0 G* I3 n1 ] M% r - * This file contains EDMA3 Test code.
/ E/ k. N, q/ T% ^! W+ Z" W' e8 p - *
) w( M' r; i& ~. ?) ?- }; W. W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 S& N9 [# V3 W; b' I2 r/ m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 A! _8 F1 ~, q5 N
- * TO CHANGE.
. @; K: i- V J2 R - *( ^3 k" D0 A7 `, c5 X3 T2 t. k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! G# k6 s9 B! |4 R, R \9 i
- *' F; @; `# p" X) y6 b
- * This program is free software; you can redistribute it and/or$ G* p0 h& g. \# b; g R7 C
- * modify it under the terms of the GNU General Public License as$ b, ^. B8 l* B, Q: O3 |# t+ {/ n
- * published by the Free Software Foundation version 2.; {, d2 K2 A) b4 U1 G. b' \/ R0 ]. t
- *8 l. P4 @) x, U# F+ ~, ~" k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" s# w0 x4 ^1 e9 N7 G9 X3 G - * kind, whether express or implied; without even the implied warranty/ q0 N7 w1 P: U& X/ k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, Y" U N2 A+ y$ Q$ J m$ e - * GNU General Public License for more details.
5 y+ ^# P l6 @2 ~! c0 B0 x# _ u - */
# Y3 h3 @- c! T& J2 c1 n$ w( p
9 v6 G u X- T( `- #include <linux/module.h>, C! u3 l$ _& X* O, m8 a5 |
- #include <linux/init.h>
& |& O7 J& X) r5 C$ A - #include <linux/errno.h>
1 f0 N( n7 B0 b4 u) L4 [% ^ - #include <linux/types.h>
2 v @! D0 ~! Y/ o - #include <linux/interrupt.h>/ U0 u- J9 \/ f) U1 f
- #include <asm/io.h>
' f% ~# r; r2 f7 y' L - #include <linux/moduleparam.h>
9 ]0 F1 f7 G4 X% O S& G - #include <linux/sysctl.h>% }& b4 F8 p9 l
- #include <linux/mm.h>
8 N: e" N c4 p! W1 W+ \8 K - #include <linux/dma-mapping.h>( z" T+ c; ]; ~/ ^$ P. ?
9 @1 @5 A3 S( S1 i6 C5 c$ q- #include <mach/memory.h>( Q+ I7 v: s* G$ B3 F
- #include <mach/hardware.h>% L8 S& K- E/ q _2 q3 A2 w, `4 F
- #include <mach/irqs.h>/ j3 s/ M+ ?( w9 a: J: e& p
- #include <asm/hardware/edma.h>
& v8 J: I; J0 ^) ~" S6 @' O
5 J1 s1 P/ u7 M- #undef EDMA3_DEBUG
4 W; @) p" @/ @" Y - /*#define EDMA3_DEBUG*/
* \# |3 K4 ]# i2 l9 } - 2 u; X8 `& A2 h( t5 \3 Y/ y
- #ifdef EDMA3_DEBUG, E8 F, i( P/ r b7 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 v7 x5 B, D4 V/ O, r2 A( d) Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ~+ V, a9 M, i% C; i h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! X% G1 o" f( O2 R, E
- #else
! C+ G" c" w) B - #define DMA_PRINTK( x... )* G! h8 w& z( j# U2 l& v
- #define DMA_FN_IN
0 }2 I( q: a6 P - #define DMA_FN_OUT* S7 |1 T+ ^8 G' x: ]# {3 \) l9 ]
- #endif
; ]5 l2 Q& i- W - - @3 X( C) W+ O6 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 r3 X# q$ u: C# [# g& {* g - #define STATIC_SHIFT 33 w2 Z8 }; [: K" P; G9 F8 W: d
- #define TCINTEN_SHIFT 20' r" Q4 R" E1 m: ]) C# V
- #define ITCINTEN_SHIFT 21
- ^% M* q# M$ u - #define TCCHEN_SHIFT 224 g n" z( [0 j% A. }
- #define ITCCHEN_SHIFT 23
& q3 O$ z0 D! G4 x: P
9 o6 B) C: U8 X: i0 Y7 l7 e0 d- static volatile int irqraised1 = 0;) g @( S, D9 g3 S7 ?4 b1 A3 Q, o
- static volatile int irqraised2 = 0;4 p7 R0 t" G) e& L
- . [# d8 {2 ?" v. f- @$ U. s: G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t- n% G# I" V% S- S/ J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ K( R: T4 S' f: Q/ Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 j4 W4 E& B2 l& G. e
0 E. n+ o i n# z- dma_addr_t dmaphyssrc1 = 0; M( ]8 m9 [$ v: v- L
- dma_addr_t dmaphyssrc2 = 0;" F" Q* ?4 I# K& |! N
- dma_addr_t dmaphysdest1 = 0;% Q/ f1 C, C! ?7 w$ G
- dma_addr_t dmaphysdest2 = 0;8 D4 G# i: d @
; G4 E7 _' G0 |; K- char *dmabufsrc1 = NULL;
4 |2 A* V- v' S' d$ D+ ` - char *dmabufsrc2 = NULL;6 Y: l: E6 |/ Z- m' q4 y1 w, d
- char *dmabufdest1 = NULL;
: q S( K" d3 q' g) R - char *dmabufdest2 = NULL;
' [$ L- W8 B6 U7 v% e - . M) h; o/ U9 \
- static int acnt = 512;# K6 h0 v w7 y) M5 g
- static int bcnt = 8;
- l( K- c* g3 V2 T4 c4 ?( T - static int ccnt = 8;7 p7 m+ U! S# B) Q% \6 I) _ e
1 |7 s4 b* z/ x9 L1 X# Y8 O+ z' g- module_param(acnt, int, S_IRUGO);' d6 k. K$ R! e8 C' }
- module_param(bcnt, int, S_IRUGO);
0 v: y% ^0 D3 g$ `9 Z - module_param(ccnt, int, S_IRUGO);
复制代码 * g. U9 m, s/ I% M5 |0 L& z
1 T( R* E* H. H. A) u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 n; L4 \" t& G) Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ F3 a8 t- s( A+ s. i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 w+ [$ e& W, ^. U
6 Z+ Y1 z8 B# r8 i' T2 T( k4 F
2 Z p. U1 H5 K4 }. q* ?+ z |
|