|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~; Q2 O; L5 u( m
- [code]EDMA sample test application
8 @ J7 N, n( R2 U - /*
* d( f7 |1 D8 Q2 B8 k6 [ - * edma_test.c& [' Q% A& n; \- ]' \
- *
0 D& h7 [3 j3 O1 p - * brief EDMA3 Test Application
* G6 _9 ] k0 ~2 O& r$ m; w$ D& } - *
j M4 `( f& F3 X7 J - * This file contains EDMA3 Test code.* u, W& C& P, C1 R2 l, o' L# Z
- *
; h; X2 }& B; I; ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Q' g1 o, `2 w" P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 n: D s/ _' Z
- * TO CHANGE., X; ^ T" S2 Z! g6 Z/ C
- *# ^+ O" f: E" @1 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 D2 y0 s7 F) F N5 I* y" h3 g - * v3 [# [2 X( z
- * This program is free software; you can redistribute it and/or
# Y+ {: ]- j$ x8 W, H - * modify it under the terms of the GNU General Public License as2 _2 u+ k( V+ w/ n Z& `# R. P- y
- * published by the Free Software Foundation version 2.
8 R7 K" B+ i- X, Z& @ - *
% c; n( J0 m) |# Y& L2 G: ^* H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# `$ x4 d' Z0 C& B' T# h2 D
- * kind, whether express or implied; without even the implied warranty
1 _% r0 o( X, i0 f3 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 t; y* H; p6 m+ g
- * GNU General Public License for more details.5 R3 U- b } |
- */
: o; _7 X8 n9 F' h, ~: f8 B* _
% M2 ~7 B, E. I6 L. X- p7 R- u- #include <linux/module.h>
: A; Z! q' ^3 S- Z. r1 Y - #include <linux/init.h>
- Z) M+ g9 x3 T& S! v - #include <linux/errno.h>
- K5 X! ~4 w" y/ @5 ]- S - #include <linux/types.h>
# e7 t: a' _& q f0 U3 } - #include <linux/interrupt.h>
0 q3 W$ G5 ?+ Q. T - #include <asm/io.h>
: r! ^# A( K/ ^ L. K# ~4 t- e - #include <linux/moduleparam.h>$ s' ^/ Z: d1 |. O
- #include <linux/sysctl.h>4 @) ^" s' ~" S
- #include <linux/mm.h>, ^$ s! v7 X! Q$ j8 y' [
- #include <linux/dma-mapping.h>, d/ w1 ?9 i6 Q3 z' }" z5 a# R
: n6 N8 n: M; e7 Z7 u9 }$ v; Q- #include <mach/memory.h>; t n. t" F% I4 M2 {/ U+ i. w
- #include <mach/hardware.h>
}3 b8 Q6 G# Y" M7 o3 U! c5 ? - #include <mach/irqs.h>
& X, B7 u6 [" u! [ - #include <asm/hardware/edma.h>2 D9 W" _/ M5 ?& t3 p; O, ^$ C
8 P- c; H/ T/ H |3 A3 \8 e- #undef EDMA3_DEBUG) g# O2 a$ ~+ M: \9 C' _8 B$ Z
- /*#define EDMA3_DEBUG*/( H5 L# B! P0 n
- 2 S8 f& y8 `/ n( N# \
- #ifdef EDMA3_DEBUG
5 K+ C* z6 `4 z+ _* b- z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 t5 ^; H0 r* V4 h w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): d7 x, q% u9 B' F+ B l) v) T4 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 c. d B1 o; e( p - #else
) P, D' W; A4 q3 l8 r - #define DMA_PRINTK( x... )
5 x, S6 @1 U7 f - #define DMA_FN_IN
, w9 T& e- F& L4 [4 q) T* A/ F - #define DMA_FN_OUT3 K5 t7 o! j: \6 n6 p9 R0 N
- #endif
. x7 S% e7 q+ j2 R0 U6 S" M
1 A' K% M8 A: J4 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 Y/ o( W+ `& b, P - #define STATIC_SHIFT 3
; Z* K+ t3 K, p/ B+ f - #define TCINTEN_SHIFT 20
: h) _( _7 g. H% ? - #define ITCINTEN_SHIFT 213 P5 N3 L+ H$ M1 u1 o- P3 j; T0 t
- #define TCCHEN_SHIFT 22. n* t2 h4 N5 \) _( S
- #define ITCCHEN_SHIFT 23
7 b% [& U) C! K! y - 3 \5 V- [ J! a' }5 ?
- static volatile int irqraised1 = 0;; W% N) @( i, C5 {* |
- static volatile int irqraised2 = 0;( @( E" Y5 @$ f
- N( a7 D2 c5 J8 e: n4 ]$ k" c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& d* A6 S( Z8 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J( x/ O z4 Q& _. P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# b) R4 X. m: Z Q& U
2 ^: w. e9 Q9 |, d( x* ^6 A- dma_addr_t dmaphyssrc1 = 0;
, u( e9 j, E; x' I* f- ?6 g - dma_addr_t dmaphyssrc2 = 0;
6 p! `, ?9 b5 e' B- M- s0 a - dma_addr_t dmaphysdest1 = 0;' t! J5 ?, K+ V# ^
- dma_addr_t dmaphysdest2 = 0;
. H% l1 q( u: ]* F# ?( H
' u2 z# Q. e+ {' q- char *dmabufsrc1 = NULL;5 e! s' n+ s* f
- char *dmabufsrc2 = NULL;+ j9 k, T0 z" M" F
- char *dmabufdest1 = NULL;( @4 t5 J B' t2 u& H& y
- char *dmabufdest2 = NULL;, S g: J( a# ~
0 y, [% q- i0 S$ H' R* Z& m- static int acnt = 512;
1 ?) ?3 O; n0 W - static int bcnt = 8;4 w) i5 y+ B% ?9 [. |( U
- static int ccnt = 8;
~ y' s4 v5 ?: s, u6 k* o
( G' g- J% G1 Q% h' i- module_param(acnt, int, S_IRUGO);# u0 o; s8 t) k, F7 ~; j/ v
- module_param(bcnt, int, S_IRUGO);) M7 a$ |- l: A
- module_param(ccnt, int, S_IRUGO);
复制代码 ; I/ c' H: E; p2 h Y& x
- G* X& Z3 R9 |9 Z w' |! \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ e9 [1 l. s" [4 }3 f/ varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- S# u" f5 c# P$ M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ x3 V+ i" {: P; P
5 H3 V( ]3 o/ \- b, u% i4 x' h2 a; f* |) P7 l' |2 K
|
|