|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& o) Y9 W, a* u4 l$ {- [code]EDMA sample test application
u! u |+ q, o8 f# u( N( P - /*
9 C- X1 A4 E4 m% I5 f+ | - * edma_test.c* N) w0 [* I% W4 S& i4 e7 y
- *
! c& F: A" c( d - * brief EDMA3 Test Application
: `0 Z n% D8 v, Z" X0 o - *
) w/ ]( P% }" v9 n" I! m2 { - * This file contains EDMA3 Test code.1 s+ I1 X, v. T( |. ?/ ? q/ f$ s
- *- v5 H/ h+ u6 u9 k, `: Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; U- |3 L0 C/ M% b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 h0 t- N0 C* h - * TO CHANGE.$ R9 Q# j6 a7 s i/ V/ B
- *! t' z. a4 e& i0 G7 {3 C" |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" a. o: z8 g; M+ ?1 ` - *! Y Q5 j, f2 l8 q9 |4 R
- * This program is free software; you can redistribute it and/or6 c9 H5 n$ a4 k- v8 w7 g
- * modify it under the terms of the GNU General Public License as) k/ [2 O; ~. X) u
- * published by the Free Software Foundation version 2. R0 M) K/ n1 D6 U$ C% I! z8 i* x
- *
! f6 [0 h& M! ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
j: S9 u, g6 D- c2 Q3 R; I - * kind, whether express or implied; without even the implied warranty' `4 {7 J5 ~' C$ ]: @* `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( i, E0 |8 B; Q5 T2 g9 H Y - * GNU General Public License for more details.
+ j# U% H8 S' K" h - */: o. y$ D5 P6 K* X' n! [
: f4 q- d% _1 r# L" R- #include <linux/module.h>
* z! [1 t" P2 u) z i0 d - #include <linux/init.h>
: j9 E6 N5 I, u; k B5 j( ] - #include <linux/errno.h> k0 @1 M2 k. c$ s& _
- #include <linux/types.h>5 X7 [' x: i+ m3 X: r5 J+ L
- #include <linux/interrupt.h># @0 x# p) ~, U$ |9 J: d
- #include <asm/io.h>
4 j6 {" b, V- {, U( ? - #include <linux/moduleparam.h>
/ f& Y9 F* K, |+ }* q' E - #include <linux/sysctl.h>2 |$ f/ E, Q* I& _$ G; W' i
- #include <linux/mm.h>6 T. K; Q E& S: q1 t4 K, }% b
- #include <linux/dma-mapping.h> V" q5 ]. b7 @6 R' C8 [( ^1 b9 W1 ^
- W( z y) a0 X# o/ p9 j1 D- #include <mach/memory.h>7 D4 v( v9 e8 ~/ p; A7 ]+ y0 Q
- #include <mach/hardware.h> x: L- _. M# l% d
- #include <mach/irqs.h>
+ s6 K# U& A: ? ] - #include <asm/hardware/edma.h>
- Z. v1 x5 G% K! n3 N - ! V9 G V# t/ |
- #undef EDMA3_DEBUG4 w( [1 P. ?: x) @# `
- /*#define EDMA3_DEBUG*/# Q2 u8 J& M5 r* L4 i8 U
/ T% E9 p" u3 P9 M2 J- #ifdef EDMA3_DEBUG
' t! Z w9 k! [+ x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Z+ l( Y- d" V2 U+ C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ n. H& u# W; i1 K/ D1 f% F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 h/ g4 o2 A u$ _& l& N - #else' x: V( d" W# ?, z4 z
- #define DMA_PRINTK( x... )
: m* a* @6 R. b6 i5 |# m) b5 m: D8 ? - #define DMA_FN_IN5 f+ ~9 x N7 e$ \# J# J
- #define DMA_FN_OUT
3 h$ J* t$ `# Y4 k, E - #endif/ J/ G u7 G3 J/ d* U5 f
6 T) t% e" q O- L4 F) `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! W* Z" r( O3 F. M/ M4 U" K @ - #define STATIC_SHIFT 3) H1 l' Z& ]2 c K$ [( y( p: z
- #define TCINTEN_SHIFT 20
' G3 Z. b3 Z% r; x- |0 q - #define ITCINTEN_SHIFT 212 P- y. W. I- t$ _7 N9 d9 V9 a
- #define TCCHEN_SHIFT 22+ U( d O2 l+ s. u& o
- #define ITCCHEN_SHIFT 23
7 P+ }" o5 b' H/ ]8 b7 I2 R - + c9 X' ^0 \0 v5 Q8 n
- static volatile int irqraised1 = 0;
# T& p5 \) c7 `) a& r9 [* S9 d - static volatile int irqraised2 = 0;) V9 ?* z6 O6 S3 U8 _: T5 S0 l. n
- 3 G8 X" e1 ?9 M. S. \& T" q4 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A! d% C/ _' Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- b- D" W! j- R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D# N) T: B/ D
% E' x5 f) h& d. f O& }: g* ?1 @- dma_addr_t dmaphyssrc1 = 0;1 p2 ]- W! N$ A' c! c
- dma_addr_t dmaphyssrc2 = 0;
4 i$ F. `! e U( T - dma_addr_t dmaphysdest1 = 0;
; m" X/ g. G* Y, I1 e - dma_addr_t dmaphysdest2 = 0;
/ ]% q( R0 K/ n* J( n9 ]
. N S4 }& z7 Y' J* ?- char *dmabufsrc1 = NULL;7 H1 v$ y! y* T+ z0 K/ J; K
- char *dmabufsrc2 = NULL;
0 n' r+ d& S* [( ?. R, H - char *dmabufdest1 = NULL;0 D5 X) D- q5 ~; }- X" z. \
- char *dmabufdest2 = NULL;% s- I$ J- Q5 f( A
- ; F) r1 S2 g/ C1 d/ Y' Y
- static int acnt = 512;
* [7 o( Z& }+ ~, M- G4 a; p: { - static int bcnt = 8;
) q5 s9 R$ t# `3 u/ L - static int ccnt = 8;; a7 U) _$ C g; j# Z( t
' {- b" ]8 ~5 n- R; V, q- module_param(acnt, int, S_IRUGO);
; m+ ~* u3 e' l2 e, C8 u( q s: O - module_param(bcnt, int, S_IRUGO);2 @! I! n3 M; ?; P \" b
- module_param(ccnt, int, S_IRUGO);
复制代码
! c- p( S& `7 K) q/ W! \5 b# \% u6 L6 `
; }3 }% Y4 c. ~8 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m% r( O& Z1 W& F3 P+ x3 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" c4 R! \$ B( h0 `4 T9 q6 G5 _# ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ y, F5 w2 C1 X- m& [# U9 V" P' ^- i) L+ c! u5 s
' u$ n* X2 p4 M, J/ t
|
|