|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % J0 \. o* P" a# B( P
- [code]EDMA sample test application
2 I+ B( D& K, K( E7 ~0 R' G$ `" k - /*
% `; P7 M: K* ?1 u0 F: F - * edma_test.c
$ h {( h- ^ C2 |) j3 B: z9 }9 F - *( t5 M; A' o. D! w2 w
- * brief EDMA3 Test Application& o7 M" h- t! B2 }) g% Q, V
- *
! M ~4 {9 L2 q - * This file contains EDMA3 Test code.! h& O/ m5 L6 r# k
- *
2 V! a8 t5 n! w& y$ N5 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ]7 V. C# t R0 M) L6 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 b; ?8 D( y; G8 \+ N1 C
- * TO CHANGE.- G! [3 p$ Y/ s
- *
; {9 n5 _- g% g2 |6 i# n. U( |3 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ B, _1 i# \; J - *
1 a6 k1 C- }& f0 i; R - * This program is free software; you can redistribute it and/or3 K* n" `4 p$ Y; ^ d* C. r! m
- * modify it under the terms of the GNU General Public License as# T( P9 P0 L3 k" g, E% l. f& P
- * published by the Free Software Foundation version 2.* P4 L! {! q# I, n) M
- *
, Z/ w, \' B. R& s& b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 f2 E; X3 |! A0 L3 r1 }1 d1 M1 w% a - * kind, whether express or implied; without even the implied warranty0 A5 j# }; P7 t1 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& u+ r6 o! Z3 I6 T
- * GNU General Public License for more details.* C. ]5 K; h1 `8 h8 g" C1 I
- */
9 d+ U) |4 \1 }% c# W - * ]6 [& \9 K2 x& a
- #include <linux/module.h>
; S" v$ [6 a K2 X% A - #include <linux/init.h>% l9 Y& a% a4 x$ }8 Z& [
- #include <linux/errno.h>: m3 h2 s8 r4 L
- #include <linux/types.h>
$ b% p" W1 S! ^ j8 x - #include <linux/interrupt.h>
3 Z# k, [+ B0 e - #include <asm/io.h>4 g: l( Q( y x) ~; j. Q2 A3 h. {
- #include <linux/moduleparam.h>8 b3 W7 h. f$ d# k
- #include <linux/sysctl.h>* ]2 c1 b1 W) q5 j1 D
- #include <linux/mm.h>
9 W# v' m. ?) B- X - #include <linux/dma-mapping.h>
7 r) O% s, v0 c, ? - ' @: L2 u" F9 b& J0 h
- #include <mach/memory.h>* j0 W |. D. h/ R. H) ?7 |
- #include <mach/hardware.h>
: N6 G( k# M- z4 @: d: m2 x - #include <mach/irqs.h>7 Y7 Y0 G% G0 Y+ E+ K
- #include <asm/hardware/edma.h>8 R/ x6 P* B& g, X
# i* v* G1 \5 D" m( A$ K- #undef EDMA3_DEBUG/ b0 v" I$ {8 {6 E& j
- /*#define EDMA3_DEBUG*/
/ X: l. x( V6 g0 m
8 z7 a' T: n; n- #ifdef EDMA3_DEBUG* X9 e9 Q2 a( o { P) X! e% e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ?* n4 U7 f e( _) S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
z( j7 k* ^) d4 M# B$ e9 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 N2 J3 m) @/ f9 m& Q2 C - #else
' Q, C1 {; p+ I+ A. c# }% `+ J/ B - #define DMA_PRINTK( x... )+ X. t1 G2 H' I p5 ^
- #define DMA_FN_IN. a- W3 p* W- A9 R2 S- q+ F
- #define DMA_FN_OUT
8 y9 G1 |+ r* z - #endif
* Y% h: e* M: }* Z# Y U" q - 2 N! @; |/ ^4 P5 N2 V: U" s6 K P( h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 r2 X% q0 k, x) D+ ^ [ - #define STATIC_SHIFT 37 f; L( A4 @) Z6 p- {/ S
- #define TCINTEN_SHIFT 20, C- A* D+ q+ u% b- A3 @8 y
- #define ITCINTEN_SHIFT 21
! @) p9 E6 c4 _3 ~/ } - #define TCCHEN_SHIFT 229 X8 h v3 J% K, \+ ]6 t: r. K) V
- #define ITCCHEN_SHIFT 23
3 y2 v) h' N/ ?4 _2 u- y% `- P - 9 W! b, e6 ?& G% z! [
- static volatile int irqraised1 = 0;
* L0 s M0 J3 u3 J; B - static volatile int irqraised2 = 0;4 Y- h* y# |2 J8 j
5 y/ s! a4 y2 v, i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); m$ n) T' N2 s' T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `3 h7 m ]1 `) v' S2 z. |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D( h1 i0 {# b" H
u3 U! X* W! {- dma_addr_t dmaphyssrc1 = 0;! q2 o* n) F7 v2 J' N( C
- dma_addr_t dmaphyssrc2 = 0;
# }8 ~8 U/ K. [! ~ - dma_addr_t dmaphysdest1 = 0;
7 `2 U8 w1 v+ n# p# ?' e - dma_addr_t dmaphysdest2 = 0;
9 V4 h0 T; [/ P. w4 V. _% j" h2 L
1 H0 k3 j/ q" K3 o# I2 `- char *dmabufsrc1 = NULL;, L4 g" Y+ A9 {- ~1 ^- o# o+ P& x
- char *dmabufsrc2 = NULL;( G/ W {; L9 X8 h; j6 P9 T: I0 p
- char *dmabufdest1 = NULL;$ f# V8 Q2 N5 h% L$ t- m
- char *dmabufdest2 = NULL;
2 [( X7 i& A6 {! z' g ~ - : d$ @+ l* U0 ~* G; C' c) j# d
- static int acnt = 512;
$ O# \- F9 ^# {- ~- D4 K" ^3 b2 l - static int bcnt = 8;
! q5 E3 C# @1 S6 B3 S - static int ccnt = 8;; q2 i; K. y* U3 t! I* v5 D
- # u' B( g3 e' z* H3 E
- module_param(acnt, int, S_IRUGO);! k9 [+ _, P1 z0 w
- module_param(bcnt, int, S_IRUGO);
$ X, C- c8 ?* [ - module_param(ccnt, int, S_IRUGO);
复制代码 D- \2 ]7 s* F6 h/ R1 S
2 B4 B5 e, y7 I" v: m0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 z& C2 Z. h. R" R4 e* k3 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. m. b: w7 A4 W& b" O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 m+ Q; V, ?1 _/ H: o
6 u( k8 B+ I. D0 r+ {) v. u5 T
9 Z# U C" C: Q/ F
|
|