|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- Z& s q2 r2 x4 i3 P- [code]EDMA sample test application
) o E# U1 i( V - /*/ L& G# n7 p! @0 _- |$ j
- * edma_test.c& r2 ?' f6 ~( S& e( H* }
- *
( Y. ?/ x. M5 ^& d ^$ q1 s9 X - * brief EDMA3 Test Application
" _' V- ]1 m* ~1 T$ n - *. Z% ~5 h! T$ w# }% l9 b* Q+ `
- * This file contains EDMA3 Test code.
2 ^3 E1 h: g+ ~3 x, J/ o8 U+ @ - *
, F5 a; M2 V2 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" \& S! Z5 g; {& ~9 @+ {6 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" D. h; z% `1 R - * TO CHANGE.8 y" k2 K, |- n9 b
- *
3 o& e. Z9 `) `# {2 S' |2 ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& [+ a5 j2 g. e
- *0 C' r8 y4 ]" j: V- q1 u2 M4 D
- * This program is free software; you can redistribute it and/or* F* i& o' t3 I/ d% S) j# ~; q2 F
- * modify it under the terms of the GNU General Public License as+ a% ^ s8 T1 D8 d v: ~
- * published by the Free Software Foundation version 2.
3 k0 O& u% f% b - *5 {/ h$ H4 L& ~2 {3 m( U; O# r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 K$ B% X% S, W9 a2 `# j3 b
- * kind, whether express or implied; without even the implied warranty
8 S! { m @& w# V# u; w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 } D9 V: H" G0 t$ K: `% y5 n - * GNU General Public License for more details.% x% p4 D# \/ W p% E, D
- */1 [: p! ]6 M5 z: b) e% w/ [
* J, n+ m+ Q) r& k( m5 D! c: Q- #include <linux/module.h>' |7 o0 R, a$ R( r+ d
- #include <linux/init.h>
' L: Z6 ^# o. q+ Q4 x - #include <linux/errno.h>6 d4 w" W. `, C5 L$ }( H! p- y, E% K
- #include <linux/types.h>' C6 O% x1 ?$ a: ^/ ?2 \8 t8 o
- #include <linux/interrupt.h># o5 S# r( {; p
- #include <asm/io.h>+ O6 Q/ }9 U& o& g( Q
- #include <linux/moduleparam.h>
/ O8 {9 F& V! F - #include <linux/sysctl.h>
/ C" d& @4 C/ I0 w8 C7 U/ Y - #include <linux/mm.h>
6 N) z* J) @6 }- S1 Z( P+ } - #include <linux/dma-mapping.h>, _- _# X/ q+ ^( c5 \& C# i7 U
- 6 ?2 G }5 F( W
- #include <mach/memory.h>
0 t2 s) \4 n9 l' n) s/ F- P - #include <mach/hardware.h>
* u3 Y6 A; j( o* W( q; o; t - #include <mach/irqs.h>: S: X( B$ a: O' `$ K- p! t+ e
- #include <asm/hardware/edma.h>
3 q9 C0 s o7 d0 d5 P& k. Z
2 L2 F* Q* [0 c& s- #undef EDMA3_DEBUG" d" p4 V( m0 ^. o1 U0 L
- /*#define EDMA3_DEBUG*/
$ U6 ^8 k9 w' v- W) ?
! y9 u3 T* C8 I' T- #ifdef EDMA3_DEBUG
3 y7 P+ i( X$ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( X4 K' c8 {: m% o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d( r6 v1 i4 q4 F% W% d/ B1 o9 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# q7 D( a0 b/ g j3 I6 [4 ~
- #else$ h8 K" @9 Y6 L% P1 M0 t
- #define DMA_PRINTK( x... ): ]3 v1 _$ M( R! \0 w* E
- #define DMA_FN_IN9 P0 K. @( @: W0 l
- #define DMA_FN_OUT
: k) t# H( `: i: T N) A9 M- ? - #endif% p! ?5 R/ ?/ s ]. m8 U1 ]2 T
0 |& {$ e, _. ?9 {* v7 n2 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768): B9 K1 W7 i# {( X, X
- #define STATIC_SHIFT 36 z# L' Q0 J2 ^
- #define TCINTEN_SHIFT 20& r* x! k# L8 L
- #define ITCINTEN_SHIFT 21& ^* A# N7 B7 t3 g* W/ x& _2 {5 O1 j
- #define TCCHEN_SHIFT 22
3 ?2 A6 p0 y5 L; @; m1 w - #define ITCCHEN_SHIFT 23; {' v# C% s# |
- f) `% y: ]+ h6 K6 x9 \- static volatile int irqraised1 = 0;) ]( M4 D5 ~% J3 h9 E/ M
- static volatile int irqraised2 = 0;
! ~# | W% N* ], ? - . c& {9 } j% b' J8 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 b$ l+ p q6 w$ D9 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P: Y p/ @+ a! a0 c5 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& K- o) k0 [5 d Y' c* X - ' E/ @ [0 M6 R: H% }- ^6 J2 b
- dma_addr_t dmaphyssrc1 = 0;
9 A# i$ {; u8 g. O5 J+ c7 u - dma_addr_t dmaphyssrc2 = 0;
`- p' f B5 t - dma_addr_t dmaphysdest1 = 0; s, R4 i0 ^+ `3 f9 K8 F0 \
- dma_addr_t dmaphysdest2 = 0;2 j$ M9 I3 y+ f6 b- Y
" |0 P* a. W+ i$ w. y7 d5 F- char *dmabufsrc1 = NULL;" S& Q- X/ z% Y5 U4 A% N* F
- char *dmabufsrc2 = NULL;
& s+ Y1 U5 |; T6 B" k! g! `1 e, I - char *dmabufdest1 = NULL;
" x, |) J! g4 J. J# l, }- N1 W, a' F - char *dmabufdest2 = NULL;
6 i/ m7 P+ Q& J7 X - 2 e B8 l/ \- k5 p# s: P s# ]5 Z
- static int acnt = 512;
# }: Q0 u: Q; Z! W+ M9 } - static int bcnt = 8;2 e5 F, [" h# E# _
- static int ccnt = 8;
* G" L; T1 g- X' n. ~& k# V - . M" ?) o. S$ S. |# p, d3 A7 p
- module_param(acnt, int, S_IRUGO);
5 d$ H6 t+ l( }7 Z! G - module_param(bcnt, int, S_IRUGO);/ t7 }% l; `7 I! q' q) a: N+ q) {
- module_param(ccnt, int, S_IRUGO);
复制代码 ; e$ g+ l8 Z4 Y& P3 p% C, J s ~
. B$ U! i U/ F+ |) y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ r! ~- K3 N0 i" H$ Q" u' S# q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 W3 v1 _# v2 v$ C- Z) D: N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ y% j) w$ d- V! D
$ B& C1 f$ k" c# E
9 O1 X p, J3 A1 A% x- G
|
|