|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + J$ X: \" \2 J9 \% K% u. ^
- [code]EDMA sample test application( S- u: Z4 ^/ B g, y! f* r/ t+ u; x
- /*
% M8 S) l3 K/ f$ v `; X - * edma_test.c
3 q# u5 x/ c7 t/ } - *2 V: Z1 N5 K$ x# u4 }9 T/ c/ m
- * brief EDMA3 Test Application
! e6 [" I( J# y9 S - *
2 @# y9 n8 o. s1 H; I; Q O - * This file contains EDMA3 Test code.) F2 ? l1 \9 P$ N6 W. ]' h
- */ v# U- x$ a7 y, A" ~; F# j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ c( q% E% [& f8 V- k; X( I2 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 x+ c# S5 l! ]3 ~
- * TO CHANGE.4 c& s4 _ |4 q# J
- *- u- t9 Z! h* Q! c) h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! z7 s( z9 k1 H# F+ r - *- m+ f. k4 ^# M. Z% ?7 P
- * This program is free software; you can redistribute it and/or
% U" {' q/ u' r! g - * modify it under the terms of the GNU General Public License as
! R8 n: A5 Q6 B) t7 a - * published by the Free Software Foundation version 2./ A/ u5 M9 H c {, c- ^: X9 g
- *
3 O( D, E$ s4 r; ]. L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ]% M: z$ q0 e0 `% ^
- * kind, whether express or implied; without even the implied warranty
2 ?% ]2 l: C: n, E, ~* K7 { ?6 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ C% S+ ?$ Q" |1 k4 C - * GNU General Public License for more details.$ |8 C0 `" [: m% Z
- */7 i# c/ ?" I# F3 c
- 2 D6 S& ?: q* k& S9 ?4 ^/ v
- #include <linux/module.h>
* w( I3 h2 @* L' g3 P5 p - #include <linux/init.h>
* V! u& `- V% V+ u9 y) S# z - #include <linux/errno.h>2 A% K9 k! I0 r% r6 `# |) b
- #include <linux/types.h>
0 `! ]3 X: m, p. d/ t/ M - #include <linux/interrupt.h>
6 H( f! ]; L" V+ B0 m - #include <asm/io.h>
+ E5 t( l3 k! h/ U2 N0 b! r - #include <linux/moduleparam.h>) ^% X. u9 s* m* {% h. L
- #include <linux/sysctl.h>
, t( a- \0 }) o9 m$ o1 F - #include <linux/mm.h>1 q9 T$ P6 Q, c$ U$ \* y" `7 w
- #include <linux/dma-mapping.h>" P4 U }# E( O. D b" g
7 r) e, g- N2 M. Q6 a( X: P- #include <mach/memory.h>
" F2 U: }3 K# e6 X6 \& A" S! @; J - #include <mach/hardware.h>! ~$ U0 ]/ J- i! F1 c8 ?4 U' ^
- #include <mach/irqs.h>
- N$ e1 Q6 m( ?4 f! Y - #include <asm/hardware/edma.h>3 q; |: a2 L# M& a- Q( m. N
- ! l% }9 z2 j$ K7 H
- #undef EDMA3_DEBUG
0 d0 Q9 m' y# ?0 {. O - /*#define EDMA3_DEBUG*/' z; [ r9 y) ^. ^
1 ]) v" W9 e6 u/ f+ ^- #ifdef EDMA3_DEBUG' }( u/ c2 t7 N/ H: t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* l, K4 C% z- W: Y; {) J! F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
@& ?+ l! c% h+ g% T7 i3 g! Q' W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ x; B4 U& T5 h3 M5 l2 ~% r - #else8 q _" o: P8 N4 Y9 Z, r, ~
- #define DMA_PRINTK( x... )
5 T8 I; P1 M5 c% U5 N/ Y! M8 D4 U) q - #define DMA_FN_IN* x+ H2 B3 Q' O3 ]2 A
- #define DMA_FN_OUT
1 Z8 H9 c7 U f' x" ^9 I8 u - #endif
* e- t. ?3 u1 \2 J
1 C% _! S/ Y/ N" F6 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 z& M. |1 e! C, F9 d. b - #define STATIC_SHIFT 3
Z9 l0 T; }2 H: \ - #define TCINTEN_SHIFT 20" h+ {2 M+ E( q2 z6 E' b/ k
- #define ITCINTEN_SHIFT 21
! w( V, {2 Z' K8 n$ _ - #define TCCHEN_SHIFT 227 U, F; C7 I3 s7 D( A z
- #define ITCCHEN_SHIFT 23
5 v I% S: q( ?; ^ S, { - 7 D! |& O) O' e1 D4 Z
- static volatile int irqraised1 = 0;+ H+ P& a" ^* `1 `+ n) g; c
- static volatile int irqraised2 = 0;
! y2 L u ^- C v8 B9 g - + ~7 u6 ]9 g8 L+ x0 o3 E: g& Y( e, x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l6 \; y& n/ w" Z0 Y# v+ } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! z, B( y* E+ Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" K3 C! q5 L, C* O1 b0 S r - 3 a0 y- c, E+ n; Y
- dma_addr_t dmaphyssrc1 = 0;+ S* F! D- U7 ~; k
- dma_addr_t dmaphyssrc2 = 0;
, a* w! |8 O* W3 T$ Z! p7 y - dma_addr_t dmaphysdest1 = 0;
" C6 |0 ?: j7 d6 c% I8 x - dma_addr_t dmaphysdest2 = 0;8 U& I# o8 [1 g* O9 ?
- % k: C* W! v; t9 U- B6 @9 J0 t
- char *dmabufsrc1 = NULL;2 `1 @! ]( x& Q- ^3 x$ _2 j
- char *dmabufsrc2 = NULL;
) ~* V- X' ?0 ^7 B& \0 q - char *dmabufdest1 = NULL;& k! P" ?3 `% h5 c
- char *dmabufdest2 = NULL;) z+ x7 Y, N; u' n
, Y4 w" d! i2 X! f/ Y3 g, T" ]- static int acnt = 512;
7 i3 F3 C. U/ m2 m r- m - static int bcnt = 8;
. |) p) g0 u% h" B, G7 r - static int ccnt = 8;
7 N4 ^$ n1 [, `* [$ H h
4 D7 v% b; M0 c- module_param(acnt, int, S_IRUGO);4 L) p* n3 o! v$ ^" R1 R+ A
- module_param(bcnt, int, S_IRUGO);
6 f4 d3 L W+ P8 a - module_param(ccnt, int, S_IRUGO);
复制代码
4 H- @+ o7 k* n3 W
! X# r3 @% p0 z4 b# l* Z2 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, r9 a* J2 z# ]; @$ L: aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ h+ Y0 T' g" k7 o# `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 e( l. L: b* J7 X5 i4 g
+ h. E# W8 n& e& `4 t1 o0 K) V8 g
) i% h9 b! ]! S( v0 d$ y1 p8 ]
|
|