|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% S+ g$ ^+ W _$ O- [code]EDMA sample test application' |5 }) p: C' e
- /*0 C _: v, Q: [, D8 u$ b9 u
- * edma_test.c `" x z2 s! D8 Z4 ]; K: s
- *
% Y, K+ h: e8 ~6 R( M5 F - * brief EDMA3 Test Application( h- D! j8 R9 o. y
- *
' k3 f4 }5 J- h9 [( | @& W' @5 _ - * This file contains EDMA3 Test code.
. c) U1 V! o% V: _2 y4 Z) z ] - *
' A2 s5 N9 a% `) W$ d) ]& U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" e2 J) e9 ~) s* H! D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 m/ }0 G$ z0 A. c r0 d - * TO CHANGE.7 N3 U! E3 P: m5 m! d2 z
- *
+ d% R: M3 D8 M3 w3 G) x* M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// {: W( W, L8 W$ N/ u
- *
+ x5 v! ^0 h4 ~' Z- b D1 Q' [ - * This program is free software; you can redistribute it and/or/ v4 O2 B% a$ @1 D/ Z
- * modify it under the terms of the GNU General Public License as7 X' {8 F. w' G
- * published by the Free Software Foundation version 2.
- X, f5 ]) e. w - *
7 T8 {2 k" x/ P) t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! S/ }; l2 c5 ~; [9 O; I; p' j
- * kind, whether express or implied; without even the implied warranty$ ?( c2 F* K+ ?4 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 M+ y7 D) O( G9 d: _& E - * GNU General Public License for more details.
T; r' l! T& Y9 a$ x& ] - */
$ O9 ]6 h N3 |! h, o, B - # I3 O$ Y; M* \# B1 u
- #include <linux/module.h>
! d3 Y$ k5 n; A6 X m6 \3 |+ P1 R, X3 e - #include <linux/init.h>. ~$ h+ s2 M; i ~2 B# K3 Z
- #include <linux/errno.h>
+ @7 W! L- V9 f+ A9 } - #include <linux/types.h>! k. u6 m4 K% ?4 h) p8 `
- #include <linux/interrupt.h>$ Q& U' k8 |. ~# K
- #include <asm/io.h>
; R! |0 x4 W0 i" J, `# g1 D7 H - #include <linux/moduleparam.h># y! N$ V$ M* J& Y$ L% F$ I
- #include <linux/sysctl.h># q7 @9 A% y7 w) w" B" e
- #include <linux/mm.h>/ N9 s/ B! [" v. ]- h/ P8 [
- #include <linux/dma-mapping.h>
. A/ [& ?! C; s+ }) i& z7 U - " q6 Z* n @# z3 @: X$ @
- #include <mach/memory.h>. n2 T( Q V$ Y
- #include <mach/hardware.h>* ~) ^' I- h/ j- f. x6 i$ {+ q3 \
- #include <mach/irqs.h>8 G/ Z3 m' N+ S- X i$ h
- #include <asm/hardware/edma.h>
9 t( V5 k0 I% ]0 P
+ a: x9 h" V0 V% b3 o- #undef EDMA3_DEBUG9 K' r2 Y0 |1 r2 n+ J+ f% B9 c# o& e
- /*#define EDMA3_DEBUG*/
2 d7 z* c) u2 E1 g; K
# a/ W& U, s* J" N1 q/ G& b/ G2 \$ ]- #ifdef EDMA3_DEBUG U6 a' A5 d5 l& b3 c I+ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 ~7 X9 @7 _+ @5 F. ? v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q% L, K) }* Q9 z+ y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 d$ j5 o7 N; U, u I - #else7 j& Q r7 `7 x. F/ c
- #define DMA_PRINTK( x... )# ^. v: a7 W5 H
- #define DMA_FN_IN
( [2 d* |+ c/ S) M1 m: ~# Y - #define DMA_FN_OUT9 z3 C/ T$ \' `& ?5 N. M o* o b
- #endif9 f9 J( y; K4 W# D
- ; L" k) o, I/ Z7 U6 i. P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) h$ [9 l% t M8 y5 ^8 D0 i2 I
- #define STATIC_SHIFT 3
) S2 n6 R3 b9 N' [8 d+ }5 i8 E - #define TCINTEN_SHIFT 20
1 n% g5 C" ?9 N5 l A, h* O4 z4 M - #define ITCINTEN_SHIFT 21# I% s. T- Q- c" k$ d- x/ n, _
- #define TCCHEN_SHIFT 22$ ?4 i5 x$ Q0 [7 O3 g( e
- #define ITCCHEN_SHIFT 23# J$ B; m: w2 u6 n+ J
, J! t3 p0 Y' f. m( i1 }6 e- static volatile int irqraised1 = 0;4 c+ Q- B+ N& f* k
- static volatile int irqraised2 = 0;
9 P% t5 C% ?. J% A5 e - 7 X9 N0 I& {* H, X ?6 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; p/ H) ~; g5 s; ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M: k, i( U0 }6 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, v+ ~+ [8 N4 r8 x3 x7 f! C5 K* v) [
- _% i2 R8 a" Y% f5 B3 @- dma_addr_t dmaphyssrc1 = 0;
& I, ]4 R) q% E - dma_addr_t dmaphyssrc2 = 0;
4 x" m" @$ a$ \; s - dma_addr_t dmaphysdest1 = 0;3 Z! c2 J: ~8 } z% s- m- T; R
- dma_addr_t dmaphysdest2 = 0;& E9 l9 p8 G9 }! O
- # F8 X' [0 v1 v9 o9 [$ Q
- char *dmabufsrc1 = NULL;3 R# G% u+ Y' G+ {3 k( H
- char *dmabufsrc2 = NULL;- g' [6 y% A4 e9 V1 D( M, V. E8 r
- char *dmabufdest1 = NULL;
0 g7 {& N. j6 e$ s- |% s* a2 @ - char *dmabufdest2 = NULL;3 ~7 a4 w* @( _* U
. K; p, P1 a/ X0 s* U- static int acnt = 512;
. A* ^. O2 R# y ]) F - static int bcnt = 8;" t8 [* q4 p/ e7 E3 F4 N& O
- static int ccnt = 8;) k* n1 i- U4 j6 T
- , l& W) r8 z3 k1 x7 M- p
- module_param(acnt, int, S_IRUGO);
. s0 M8 A0 K" m M6 x+ P - module_param(bcnt, int, S_IRUGO);9 U+ C3 ]9 ?9 }& m$ Y$ _: |
- module_param(ccnt, int, S_IRUGO);
复制代码 n: y3 j6 [, u3 G
- O5 A$ X/ j5 M5 B$ k# v! L) \/ F+ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ K& K! d3 c. ^" E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* V) O+ h* D Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* y; y2 w( w7 o, F- I
2 d6 s0 Y& r8 ? c) i: x/ U# S1 E- I+ S8 _7 p* c/ I
|
|