|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
V8 B% D, V- t" `0 ]- [code]EDMA sample test application
: s& N2 _" g9 j4 E* s6 h - /*
4 l! \0 E" f |2 F, N - * edma_test.c& _6 V) T) T9 Y% S: ? c. F; ?
- *! K3 r7 p4 p0 t( o0 u& e
- * brief EDMA3 Test Application
9 k0 P+ w! g1 O A7 u6 E8 i/ [ - *
( \3 ~% F( @# |) ? - * This file contains EDMA3 Test code., R9 Z( I# T A& ?1 z
- *
' K, m1 |7 G" B4 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 i) u" y! H0 `+ |; n! a% I9 I, V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 w+ _- Q. y5 ^! V$ u; o8 d: g
- * TO CHANGE.* p2 P! j7 j0 K8 b3 R
- */ w9 O# E2 `; q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 e! j4 ?" K$ |/ T
- *$ }8 T- q5 X# w: V
- * This program is free software; you can redistribute it and/or
8 q& @: `/ i5 y! a1 r5 d - * modify it under the terms of the GNU General Public License as
0 o3 r; [+ Z, j4 Y - * published by the Free Software Foundation version 2.& X. n3 h; L! F# B5 f$ L! E$ {
- *: _% S2 V9 i& D" Q: o7 X G3 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 ?1 b+ ]- K: \" u - * kind, whether express or implied; without even the implied warranty
p) v6 B8 \8 V# S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 ` ^3 n1 e: z9 r( V - * GNU General Public License for more details.
. e: [. }0 v, @* P: w - */: ~4 P+ {6 r/ l5 n3 T" x' [1 ^
+ H |4 a( F; J; i0 W- k- #include <linux/module.h># I) s7 F! c1 F2 x$ B9 x
- #include <linux/init.h>. S; V5 A1 ?* H. t' g& V
- #include <linux/errno.h>
. `6 K! g2 N- d1 w - #include <linux/types.h>+ n, u: r$ H9 j: P: H
- #include <linux/interrupt.h>- b5 l/ d2 L j f
- #include <asm/io.h>$ ]8 E5 l& q) ~1 A1 c% L
- #include <linux/moduleparam.h>+ H- q, M$ z; m% z6 t
- #include <linux/sysctl.h>
# ^& b. V4 |! @, Q5 t - #include <linux/mm.h>
: e x3 r7 a, U7 ?6 d% w - #include <linux/dma-mapping.h>7 P r# Y1 r. G# b
e( d j! g% U" p9 Q0 y8 @3 g- #include <mach/memory.h>2 h9 [% Q# {& R9 {
- #include <mach/hardware.h>( ?3 |/ J9 n! `+ \$ I
- #include <mach/irqs.h>; l( u( r+ S/ G$ X6 i) h% f. L7 r X
- #include <asm/hardware/edma.h>) D( d, D3 u% L2 q3 M3 Y1 T
7 A* }; N( a9 K& E3 W7 y: ~- #undef EDMA3_DEBUG
$ s% M+ z# V6 I - /*#define EDMA3_DEBUG*/
/ u K( z6 }( K8 A$ ] - 3 r, |1 M# A' l) Y6 K
- #ifdef EDMA3_DEBUG2 f2 t1 V1 Z/ Q+ h# S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 }: m+ u; _ C* ~( S. ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 T; r+ M* _; x9 ]$ v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C. P; B/ o/ L+ m4 |: {- I; U( B
- #else
# q4 z7 P: A% J( a% N - #define DMA_PRINTK( x... )+ P+ l0 G" Z# ]0 k( `: v; [$ j: \9 S
- #define DMA_FN_IN& u( x5 o7 \+ Q5 @$ e! z8 F$ _- Z
- #define DMA_FN_OUT
t: z- @+ Z7 ~0 {/ G7 R" b' |9 q - #endif
# z6 k& V; V$ m0 y0 U
) {) ?% o* A" ~( s) T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 M2 \2 i* ^% ?! l- k
- #define STATIC_SHIFT 30 f c0 G9 q; r3 `: E* F( G9 J; N
- #define TCINTEN_SHIFT 202 u% |" \ V! c2 R0 O2 c4 k% W
- #define ITCINTEN_SHIFT 21" u6 p; h! ]. e- v" |: p) _$ Y
- #define TCCHEN_SHIFT 22
: @0 H. C: Y' S5 J, ~ - #define ITCCHEN_SHIFT 23
* Z" o d. j/ W n; E$ K& {$ C
- z+ B2 @& P. `4 I% f0 {- static volatile int irqraised1 = 0;9 \2 J/ I1 t( w x4 x5 q& y5 E
- static volatile int irqraised2 = 0;
+ ~- G1 S( j! D- m2 I3 T - % U. A- @: a3 l8 [; ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [1 ~ d3 i; ]4 R/ G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 k+ f5 S8 N! v, H1 V! `+ s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" y. O( k M9 X
1 U2 c" w9 s8 C" ] ^1 D* l. o- U- dma_addr_t dmaphyssrc1 = 0;
- y) n; @( V- j d3 c0 w5 t - dma_addr_t dmaphyssrc2 = 0;- Y8 o7 V; H0 Q% _
- dma_addr_t dmaphysdest1 = 0;: x" a2 f8 J8 I: W6 X
- dma_addr_t dmaphysdest2 = 0;; [6 u3 J7 I9 F) ]( y( A/ K1 L
( v+ Q3 B$ W5 A0 Y- char *dmabufsrc1 = NULL;( p! D. n% h* ]# T/ z
- char *dmabufsrc2 = NULL;7 G/ S* H5 k6 k9 V: q( o0 Y4 \+ O
- char *dmabufdest1 = NULL;
# N T- l9 \; B; r% \: z' b - char *dmabufdest2 = NULL;/ C5 u. r! X8 z4 |% b3 r7 J: b
3 @. S8 E: h t2 I, b6 P* P- static int acnt = 512;
% c0 Q4 J. S- @ `3 A& y - static int bcnt = 8;
3 j( K) Z' o* o) d% t( `8 k - static int ccnt = 8;
: e5 _' e. z; q5 y - $ B/ U5 Q% I5 b4 p+ d- p$ O
- module_param(acnt, int, S_IRUGO);
3 B% p; U9 B7 O" z) S - module_param(bcnt, int, S_IRUGO);$ I; q' U, E$ X3 Z8 [' c
- module_param(ccnt, int, S_IRUGO);
复制代码 2 l( V; b+ k8 |7 P0 X b3 e
. p# k* a+ f0 c v: V) z; O3 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Z; A w& K3 e) L, U5 V- W ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Y# s. T/ u9 k. A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ D5 @6 O6 n+ l" [
- ^; I* U" P% r0 B& H2 v& n6 y
9 y2 u6 \ T3 G( }; \0 V0 G |
|