|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- l2 B: w# ^1 z& {4 U9 u/ B- [code]EDMA sample test application
7 [) e2 Z) F2 E. _# B: ] - /*
' _0 _7 U; W4 h7 m) r/ P - * edma_test.c
9 w9 _6 {/ X& J S - *
+ @# ~4 F: X$ E2 u0 ~: r - * brief EDMA3 Test Application8 U. ^" I3 q) ^
- *7 [: ^7 y8 Z/ k0 ~! ^ E4 E+ t* r L
- * This file contains EDMA3 Test code.* \, n) C, w/ i6 a1 H5 T
- *
$ b3 s6 K. \, N5 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! S5 ^' }. \9 Z" P6 V- x) @0 d, t6 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 u# L- y1 a4 b2 E
- * TO CHANGE.1 i3 r' A( k# I% n
- *! ?& I( p6 n' ?2 _8 q, U+ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' P# e( V' k a d. O) U8 z
- *1 t& [ M, n* o
- * This program is free software; you can redistribute it and/or
6 m$ x% B5 ^/ e, N/ j2 l$ q - * modify it under the terms of the GNU General Public License as s& m1 @) K; \; E+ }
- * published by the Free Software Foundation version 2.9 x$ c/ @( J1 B; L! o: ]
- *
7 |" I* @, e8 [* w% U9 E: @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& r s( J/ I2 v0 ~7 S - * kind, whether express or implied; without even the implied warranty$ \( J' `) c3 G8 l3 W2 }% `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* L& o3 r+ O k9 k
- * GNU General Public License for more details.
8 D d* ~! r, V2 o7 g: N1 b - */3 j+ F8 r4 w1 [( d
: r: I$ k$ v1 d5 t- F- #include <linux/module.h>
9 H: f9 F) z& G f - #include <linux/init.h>- u& s: g- S% O `2 ?' q- h
- #include <linux/errno.h>1 n' i2 t+ p; y e2 [+ o
- #include <linux/types.h> s$ S" E% m a8 t* G# [
- #include <linux/interrupt.h>" G1 Z6 M2 L9 I; S" d! W
- #include <asm/io.h>* n" a7 ~; }0 v" n F& Y. B! M8 ]
- #include <linux/moduleparam.h>$ O3 B4 K) m; k7 A$ |
- #include <linux/sysctl.h>& _0 P" A4 o2 J; x( y" D
- #include <linux/mm.h>1 u* N R9 N+ R
- #include <linux/dma-mapping.h>
: }7 f w) X" B& U$ g3 y
1 v! s0 |' t7 I2 a. A! [( j- #include <mach/memory.h>" w0 C+ d: c# I' k6 V) L/ L6 Y9 _( ^
- #include <mach/hardware.h>& j1 h& U& L- [# O
- #include <mach/irqs.h>
+ O$ O- n. \6 {1 k - #include <asm/hardware/edma.h>
6 F9 l7 J2 m: y' `" U
+ u) o: }# }8 h+ E, ~- #undef EDMA3_DEBUG! L/ \8 N; J! |8 c" U
- /*#define EDMA3_DEBUG*/, V- j. ?: f) e- n+ F0 q4 ?
% A% r. M1 {% C0 \7 W, B: U- #ifdef EDMA3_DEBUG8 n; U; J$ z1 x8 g0 z* y' v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 s4 c W. A) d1 R! \) @# K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! k& R/ q# n- Q) z. G5 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- D Q4 m0 q, U% F - #else7 T% I! H* X) w0 [0 e, H9 F
- #define DMA_PRINTK( x... )( E4 X; @0 E& {: n! v; `
- #define DMA_FN_IN' y9 x! [" B, a$ D: ]4 L
- #define DMA_FN_OUT
, Y$ x1 b: |" K; s& ]( [) B - #endif& j1 v- a9 r! X! U0 J
& ^4 l5 G8 {! m) Q0 O# e+ E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ i0 L! p. x% q# d2 w$ v2 s
- #define STATIC_SHIFT 31 T& _/ t* w8 b; B+ `3 D
- #define TCINTEN_SHIFT 200 D& x! m( m+ _7 o
- #define ITCINTEN_SHIFT 21
& ~5 L3 y, x8 b$ H, i - #define TCCHEN_SHIFT 224 n4 F5 D. Z! Y3 [6 @
- #define ITCCHEN_SHIFT 23
: |. J R& Y: B8 F0 j
* e0 x; m5 f# _6 ~0 M6 f' s- static volatile int irqraised1 = 0;3 I/ i, S, x! i4 j/ Y7 ~: \
- static volatile int irqraised2 = 0;( Z. F' O! T, Y6 T2 J2 H
1 r8 [( J2 g( F6 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~2 Y6 x' a2 E) _4 V' J2 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \# g% \" H, \/ ?* [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- t( i3 \7 I; l* X) c
9 N F7 _ V4 x; _# S- dma_addr_t dmaphyssrc1 = 0;, S1 L9 }0 X6 a5 W! v [2 ~6 I* N
- dma_addr_t dmaphyssrc2 = 0;
; d$ Y' c7 V2 M - dma_addr_t dmaphysdest1 = 0;4 j* U& K8 A1 S" m
- dma_addr_t dmaphysdest2 = 0;
: |4 N7 u! Q1 j4 ~
1 M- j: M8 U6 m4 B- char *dmabufsrc1 = NULL;
/ f; m6 s9 L1 E6 \ - char *dmabufsrc2 = NULL;- Q j, Q; K- b, J( q+ R
- char *dmabufdest1 = NULL;
7 h* V8 z( p) g+ H6 A - char *dmabufdest2 = NULL;
- N7 H3 E& m% \8 c- _+ V
% S/ w( Z0 I; i, Q1 s" `0 \- static int acnt = 512;% B: l( E0 k- u, W
- static int bcnt = 8;
9 D7 Z7 Z+ k# u+ f, j0 H - static int ccnt = 8;
|, F9 e8 R( E7 {2 ~2 Z, \ - : d( |! o+ g0 X- V
- module_param(acnt, int, S_IRUGO);
! E8 e3 D" ^" D+ b( ~0 n3 t - module_param(bcnt, int, S_IRUGO);; [$ L+ k/ d( O4 X( a) a, A3 b' ^/ f
- module_param(ccnt, int, S_IRUGO);
复制代码 7 n/ y9 X; P7 h( z. t1 O8 q8 b& G Y
' R( M9 Q1 M4 N( p5 _% i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 m$ w. U$ E3 G; t6 e/ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 A. h! Q8 u4 {, R6 m* ~! Q" ]$ F' \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ^3 Q5 p6 l4 |: f& v1 Z* M2 f5 v3 y) n
( b: J7 i2 J* T( ?* l1 j
|
|