|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 Q3 T8 c8 K! t9 Z6 \ n
- [code]EDMA sample test application* f! }! c# o5 l5 Z- {
- /*
& M" I: A A) E" f0 K5 z - * edma_test.c
: I! M/ [+ J1 u! f4 W" t$ J - *+ Q0 `- q* l( w" H! m
- * brief EDMA3 Test Application9 g6 Z) B! L, j+ L( |) C1 ?
- *
% C D6 {! j: I3 t6 F0 d - * This file contains EDMA3 Test code.
. a1 D+ I; p7 C# d8 c* ` - *
5 c4 R8 r! e9 H+ l* I8 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( g7 `: G( V6 |3 T4 j+ O* y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, {7 }( d9 Q( ^ - * TO CHANGE.3 x/ }5 n1 i- S0 L4 A6 i
- *# n" ~/ G* N6 h( T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: _% Z5 w/ K7 A0 [* _
- *
; q O6 P- e, W# i0 _1 h: \ o - * This program is free software; you can redistribute it and/or4 s6 i d- a. s) R
- * modify it under the terms of the GNU General Public License as3 i+ D2 d: J. I2 Q
- * published by the Free Software Foundation version 2.0 i0 D1 \. d9 E, ~0 P- y
- ** m! J* H- C* z X" m/ z6 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, q8 M* P) ?. p t9 y+ y - * kind, whether express or implied; without even the implied warranty, ]! B6 Y9 ?2 t5 Q/ _' {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 M1 ]) u! o/ B$ G. u2 I
- * GNU General Public License for more details.
# ^3 E/ ?; L+ E/ j# o - */
% f1 A' E+ }% P" I$ q s - 7 {9 \2 G6 Z8 g! [5 ~: ?
- #include <linux/module.h>- W- U, y. y1 ~: d G( K s) D
- #include <linux/init.h>
7 \ @2 F5 l# q! d; m - #include <linux/errno.h>
& K+ [1 R, o1 ]* p - #include <linux/types.h>
0 _* Z0 \* O1 Z/ \! k - #include <linux/interrupt.h>7 U( u! O8 n) c& B" `$ P
- #include <asm/io.h>2 B8 B: L; s8 Z
- #include <linux/moduleparam.h>6 s% ^5 U( Z( @; ?0 N8 D
- #include <linux/sysctl.h>
8 B' g1 H" g& v5 f/ D! b - #include <linux/mm.h>6 ~/ K4 m R; X. x( i9 Y
- #include <linux/dma-mapping.h>
8 n0 z( ^/ [6 [4 \/ o b% y; ?" s - 6 I8 j# D+ J7 f$ T
- #include <mach/memory.h>. W# C0 n) K! b- J; Z, P5 U
- #include <mach/hardware.h>5 K; c2 J+ j ~8 l3 }
- #include <mach/irqs.h>. {" P9 Y! b0 H
- #include <asm/hardware/edma.h>
! V' j& |# m( {% H3 Y - 9 O3 Z" G+ c4 A: Z& m* R; z) g# j& J
- #undef EDMA3_DEBUG D3 s; \1 w. h
- /*#define EDMA3_DEBUG*/
- I& w4 D# f$ t1 f1 V
: h; _0 O6 _; W+ s v3 g- #ifdef EDMA3_DEBUG
" h3 C9 L2 L/ t* w9 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); x/ g" f) S3 U4 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ x/ e) N4 n3 u5 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ Z: [& R% E0 y7 v4 n& ^! c - #else; {3 G9 H: T: g& V/ w0 P. X
- #define DMA_PRINTK( x... ). A( X: [- o6 @, J* }( K
- #define DMA_FN_IN, a- ~3 s8 J6 a! F& ?- p
- #define DMA_FN_OUT! v2 j8 i4 n5 A3 U; m$ j
- #endif5 I( C8 Y4 T$ |( R
$ a% a) N7 ?/ s1 n/ B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- A; f6 B1 R# M' c% w8 X x
- #define STATIC_SHIFT 3
# f6 n9 W. _5 r1 J7 n% | - #define TCINTEN_SHIFT 20
0 ]6 Z- a# G) I; t! E6 b - #define ITCINTEN_SHIFT 21
: f# R5 H3 c2 I2 C# q7 Y L2 a - #define TCCHEN_SHIFT 22
# z: Y% |6 A1 n - #define ITCCHEN_SHIFT 236 H" q! m! P$ j! U b
! L. p- }- v+ {3 u& d' K; W- static volatile int irqraised1 = 0;
; j( z- n" V* H S+ q1 i" r - static volatile int irqraised2 = 0;
# j/ g u# l' n/ R% m0 M' n0 A
% m$ A9 i6 W% {# ^. Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' F: u! j2 k" S5 s4 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o* g1 Z' C9 P2 M+ n3 W2 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m8 N; ^& }4 M
2 i. b( k. b: c3 v- dma_addr_t dmaphyssrc1 = 0;* Y" S* L( |$ t4 I0 A
- dma_addr_t dmaphyssrc2 = 0;
P& Z0 J( W( b3 p( P2 V - dma_addr_t dmaphysdest1 = 0;
: i% z6 l l. g5 e5 H* t5 \/ @# D - dma_addr_t dmaphysdest2 = 0; G- a7 k& [0 T& T5 Y% n) s% y$ z
- 6 n; S$ }- F. P0 o5 a
- char *dmabufsrc1 = NULL;
. ]0 M7 ]* Z1 Z& |5 G - char *dmabufsrc2 = NULL;
/ k5 z0 o7 P* p* S5 K! J - char *dmabufdest1 = NULL;
/ P4 X7 Z- P6 O; T* w - char *dmabufdest2 = NULL;
2 R9 y, Q7 P) ]+ P
\6 E$ t4 B& ?( d8 ?- static int acnt = 512;
; N k: C. ~8 C% L. C" O - static int bcnt = 8;5 X2 ]+ I# Z! I, R; E* s
- static int ccnt = 8; A$ o, r- F" z" F
- ! ^1 V4 C* r3 ~( N, E7 ^" J
- module_param(acnt, int, S_IRUGO);
& w7 |& h9 b# M - module_param(bcnt, int, S_IRUGO);
. m& h( K: E2 J+ l* Y K% y - module_param(ccnt, int, S_IRUGO);
复制代码 % g" j' e6 U! g% v
5 L& o. D+ ~; t& x; t' h4 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 _5 w) r$ k/ S; T5 K9 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 z Q. J/ b D3 A; p9 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 \. |) M# h# a6 {# z3 ?) o' s
8 y+ j7 J2 ~! O1 I# U2 w) f3 |: J/ x, H3 r" @+ F3 T: B, F
|
|