|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 V! H, Q3 K' F) ~0 [/ I3 z' K
- [code]EDMA sample test application1 m* U1 ^- f8 ~2 k" N: @
- /*7 _# U% J8 C u' ]+ X. G
- * edma_test.c/ D# k" Z) c3 f
- *
e0 |' e7 q2 W - * brief EDMA3 Test Application
7 |) n& G: c" p. G; S9 w - *
7 K e8 N/ `2 s! K! z - * This file contains EDMA3 Test code.: e& x! p6 t. I2 ]( w
- *
4 V+ m* l, c4 ?, y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 B8 @6 E' f2 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ |; b* U. U0 K" ]# ?0 T4 H7 C$ v - * TO CHANGE.
4 a* {* b( Z' @ - *
6 U8 r9 h1 o2 S! l0 ~ c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' g1 E$ |3 i+ a' S" o3 Z - *
% {2 _2 `5 |7 j$ Q! g - * This program is free software; you can redistribute it and/or
: P9 D8 ^! ]) g R5 v - * modify it under the terms of the GNU General Public License as o4 n1 x0 Q, p) R- R% f/ v
- * published by the Free Software Foundation version 2./ m! j9 b2 j: R$ n9 I" I* |/ }/ X
- *
- I0 j+ R0 `9 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 e; R# F& x- d* p/ }/ j: w - * kind, whether express or implied; without even the implied warranty
& K m/ i, L" R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; V) Z2 \- W' V+ `) x% @; ?
- * GNU General Public License for more details.
U7 j% c- u; i# Z - */1 r! x ]- G# ~" \) N2 K4 E
5 W4 {4 s8 o% O6 m5 I- #include <linux/module.h>$ g; b: c6 G. W w Q6 g
- #include <linux/init.h>
9 G+ q3 j4 l. a' }. u& R3 V - #include <linux/errno.h>7 N. ?0 v d; A! F2 y" _1 w9 M
- #include <linux/types.h>
% {9 i) A% v# [4 c3 J: Y" q - #include <linux/interrupt.h>
2 {; v. d2 l& j n - #include <asm/io.h>9 ~% y7 {+ Y2 }* M2 Y+ [
- #include <linux/moduleparam.h>, Z$ U- l% a7 R0 t; T+ G
- #include <linux/sysctl.h>
: F' m1 ]5 y! p' W* r1 l D1 N - #include <linux/mm.h>
5 V2 L% `$ d) d; i - #include <linux/dma-mapping.h>" f/ m' t/ i9 c8 p/ L" ?. H9 R
% }" L2 u- H0 h; l9 T- #include <mach/memory.h>
4 F2 T& q; G7 H" J: U z1 t% t - #include <mach/hardware.h>
& J9 d; G( G, P$ O+ t - #include <mach/irqs.h> ?/ d& ?- b$ X, Z6 T
- #include <asm/hardware/edma.h>! o% P% k$ N9 w. q) V% {& t
' m$ C, c c3 L; o- #undef EDMA3_DEBUG" m9 V% N- w' J8 v1 x; i
- /*#define EDMA3_DEBUG*/: P2 D. N! X# k+ i) L
- % W0 c+ M2 G4 |
- #ifdef EDMA3_DEBUG$ _- C5 W# z$ \4 d" F0 ~& a1 k9 S6 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- O. {/ `. L) G( v. I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ l5 Q- L) {# H- s L- E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; K" J$ R( b+ v - #else* E& L7 e! ^/ Y" ^ a
- #define DMA_PRINTK( x... )3 u% C% \ N2 @6 Y0 U
- #define DMA_FN_IN& x5 E' z$ r- h- @
- #define DMA_FN_OUT
/ _2 F8 z" E6 k6 j$ k3 ] - #endif2 J: [* V; ]' O) I# U& @' t* a
- ; g7 f3 T: p; _" y$ e5 n8 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Q8 J: h$ X8 b: z( O
- #define STATIC_SHIFT 3" b/ W$ l* u8 E4 i$ Q- F: V6 w
- #define TCINTEN_SHIFT 20
; P- _- U( O% _# ` - #define ITCINTEN_SHIFT 21' i( q, e; U" u. {, E$ {
- #define TCCHEN_SHIFT 22
; U1 ]8 R) r- h( }7 R: f5 Q/ n - #define ITCCHEN_SHIFT 230 I. y* f0 t7 Z* c/ B
; }! j$ F* O' n+ f, s2 d; w- static volatile int irqraised1 = 0;
# L/ n) L, R( z9 V Z - static volatile int irqraised2 = 0;) ?$ s( r1 z0 X' L0 n7 o
- * B+ F) A& U6 H/ }9 w" {; e, V8 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
?3 F6 d; |- {) B/ j/ n& B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |0 |! w, E/ C, K, ]) R$ {/ ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 o6 M v) a( B5 j
- " x S; g" W; y* U" @; u
- dma_addr_t dmaphyssrc1 = 0;$ p% F/ f7 G0 H$ D& {( D
- dma_addr_t dmaphyssrc2 = 0;
& Q% c+ n$ |, r" X6 j - dma_addr_t dmaphysdest1 = 0;
0 u3 `2 x R" O; M7 Y - dma_addr_t dmaphysdest2 = 0;
8 H) h8 v0 P* k7 w - " A7 z+ I2 s" q/ m# j$ B6 ?0 E, z
- char *dmabufsrc1 = NULL;( d) V: Z6 s8 p5 } n- r' \3 d5 h" d
- char *dmabufsrc2 = NULL;6 n2 ]& o/ l0 p" E' G3 A$ |
- char *dmabufdest1 = NULL;
: y0 p4 Y; E6 ~6 W7 d* R - char *dmabufdest2 = NULL;
6 L3 e. h5 W6 M1 q# _& s( C
* K6 S0 r# U3 l" S: k, x- static int acnt = 512;
8 w! U! t6 j) _: L( \* b! e ] - static int bcnt = 8;
+ S2 O2 i" o2 k6 [& Q - static int ccnt = 8;7 W. S6 ?8 _" I
. B f0 x4 b; r/ l. ?0 w- module_param(acnt, int, S_IRUGO);( {- h- V) k0 n0 P# k
- module_param(bcnt, int, S_IRUGO);3 s$ z! D9 {. H' [; k
- module_param(ccnt, int, S_IRUGO);
复制代码 ' B0 Q3 c" ~( j+ p6 ~5 ]6 N
: }1 a8 p$ p3 S+ m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `$ {- p' O: n' @' k8 L$ B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 \5 X% ^) \/ Z9 T& [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z9 [& ~ ^' c- n
8 }) k. _5 b2 z7 t2 H
$ A r, k; a- r |
|