|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ x0 q8 R% j2 d+ A: }% ?. `- [code]EDMA sample test application
/ A+ P/ \! E+ _ - /*5 s3 Q6 q- ?( s$ S! }
- * edma_test.c7 N7 ]5 s& I* g# d& j3 \0 g
- *' d1 M& a& _' b/ R# h
- * brief EDMA3 Test Application
' y/ }- o* ~" N9 `1 M0 ~ - *
' C& X! s4 n, |6 I+ ] - * This file contains EDMA3 Test code.% D$ h/ E& u1 i* s$ b6 l9 U. _
- *# M4 L" F9 w p. u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! y2 D. J, x- T; b5 J( C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 J2 I( X5 I# a+ E9 y0 g1 c3 D
- * TO CHANGE.
0 }$ K. l3 P+ G8 E+ }9 D - *
" _+ w$ N, Z) w( r* r. u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 x0 h* o% R- r D, b
- *
0 R% V% J3 g e4 f& \) c% H - * This program is free software; you can redistribute it and/or
# B0 K5 z$ Y+ y7 V' H - * modify it under the terms of the GNU General Public License as
8 S/ ?1 N% j- B. W5 G. B2 R - * published by the Free Software Foundation version 2.* ^0 I6 [, [# y! B
- *4 y* s4 C# v* t! e# C% E* |# c4 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. K- J. y8 k/ ~5 Y- N7 r4 U. ~ }" o - * kind, whether express or implied; without even the implied warranty
0 B7 m4 f* h2 e A- j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& _1 Y% f& y# b' } - * GNU General Public License for more details.
. H1 m; q. D- B5 p: ~ c - */
3 p, s6 j& k4 {# b" G+ V
( c- e6 N v" e: l- #include <linux/module.h>5 g% s7 K- \3 {
- #include <linux/init.h>
# u8 K9 O# H' |5 [ o& j - #include <linux/errno.h>6 R0 X/ N% _ t9 t, {: v
- #include <linux/types.h>
0 p/ G; y8 P7 ?# @$ I& ^+ B - #include <linux/interrupt.h>2 F2 u+ ~4 Q* Y; u- L1 i X. l5 E* R
- #include <asm/io.h>
1 ]) V2 W% K; v$ A& a: d+ h - #include <linux/moduleparam.h>
& I# F# ]9 M. E) z3 @( ^" d - #include <linux/sysctl.h>
- O8 h( g" d9 `1 k4 U) R: o - #include <linux/mm.h>: ` T3 l* c' i$ U5 b8 i1 l: \
- #include <linux/dma-mapping.h>
9 d% h( s! u6 } `
2 B" ^6 r7 O) U- ^- #include <mach/memory.h>
9 ]" r# p% a6 z8 d. u, W - #include <mach/hardware.h>
- U1 S) U+ Y; F - #include <mach/irqs.h>
! K! K" L1 w8 i: ?8 @% m - #include <asm/hardware/edma.h>
+ ~2 N# \- G& w9 e! R6 } - 3 b% `6 [1 E2 j) @; [
- #undef EDMA3_DEBUG
$ ?# j; d, D. d( s' M - /*#define EDMA3_DEBUG*/
5 `4 ~6 P q$ i
2 ]" D5 I% v7 f8 m- #ifdef EDMA3_DEBUG5 x* k9 c; e' }2 G2 |- o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 `4 Q/ C l, t8 q& k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?5 _; t: T' p5 L5 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% L2 V1 e+ z; W/ o/ A. z+ a, H
- #else ]( ~0 Q+ F* g/ A9 w7 T; j+ Q
- #define DMA_PRINTK( x... ): s4 `% T; X, D4 l) j B
- #define DMA_FN_IN4 w5 @4 d5 ^- z" a5 }: u
- #define DMA_FN_OUT
4 L* g* P1 @( [ - #endif
+ i) O, Q$ w" r% C
5 V! n; I" M2 ^" s% d0 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 ^5 `! H0 ]( R9 k( [, M# E+ J
- #define STATIC_SHIFT 3% E9 A0 d% M$ L" G& r8 x* s5 G) r
- #define TCINTEN_SHIFT 20
* _8 `7 l, u' Z! @ - #define ITCINTEN_SHIFT 21
9 T, B+ \* M0 @0 q# O Q - #define TCCHEN_SHIFT 22
% Y, z( {0 a+ X0 W! M8 \2 A - #define ITCCHEN_SHIFT 233 }! Y' Y8 h4 [( F
# E d. J: |5 S( I% |- static volatile int irqraised1 = 0;
1 j4 e) v7 o1 K; k3 h- Y# c - static volatile int irqraised2 = 0;
8 Z: L0 F( N3 k3 c% P. j - $ J5 ?0 _9 {$ g% o" V$ L. d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~/ ?7 {4 j" }1 N* T* h, i4 L: d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ K( n# |6 S# c& w/ y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ] \. R; }& c0 B8 ]4 \
7 P1 _; k2 ?# U& o" _# Q6 n- dma_addr_t dmaphyssrc1 = 0;4 h% l5 v5 n) }! ^9 ^) O8 x F+ c
- dma_addr_t dmaphyssrc2 = 0;7 N7 H$ q# {5 p
- dma_addr_t dmaphysdest1 = 0;( v A+ I: }- ?8 {
- dma_addr_t dmaphysdest2 = 0;
- M% y" c9 Z& \4 O& g
/ u% x$ e) Q' E7 e* T% B- char *dmabufsrc1 = NULL;7 J0 t' q3 ]8 L/ ]' U; c% ^
- char *dmabufsrc2 = NULL;
7 x* l; @& }4 W" L( k( k& d - char *dmabufdest1 = NULL;' I5 G$ P$ f3 {/ h# c6 o3 Y
- char *dmabufdest2 = NULL;; H- i4 N- F7 {4 t" u6 e
8 f8 V% I# a1 O- static int acnt = 512;
4 h5 g/ [8 @% d/ a& V, Z3 {; ] - static int bcnt = 8;9 r' y; ^* l6 c N; y- V J( x
- static int ccnt = 8;. _& o' u D. X: e0 P. h
: f7 b, y* w" T) z* F- module_param(acnt, int, S_IRUGO);2 D& h$ \4 h8 M
- module_param(bcnt, int, S_IRUGO);+ s# s2 a1 g# u& G1 P
- module_param(ccnt, int, S_IRUGO);
复制代码 # {$ z5 ]9 ~4 M
7 _; c' A' s0 W" K* Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# t5 {$ W2 f/ c4 ~+ s( f: y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ?; X1 a4 m, X+ m1 M. ]: [5 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; v5 d, y( W1 c8 B
. _. O: c/ n- m7 I6 C% ~' J9 c7 z2 `+ z; R( t* ~7 l" A- B
|
|