|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( ]; y4 s6 a8 e% P1 v
- [code]EDMA sample test application! _. w! V: K, W, Z' x! P" L( B
- /*
. t4 ?) p8 k- Y2 k - * edma_test.c
7 c' i$ K4 n' E8 t; M4 T - *9 a7 Y; E2 ]. h9 J8 m* T" X2 d
- * brief EDMA3 Test Application9 X x+ K( j; G5 D" _- n
- *$ r' O2 v* @* K$ [2 H- f
- * This file contains EDMA3 Test code.* J3 s2 f2 K* n1 K- k
- *5 S9 `4 T* E7 t/ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 s `& R V' p9 ^# X, ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 T, f" R3 z j4 u- S8 E - * TO CHANGE.
# K/ \- X W0 w' g [5 m/ n - *
2 p5 ]8 @+ F% E2 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 M' i1 W7 p8 L0 F$ f9 d) o0 K - *
( ^; b$ |% @% E: @6 D - * This program is free software; you can redistribute it and/or
% u/ v) n1 y4 X: h1 x: ]5 r) }8 ~ - * modify it under the terms of the GNU General Public License as
, \/ b$ d! x# I! o) h+ |) O - * published by the Free Software Foundation version 2.( b! [) h Q' i$ k! T" V# M% e
- *+ C6 ~+ h0 W0 z) K# I" b1 c- C2 V% Q; y% j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% s0 t* x2 k- D8 m/ \
- * kind, whether express or implied; without even the implied warranty
: v5 T7 L! F; W& R: N/ k Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% m/ `% G! F6 j5 D/ e - * GNU General Public License for more details.
+ F" ?. r. q/ x - */
8 e6 V9 t8 s h2 m6 E
9 ~: m3 u4 y* m: {5 C& w6 _3 O- #include <linux/module.h> N' ^6 h' V6 H) g+ G
- #include <linux/init.h>1 L1 q6 Z$ `$ s0 V
- #include <linux/errno.h>5 A: J( q& `9 Y- w! h* I
- #include <linux/types.h>
& V; [# z' h! q% Y - #include <linux/interrupt.h>+ I c: f& i- s! l) [
- #include <asm/io.h>3 O$ y+ h, E( O5 u
- #include <linux/moduleparam.h>/ L7 L$ e( G) \; T& s! H; |% f2 M
- #include <linux/sysctl.h>
: g/ P- _& m) ^/ P; n - #include <linux/mm.h>% s& i5 D- f% z+ ?; V5 F
- #include <linux/dma-mapping.h>4 x' `: b& O$ J/ p( @
4 u5 g- N, L1 T- O& K5 ^- #include <mach/memory.h> R9 @& f: Y2 m9 L- q
- #include <mach/hardware.h>
2 \* n4 S& `( U; D - #include <mach/irqs.h>
0 B/ C) p3 ~2 i& F, n5 j+ o. {" z - #include <asm/hardware/edma.h>, G, Y, M3 ?& _ _1 k
8 O4 U, W4 u& e7 ]5 i+ N- #undef EDMA3_DEBUG1 `' L, c2 v% E: P9 I* r k6 y
- /*#define EDMA3_DEBUG*/3 ^/ }& r3 d% ^* m$ a
- 1 D x3 @4 E4 [; ]; Z
- #ifdef EDMA3_DEBUG
8 z$ y: }9 x$ W: j! K/ h% S" T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' N. Z; ?& ~+ u, y0 G6 X+ |0 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 Y/ S. h# x2 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 \" q3 A; P6 ~# S" }, M8 _ - #else
( `; p, _* ~ h3 j/ \ - #define DMA_PRINTK( x... )
$ z$ z) i+ i. f! R# g7 A7 i( G - #define DMA_FN_IN* P6 N6 w; ]1 i! ]- v
- #define DMA_FN_OUT( A. L% X N3 g3 w& p
- #endif: o- R! J1 {+ C: ?
* u! Q* B w0 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 H; i* A' s/ s+ q0 b - #define STATIC_SHIFT 3: o9 `: B; R) ]
- #define TCINTEN_SHIFT 20
4 R0 ~$ J5 H3 F g3 w - #define ITCINTEN_SHIFT 211 |, V. m: }: K; h R# }2 I
- #define TCCHEN_SHIFT 22- F# u* Y7 h9 P& [) i' h6 l+ C
- #define ITCCHEN_SHIFT 23
+ [8 r' C$ x+ |7 ~
$ \# v ~! \% L, [0 K3 n9 Z- static volatile int irqraised1 = 0;: k" V$ j: C- F) _+ s7 o
- static volatile int irqraised2 = 0;4 I4 ]' h. W' W9 F* e5 J
8 {. U& a' y- f; H2 M# ` U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 @' i# d. z. l) Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 o+ c8 h! ]0 N6 C8 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r9 }5 G7 F/ Y; A& U
2 s5 E$ O$ }9 g. t- dma_addr_t dmaphyssrc1 = 0;
3 t$ ]( ^% N) I4 Q* P& L - dma_addr_t dmaphyssrc2 = 0;
1 {) {- {- R. R J l - dma_addr_t dmaphysdest1 = 0;1 p5 H6 U/ W7 _6 l& g
- dma_addr_t dmaphysdest2 = 0;8 U. V% a* ]! W$ m' f. d% A! Z6 Z u
- % g3 p9 v8 Z7 I4 w0 ?
- char *dmabufsrc1 = NULL;: j: b% K0 K' X1 l
- char *dmabufsrc2 = NULL; @4 s/ I+ m9 U: j( w: n$ P1 ]+ @
- char *dmabufdest1 = NULL;
: l1 R; J/ a9 ? - char *dmabufdest2 = NULL;
~0 n2 J2 o8 V8 `5 X9 h - / g h6 w4 t& I) C: E
- static int acnt = 512;
+ v1 x+ ]; B: Q! _& i - static int bcnt = 8;
6 z8 S! ^6 C2 u- o4 N9 C - static int ccnt = 8;
9 w& `, Y7 W4 J+ C/ p! _' i
4 N7 H4 v6 G8 z- module_param(acnt, int, S_IRUGO);( ~& A5 p& e6 ^' U: |2 S' z4 N
- module_param(bcnt, int, S_IRUGO);
. C @' K+ c! _5 f8 J - module_param(ccnt, int, S_IRUGO);
复制代码 7 ^+ g- m/ [9 d/ [& \$ |. P
& ?0 K5 S5 r- D" b4 L0 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [$ `) ~' @' M3 `( oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 p+ C. N, `7 b, b3 b1 K: g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E% {4 w* P3 y! `( g2 p* r) h$ D$ Q ]
- z5 o% u% X; o" V |
|