|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * M n* J1 |6 D' D8 O. ^4 O
- [code]EDMA sample test application
# P+ M7 c3 y) S- \- A/ @( b - /*! Z- q l2 J7 H$ {0 A V0 ~8 w
- * edma_test.c8 ?! t8 a; F8 Q& K$ T2 H/ D3 t4 S
- *
9 m" X8 |8 o' s - * brief EDMA3 Test Application
5 v: M" |; g& \3 T6 C9 ~) m( y4 i - *$ h& Q- F6 s2 `
- * This file contains EDMA3 Test code.
$ b- s i ~5 M - *' @. z( ^# @. B' T! ^& c6 S9 W. `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, t+ Q* D" @: I+ ~( j3 ]3 ~% s$ v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. l' j# v/ p) b8 R! \& z
- * TO CHANGE.* C6 c: \% A5 T8 R) W8 {
- *
: L3 _. _' c1 I% P! E) ?. P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% }8 \0 Z0 }3 c) w- n& l - *
' k2 T% D( v) g7 k - * This program is free software; you can redistribute it and/or
) D% o' X- Q+ G/ n- V - * modify it under the terms of the GNU General Public License as8 F1 }% O8 k0 n: w
- * published by the Free Software Foundation version 2.: k+ V$ z- {' A" X& D& y
- *
$ z& S* n1 g" D: ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ R x7 _! X% @, o8 Y
- * kind, whether express or implied; without even the implied warranty6 ?. F) {& t. K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: H0 q+ ]$ x! o$ W - * GNU General Public License for more details./ ?( z$ p' ? w& w3 W
- */& w# B4 _; t% f% ^3 `# F1 \* [" k
- ' q+ {6 X, Z) c( I M2 t& @
- #include <linux/module.h>
: ?$ W) F5 _& P/ ^% S- R - #include <linux/init.h>5 B, |# M' l3 J# b
- #include <linux/errno.h>
: P2 e/ i+ H! h - #include <linux/types.h>( S8 A" _) c# }6 H& c) Z
- #include <linux/interrupt.h># n5 w% @3 g' x2 T) a
- #include <asm/io.h>9 Y2 G1 F; I3 R& g( f' K o1 G
- #include <linux/moduleparam.h>
p* U5 b/ R6 R8 T( E8 P( @9 j - #include <linux/sysctl.h>
- m- @0 o5 k# M( E2 b2 f - #include <linux/mm.h>
5 v$ q8 ^; o8 k& A - #include <linux/dma-mapping.h>2 d% `. D' g' u1 M$ M
6 b3 R( C2 ^1 p) W' a- #include <mach/memory.h>
& P4 O& j T+ a% z9 z6 x - #include <mach/hardware.h>+ G' Y, u- W# m/ }0 z5 n
- #include <mach/irqs.h>
" e# m& f0 ~0 r) V ~ - #include <asm/hardware/edma.h>
3 E- \' K- n% P/ h
6 V _# b" ^& e- Y! A- #undef EDMA3_DEBUG4 |0 s1 _; k, A
- /*#define EDMA3_DEBUG*/
: ]' _3 j- Q5 ?' @ - - ?3 i8 c1 A* j& d7 d; Q+ J y+ I
- #ifdef EDMA3_DEBUG
3 p1 [) M3 d( ~9 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 n) Z) _2 M% Q0 j! M. Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- {- U* z9 [9 F! y+ a8 y2 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) s) m$ X% c3 q2 y) X4 A - #else& z% K+ G; E: t: Z9 V; X
- #define DMA_PRINTK( x... )2 u3 y- [' t, j+ \ n0 ^" ?) F5 @9 y
- #define DMA_FN_IN
# P, u7 N/ D, o9 s9 r' ^ - #define DMA_FN_OUT4 T& H+ I' ]1 C1 X/ H, D
- #endif
' e6 G, \3 P# R
+ G- T' S) B; U3 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- b$ t& Z: Y8 `% R% V- h( g7 \ - #define STATIC_SHIFT 3& [: M1 Z2 T' h+ S& h& r: T& r* `
- #define TCINTEN_SHIFT 20; A. ~' N) ]0 u1 f6 ]/ d, @3 C
- #define ITCINTEN_SHIFT 212 B. V8 _# V% Y' n7 a8 n5 P
- #define TCCHEN_SHIFT 22
0 E& ?) x" Z2 {; q' E5 N! ~ - #define ITCCHEN_SHIFT 23
/ { d/ N% B. N% z! M
" C- V/ D3 M: J) m7 y! K( ?- s7 D- static volatile int irqraised1 = 0;
" z+ C# Z" J1 q; L9 h4 F1 d - static volatile int irqraised2 = 0;
+ ^$ M+ W$ J6 }8 T- ~* D9 N- Q
, T$ l) o( l q0 t2 h) r2 R0 j( K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g) v! M- }, T4 _- z# z& i6 N! {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ U/ S. @3 S% L0 P: B* [2 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p1 y+ e& h* J/ K
% @+ L; n" B7 G+ J( p5 m# k- dma_addr_t dmaphyssrc1 = 0;
& c6 R+ f% |" `7 n2 X - dma_addr_t dmaphyssrc2 = 0;
5 P% z" T# B8 J - dma_addr_t dmaphysdest1 = 0;3 f D) B3 @$ c& a X; A: _
- dma_addr_t dmaphysdest2 = 0;
" k0 u, n0 d" v W
) w2 G- s& R( v- w) d$ P/ j0 n- char *dmabufsrc1 = NULL;. Q; E/ h* P- O
- char *dmabufsrc2 = NULL;
1 A' }7 n/ [! R: K2 Z% _, E - char *dmabufdest1 = NULL;! B' u# W3 l: n! T$ P
- char *dmabufdest2 = NULL;7 f4 Z# u( z# c3 w# B" u( S
- 4 K( h2 G8 T3 ]
- static int acnt = 512;
$ d; O) w" B" {" j% U" v8 { - static int bcnt = 8;
, w6 Q) \7 T' b* ~0 i# w2 h( J - static int ccnt = 8;# B: V0 v! z* |
2 Z7 X- b; y+ B: Z- module_param(acnt, int, S_IRUGO);- l# K$ v( b8 N4 L% n* j
- module_param(bcnt, int, S_IRUGO);. r! P( L1 u$ `/ D
- module_param(ccnt, int, S_IRUGO);
复制代码
( j9 z* }) o3 n2 E. R" E) a
6 N- i, W4 y, G! h1 i. L; k/ n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. d5 F/ f' S- W+ r) g) B# L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Y1 D4 [- t" B: b0 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ~" ~* W' C* }% u+ J9 g5 U1 r" C: X+ K
1 b; U4 F# B" e |
|