|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v! _. o4 l6 q2 C2 h: `
- [code]EDMA sample test application; @& R) w: _* M0 l4 s! y4 ^
- /*! b) z" v- }0 K/ `7 @/ G
- * edma_test.c' f' g7 T: H5 N4 K- e: a+ _
- *
0 O, {( n4 r2 P/ O m - * brief EDMA3 Test Application. ]; c2 m. X# H7 T
- *& v4 s8 f' Y7 w) i
- * This file contains EDMA3 Test code.
5 B& z; [4 N! H) q - *( e" _1 Z/ ^) ?0 t3 s7 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p' b3 d4 H& C8 Q( ^: @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ g6 V g6 y9 E$ j3 H
- * TO CHANGE.3 I9 o. [: G3 d$ K; v$ h
- *8 L4 E) Q8 H8 H4 g/ h- ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p) B# Z+ Y* d8 k$ T+ K5 n7 e
- *
: y2 m( L3 v. g" `. k) o( G( F - * This program is free software; you can redistribute it and/or {6 t8 n$ N8 E4 Y- t+ T
- * modify it under the terms of the GNU General Public License as
1 I8 b- P) ^+ L# n2 f- Y - * published by the Free Software Foundation version 2.
5 p7 q8 F( H \$ z - *" }: T5 N6 ~) T2 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- o/ n0 t$ y4 y7 x" K - * kind, whether express or implied; without even the implied warranty
+ h, ^9 u% V: o S* F& Y/ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ k. U- d: T1 \* [6 T
- * GNU General Public License for more details.
$ o! |3 w0 a# Q! m - */- Z* i* C3 x, B' [
- 8 b( C* e& s3 D, o* k
- #include <linux/module.h>
# l: f7 @0 o2 b2 Q7 J - #include <linux/init.h>
* L* Y4 Q, s; D. p9 u - #include <linux/errno.h>
# m0 \! g; [8 Y( A - #include <linux/types.h>
# ]; n" a% R1 D/ X y - #include <linux/interrupt.h>
5 b. w, ]7 o0 t/ N5 i P - #include <asm/io.h>
+ y! G& r% Z! g7 r0 u3 h - #include <linux/moduleparam.h>
) _( t! `8 @6 W2 Y9 @0 i% M - #include <linux/sysctl.h>
s. D/ {& y2 l5 g - #include <linux/mm.h>
8 X: q+ m7 F$ c" t8 g* X; | - #include <linux/dma-mapping.h>
0 t3 N; M$ |' I' g - : e) [! Z& a. u8 j/ z9 _4 B
- #include <mach/memory.h>7 z& b/ b% z. H3 d
- #include <mach/hardware.h>* W3 y% W5 W4 V6 x
- #include <mach/irqs.h>: P8 P7 I0 u) c0 O; h7 g, B
- #include <asm/hardware/edma.h>
( Z: Z# I" ^3 F2 y - 7 Q4 Y* B+ U1 |3 s
- #undef EDMA3_DEBUG
) M! Q# ]2 q6 J9 I* C$ w - /*#define EDMA3_DEBUG*/
4 w& W6 _8 p; z. ]6 c2 Q& m/ I( \
4 u8 q! x: w7 r, ^5 g- #ifdef EDMA3_DEBUG
, J9 u% u' Q3 k L: Y1 j Z3 f- R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 c* O# ]8 q8 ^" Y( M: f2 h+ ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): L g: ?6 A) G! _- x0 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). P; T0 r7 ]% I# k# E1 |
- #else
7 V* A! m$ B, R1 e [# K - #define DMA_PRINTK( x... )( [$ z& p: k& X& q
- #define DMA_FN_IN
) ~( {; f' v4 t( N. o1 { Z - #define DMA_FN_OUT( k& o2 w7 q+ w# E9 x/ h9 z/ B! J4 P- r0 r
- #endif
7 ?, x/ V) P7 X( k
" @9 O# U( s3 Z$ K1 a, n& E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 m6 e' U* x) ? k4 k! V
- #define STATIC_SHIFT 3
; x b# G& r5 L& ^2 o) U5 v5 N - #define TCINTEN_SHIFT 20
1 o9 \9 L' W U$ W- t- @ - #define ITCINTEN_SHIFT 21
( }% @* N" J y) G& H - #define TCCHEN_SHIFT 22
# V! O; _, g+ r7 P" S - #define ITCCHEN_SHIFT 23
7 i9 e+ c9 i0 C, p
: i- F" i8 s5 B- static volatile int irqraised1 = 0;
# `; R# B% Z: n0 j" X+ N& Q0 | - static volatile int irqraised2 = 0;8 p+ H4 G, m/ Y: ?0 J% @5 ]
. b& c0 z5 ?" S/ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r; p# a' C& |2 ]! Q z' R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
}* Q% _) A0 r& a. z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ L$ L. E* \7 F; B9 G
: m: ]3 h$ ], |' N5 N; V. m( h; ?- dma_addr_t dmaphyssrc1 = 0;
1 y8 X6 H1 Z; j/ M q7 u# N& M# a9 Q - dma_addr_t dmaphyssrc2 = 0;
4 ^7 X# K. m1 m) q4 w2 i - dma_addr_t dmaphysdest1 = 0;
. t% P4 {! \3 V7 m - dma_addr_t dmaphysdest2 = 0;
+ m3 q2 ?3 ?& G# y7 S$ Z; J$ l, @ - 1 X" C) z. }% T t# |6 P
- char *dmabufsrc1 = NULL; d) O! M6 q0 ~1 W
- char *dmabufsrc2 = NULL;& q, P) P7 P4 n; i2 H
- char *dmabufdest1 = NULL;
- z' [6 B. t! R1 m. g1 \ - char *dmabufdest2 = NULL;: i4 a: [( Y5 c/ T4 s9 ]5 _9 m8 l
' V3 ?+ y# Q$ ^7 \2 I% {- static int acnt = 512;& e. y9 p! X2 X) {6 J! L, k" Z
- static int bcnt = 8;
0 `# o/ a* L$ X: a/ I R - static int ccnt = 8;
0 @8 B, d* M( U2 r( c& l - + ^8 F2 c7 w8 C, i3 O; [8 |
- module_param(acnt, int, S_IRUGO);
1 h3 s' J9 w! d/ P7 G. s - module_param(bcnt, int, S_IRUGO);/ |+ k+ K- ~7 H9 \
- module_param(ccnt, int, S_IRUGO);
复制代码
2 H) W% @; Z# E8 U3 n1 k4 m: _/ M! H! U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t; c0 t q# H0 E' q9 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N* O# }0 P( p3 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; t8 e G, J5 h- K! c
" S; X( ^* B% n0 R
9 r; E$ F+ l! m: F$ a# q1 w# E
|
|