|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) V, z, w4 @+ |1 [
- [code]EDMA sample test application. h* x: m8 L8 J9 v
- /*
& N7 k6 P1 Y w$ o$ @' u8 O - * edma_test.c, T5 g% _, a+ j& ?( ]- A
- *0 a0 k! b! ]6 k d# k) z$ T4 H
- * brief EDMA3 Test Application2 E2 [" m) w! [6 L# W
- *
- |. A; ?: m* h( }7 g1 {; ? - * This file contains EDMA3 Test code.* s5 A8 g% M; J* {; ~" [
- */ X7 J8 n6 z" w6 H& A' n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- f! g6 t, l) {. N6 I ]0 f8 C& m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" K5 w/ W! n6 }3 _6 b9 ^1 }
- * TO CHANGE.
$ Q; f9 G2 v' @. U/ o6 ` - *9 X' M- R0 I, i$ U- V0 `" O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 @+ |8 o9 f7 B6 i X$ \ - *
( C& a' N# b1 f- G - * This program is free software; you can redistribute it and/or# V& X# z* A. N- [) e# d
- * modify it under the terms of the GNU General Public License as
/ \6 R/ @( r$ X; @ - * published by the Free Software Foundation version 2.
) b' n1 G! k- t. K1 k* y3 j - *4 p6 F* x9 Q, T: q) p: Y' X" u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 b' _( T/ f: G u6 W
- * kind, whether express or implied; without even the implied warranty
0 ~$ H4 J. T! T% W- t0 v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- I1 i3 d. p0 y! i4 V( g - * GNU General Public License for more details.
) m, ~! B! d0 a1 V, u - */5 H' Y. w5 {; Q
- 9 T' C; } K% e
- #include <linux/module.h>
4 [4 p: S- ~. c- b8 W: [ - #include <linux/init.h>1 w. r- C; o2 e6 J2 j: h
- #include <linux/errno.h>
5 U# J# j W1 w: w2 e& I) I - #include <linux/types.h>3 U6 M6 d& e! y" B S$ P' Q
- #include <linux/interrupt.h>
" p- j: k/ s' x. v - #include <asm/io.h>8 g, |' n/ x+ W7 A# y; {
- #include <linux/moduleparam.h>
5 N( M+ d& `# x) I - #include <linux/sysctl.h>
9 ?1 x6 x7 M) ~2 N$ f, ? - #include <linux/mm.h>$ u2 a% H2 E1 B( f1 c
- #include <linux/dma-mapping.h>
% }3 D) v! J/ i e - . a, }( ~8 L. B$ D# p3 K5 P
- #include <mach/memory.h>6 u. h, Y* q; [: T( U( C
- #include <mach/hardware.h>
) r3 A. g7 O0 L" v9 l4 a' D# | - #include <mach/irqs.h>1 k. ?3 e3 H1 T4 F( y
- #include <asm/hardware/edma.h>
9 |" f Z: P2 u: `, G6 C - , I" G4 o. t5 x& K& c
- #undef EDMA3_DEBUG# p* D0 Q/ O+ V' I8 X$ r& p/ }4 d
- /*#define EDMA3_DEBUG*/
x( y) t1 Y* t' M* ]( v
. ~' S& n3 A, u% ?# y- #ifdef EDMA3_DEBUG1 t. ] q( Y Z6 W0 p6 B0 ~& V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ]# N0 e5 E5 ~/ ~/ k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ s0 Q, F4 `& [0 H. T1 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! k, ?2 \: Q0 \/ r5 y
- #else
% C7 G; s- U, C6 |) @ - #define DMA_PRINTK( x... )! c) O5 a$ e- p; p
- #define DMA_FN_IN
( i: P$ x' A! ^. s$ Q, y$ \# w - #define DMA_FN_OUT) E# B/ a4 t- W7 O$ V% e
- #endif* G( w6 s; s, Z, ]8 P& M; Y( |
- 9 s! v% ~$ X& E5 U! g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ z# ?. x& H1 l7 c7 s6 m: L
- #define STATIC_SHIFT 3
; ]# o$ P0 I' u$ S' |1 T5 K - #define TCINTEN_SHIFT 203 D P. Y/ P8 E+ e$ o# B# ^8 U* c
- #define ITCINTEN_SHIFT 21
2 ~1 o w0 t2 K0 I* s% @" E1 R - #define TCCHEN_SHIFT 22
- [# k' p- F( \: p+ P$ g- r - #define ITCCHEN_SHIFT 23
# Q& ]" P Y- F8 Z! e+ U
+ v0 k* v# o! |- static volatile int irqraised1 = 0;- }' }- C/ l, P2 l: m p
- static volatile int irqraised2 = 0;
& y* a5 j7 x; V0 x; y6 P; _, l
8 j8 h- k* n. \0 j8 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c3 L+ {* \# H) Y$ ^# A, f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ m: z' w4 {( Y) {1 i7 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 \3 B& o1 g- n! b, I9 \
: W- N: p5 u: a( e9 s! M- dma_addr_t dmaphyssrc1 = 0;
7 K( y3 z2 u* ^ - dma_addr_t dmaphyssrc2 = 0;
; i& S( Q$ z- z4 v - dma_addr_t dmaphysdest1 = 0;
1 `; r, |2 p2 z5 p - dma_addr_t dmaphysdest2 = 0;: u( G+ U- M/ f: ?, s; P; g5 y9 I! w: p
6 I, v0 h! R3 x9 H; x- char *dmabufsrc1 = NULL;
9 V* q/ s: D: R3 x" Q4 S3 V - char *dmabufsrc2 = NULL;- S2 j5 h( ^8 e9 z% [# [) S# o
- char *dmabufdest1 = NULL;. L" D0 N. N m \8 A, u: W4 n
- char *dmabufdest2 = NULL;* H. k0 N; V* ^( {7 _
- + ~" s. w$ ~: i
- static int acnt = 512;
; s, W8 x2 I' K# c7 B1 @$ G - static int bcnt = 8;2 A. V6 H# u l3 l9 Y1 G; A
- static int ccnt = 8;( n6 H* ~: y* M3 l
$ P! V1 _! W, C- module_param(acnt, int, S_IRUGO);3 {9 A* q8 m' H8 `
- module_param(bcnt, int, S_IRUGO);
- G9 d1 m. g* {. x4 K2 q" g - module_param(ccnt, int, S_IRUGO);
复制代码
D' f: O) E8 ]* @4 Y) X4 L2 ]9 l7 M' W, c' m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Q1 o* O6 G5 D5 G0 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
?) e+ M( | a& y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. C3 r7 I% t) q* V1 q
1 P6 l, _+ t) ]# i9 v7 u, d
$ r1 Z' L5 K3 V, C+ r! q |
|