|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% Q' m2 U2 Y1 _3 s- [code]EDMA sample test application. c6 X3 P3 ^; N. k- F- R; ]! c
- /*+ [7 |8 S. F3 B1 Y
- * edma_test.c
) Y& i* t0 H( O# D: T0 D5 [% ~ - *
4 a* \4 J5 c) _8 [- u4 o, A - * brief EDMA3 Test Application! g& K+ }" L2 }( l4 A
- *
A& D& E; r$ G3 |- q1 ~" t7 P O - * This file contains EDMA3 Test code.0 {( H) S J, K8 [3 c) Y
- *
$ U: l3 ]" Z" F" C# J2 ~0 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ {3 F# M) B3 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: g8 s6 v* x( e0 x - * TO CHANGE.
4 a" A& M- n% _: ? - *
2 n- s1 s# E, f: H7 [7 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// j) ~2 z% ]9 V
- *
' s Q* B9 U/ k( F$ p3 \5 @ - * This program is free software; you can redistribute it and/or
+ [9 a; r* v. Z4 P* G - * modify it under the terms of the GNU General Public License as* o# a" b7 b! m
- * published by the Free Software Foundation version 2.
5 x+ C# E. V, x1 x$ H1 z - *
: f3 @ {5 e, e: D6 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R; @& f) b" d
- * kind, whether express or implied; without even the implied warranty
2 d( W$ o J* t$ d9 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; e7 Q1 D& U- i6 C6 T( y# D b8 n2 Z - * GNU General Public License for more details.5 Z. C' s; B* Q: v
- */# J: [5 k4 `" V$ U4 G/ h
- 5 |8 x! s1 [) o; `) b) w$ L
- #include <linux/module.h>0 ]2 n; J. S; Y+ Y% p( J1 Z
- #include <linux/init.h>
9 v$ h7 E3 i# Z' H - #include <linux/errno.h>0 R7 r# B5 H! ~! a
- #include <linux/types.h>
! g( @( N0 Z ~) x* h - #include <linux/interrupt.h>1 j3 r. I* k: x# `/ V7 W" r
- #include <asm/io.h>! j6 i' o* B" e2 t9 B
- #include <linux/moduleparam.h>5 m* [( h8 O: U* Z) R( y
- #include <linux/sysctl.h>
. g8 X4 z$ |& }9 f: J* p - #include <linux/mm.h>- i0 q3 W( k$ a9 Z' `2 U
- #include <linux/dma-mapping.h>8 X: h5 Z6 `& v
- $ t. m* o; D& O" o5 ]- {+ W
- #include <mach/memory.h>3 m9 `! k2 a6 R
- #include <mach/hardware.h>" B( _. U3 S+ Q3 p
- #include <mach/irqs.h>
8 U% u6 q/ S/ g0 e P2 b/ G4 Z- `" a, [* Y - #include <asm/hardware/edma.h>
: x, |5 s3 y' R9 @ - % M5 `$ H0 H; a0 o/ L) w/ J
- #undef EDMA3_DEBUG# {1 o; C* U: q0 R" d
- /*#define EDMA3_DEBUG*/
6 {9 q0 N7 e' m7 H8 q - 8 Z+ S L; t" F, b9 d( H
- #ifdef EDMA3_DEBUG* ^2 o1 b6 t. p" C' r! r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 `' T& x2 T7 I7 }- u7 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 g( l- W8 E E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 [) z& e' J5 I- d' U- ~ - #else
1 m$ g; c! k' z7 M6 f$ ~! y- I - #define DMA_PRINTK( x... )2 n9 A$ @# u {! y
- #define DMA_FN_IN
! w" B6 O. l" ]7 y" r. [) {5 w - #define DMA_FN_OUT9 O7 H0 Q( m/ C; @
- #endif
* F$ D" K2 l7 b/ ~: _9 p
; P9 E/ r/ ~7 s' F+ f6 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768) j5 G; P7 M8 @9 _* o% f
- #define STATIC_SHIFT 3
o$ L8 x9 G) w- I+ J - #define TCINTEN_SHIFT 20" u. _; M. g5 K7 H6 A6 {
- #define ITCINTEN_SHIFT 214 a G; B5 f! X
- #define TCCHEN_SHIFT 22
$ ~- Q: n, S. S0 u9 y - #define ITCCHEN_SHIFT 23
" [+ Z g& a* D! c& e
, T1 Q: u: s" q2 X, t; W- static volatile int irqraised1 = 0;
% r, c9 D3 W3 e2 a2 r - static volatile int irqraised2 = 0;' B% Y% h0 t. S* H
- : M5 e/ [7 R, P; h- o9 J7 @# T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. b5 a0 R% w# y# {% k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l) a1 m7 J( n- g0 T; r4 ]# h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 L' \4 k, ^7 W3 O - 2 i4 R0 O/ [0 u% ~
- dma_addr_t dmaphyssrc1 = 0;* g" i$ r; b, J l6 p0 d( ` m
- dma_addr_t dmaphyssrc2 = 0;0 g+ F. h# F! }+ N% E
- dma_addr_t dmaphysdest1 = 0;9 Z ]5 P9 x2 T0 R4 [
- dma_addr_t dmaphysdest2 = 0;+ K$ z- h ]9 M. [. L3 N4 a
; p& Q( X y$ z8 |! h7 \- char *dmabufsrc1 = NULL;: [. f. e( h, R/ D/ a/ h3 f
- char *dmabufsrc2 = NULL;' I0 X- c+ B2 B7 r8 N" Z
- char *dmabufdest1 = NULL;6 V8 v- S) a; z+ n x( G I* ?% s
- char *dmabufdest2 = NULL;3 Q9 W3 z2 a, L9 i, f) z+ _
- 6 n; [. @0 k8 }: q5 Y
- static int acnt = 512;/ n3 _- K9 o1 C$ [
- static int bcnt = 8;
/ X3 i- r& d9 {9 O7 r - static int ccnt = 8;+ b9 R- C) n6 v& Z0 k
- q% i7 ?4 r: N0 d$ V+ W6 u6 X/ ?- module_param(acnt, int, S_IRUGO);
1 F: c+ P. w6 T1 r+ s1 p$ ` - module_param(bcnt, int, S_IRUGO);
N. \% w. o0 Q% f& T2 Q - module_param(ccnt, int, S_IRUGO);
复制代码
1 d% R& _4 S5 P. g$ h9 E7 f8 M" e
/ j6 e* f& D) W9 X9 M/ b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- K) M0 D9 k/ G3 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- o; p' ?( `- a- O, o$ O2 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) y5 v0 v, t8 W' V
! z2 p/ l9 _" p" }
7 a; M: `5 `2 ?5 g, m" z. z |
|