|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ~( T1 n$ ?7 E3 j* K
- [code]EDMA sample test application
3 a0 D; p- D& ^: f Q% a- N/ I - /*# ~/ y! C7 {4 O6 _" t
- * edma_test.c; v' X n0 n, P! a: ~# {
- *
: A5 f8 k7 f# _8 H$ o" I+ f - * brief EDMA3 Test Application
2 ` C" }, F; {! B3 u9 G( Z - *
2 p9 K7 l$ H+ n/ k$ F/ U! o" ? - * This file contains EDMA3 Test code., u+ J3 }( N. I1 z0 a1 @, B
- *6 T' d/ U+ L) g) x ~# ?2 ^8 X7 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 K8 F" W4 E) h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j0 d1 A8 {9 X$ Q
- * TO CHANGE.
" f, e* v2 z& B. o - *
& n' p+ c! v+ a8 m5 e1 b; P! m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 A- {% O4 A& O/ r( I. s6 | _
- *7 D/ ]/ C& I+ o" W$ T C; w4 o
- * This program is free software; you can redistribute it and/or
- j" k3 q( j6 ~9 ]& g& o$ V) | - * modify it under the terms of the GNU General Public License as! l- v% X( Z* ^# p0 a1 P8 @
- * published by the Free Software Foundation version 2.7 Z5 y* w- e2 R% W( \% b1 z' m
- *" E( u* \7 v0 Z8 h! E% Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 S/ P- Z( L1 X& k2 U
- * kind, whether express or implied; without even the implied warranty D6 f" J. l3 e9 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ l: E) ]: z/ y5 q/ d
- * GNU General Public License for more details.2 K$ z- K- M7 Z2 {: x3 @
- */' w) U2 ?% j$ v7 x
, Y. G4 H# ^+ ^0 W- #include <linux/module.h>* ?- B) I) e, m/ s1 G
- #include <linux/init.h>
7 P- y! Y& L4 A$ L8 l; f) }+ E' A - #include <linux/errno.h>3 j3 \4 R2 f& P/ E
- #include <linux/types.h>
2 {! I( Q# Q; G0 \ - #include <linux/interrupt.h>
$ I7 x0 D( \3 N* ~# A - #include <asm/io.h>
" M" t5 l+ e6 o; K0 S - #include <linux/moduleparam.h>* ]" _$ ` x1 k$ C
- #include <linux/sysctl.h>
& v& N8 K" F5 H, k/ R4 r - #include <linux/mm.h>
& C7 [, y6 r5 a: h' U6 u - #include <linux/dma-mapping.h>
% T$ w* ~4 E9 l - 0 h1 e7 v8 p% s$ r) z) i3 s1 X
- #include <mach/memory.h>
# O6 W* i% ^/ x( J1 j - #include <mach/hardware.h>
7 o& e6 @; g- j0 h - #include <mach/irqs.h>
% s8 O6 w1 Z( U$ \) `# i3 ^ - #include <asm/hardware/edma.h>$ G# q$ T% L; k* H
- % U- t- p7 @0 M
- #undef EDMA3_DEBUG
0 I7 m9 Q/ L4 N; U: d# i - /*#define EDMA3_DEBUG*/
+ x4 [; O; |) P& K! u2 } - 6 w! t8 h( Z6 E" \
- #ifdef EDMA3_DEBUG, j" t/ H5 n# Z5 X: q9 q, z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! H/ Y, P7 |6 g) B3 C1 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 v7 ~* t! Y7 [ _$ S- ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, V8 O7 }5 _: x% W9 h& D0 C4 G - #else6 Q. J8 j" ~1 o& B+ R6 T+ t
- #define DMA_PRINTK( x... )
% N* ]& x- L; B/ W- D - #define DMA_FN_IN
: H( t& K1 u+ p3 @! d" T9 K - #define DMA_FN_OUT
- f/ `9 c+ Z+ F E' c9 \- Y7 I - #endif
- O9 s' s; s) ^: W9 C - 3 k; k1 m" I& a5 n% Z/ E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 A1 k2 Y7 J J+ [1 V3 C) }
- #define STATIC_SHIFT 3
" g) Y1 X: e8 s3 P$ x$ C - #define TCINTEN_SHIFT 203 E" \6 E; h4 m* x- p$ s% g
- #define ITCINTEN_SHIFT 21- r. a2 B0 d3 ^3 |- u5 {
- #define TCCHEN_SHIFT 222 W( L6 O0 n4 y; a4 i5 E
- #define ITCCHEN_SHIFT 23
/ b1 o8 _# B. @ - / l6 p1 R# t2 R& r0 A
- static volatile int irqraised1 = 0;
! D. X, G) x& W( w - static volatile int irqraised2 = 0;) y- i k% T: S4 Z! _4 P- X- M, c* n
. W7 X6 E! F: I8 i* E d: l1 @% ], L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _: w1 S/ B6 X K, Y0 u$ a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 |- x- d) Q9 u( D; ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 V: H$ w. x8 ?( S4 e
! O& X1 x0 Z0 o+ Q5 D- dma_addr_t dmaphyssrc1 = 0; n/ Y+ k1 E' [% f: H6 U% r
- dma_addr_t dmaphyssrc2 = 0;$ A+ ~5 S# u: K" G; O
- dma_addr_t dmaphysdest1 = 0;
5 l% @0 b _9 p0 O3 _- A - dma_addr_t dmaphysdest2 = 0;5 }, `- |0 ]; Y- b) t" Q9 J
6 X1 P; D1 @6 d* k- char *dmabufsrc1 = NULL;% L( B7 n- x6 p+ ]3 _
- char *dmabufsrc2 = NULL;0 }3 O4 M8 s Z, ~4 j5 w) k. A! F
- char *dmabufdest1 = NULL;- f& X( ~' d! k# t- W
- char *dmabufdest2 = NULL;
$ B t5 w. x' b
9 g3 K/ }1 k' k+ y% G" ?- T. t/ Q- static int acnt = 512;
m! B! s* Z0 e9 E2 @4 i - static int bcnt = 8;& L# I+ A* Q, q& z! |
- static int ccnt = 8;: I L" t6 d. v
- . F9 t4 Z5 y+ l* _
- module_param(acnt, int, S_IRUGO);
. r a' ?& }7 a - module_param(bcnt, int, S_IRUGO);
" e( ^+ x! L; \) f+ P8 @: X - module_param(ccnt, int, S_IRUGO);
复制代码 8 O1 L) c) U: t
6 @ D8 O2 @8 W* L! Y& [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |0 S! O+ _& t4 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 i& V$ O1 q+ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( @' x! P& ] S8 Y# A2 W
5 d+ y& e3 g5 v( V0 m9 l3 E# ^0 d' e. a/ L" G' e8 [# t
|
|