|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L" o( H7 v0 l* a# @1 ~- [code]EDMA sample test application
+ ^( J. B1 p: Z - /*
A( R% t- N+ f( v9 l0 @ - * edma_test.c1 {8 |+ E) V1 U( v& `, L2 m- {
- *
6 A; r* N% {* I- I5 |, v - * brief EDMA3 Test Application+ i, [( C- n; Z- {5 A
- *1 T( K" e: K& Z3 L8 a) m& V
- * This file contains EDMA3 Test code.$ {/ x* r V8 o7 ?* m& j
- *
8 h% ?' Y& @' Y: @ |* K1 x# J6 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ f. u6 w, i4 ^' u1 A/ O7 B7 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! \, B- f: H, |/ \( e* _% p% c% m - * TO CHANGE.. F4 z$ |+ A" h* D* v* L4 u; ]
- *
# v) Y. ]3 z) }) C2 `* ^- W- ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 \3 w1 v' x4 Y$ m+ h5 p' ]& t - *; x, l! t% I8 ~+ P# T" e
- * This program is free software; you can redistribute it and/or9 \# m" T; g. f9 ], b- q+ G
- * modify it under the terms of the GNU General Public License as3 J9 z: L9 d: d f
- * published by the Free Software Foundation version 2.
5 c, S0 `- E) O: V - *
/ D* d+ c7 y; ?9 |0 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 c* T7 q% _3 [" N8 j - * kind, whether express or implied; without even the implied warranty+ v; Y- ^& z/ r/ s4 u2 \/ K8 S- L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& ~5 M4 n. D: A2 n; [ - * GNU General Public License for more details.* f, D; Z' U3 N$ f# l/ h0 }
- */
" z% c1 f! M3 m7 P7 o - ! }/ T7 M. I7 a5 b7 t+ z/ _
- #include <linux/module.h>
! q6 ]1 P3 x8 i2 D - #include <linux/init.h>
- W) K# l5 {- ~" d - #include <linux/errno.h>- m. U8 o: h6 C3 M' J2 p
- #include <linux/types.h>
0 ~! o8 j6 `" s - #include <linux/interrupt.h>* o* E! J2 y; s* z1 J
- #include <asm/io.h>
, w9 f1 x! R' l6 L& h2 { - #include <linux/moduleparam.h>
/ S! R+ X, p4 V, _, V; K9 n- N - #include <linux/sysctl.h>, v8 F8 U2 P \( o% ~# x) \# {0 i
- #include <linux/mm.h>
- F. J" B, m% e* H8 B7 n2 g - #include <linux/dma-mapping.h>$ B/ w" L1 |& H3 F
4 f6 L) t. D- e; f- #include <mach/memory.h>
: J6 @% w( S! Z0 v+ z* r - #include <mach/hardware.h>
5 [# B$ e6 n: ]* M, \; R3 p - #include <mach/irqs.h>
1 v* X! z9 U0 W4 ^# x - #include <asm/hardware/edma.h>1 c% ^7 d; b y2 e3 p/ B% f6 u+ I
( q3 |* k( J+ z2 w$ ^% A! Q- #undef EDMA3_DEBUG1 z6 h/ B! ~+ x7 ?4 d' \
- /*#define EDMA3_DEBUG*/8 d2 [: p9 K. C& x3 I8 s. k
$ R4 m0 f: Z9 d8 n" B/ D& O- a- #ifdef EDMA3_DEBUG5 P# b$ u6 ^6 d( _7 p% {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* }9 K4 K1 S! B) k i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! b0 Y; S6 w* R R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. q5 \, E/ S( U! T0 `) M- @ - #else
' a4 X$ f S: L1 C# V# L - #define DMA_PRINTK( x... )
# _: U! H. u' K! j - #define DMA_FN_IN. m! ]2 M8 u# C( S& w {5 N% ^
- #define DMA_FN_OUT( H8 c7 v) @% o+ u1 d+ {$ a6 }
- #endif
$ y9 b2 p2 {% {# V - 6 c1 d$ Z/ ]! l. u1 A5 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ v8 m# {/ Q) U" y( C7 A- D
- #define STATIC_SHIFT 3
4 K( w1 g) ?% v9 z: x - #define TCINTEN_SHIFT 20- m4 |% B" P1 X _: E; Y: b
- #define ITCINTEN_SHIFT 21
* A2 O; K% r/ a1 h3 c - #define TCCHEN_SHIFT 22
0 R/ ^0 P8 N9 u. { - #define ITCCHEN_SHIFT 23
! ]& U0 U. |- ^& p. A - & V8 R/ t9 `) ]% j$ @ C3 d {* D
- static volatile int irqraised1 = 0;# Y' k/ X7 M; q; m
- static volatile int irqraised2 = 0;7 J S: y6 y* s$ x8 G
2 M; i0 E8 S- Z# Z! P6 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `9 ?- N$ j1 u8 t- L5 e. {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( o' M [9 v+ v. [7 v) G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' v8 a! ]! K* y4 `* R9 D
8 l" ?# f U" r# i* _- dma_addr_t dmaphyssrc1 = 0;+ M0 ~2 B( Y7 s3 T! ^ d. A k6 _
- dma_addr_t dmaphyssrc2 = 0;5 E0 _" C' T' X7 E$ q/ Q+ a5 u
- dma_addr_t dmaphysdest1 = 0;
$ l% T) F0 Q7 T: @9 e# O$ W; d - dma_addr_t dmaphysdest2 = 0;* ]7 j U% b& ]* Y( f6 U1 k. [
5 w2 M) Z# }' `& c$ z4 l- char *dmabufsrc1 = NULL;
( o+ B8 |8 l: P) h( o - char *dmabufsrc2 = NULL;' R6 F3 H" s( e0 s9 ^; ?/ V8 Z$ P
- char *dmabufdest1 = NULL;! @# r6 o6 Y0 R1 g K
- char *dmabufdest2 = NULL;& g8 j+ a4 N& p4 u
2 t5 f) s2 G- V" i5 P- static int acnt = 512;
& h3 O, }' u7 T - static int bcnt = 8;$ E" I9 G0 @3 k& q
- static int ccnt = 8;
( r/ s5 z) z6 g# ^, C6 d* N( p( M# r - ) X/ L5 ?! u8 M. V' q3 d+ t1 ?% k
- module_param(acnt, int, S_IRUGO);
$ |- E3 J0 k0 f- q - module_param(bcnt, int, S_IRUGO);, V8 [3 m: |% ~& y" w( m! _
- module_param(ccnt, int, S_IRUGO);
复制代码
) m! U4 n; W& } Q. K: v! ?$ Y7 q4 P( u, w* H* j ]4 E$ i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 b. T2 T% W( E1 g( Garm-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 ^7 N+ ]% i& c3 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x1 ? K. A9 ^- K7 q: f8 D, @
) I9 d. W9 ?# G. h9 X# s7 x
6 r$ T; i5 f- y) Y) ?- }9 R. O& a
|
|