|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 ^9 W6 ^, l3 s- [code]EDMA sample test application W# s+ u, |6 p0 H. D# z6 D
- /*' X6 i( }' S3 L! N; t$ |
- * edma_test.c
! R: d9 Z8 G. \( f - *
2 ^: t# |; w7 e7 T `# G - * brief EDMA3 Test Application; ]6 L% g- X$ ?& k4 a
- *
2 s: O9 B! n' q1 c - * This file contains EDMA3 Test code.5 b* x+ M- N* b9 l4 G2 k
- *# U \& l' B6 W5 H# ^3 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 i" ^, N7 X2 P9 b) r+ S. Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D1 ~ i' Y, v2 n2 K
- * TO CHANGE.
; L5 v% \0 i6 v* w: ^* K8 U7 e - *
* @& u7 Q, K- L5 G& \. X4 E* C @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, L6 c- p2 M# Z: A$ B6 `
- *
% M8 b% g" r7 h/ K5 w0 i - * This program is free software; you can redistribute it and/or8 l9 U+ @+ K# D) E/ F/ H
- * modify it under the terms of the GNU General Public License as# w0 Z8 D# M; ]8 ?1 t
- * published by the Free Software Foundation version 2.8 H* {# _2 L$ ^, v$ W# }* J
- *
: O9 i2 b* } { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. A% r O+ E) J* u% r2 `5 @2 q
- * kind, whether express or implied; without even the implied warranty% K! H8 ?/ E; M0 y5 f. _9 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 E; f7 t6 I4 o6 x9 z; P
- * GNU General Public License for more details.
! y2 h; W& o9 H2 R. @# e - */
2 B: F; ~ b( U8 F- V
5 ?9 e+ }; X8 w+ X' N- #include <linux/module.h>4 |- ?( e' f e- q% F: Y
- #include <linux/init.h>: B. [2 o! Y, V. s- x# j5 }
- #include <linux/errno.h>" X2 L2 L3 |) s* X0 Q7 M
- #include <linux/types.h>+ z, F8 e0 O3 b& u$ |; T
- #include <linux/interrupt.h>
' X. ^( o. R& M+ Z* g* y - #include <asm/io.h>1 b+ `6 j) H j$ q8 n( t( ^
- #include <linux/moduleparam.h>; F% Z0 x7 y4 W5 F/ M& E
- #include <linux/sysctl.h>( a. m$ ^, r( `/ T7 \
- #include <linux/mm.h>
/ M' B3 X L7 s - #include <linux/dma-mapping.h>
- g! }$ o9 A8 u( |$ A2 Z
- \' J0 m7 @- a+ \2 {- #include <mach/memory.h>2 \6 i1 e1 S+ r, c) n* C
- #include <mach/hardware.h>
$ d( a( h: ^2 K0 F: A. t - #include <mach/irqs.h>3 Y( V) V- t' [: n
- #include <asm/hardware/edma.h> G; o. l ?- P0 z
' b$ e1 V$ K# o- v6 s) o7 Z- #undef EDMA3_DEBUG9 |' x1 v' q G, w; j# p& h( p0 V
- /*#define EDMA3_DEBUG*/6 h! P7 R& W a
- . N- Y9 e; q9 H7 X7 B# r2 s6 g
- #ifdef EDMA3_DEBUG
7 b, E$ {! _6 |) h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Y! E2 g( v3 @# y9 j% H2 L- y* i9 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 G8 M/ p$ E8 D4 {/ H3 g3 h: L& X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 b/ E% j( v% N
- #else3 Z: N& K0 ^9 w; t4 p$ s
- #define DMA_PRINTK( x... )
7 d' G) V7 W% V, ]0 L5 X - #define DMA_FN_IN& U) u: v+ w8 A J
- #define DMA_FN_OUT
2 {# @* l2 d! l - #endif
9 w* E: j! c/ ]9 L - ; ~3 |; C6 c* d7 y# \$ g; w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 c* g$ U. O" x( P - #define STATIC_SHIFT 3% f+ K7 P+ h3 r
- #define TCINTEN_SHIFT 207 Z) B8 f: M; K+ \
- #define ITCINTEN_SHIFT 21% m1 Y+ P2 V7 C/ w
- #define TCCHEN_SHIFT 228 o* X( Y2 e9 p1 N6 |+ B! J
- #define ITCCHEN_SHIFT 23
1 B1 s+ C8 E& A - 3 F) B& g( Q4 \3 T& q( m: ?8 {
- static volatile int irqraised1 = 0;6 W8 _) U% c: Z
- static volatile int irqraised2 = 0; I+ P! ?% u9 Q
; u3 {' P/ f& e. k' Y6 w9 k3 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 i- \; p- @ ^* M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 j9 k: K- X' z! H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; a6 F0 _8 A) d* Q
; ]# Z% i/ R* ]+ p+ L- @- d/ W# r- dma_addr_t dmaphyssrc1 = 0;
9 s3 Q! k0 o# q3 o$ B4 T& Q - dma_addr_t dmaphyssrc2 = 0;
9 O9 e1 Y, g l j+ a - dma_addr_t dmaphysdest1 = 0;7 f: d( A" i( @9 X" I& k
- dma_addr_t dmaphysdest2 = 0;" S- u( ]; L% C# e1 @( }% r7 B* l5 ^
* ? d5 a. c8 y# t' J6 c; P' p5 A- char *dmabufsrc1 = NULL;1 Y: v' U, F5 U' W" l
- char *dmabufsrc2 = NULL;7 W8 N+ R5 W4 P! N0 ` `4 S
- char *dmabufdest1 = NULL;
0 d+ _! e1 e0 H! D( V3 g5 i - char *dmabufdest2 = NULL;8 C9 J0 U4 \- _8 b q
& Q: ?# f2 k3 O3 Y- static int acnt = 512;
9 y0 j' v/ {3 t: I9 D5 w0 g - static int bcnt = 8;
: g/ r# B b4 G3 y- L - static int ccnt = 8;
% h, T2 r% J( l" g- q8 M: R9 i+ n" g
) ]6 _& M5 N! F& L+ N/ O% x9 c- module_param(acnt, int, S_IRUGO);* z1 V7 j4 ~/ B7 Q
- module_param(bcnt, int, S_IRUGO);
- x [2 b3 u/ W) z: y, x# S( ] - module_param(ccnt, int, S_IRUGO);
复制代码 # L) \/ U: \1 B$ P: _3 g7 q' [; T: v
1 S1 l' }, m9 f4 [- T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ _1 Z2 d1 m& X- N4 M- ^ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: A! }" O) Q* {: u" S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( _' I; l6 @" F/ C
1 R! p0 X a5 y6 P5 ^2 y9 t% m6 z" H% O" r5 n- A: O7 E A
|
|