|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 h& m) f2 V$ y; }. Y- V7 J
- [code]EDMA sample test application
: Q2 X7 P4 Q, o& R! N: X - /*
7 q9 r, v9 B! P4 j. F - * edma_test.c* J! x9 p }8 s7 ^5 r. V2 K/ X
- *% K0 F( H. e0 s( ]2 _
- * brief EDMA3 Test Application
# v5 d1 R' d! x3 J7 f' F - *+ w3 S% h6 u5 f D: @) G4 L
- * This file contains EDMA3 Test code." P- S: x i7 I7 j, g& _7 R
- *
1 @, e0 i, D2 D' G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M/ Z. j8 h. [* @; e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, J$ f. j( R4 }: ~, i9 `8 [" w - * TO CHANGE.
9 q- s% \- V, l5 x, C - *0 b- [/ R1 {$ T- @# l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& m7 g$ d( G/ F9 G0 A) E
- *
W/ B8 S2 U! e: B - * This program is free software; you can redistribute it and/or% G" l5 g$ t: i5 }
- * modify it under the terms of the GNU General Public License as# z R9 {, T$ h+ K, s
- * published by the Free Software Foundation version 2./ ]/ j4 i7 Z: K# N/ w* q
- *9 n: L6 m" E# n: l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y* k' I7 ?9 `- h5 K5 W
- * kind, whether express or implied; without even the implied warranty
( a8 h7 z# U$ _0 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- r* ?. C/ ]* D) J) F3 T+ M5 V! c
- * GNU General Public License for more details.
, l! p3 ^8 g7 `, c; T5 U5 d# L: ^ - */
; p6 S/ T' `" I& z$ {
* h9 Y$ G5 e0 J- q$ V8 N: Q- #include <linux/module.h>: W- S2 ?5 n; _) p6 t" k1 D+ M u" d, l
- #include <linux/init.h>. C7 X! T$ u7 Q5 c/ c" r" z
- #include <linux/errno.h>
( a2 ]7 U5 ~3 N5 C; B( a T" c6 G - #include <linux/types.h>8 B' F' D: U% H- q1 w! `( I& ]
- #include <linux/interrupt.h>
6 i" f4 c1 }/ n. g: S! l - #include <asm/io.h>, F; w9 S. T- f. C) A, B# l+ Z
- #include <linux/moduleparam.h>
! a! h2 H3 D k9 j! U* w# f - #include <linux/sysctl.h>% p- o0 K0 p& s4 w8 r/ d5 x
- #include <linux/mm.h>
2 W! { v& p+ S7 i - #include <linux/dma-mapping.h>
& B# P" y8 V" z
% x0 K/ m3 ^3 L3 K4 y) F- #include <mach/memory.h>
. Z- p2 U0 @! s: s - #include <mach/hardware.h>
& L% ]* r w' U/ h - #include <mach/irqs.h>
9 x9 }9 T/ b. Y4 E - #include <asm/hardware/edma.h>7 Z7 p4 R! s# `2 j( W& ]
9 n6 f0 I \, X1 n# r- #undef EDMA3_DEBUG2 r$ {9 S2 Y/ E+ y/ I
- /*#define EDMA3_DEBUG*/9 S W% y2 y8 {3 r" f
- ; B9 w: z R+ e4 g- d6 h
- #ifdef EDMA3_DEBUG( F1 M) p/ G* C) O: ]0 \( s' D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V4 x! }$ m; A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: \. b7 w# A" [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 f2 b8 Q5 h6 W6 O7 V' t( e Q7 Y1 d - #else
0 U S: ^6 P5 G" |' I9 ~ - #define DMA_PRINTK( x... ); \6 i# m( S8 e6 c' E
- #define DMA_FN_IN
9 t, Y# \- l4 F0 x" T$ x/ h - #define DMA_FN_OUT
# B( M8 H( s& r/ }1 Q4 ] - #endif& C7 C }& X3 |) w: d
- 9 [7 o. o h* i; ^+ T# d" P h' D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% m9 N. f, |6 w, ]; `- I3 Z - #define STATIC_SHIFT 31 G; H8 {0 G: K- k& f
- #define TCINTEN_SHIFT 20
2 g9 T1 c8 J" R# O - #define ITCINTEN_SHIFT 21
) Z, \/ S6 E9 I; P3 M; ] - #define TCCHEN_SHIFT 22- y/ N0 R8 A; B/ t
- #define ITCCHEN_SHIFT 234 V+ T- w0 X1 `' x9 y, {0 ]9 ?' E
, X& l( I' ]% C* _- static volatile int irqraised1 = 0;
: x0 D. e# d0 F* r, }2 r' H3 z - static volatile int irqraised2 = 0;( m5 f, w, B& f
9 F; _9 j6 W6 W! Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- F/ ~$ J' M6 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; D* |5 N( C6 Y5 u0 ?& V, ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z0 U, `0 i5 v - 4 l! K/ E5 L$ z% H. s
- dma_addr_t dmaphyssrc1 = 0;
: Y) H, O% v/ x5 r6 g - dma_addr_t dmaphyssrc2 = 0;
8 y8 c: {2 q! K- z/ z' ^' P - dma_addr_t dmaphysdest1 = 0;2 ?1 v- C0 S; q9 M! \- a
- dma_addr_t dmaphysdest2 = 0;
0 {$ T) B7 W K3 j' h' d% k1 i" |9 t - , ?% J% g8 l9 T+ [
- char *dmabufsrc1 = NULL;5 N/ w( S" t# F/ x0 b
- char *dmabufsrc2 = NULL;
7 B; W" Z# f& D! P: X/ P; ~ - char *dmabufdest1 = NULL;4 z9 p# @* H Y. }
- char *dmabufdest2 = NULL;5 f' Y5 R& g" u0 ~" h3 m$ \
$ p% {$ H: V6 p5 u9 U- static int acnt = 512;
/ w9 j5 g* n" y) }# ` - static int bcnt = 8;
) A! d) m. S3 r0 ^) M - static int ccnt = 8;
7 i: a/ ^- N% w' G; d
7 @! |1 L6 D. |+ G0 v- module_param(acnt, int, S_IRUGO);
/ W' @- M1 v8 T0 I- g a' \ - module_param(bcnt, int, S_IRUGO);6 c4 N0 y t7 k; Z; T+ R. g
- module_param(ccnt, int, S_IRUGO);
复制代码
K/ ^1 T% R0 r# r8 }# H& X6 |' \9 S2 A! |' H5 W, @* o& e5 s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! ]2 A+ _! [' e4 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 s+ L" O! R3 Y( e& u3 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 F/ o5 |( t1 O3 N: }$ Q( [$ v# {0 S6 H3 K/ J* B
) ~ h. e$ ~. v4 S& L6 c |
|