|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ F0 N1 [4 C3 @' I" R- I) {7 ~& w- [code]EDMA sample test application
k+ N, t1 K+ w - /*
8 i6 Z# y4 d. c+ s - * edma_test.c
' r& H h" K8 U4 t+ O- G - *# j5 E8 o6 m2 b3 S7 V6 f
- * brief EDMA3 Test Application* b% ]4 ^% T/ B6 J4 |+ |- Z7 S
- *
( P* I. l. u X" @9 [ - * This file contains EDMA3 Test code.
2 z$ {' f) t+ K$ h7 i - *
2 S' b. R; Z' V l+ n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) R4 Z0 X; R7 s% h; Q0 k6 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 v( t& K* Q, w2 o' a) s
- * TO CHANGE.
( C; c Z/ b3 P8 I9 j" C& O1 c8 } - *
8 N9 ?: ^( K2 K* X: f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 J/ l' d8 ^* S# C - *
) H; i/ Z2 h! L, A - * This program is free software; you can redistribute it and/or5 r( ~# I: G4 m
- * modify it under the terms of the GNU General Public License as8 [) k" t2 j0 `+ H' s
- * published by the Free Software Foundation version 2.
1 o8 J/ F+ P) ~0 v' N - *
/ V- b( F0 n9 Y+ Z- U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. e2 Z. F, z* Z$ O" d( e% R - * kind, whether express or implied; without even the implied warranty
7 o' I7 ~7 F6 s9 F' b" @ X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' V8 k7 O) P, j1 _! {
- * GNU General Public License for more details.( I% E% k8 a' I; z/ A6 O$ y( x
- */
. g) a7 A5 N! y$ d - 5 \/ R l3 q* H% N
- #include <linux/module.h>+ [9 Y p5 ~" c) q" k$ I9 F& J
- #include <linux/init.h>3 O5 o( L! ^/ x. a
- #include <linux/errno.h>
8 X, Q: `4 n J' @$ i* V - #include <linux/types.h>% U; D2 p" b3 i) n. B- t) x
- #include <linux/interrupt.h>
/ f6 s# ?/ j0 C; [ - #include <asm/io.h>
W0 v9 @+ t. @# \ - #include <linux/moduleparam.h>
# h5 z) v; E0 u - #include <linux/sysctl.h>
7 i" L6 z( u3 @ - #include <linux/mm.h>
1 j: K( _4 d3 f8 V2 R4 b - #include <linux/dma-mapping.h>
0 A: o0 ~; K: [( y( D
! J4 v5 ^! w7 ^- #include <mach/memory.h>0 n' m- u& r- O4 _" r' r/ n
- #include <mach/hardware.h>
1 N" @! @/ o+ e% O6 w# |( M - #include <mach/irqs.h>
3 Q+ y/ q4 Q) C8 S& k: j - #include <asm/hardware/edma.h>
% g! D3 f3 Y/ l1 Z; m1 f6 p$ S
4 Y: @) n/ A& g" a5 n# W- #undef EDMA3_DEBUG6 w Z4 x5 A7 N3 n
- /*#define EDMA3_DEBUG*/
3 W4 g7 q0 ~ b, v( h; J
' v$ ^, I! ]0 x- A( r- #ifdef EDMA3_DEBUG5 Q( j l( o3 }! S* d* o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 |- W) P9 x/ H* [) q" i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* n% t/ x4 U2 a6 V' w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, }( G1 Y, C) S! }. Y' q( u - #else' m" t4 i6 S2 r0 ~
- #define DMA_PRINTK( x... )
3 y9 l% ?# Y- l7 S. m - #define DMA_FN_IN/ U+ H- g( E- D+ K% S' Q. b
- #define DMA_FN_OUT) Q5 _2 T# I, L0 Q
- #endif
& d- Y5 m5 T, y I o$ ~1 W - 6 w% d* |0 G* ?& v% k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( a8 Z4 ]0 g2 U1 d* Y8 ?0 N
- #define STATIC_SHIFT 3
+ ?. O5 R) \8 F. z0 y - #define TCINTEN_SHIFT 20: z- R5 Z* H4 n* A
- #define ITCINTEN_SHIFT 21* O. _4 B+ L9 z% G2 M' A
- #define TCCHEN_SHIFT 22
2 n- P6 m' p2 m% Y+ ] - #define ITCCHEN_SHIFT 23' i7 E- V7 X& _. e+ s- k' b1 ?
- ( |, r% e& Z, |) A- S8 s
- static volatile int irqraised1 = 0;
! I# n( C- A& \2 Z0 d* M9 W - static volatile int irqraised2 = 0;
% e1 }3 J2 h1 s+ {+ X - * G2 F5 H+ M& l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `3 K' h; j: r& k; J$ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! U! \" _ e. S4 @) _4 w- L; E+ ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y% i+ D8 P: Y2 y8 Q1 }4 j
- - b! K" b) L! d* m
- dma_addr_t dmaphyssrc1 = 0;4 P+ n- O# \5 ^* o8 U
- dma_addr_t dmaphyssrc2 = 0;
7 |. d$ R0 I: _1 w0 p3 N - dma_addr_t dmaphysdest1 = 0;
7 r- F, z8 D7 J" q! Z' Y9 Q( e7 F - dma_addr_t dmaphysdest2 = 0;4 c9 e1 }6 L& H; F/ m4 g+ C# w
# A- A& _5 |7 J5 G- char *dmabufsrc1 = NULL;
" l6 X0 r! m* `4 l; Y# j - char *dmabufsrc2 = NULL;
j; {4 f" h+ _& H( ^/ g; a- Y - char *dmabufdest1 = NULL;
3 p3 N* u& q$ m% \4 ]5 Q - char *dmabufdest2 = NULL;
0 m: r6 Z; \" H( s3 D! u - - g8 L4 t* ^1 L' K) V& q
- static int acnt = 512;
5 q9 j1 W' T3 ?3 O& O - static int bcnt = 8;8 ~1 Y8 s/ S1 S) N1 s) p Y
- static int ccnt = 8;1 j2 [5 Q( W/ E0 d+ n* W- A
1 i) r6 x& P4 S$ R# V4 l- module_param(acnt, int, S_IRUGO);
9 L9 l' Y# D& J8 k+ _9 { - module_param(bcnt, int, S_IRUGO);; h ]9 ^8 f; T2 q
- module_param(ccnt, int, S_IRUGO);
复制代码 , M6 E/ @% t; e0 u/ q1 C
% p D# e5 r: E @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! a: q- i6 B ]% \9 c+ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: @; S" @% L; B4 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 ]) p0 m3 w. A m2 q- j
& z; E. f4 K" @/ j! `, V/ z2 X
" a3 s* O+ X/ V; H; I$ z% W' p
|
|