|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; f/ u7 N7 p8 C* W! J" p2 E- [code]EDMA sample test application
7 M4 _% ^* \ j' ?# o1 F - /*$ C8 F9 |4 }' p6 ]+ c9 I% P8 g
- * edma_test.c; g; J4 t- H p) S
- *
$ p1 b1 N/ W+ x1 ?! x! H - * brief EDMA3 Test Application3 A9 O* M0 K3 u9 k5 m$ ~0 X
- *" |' [3 b2 H: h+ A5 p
- * This file contains EDMA3 Test code.
1 n0 U6 C' I5 `6 @) N - *
# Q! }- s; ^% K: n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ `1 w9 X J b5 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 f, g3 @+ o) d5 f2 A - * TO CHANGE.! T2 ^9 q0 z+ n! Q8 D
- *
$ V9 C0 z$ | \# g4 H, z5 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" p' r2 v$ I1 V) ]5 X4 I! i0 P8 l* a
- *
# e4 v6 o e( g) `; ^; R: \% v - * This program is free software; you can redistribute it and/or
2 o% i6 p- h, s4 Q - * modify it under the terms of the GNU General Public License as
0 [; `3 j( I3 r; G$ V. i1 k/ i - * published by the Free Software Foundation version 2." `* B6 E0 _) x+ T
- *
( l0 ]% Y# O; ~0 Z3 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 D+ J0 _( C- R/ _9 X ~* O0 L
- * kind, whether express or implied; without even the implied warranty
, U- H3 F# g) T! y: z$ D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 m* `2 s$ L8 }' d: _/ f
- * GNU General Public License for more details.4 F! R" m1 ^+ L x& q
- */
2 p$ b" {! _2 @1 A; B! f: v
O- A0 G! o5 W7 A- #include <linux/module.h>% I# y/ o3 Q+ q/ M# M) I
- #include <linux/init.h>5 X0 e) W4 w) u' X; b5 ?1 u
- #include <linux/errno.h>
$ z, C! q# [3 i' S* C - #include <linux/types.h>& p5 W! \; J Z: N. P, x* I/ y `
- #include <linux/interrupt.h>
6 D& t; J) \' \! J% T - #include <asm/io.h>
/ O+ u0 ~& e5 `( N9 S - #include <linux/moduleparam.h>
) g4 A: K' z+ H" Y - #include <linux/sysctl.h>8 T5 b$ f5 l! F
- #include <linux/mm.h>8 {" S8 q6 W f) B* i) B* O" L2 B
- #include <linux/dma-mapping.h>; e, _- W) L- ~, V R0 V) K
+ m1 Q. h% e1 P7 @0 i9 N- #include <mach/memory.h>
: A) l2 W: X; o4 h/ ^- L - #include <mach/hardware.h>7 C/ k8 j- r- V& m6 A. L
- #include <mach/irqs.h>3 d! P2 T; u2 z4 N% P
- #include <asm/hardware/edma.h> B. @) _# O9 i w
. H: [ c) h$ O7 j- #undef EDMA3_DEBUG
% a' B% `4 i# V7 \/ Q - /*#define EDMA3_DEBUG*/
4 _) X/ s& n& n# l' J - . T5 ?. x. ^) v5 i8 C5 U
- #ifdef EDMA3_DEBUG5 x+ }! \! J B. x1 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& t6 \7 I4 s* d9 w9 d3 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ]: S5 ]8 _. V8 ~1 V9 l f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 H o# o+ Y/ T7 T$ x
- #else' O. J8 r h' d' x! ^4 T
- #define DMA_PRINTK( x... )' @- W3 J* s" F9 p! d, V; x/ F) N5 L
- #define DMA_FN_IN5 T9 F) f& s5 D/ `
- #define DMA_FN_OUT
1 Y1 f I; H# N* o - #endif
. t% e P4 P( J$ O% v - # H2 @6 W$ g8 S0 T Y4 V3 h" I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 j8 l2 P; j! r8 o6 e" Y - #define STATIC_SHIFT 3
7 x# L- b# L; X9 ^% t - #define TCINTEN_SHIFT 200 ~5 }# V" J+ m7 D7 _
- #define ITCINTEN_SHIFT 21$ k! r) \' _9 I8 N% ]1 h2 C
- #define TCCHEN_SHIFT 22
- ]% ~; y! G! _6 t' L - #define ITCCHEN_SHIFT 23
2 x# V- j$ B( S% b
) u# E' t5 @& J; l& @1 V0 f+ ]; o- static volatile int irqraised1 = 0;
- h. f( y9 c2 t! O8 o8 A' u - static volatile int irqraised2 = 0;3 O3 u. ^1 h/ @8 t
$ I0 ]) c3 l/ `. O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y, ?" e. H5 Q0 w* M/ f# Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 l4 ]9 P$ f6 O' B$ d- g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C# [- Q; b' C* D
- 9 h& K' [8 H! M A
- dma_addr_t dmaphyssrc1 = 0;
5 O* U; y% z5 L# g - dma_addr_t dmaphyssrc2 = 0;- B, n6 h& W2 F( `& z
- dma_addr_t dmaphysdest1 = 0;% f% F8 W- ~$ g: j
- dma_addr_t dmaphysdest2 = 0; U, V9 i$ q8 g% O7 D' l7 T
- ! b' g( X- z% y; L
- char *dmabufsrc1 = NULL;& e7 U1 W% p: k6 g
- char *dmabufsrc2 = NULL; m+ E% i7 ] S$ }3 I
- char *dmabufdest1 = NULL;
/ ^5 f% W. j6 t) e - char *dmabufdest2 = NULL;
4 u/ n" o W! P4 q- }9 p6 |
3 S f$ M4 R+ D4 s( @7 i0 R- static int acnt = 512;
# }6 Q0 g& p6 R - static int bcnt = 8;5 l' x6 s; K. m3 n
- static int ccnt = 8;
3 [& \/ ?0 z. d; s! O
8 |- G, Q0 p" Z- module_param(acnt, int, S_IRUGO);
/ _3 m; o9 D0 @: Q% ~+ }$ { - module_param(bcnt, int, S_IRUGO);
6 A$ u2 t1 I% t) s - module_param(ccnt, int, S_IRUGO);
复制代码
. a1 Y% c! M [9 Z; v! v8 y1 I- G& z. x5 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. N1 D5 B( L8 F8 e( \' W; S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 E/ K" o& y+ a' P' y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 L6 X ^9 o0 j- w' \1 y# ?& X4 ]; n n. O9 b8 {( L; R
/ k/ @$ o% i0 O8 U6 I$ Y |
|