|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 L2 _$ A i* ?) A& z( W1 S0 N- S- [code]EDMA sample test application
; j* R) h3 n( B8 C/ U- G - /*
0 c/ a( U: U6 I+ J5 g8 R - * edma_test.c
3 c9 Q( {6 H1 W6 M+ h% z' c! a5 L - *
, G3 O( @' x9 Y" j3 O - * brief EDMA3 Test Application
# y7 l9 X" g! b+ [& W - *4 ?- u( R; c6 K' U3 Q6 y
- * This file contains EDMA3 Test code.
; [/ V5 n5 I: O - ** n: T8 `- o- _ ?- E$ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {# U6 t, V2 Y; Q) h/ s7 g& B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. o s& |6 ]; f2 }# s Q - * TO CHANGE.
% j- @; u+ ]# }) q - *
. A& U& [5 _* S( Q. ?- l L8 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ~* w! @/ j, `$ y/ ? - ** ]/ l1 z& r* _7 t8 v% w, Z/ ^
- * This program is free software; you can redistribute it and/or4 x* y: B" h- i+ w+ i, z- t5 l
- * modify it under the terms of the GNU General Public License as
0 f/ V9 ]+ V3 T* F) j - * published by the Free Software Foundation version 2.9 P: u! P$ R, O# } C- t
- *8 g: t6 b: H7 i F5 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 Y( p; h. T' @1 i5 S' p
- * kind, whether express or implied; without even the implied warranty) C, X# M+ S8 D2 { r& M) L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& r4 @; x# e& o0 E; h - * GNU General Public License for more details.
+ y% m7 r/ B2 P0 p. e( O' T3 h - */( \3 r! }2 e2 k7 k* k
- % Q, M/ G! l0 c: u. y& e/ C. Z0 z' U
- #include <linux/module.h>, v6 O# T/ u L w: d; v' L- ^6 f: [
- #include <linux/init.h>
% X4 I% h$ ?8 |8 s- M - #include <linux/errno.h>
" a8 b! R, e, ^- m, w3 E - #include <linux/types.h>
: c% r5 i) R( S, u3 S4 h4 [ - #include <linux/interrupt.h>
8 ?$ w) Y. L+ t" H" O - #include <asm/io.h>
9 s, M1 W7 ? m0 N! o6 v+ o - #include <linux/moduleparam.h>
& i4 Q; i# ?( O - #include <linux/sysctl.h>3 d- R4 `! ~- t0 w" n+ x
- #include <linux/mm.h>" p% i3 Y e- M$ o0 r' H2 X
- #include <linux/dma-mapping.h>
5 P# U/ F; l# p" }4 w3 h - . e( H$ g# ?; [( o" P
- #include <mach/memory.h>
# x0 |8 O, @4 a - #include <mach/hardware.h>- N$ N0 ^0 V8 V& }$ i- p4 r- U; U1 A
- #include <mach/irqs.h>+ G# ~7 m( K1 k" ~ X
- #include <asm/hardware/edma.h>8 t) o) I8 F- I" i4 N$ l
v2 K7 t3 K( k; x, ^6 N- #undef EDMA3_DEBUG
+ Q: g! l% c l - /*#define EDMA3_DEBUG*/
5 d7 M/ o/ @0 m9 d8 I - $ i* d: ]' _. M) U
- #ifdef EDMA3_DEBUG
$ X$ [9 f/ }) p( r4 `( C6 l0 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& K/ ~! j0 C$ b: t2 v. f" k M& G' t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: I* z1 P. F, Y% w7 l# z" @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 u& H6 B$ W1 j; F- _$ j5 x$ z0 r
- #else: L+ n7 O6 S- V! [3 P) A) F5 r+ \5 x
- #define DMA_PRINTK( x... )0 ^5 t7 n* r3 i% A; }6 X
- #define DMA_FN_IN( _' l% X b0 `0 n) H
- #define DMA_FN_OUT
* B S2 I0 u% S1 [/ F5 L - #endif6 I8 b: l! u, {. a4 l9 [( S$ i
5 n# N9 U) Z& n* w: j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 X; w4 q2 v3 |8 @% w1 e* ~ - #define STATIC_SHIFT 39 E" |6 P2 a4 H) E* x$ s, r8 @, G
- #define TCINTEN_SHIFT 20- R m' @5 f2 N% t& X
- #define ITCINTEN_SHIFT 210 f3 U# c) f1 N
- #define TCCHEN_SHIFT 22
% W' @' h2 d0 A* | - #define ITCCHEN_SHIFT 233 s; p& A+ O% r$ T/ l) `
- , j6 M$ w6 J$ q0 C4 _# T" C8 j- m% s' s
- static volatile int irqraised1 = 0;
( a1 p7 s+ J9 f: O- y - static volatile int irqraised2 = 0;/ p) G/ i2 n' |) H4 O
- % g- v; S h2 m O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 z( e7 f5 o4 [" i6 C4 F/ L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U7 J9 W$ U$ Y3 O) R* M. y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! C5 ]# p1 K: \- x
& B' G/ k3 o* \, V+ k$ m$ d- dma_addr_t dmaphyssrc1 = 0;1 p6 |0 ]6 y0 p) l, O8 I: z
- dma_addr_t dmaphyssrc2 = 0;
0 M3 Q8 A1 ~1 m. l; k - dma_addr_t dmaphysdest1 = 0;
4 M. W- D& k( e( ?, w - dma_addr_t dmaphysdest2 = 0;
- ~: T4 U+ Q! \3 J- z [9 Y5 w
+ Y) Y. ?+ t0 |& O7 |- char *dmabufsrc1 = NULL;# R: ?* x! E% }: W( i* N: B
- char *dmabufsrc2 = NULL;
/ N: B, ^; g n' H - char *dmabufdest1 = NULL;
- |/ h3 U d; Q; M3 x2 Z - char *dmabufdest2 = NULL;
& J. S2 u- R6 x7 B6 K# e
; K, ?4 o+ T' s( r0 E" _- static int acnt = 512;6 E, P6 U8 M! v# {- D; e2 ~
- static int bcnt = 8;6 L) l, B5 ^4 u# j+ X% _0 Z( v
- static int ccnt = 8;0 h8 }" x: }9 o* J
- % |# L" o. |: a l" M2 }
- module_param(acnt, int, S_IRUGO);
( h3 _( L9 y! C. ?7 I - module_param(bcnt, int, S_IRUGO);
) o, U3 H+ c& ?9 L8 d4 @ - module_param(ccnt, int, S_IRUGO);
复制代码
! E+ o8 Y( T1 Z! W4 P' p; W7 A0 s2 T9 E) E% _1 C$ e; Z0 C, v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 r2 C3 P0 b, u* P, e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 a& f& `0 A7 N1 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 m }& J; u3 d% k9 K, T/ m5 ^
! |: l/ ~) m1 G5 C* w3 H& D0 B# c6 q K9 P" I0 g
|
|