|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 `( m3 ~ X o: r
- [code]EDMA sample test application. u" h0 A( j; S
- /*8 k/ z' @# Z% p6 Q# d
- * edma_test.c% a' G9 _- Y6 X1 N. Z
- *) t7 \7 Y0 i& W# C
- * brief EDMA3 Test Application
- Z. g: T; f% i3 n3 B - *
0 J* p/ j- L1 V6 [ - * This file contains EDMA3 Test code.6 F9 {. Z5 l0 E, x; ]$ q/ f! [
- ** n1 A. I" Q( ]- e# T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. i/ d; i) u4 W1 k3 S. N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
e: T1 S1 \* f8 s. B2 o7 @ - * TO CHANGE.; E* U& n( ]% t2 e) E0 u6 s( k
- *3 a0 L+ y7 F3 y0 w. e/ [$ Y ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* V" D) w( D7 k& T! J7 Q: h- H- y1 B
- * c1 @% j+ f$ R3 J! P
- * This program is free software; you can redistribute it and/or
4 k! M; r7 P% H - * modify it under the terms of the GNU General Public License as- T. Q1 N3 G) u2 I1 \: |: Z
- * published by the Free Software Foundation version 2.: j0 Q9 \; ?2 R- q. d6 b
- *
3 S# o3 m3 p' E7 ]; O0 ]6 g8 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any C2 ]! w% W; m3 S
- * kind, whether express or implied; without even the implied warranty
- F% c) j5 ?$ n0 ~) N" E, Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# ?) Q0 U L9 G- c7 \2 Z3 ~
- * GNU General Public License for more details.
6 ~; ?% z! U( t - */) E4 U2 {, U2 x3 ?
( Z: c. Z# @3 b( [1 F. Q0 @- #include <linux/module.h>4 L1 {, L0 y. F+ D( K# z) K, S
- #include <linux/init.h>& i) W2 C& B' C* D
- #include <linux/errno.h>/ k8 I! \8 i" k. A% K0 i. W, ~: I
- #include <linux/types.h>% ~ C9 C0 \8 @6 N8 }
- #include <linux/interrupt.h>. i" p% t1 [* \. E3 v: M. Y
- #include <asm/io.h>
O7 x/ i3 a" U" }0 v/ { - #include <linux/moduleparam.h>
5 g! Y! S0 B3 {+ r - #include <linux/sysctl.h>' Y; ^- e# Y) h
- #include <linux/mm.h>
$ A k9 u: |' \" v# l. h O - #include <linux/dma-mapping.h>; X0 q$ C" }8 C6 F* ?* L5 U4 J
; E# Z+ m' s& s- #include <mach/memory.h>
5 w# n0 _6 V+ m5 M i; x - #include <mach/hardware.h>1 T( B/ T) r2 H
- #include <mach/irqs.h>
% R9 D9 K( @% { }) e - #include <asm/hardware/edma.h>0 Q0 O( P7 V/ @6 m/ k t
- % v1 v ~2 B4 C! Z& @8 ]! r
- #undef EDMA3_DEBUG
I& P: z" x. c4 v- W0 J) z - /*#define EDMA3_DEBUG*/
% a2 b; u* \7 T( O/ I/ E# Q
& u- O2 F7 C3 U8 g- #ifdef EDMA3_DEBUG! M) j+ T: z! r/ Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 G, x# G9 j0 F! O! \' f$ a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
D. Y" n2 h' [- M& M0 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h6 V+ E& R1 ^1 g: t, @5 D9 J
- #else) `! v2 t( ? H5 V7 A: H/ Y0 ?
- #define DMA_PRINTK( x... )- b: \- L% j9 D2 U
- #define DMA_FN_IN
% Q5 a# a+ B3 O' X& P/ K8 W - #define DMA_FN_OUT$ z( t2 a1 {: h; Q2 {
- #endif) j0 \; `% S% N6 k
- ; }% `) j. q! l/ p$ |- H$ M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): o3 Y0 S/ \8 S2 {* r' y: j( ^
- #define STATIC_SHIFT 33 V" @" p5 f4 R% V E- K) Y
- #define TCINTEN_SHIFT 20
) `3 l) C& Q2 F7 Z4 F- L - #define ITCINTEN_SHIFT 21
3 N* ]- d. T2 A' ^: Y1 j - #define TCCHEN_SHIFT 223 J/ P' H2 G+ E# Y& v! H' C
- #define ITCCHEN_SHIFT 23# p% [5 P& S+ ?. h6 K
% h% C7 v7 x! W, I" A5 d- static volatile int irqraised1 = 0;- v+ T$ ~9 m9 y9 c% @. k ?: \- \
- static volatile int irqraised2 = 0;
; v. G3 I$ B3 b1 b' h# x# _
3 H9 k. y7 `% I0 u$ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ^/ i8 f. v6 W+ H( {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# C [, f& [* {4 G6 q; n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& _3 K( M% [/ D' b/ |% a - 6 z0 y7 z4 b& T/ O
- dma_addr_t dmaphyssrc1 = 0;( W0 W3 Z# r9 [/ J
- dma_addr_t dmaphyssrc2 = 0;
% ]% G4 }* x- U$ v. u7 h - dma_addr_t dmaphysdest1 = 0;8 P7 N* I% h. t8 g/ i1 A
- dma_addr_t dmaphysdest2 = 0;5 k2 X$ o5 Z' D `
- , }# Q6 y5 G& @$ }6 @% _$ `
- char *dmabufsrc1 = NULL;
) J9 l% h6 R% X( q - char *dmabufsrc2 = NULL;
( Q2 {' W* x/ ` - char *dmabufdest1 = NULL;
5 p# A. D5 r6 r/ G% m W - char *dmabufdest2 = NULL;: v# G& \2 ]$ F' D; x3 E
- - N4 R7 q/ W: R
- static int acnt = 512;* j+ y9 M0 y! J" A9 C$ T
- static int bcnt = 8;
$ c( b& _: ]7 ~ - static int ccnt = 8;7 T8 o4 H+ O+ [; I( S- @8 w
3 e \8 Y4 Q' {( |- module_param(acnt, int, S_IRUGO);. r5 X2 q7 h- m5 X, ?
- module_param(bcnt, int, S_IRUGO);! B" w2 x" b, C6 g9 [
- module_param(ccnt, int, S_IRUGO);
复制代码
0 n9 C* R8 K$ n% A
* p+ q- b, Y$ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& H: j1 k* B: ~1 o" q @$ n9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* w2 K) A$ `: n: V. C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 p9 F; G* N- b, X8 f9 U! ^
4 t1 [$ u$ {" s) J8 h& X1 x7 X6 n
|
|