|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ]0 L" ^9 [+ o/ p0 w
- [code]EDMA sample test application
8 S$ k7 j( K: G, e$ M6 w - /*- s, ]4 Q1 D ?
- * edma_test.c1 w8 n* y* b9 v4 c) a9 y* _& s
- *; t7 T- w. D+ M2 ~* u2 ?
- * brief EDMA3 Test Application
6 }4 V! y8 J; M, @; w9 C# R+ p* J - *
! n, M5 m6 G/ ^ - * This file contains EDMA3 Test code.
4 l/ E5 C% N: c# s9 F5 K! y" Z' r - *
% Y1 Y; l$ l- E% U b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- D2 C: q3 z6 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( x1 S$ Q: `( v7 f; S
- * TO CHANGE.0 X8 n% e/ c: L# g
- *
- q5 H' a! R* t% ^! A3 b5 p7 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W. P' j7 m) {" J
- *
: Y4 j: H0 [5 Z1 K8 I+ R - * This program is free software; you can redistribute it and/or
4 z8 l6 R O4 O8 i' Q3 r; b' A - * modify it under the terms of the GNU General Public License as
, Y* y$ h5 h( z6 ^# ~3 N9 e - * published by the Free Software Foundation version 2.
7 f2 n3 G6 s. y( l2 ] - *: W% y U( b$ s9 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Z; a. s2 v! g5 S, Q5 o" n7 h
- * kind, whether express or implied; without even the implied warranty
% L( w+ c" @- i* x/ X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ f" y$ Y7 b( C" c, | x
- * GNU General Public License for more details.' c f, v; ] `3 Y. b& L. H; ^
- */
( V3 T j+ f( {! S" J, i
+ ~9 m* R: Y/ m0 { e8 q. Q5 n- #include <linux/module.h>
1 Q) K v$ ?) s6 E( x - #include <linux/init.h>
' h/ T, h8 ]* Y# K! I; p - #include <linux/errno.h>
% A7 L+ D& [3 ^0 W7 R: Y% w8 [2 g - #include <linux/types.h>
; K, o- ^+ b0 w - #include <linux/interrupt.h>
' d% J& g' K1 x0 i - #include <asm/io.h>
8 c7 s$ z( _* R' g( L! J - #include <linux/moduleparam.h>
A, {) ~& [; i t% A0 n - #include <linux/sysctl.h>9 B7 a! z3 {" w0 Z& Y
- #include <linux/mm.h>
) G$ `1 m% x+ P3 `/ R9 C7 a - #include <linux/dma-mapping.h>
3 o& L% V0 ~) k! ^6 S) Q - 1 ^1 N2 {/ y1 W* o& i R ?
- #include <mach/memory.h>
. t3 I X/ ]8 ~% \& [* l, Q - #include <mach/hardware.h>! }% N# \: K+ x
- #include <mach/irqs.h>9 G% x9 f' o/ U- y+ h
- #include <asm/hardware/edma.h>9 I# n, H8 V$ _$ }; C
' T" M9 M+ G* L' l# a5 R9 Y- #undef EDMA3_DEBUG, K9 P! {& X% |! P7 A
- /*#define EDMA3_DEBUG*/* L- \8 Q1 S$ ?- w0 Z, e
% k0 {1 W2 }5 z- #ifdef EDMA3_DEBUG
4 j% r9 i6 ]' a( V; j( ]( D# p9 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# Y9 n% Q( c5 p% S8 u) Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 T" h' q& \9 I+ j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# M7 L9 X5 _) Q* S+ B
- #else
' m; {# x% e- {: d - #define DMA_PRINTK( x... )1 P6 [/ l$ _; ?% a% r) i
- #define DMA_FN_IN
# ^) [1 y# M! x/ w5 g - #define DMA_FN_OUT
! R6 H. W- ?* ] - #endif
; S5 M( p w9 H& m - 0 S) _# b0 j( ?& j$ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* B2 U! J$ l2 p( P* q - #define STATIC_SHIFT 3
3 R& H- f$ q# i. w u& v - #define TCINTEN_SHIFT 20
* G+ ]0 }6 a! x0 h3 \ - #define ITCINTEN_SHIFT 21( ?# r ?* E8 j$ q
- #define TCCHEN_SHIFT 225 I) y" l4 \3 C+ a, U
- #define ITCCHEN_SHIFT 238 y7 @+ V/ M9 E
) V2 A6 v( x4 C. }% v5 ~# J/ @- static volatile int irqraised1 = 0;/ L, f: E! M' h4 y0 l& p' ]6 E) z
- static volatile int irqraised2 = 0;
2 B3 G2 O& j5 A$ ]' a - 4 ]- I, g& O) [: A/ X$ }* `0 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z2 @* ?$ F/ m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W6 |' i# P; {! `/ t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 k1 q4 R6 H* ^
. C y5 V6 n# ?! g7 b- dma_addr_t dmaphyssrc1 = 0;) N3 x8 n3 y: e+ \8 f, P
- dma_addr_t dmaphyssrc2 = 0;
3 f: m0 n% F+ O$ p; x - dma_addr_t dmaphysdest1 = 0;
! @3 i/ L1 z6 E, b5 O - dma_addr_t dmaphysdest2 = 0;
/ F% W) R- b9 l( O5 M - 0 ?+ k) N" p$ ~9 A0 w3 l+ R
- char *dmabufsrc1 = NULL;% W( h; \9 g9 Y5 T( q5 }
- char *dmabufsrc2 = NULL;
& Q) G* u, m* `' D+ M - char *dmabufdest1 = NULL;4 t- t; g2 F9 u' M6 t/ N9 n
- char *dmabufdest2 = NULL;
+ V2 T Z5 t: ?- p/ i4 n' \! B2 t
G& T7 _$ A$ h% K4 J0 n( W i& b1 W- static int acnt = 512;1 S. L" {6 N) p
- static int bcnt = 8;7 u6 t i; K) M
- static int ccnt = 8;
; W- D+ G @; w5 Z1 c9 ^
6 Y+ f, a9 V: ]6 g) j- _- module_param(acnt, int, S_IRUGO);; B' ?( J1 d: ]; d8 _5 w7 ^0 R
- module_param(bcnt, int, S_IRUGO);8 \; t$ v! b/ f
- module_param(ccnt, int, S_IRUGO);
复制代码 , V- L w8 M. F6 e2 ~) }& R
+ Q3 U7 s) D# \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' D( I2 A& E2 K% X9 R4 Z6 sarm-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 R1 F9 p; H7 {- O2 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 M3 F& X+ q9 X1 [" q0 M6 ]4 v3 y! J o) W, n
7 a" s! l# o0 s: S. Z: T% @4 F; E
|
|