|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 @1 f* ]- T/ G9 B9 W
- [code]EDMA sample test application8 k) \! j2 W# f F& J7 W
- /*0 A; b# p% a+ s2 r
- * edma_test.c
/ G& {) Q" M/ L! e X - *9 @% _& u; ^5 p' d& w
- * brief EDMA3 Test Application0 ^) Z. h! \) z) V8 X
- *
2 G' f) V* J5 d: f% f - * This file contains EDMA3 Test code.; J5 m& V; K; n9 B
- *
& M, _. j, P! t: Y8 c& d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: A( {3 B2 K+ j& K! u8 S& F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ w; S, ^0 n3 E
- * TO CHANGE.
6 n! t {0 J& e- p/ A U! `2 V - *$ d# ?7 Z5 y* ^! o" r1 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ N+ {8 S# O: [
- *4 ?( _8 E$ n9 r9 y' T+ \6 V
- * This program is free software; you can redistribute it and/or
3 r) A# X1 q0 V% P - * modify it under the terms of the GNU General Public License as
" S6 B, C) u+ O& O$ f - * published by the Free Software Foundation version 2.
' v) E5 X4 P/ k( v+ L( E - *
. g6 o, Q0 c3 V6 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) y' @% @% ?! X @) U' Y - * kind, whether express or implied; without even the implied warranty
) x6 }% c' x; p2 r2 X4 d9 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' T2 a8 B9 S1 N/ k0 n8 t) T
- * GNU General Public License for more details.
" Z( J/ m$ H2 N9 ~) M5 {4 x) N - */9 c+ k1 e; ^7 g
* R" y. w; i+ D K( N8 s- #include <linux/module.h> ?# `% @8 z7 \& s7 ^! m
- #include <linux/init.h># _" [8 c/ J5 a9 Z4 p) a
- #include <linux/errno.h>& e* ]! r* N2 ^3 ^" a& J4 [/ R+ K
- #include <linux/types.h>0 C' v0 d. l \, x' G; h
- #include <linux/interrupt.h>+ O, {& A+ F& d% _ b% C0 H
- #include <asm/io.h>
6 x) u3 D/ \/ [4 P% r9 K - #include <linux/moduleparam.h>9 L' k' p; A) R' P2 F2 [4 d/ ~. f
- #include <linux/sysctl.h>
- F# D% Z4 j3 ^/ M$ j2 ` - #include <linux/mm.h>8 S# ~: R" h- k
- #include <linux/dma-mapping.h>
I& ^. Q7 {4 b' K, W: g5 {$ p1 Z& z
+ s- `4 ?6 ?! _5 \- #include <mach/memory.h>. j# [ R6 h) t' u' f& p
- #include <mach/hardware.h>9 Q: I" {( K( p0 v
- #include <mach/irqs.h>
' K' D9 B2 `! }, y3 V2 s. W - #include <asm/hardware/edma.h>
. k9 S$ J6 I F
5 Q, R; Q! `1 K9 d" s* G! U- #undef EDMA3_DEBUG, }) v6 \% ?" U+ x7 X5 n; M. F
- /*#define EDMA3_DEBUG*/. G8 D$ m$ h6 M* G& E/ Q# H0 o, P
- 7 I1 f1 s# i9 T6 A) H& ` e
- #ifdef EDMA3_DEBUG
% M/ V, }: f1 }: {/ j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 q- M% Q9 R' L% {8 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T7 N& U) y( }, R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. a- ^, G. F% ^# j - #else
3 H+ {3 l5 Z( I3 _2 N9 z - #define DMA_PRINTK( x... )+ d! M; _/ u! H7 u' w
- #define DMA_FN_IN
6 v8 F: ?- z2 F - #define DMA_FN_OUT, I( ~% y( [: T
- #endif! P& X+ B! }8 p% M# O6 ~
- ) V( C8 l7 d) r0 c. c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" `' \- u3 k8 s7 Q - #define STATIC_SHIFT 36 _+ L/ a- O$ f8 `' A: ?2 A" a
- #define TCINTEN_SHIFT 20
& F1 g0 [; n# G4 S6 `) @ - #define ITCINTEN_SHIFT 21
( s. I" J9 @% y0 u6 F% f - #define TCCHEN_SHIFT 221 H D; A& e: @ ~* O
- #define ITCCHEN_SHIFT 23 k) r! w1 k# q' v- g) M
4 \4 S" Z5 h, e! V0 m* W. \& n7 D- static volatile int irqraised1 = 0;
3 N9 `3 Z& y, l, c - static volatile int irqraised2 = 0;, }1 o& ~+ W- l3 c1 g
- 3 ^. K) g* n% f! S0 _& x% \ s* [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G' m8 T$ P7 z" n) u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d9 w5 W0 S+ \" m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f! d9 X/ D; G/ U8 W0 r& {" w
+ J% r/ _0 k" \' E9 e/ u- dma_addr_t dmaphyssrc1 = 0;
# z+ r( o# U2 ^4 b - dma_addr_t dmaphyssrc2 = 0;
4 B) R. B! c8 e9 p - dma_addr_t dmaphysdest1 = 0;/ M/ P0 a+ ^5 \$ F2 d
- dma_addr_t dmaphysdest2 = 0;- ?3 R B: Y; [+ }: k- h& X, y
- # J# e6 k" N- E1 j a' q0 r
- char *dmabufsrc1 = NULL;
f& l+ }8 A* u. |$ M" S( r/ g - char *dmabufsrc2 = NULL;
; m% k4 y" ?+ T5 X2 P! M2 s, F5 S - char *dmabufdest1 = NULL;
3 J+ _, Z4 _+ P" i8 W' Z# Y$ b - char *dmabufdest2 = NULL;
' O% I, f# f) t L7 t, ?2 c; o) d0 r8 h2 Y - 1 r- [. Y) w8 o3 `6 |0 F
- static int acnt = 512;
! W ?4 S. n: c% M( w6 o - static int bcnt = 8;
5 J! ` G B8 x - static int ccnt = 8;0 t- D2 `" C% y& c$ s. n1 ]
. L6 x* l, P5 E# { N7 a7 p1 P- module_param(acnt, int, S_IRUGO);' |" \/ U) a: z7 d% B# _2 `+ c
- module_param(bcnt, int, S_IRUGO);
% r( g9 E) Y# c - module_param(ccnt, int, S_IRUGO);
复制代码
# E6 N7 R9 w. c) E) ~+ ~
% o' u+ E+ @. |5 p0 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& M7 Q2 V, A% J- l& S. w7 H- O) I6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) i2 u1 |$ }. p* i2 e8 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ h7 k# x3 T* ~, T/ `0 Y- ~
0 o% N ] z& H, K4 g$ { X/ y- T7 R8 \, b' z2 D
|
|