|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 G. ], H. Y; E/ _4 R8 ] c- g
- [code]EDMA sample test application, T7 F8 U, R3 A s y% E; e1 g
- /*& H' K: e Z# }) m' g
- * edma_test.c
# k6 @( V6 D) d" D5 } - *- ?" v6 d7 I1 n9 x6 G! P! p y1 T
- * brief EDMA3 Test Application
8 ?% Y1 U5 g3 p9 G' H% i7 x4 o$ X! k8 F - *
& S0 a! e5 A7 n7 e J/ Q - * This file contains EDMA3 Test code.
8 n5 E! a' h- u) x( R: R# M% L - *
( N" G+ ~, M( {( M4 w( C$ T8 ?1 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
~& d5 \3 H, _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 a6 S3 Q( C! @7 Z3 m6 U2 b - * TO CHANGE.$ b6 {7 Z% \4 [. b1 D" A+ ~* Z7 w) ^) x
- *
9 v# y$ K& d( _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ W9 [9 S" t/ [& v2 X
- *& m" J: v$ `5 }, O I# C: c: S) @( L
- * This program is free software; you can redistribute it and/or+ B8 r' K+ x% B7 |. G
- * modify it under the terms of the GNU General Public License as) X. ]) O- T* M5 q. A& K1 E
- * published by the Free Software Foundation version 2.! ]4 \2 U9 Z0 F7 W% H5 ^: }# r
- *
6 |% }" Q5 P# h( N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: G) m# \! |0 E" J+ v8 P - * kind, whether express or implied; without even the implied warranty( ?7 V2 b; N+ B( y8 K: d) {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 P2 N, g4 [6 s1 F" z
- * GNU General Public License for more details.
8 s5 a9 L t5 {( ]3 i/ u% _. r. k - */
0 L, x& U' y8 D3 Q5 N: h: G
: R) _" X# q$ s7 {; t2 [- #include <linux/module.h>
9 f, u8 W) Z4 z5 w. o - #include <linux/init.h>, H3 L9 w' f5 _( o9 M6 J) Y' o: V7 R
- #include <linux/errno.h>
6 X1 v5 n5 c* C/ @/ T9 E - #include <linux/types.h>3 e! Q4 g L- O4 z* o, R: l
- #include <linux/interrupt.h>
) `/ x6 m4 j$ H - #include <asm/io.h>- P5 T5 e2 T# V( _( w6 c# {9 B
- #include <linux/moduleparam.h>, Z7 U0 D, D- P3 r: T
- #include <linux/sysctl.h>( P- v; g' X# w% o
- #include <linux/mm.h>
$ M9 F7 T! C# Z) M, F* l7 n$ h - #include <linux/dma-mapping.h>
* H/ b2 G" O- M0 ` - $ X8 s( }' g& }9 f
- #include <mach/memory.h>+ F% w' [- d* Y& ^+ ~2 ~
- #include <mach/hardware.h>5 o V; I) k8 W& L/ I; @
- #include <mach/irqs.h>
* i& z/ P% E8 r# l* p4 ^ - #include <asm/hardware/edma.h>
9 s3 r" d6 l e - , B& ^5 i, m; V( Y' v3 X9 z
- #undef EDMA3_DEBUG/ `9 p, g1 `9 ?. q5 l
- /*#define EDMA3_DEBUG*/
6 S1 I! n& ? J+ P# A+ w- @9 ^, Q - 5 G- p4 w8 q) {1 e9 L. [% c
- #ifdef EDMA3_DEBUG. s& I$ ~ z7 K1 |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 I7 k5 O$ |9 O! B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 g! K* H K, z3 l% A7 U& W4 D0 v" d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# Y) q3 A/ k, z2 L) R6 E3 l$ s7 ^! o - #else( ^" z7 H) b' V
- #define DMA_PRINTK( x... ). q* N5 K+ h9 s8 v
- #define DMA_FN_IN2 q: |! s) i; D+ e/ [% P
- #define DMA_FN_OUT
9 } Q" m n% V - #endif
& X/ G! a, T9 g) H! U0 N - $ ?% Z! f/ R- ]/ P; G2 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- y5 f" ^. x9 _6 h+ `, e) \ - #define STATIC_SHIFT 3
: m$ o0 a0 ~, X/ b - #define TCINTEN_SHIFT 20
+ |" v. X' y* D1 x: j# q! n% C - #define ITCINTEN_SHIFT 21
5 c& t6 S2 U7 T - #define TCCHEN_SHIFT 22
% o2 M, |1 w( t l5 P3 } - #define ITCCHEN_SHIFT 23+ x; l4 i5 D( E" S9 F+ h9 ~
o6 m8 K1 S/ y- static volatile int irqraised1 = 0;3 U# }* Q: o: {9 O- x& B( r
- static volatile int irqraised2 = 0;
9 _3 G' [+ u% j( X) x R0 P" e
) `& ]( ]2 o# t' f1 f! l1 i+ l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Z4 I; y/ s6 r, ~3 Z+ \; \8 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 A' X' T# A3 e' j2 Z" H1 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) [ A9 l, V' e+ y0 ^0 D - , C% Q0 z4 j/ C+ {/ c
- dma_addr_t dmaphyssrc1 = 0;3 @) }6 @+ Q; [
- dma_addr_t dmaphyssrc2 = 0;' f/ Q1 S9 t9 L2 {& T) s$ Q
- dma_addr_t dmaphysdest1 = 0; U1 G$ {: `3 h
- dma_addr_t dmaphysdest2 = 0; n% S# I, E$ q
- - |; L% n6 m# e( Z
- char *dmabufsrc1 = NULL;
3 t: C$ h! Z; W - char *dmabufsrc2 = NULL;
; k2 r5 ^" A2 N2 | - char *dmabufdest1 = NULL;
; h! a' c; O7 [ - char *dmabufdest2 = NULL;
8 p3 V& @) F4 D
; }; X( ^( i4 Q- static int acnt = 512;) r" s$ k: v' @
- static int bcnt = 8;8 a) M- g0 x: z W$ v1 t
- static int ccnt = 8;
3 a6 y# \( I1 h$ o - 5 z3 G, }) {& K0 b) _ t' V
- module_param(acnt, int, S_IRUGO);
v$ d7 u) i4 N3 I- I) ~ - module_param(bcnt, int, S_IRUGO);
& C! `3 v0 e/ F0 j5 O- ^7 O& _ - module_param(ccnt, int, S_IRUGO);
复制代码
) e% J8 p2 |- k. g& F
# U1 ?7 K' ?# H$ |% F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 e8 O2 Q: p, S. r" B+ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 c( w! j7 l/ O( b/ \6 s/ r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ S5 d, Y0 Z# g: P1 y1 q! }- b$ V/ s8 |, h0 m0 m' r
. h1 c( e/ p) G( R
|
|