|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [1 ]! u5 x* a5 x% g6 l; r n5 p5 G
- [code]EDMA sample test application
( v4 E5 N0 Q) q/ x+ X% r - /*! ?& u. ]: f X
- * edma_test.c" W, J& Z0 B* s" q$ ?. X" `% B% `1 D& N
- *
0 q: g* ]& p3 s) w - * brief EDMA3 Test Application3 s, O q4 ?* K9 h
- *
& c: D6 g" n. @, P! [ - * This file contains EDMA3 Test code.! d L7 C+ X( @) H
- *6 R- C/ I, \4 W7 o1 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" r: L$ ]0 k# k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Z f& {2 Z5 b$ f - * TO CHANGE.$ V- t' |9 L' t$ z! |( O
- *
C6 x9 [, F7 M' o- J1 d. h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 e" b0 t4 F& b$ U+ F6 z3 {& P
- *
5 E1 V& \, v# k* W - * This program is free software; you can redistribute it and/or
' y W9 ~, G3 q- k1 S* N - * modify it under the terms of the GNU General Public License as
' m9 i3 d0 e) a) c! Z - * published by the Free Software Foundation version 2.
+ g* A0 Z* F8 Z7 h: y" A" q9 q' M8 o8 ] - *
. H: o7 k1 d& r% l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ [ H8 }, o: Z V; l. S" K3 p - * kind, whether express or implied; without even the implied warranty: d2 z; F6 f3 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 |6 l% z. h% M& _* V
- * GNU General Public License for more details.% m2 L( C: x; I3 D8 |6 a/ F
- */1 B* p6 T/ G7 J! q9 }
- 9 ]# \8 c0 D( W8 H4 e* O
- #include <linux/module.h>
$ d' e2 D% E6 h/ W6 k6 r. n - #include <linux/init.h>" V* I4 p% R9 f6 U+ S/ ?8 X2 s
- #include <linux/errno.h>
& P0 t) O9 u4 Y) n# L5 }6 G - #include <linux/types.h>
* U* O! a$ `. |" w M - #include <linux/interrupt.h> r& R0 [- d$ |/ `* s! s
- #include <asm/io.h>
& Q1 d, U# L) O* _8 X1 T2 w - #include <linux/moduleparam.h>; B( w$ j7 \, I3 p
- #include <linux/sysctl.h>
' X/ j1 L; x% w1 P: S - #include <linux/mm.h>
5 R( C$ I2 j- ~6 ~4 W- Y - #include <linux/dma-mapping.h>) U" B( I" @+ ]2 o7 ?
* L9 y) R$ L- d/ [$ U; l- #include <mach/memory.h>
8 Q4 A+ q: F4 p5 Y - #include <mach/hardware.h>" l: t |0 s( L8 ^: F
- #include <mach/irqs.h>, F' d5 }. C, |7 \; w$ Q$ I5 k$ N" i
- #include <asm/hardware/edma.h>0 H" m( E9 e# h( U% z) a
- 1 I u! i! ?( J! z0 K
- #undef EDMA3_DEBUG
' o( n- L2 }% P; t0 r; z* _ - /*#define EDMA3_DEBUG*/
# D( s# u* G3 h. | - 7 `* W; l8 j8 W3 s/ u. } K
- #ifdef EDMA3_DEBUG( }( E% k; s& p' k1 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! F U" O0 B1 A$ d7 L4 g' S/ j W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 h9 R7 Y8 q: k9 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# k5 g$ B. c$ K. j
- #else& d; h4 }$ ]. Z( O5 v6 W9 U+ Y
- #define DMA_PRINTK( x... )* ?% }' P$ }2 A. `3 _
- #define DMA_FN_IN; g! O. ~: Z3 B6 h
- #define DMA_FN_OUT
# V0 R3 F) q. `6 h - #endif3 f8 w' U# E# I
- 7 D3 t% b7 t/ N& Q8 o! n- ^6 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 Z- c$ }- k0 h& e - #define STATIC_SHIFT 3
" e" L) t$ f1 C - #define TCINTEN_SHIFT 20
0 j2 ]: \. b) u4 J; ^ - #define ITCINTEN_SHIFT 21/ {) u6 `2 _; F& B3 R
- #define TCCHEN_SHIFT 22
4 W% m0 r G" K/ z& b( I - #define ITCCHEN_SHIFT 238 ~% d) c9 H# r; o6 E
9 _$ f9 g! D/ k+ K- static volatile int irqraised1 = 0;7 ?8 q+ R' q+ v$ c1 }; M2 [
- static volatile int irqraised2 = 0; p# r# }4 l l" w/ m9 z: M9 j
- 6 A9 }8 m- Q& s$ C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ o6 N. w1 s6 E9 g) ~$ V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ^/ k! Y7 `7 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 d7 N/ I1 A' X" z% P: z5 U' W# J# I
' s% h% q* x1 k/ C0 C2 i/ \ Y- dma_addr_t dmaphyssrc1 = 0;( [1 @8 x9 U& P
- dma_addr_t dmaphyssrc2 = 0;
# N, W9 y; ~: I2 @1 i - dma_addr_t dmaphysdest1 = 0;7 L0 p. i8 G5 {- c! D: \. w
- dma_addr_t dmaphysdest2 = 0;* T1 _9 G4 n5 t" }. E
- $ D+ h8 h R5 V2 G
- char *dmabufsrc1 = NULL;' Q! ^- A/ \0 A3 q% `
- char *dmabufsrc2 = NULL;0 l0 ~+ S4 q# @9 {
- char *dmabufdest1 = NULL;
' g7 N. N: G& T - char *dmabufdest2 = NULL;. E% F" I {6 k% F
2 K2 x3 M" P1 t) E- h* A- static int acnt = 512;
* V& X% z$ l& k; ?2 j - static int bcnt = 8;
" j" B3 k& E3 P! ?* p - static int ccnt = 8;
2 p4 V+ d1 |! M6 `; P7 G8 H - 5 ?5 B% A, r% P$ b! I# I
- module_param(acnt, int, S_IRUGO);1 |: k y6 Q8 a7 g! m1 V
- module_param(bcnt, int, S_IRUGO);0 H/ X4 a! h1 M, K) b `+ \
- module_param(ccnt, int, S_IRUGO);
复制代码
3 b. n2 z( P7 e9 B" i
( U- G- \% g% B' L( ~2 h9 ?/ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z& n, S1 \/ }4 Y" Y7 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 H, o, H9 t$ X: r2 `! U2 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: _& G( U. a) n% [4 R! ^' N$ `, u; U! y# j, S
' W3 x( s% _4 ]9 E- I. ^3 A |
|