|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 p, {) c& p& X6 Y- [code]EDMA sample test application3 w8 p7 Q! ]& E# d# F0 w
- /*
3 ~8 Y! s( x9 }: Q2 q" O3 @ - * edma_test.c" j( w2 h c v S& y
- *
! B0 [. V6 K4 I8 D; l" { - * brief EDMA3 Test Application& E. K: H9 K8 z; E# \
- *
2 Y! j6 u/ J( D/ ^, M - * This file contains EDMA3 Test code.
+ e, } Z* H, \* ~9 |+ V - *
) G- B+ y1 D! q) A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% v5 L0 }. x2 K5 j0 E5 H. X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# G# X. c# _9 A$ } - * TO CHANGE.
: Z$ l: x2 A8 f* q4 L, @ - *+ G; c$ a9 I5 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U; r9 K) t. U1 m1 x, _! R. o
- *
/ ~/ }( L6 Q5 o/ N. P - * This program is free software; you can redistribute it and/or7 M9 p3 D: |9 g$ W& U5 a
- * modify it under the terms of the GNU General Public License as" W! z, a/ ?- k$ v4 U
- * published by the Free Software Foundation version 2.
+ _! @# X" J& h% ]. l% f+ R - *& y6 ]+ s2 }/ |4 q; v1 R2 d& N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 v4 F9 V) E3 i* J6 H+ H" p - * kind, whether express or implied; without even the implied warranty: N: t' Q+ t+ w! Z+ U% L$ k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& D! x% F _" {4 S - * GNU General Public License for more details.
1 u! y9 S$ T$ `/ a0 N G" E - */. ]' @2 k; W5 b$ y
- 5 i5 y5 z: j" ?! @
- #include <linux/module.h>; E2 G% o T+ F* {
- #include <linux/init.h>9 m3 h' ^% A% M
- #include <linux/errno.h>2 k2 y% k" _6 E$ g, c- I
- #include <linux/types.h>4 i+ [: i$ J8 `- z
- #include <linux/interrupt.h> y* x6 I6 H7 }" a9 d( V, m E
- #include <asm/io.h>! _1 _* J) o4 v: ~( n
- #include <linux/moduleparam.h>
4 U6 S: K- e2 F3 ~ - #include <linux/sysctl.h>
3 W4 Y5 v X8 j - #include <linux/mm.h>
" ^/ Y9 ?; G9 x3 [* |2 H - #include <linux/dma-mapping.h>% k9 H# A* d8 c7 d- N# J
- 7 |& F/ r4 l, T& N5 o) `! H
- #include <mach/memory.h>7 ^* a' i3 ^4 P% Q0 {
- #include <mach/hardware.h>2 P! @4 m" I& z& p
- #include <mach/irqs.h>
* Z1 c4 q! V; O7 k! s) k- e; w4 B - #include <asm/hardware/edma.h>: P/ f/ A8 l( [! A) K' [
- 3 m6 w3 g5 d9 _3 z& J1 F
- #undef EDMA3_DEBUG8 @3 f' e$ ~; O( s3 t9 E" N' f
- /*#define EDMA3_DEBUG*/
9 j7 h! @$ H: e7 O, l, O+ r2 j. ?
& L; S$ }& g5 o& P% ~# y- #ifdef EDMA3_DEBUG
$ F! { Y' [& O8 y. g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T9 H7 U& B9 y+ `& Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 T/ p4 J# A/ i8 N4 h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V4 }8 M: p" D; L7 g0 p
- #else6 c# h( B7 ]# C8 t+ k
- #define DMA_PRINTK( x... )
' u$ {# `/ Q* A/ P - #define DMA_FN_IN
- e/ k, r9 ~# z% D - #define DMA_FN_OUT5 T7 @' Y2 w5 q8 h
- #endif0 f1 b2 C- \/ U+ Q' p% V
/ N# T+ H. Z4 O/ n$ S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" ^2 }9 Q; Z7 [* a- l
- #define STATIC_SHIFT 3
F+ z( U9 R T( B; V* T4 D' u. } - #define TCINTEN_SHIFT 209 ~1 f6 p$ D& o: P& B0 X. `0 f
- #define ITCINTEN_SHIFT 21" [7 ^6 O; ~# c9 _1 i
- #define TCCHEN_SHIFT 22
0 `! `' O# r7 k/ h - #define ITCCHEN_SHIFT 23* p* |" F6 C$ o3 e/ t" Y; I& C
- " p9 q B+ Z1 i
- static volatile int irqraised1 = 0;8 p) t9 U. z2 k' J! L
- static volatile int irqraised2 = 0;
$ j% P" B6 Z' F/ l' Q2 f+ x - 0 b, b; k3 `- h& q2 b: J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q# K# i( w4 L8 Y+ e0 F# y0 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ] v# E' T3 {" b) V& m/ @/ ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); |* @8 r1 D) {2 w
- W6 c( G3 W: `- m( H6 l
- dma_addr_t dmaphyssrc1 = 0;
8 t' ~, w$ }$ V W$ M - dma_addr_t dmaphyssrc2 = 0;2 a8 O J D0 a: Q% O) v
- dma_addr_t dmaphysdest1 = 0;
( [; E i! ?% R; s - dma_addr_t dmaphysdest2 = 0;
) K& f* V4 u' c* [ - / D6 N/ ?6 m' P |, N
- char *dmabufsrc1 = NULL;: q. {( t+ D1 G+ x
- char *dmabufsrc2 = NULL;
9 o3 }) r& U3 S! y% H - char *dmabufdest1 = NULL;8 G8 l8 T* r( @6 Q6 {
- char *dmabufdest2 = NULL;
. X" n2 k x; h c - ( N' t4 C( e6 P( T+ K3 c: u$ I
- static int acnt = 512;
, J5 w1 c" q7 r: A+ c0 Z" X+ M - static int bcnt = 8;4 u, d" F" ]$ R$ w* \: J
- static int ccnt = 8;2 s! u" ^: L% u7 q& Q
- ! `3 T8 ]4 ?4 h: I4 S+ Q
- module_param(acnt, int, S_IRUGO);4 l6 A7 b* S) D& S, g- E/ ~, J ^
- module_param(bcnt, int, S_IRUGO);
- a+ ?+ P0 H! w3 E - module_param(ccnt, int, S_IRUGO);
复制代码 ( I3 g1 o$ m; Q- \
: c: j7 ~( n5 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Z: p0 F2 R$ e4 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) s6 v3 ~/ G" @7 Y0 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ q2 V( o8 ^- J2 {- i
, ?; b; M' `) r# l3 B
) K, @' d0 A( r9 H |
|