|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d/ ]2 O' M/ j" c- [code]EDMA sample test application2 ]2 @4 H( N o' F. c' k9 f( x
- /*
* a1 Q p7 O. x) S6 c: W - * edma_test.c* \6 j. ]" u7 m8 W
- *
: N" d* f: X6 }+ G- \3 ] - * brief EDMA3 Test Application8 C ^. \$ T* d4 S0 T
- *
. g. ]4 R6 W) _& C9 m. j8 F - * This file contains EDMA3 Test code.9 X- G7 h1 t3 }* ~- r+ D& O
- *
" d+ ^8 _. [' j5 O' \+ x: X. p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" E- I$ |; {7 ~* K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& `# ^& L6 b6 E5 }$ i. a8 | - * TO CHANGE.
C5 ]& I5 K- w' \5 U - *
, J2 w; l( x+ P0 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O$ B [5 T$ x) |
- *
* F6 ?7 W; _) K8 W) ] - * This program is free software; you can redistribute it and/or
1 A: }8 w8 M' v5 p - * modify it under the terms of the GNU General Public License as
$ D- D) E U; j- ?& G" w - * published by the Free Software Foundation version 2.
9 M. }4 e, m3 e! N" S! e+ N- U - *7 E9 x2 j' {0 R" g( E5 Z4 r! G( Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z0 O* l$ S8 f. X0 p) {
- * kind, whether express or implied; without even the implied warranty' k, V! Z: e; S' S, |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ H/ J0 J9 S4 Y3 n2 ^; q. T
- * GNU General Public License for more details.- i: W) I( A/ G2 s8 E8 {/ v* F. f
- */8 W/ {( w4 q0 W
- : A5 e9 ]* d3 z y6 [, m0 m
- #include <linux/module.h>
8 [7 B) ~2 p0 f) q! @ - #include <linux/init.h>" Z" X2 t1 D: J8 W8 W
- #include <linux/errno.h>
2 q; l: v# I' L: h$ d, l3 v - #include <linux/types.h>, @+ G" Y! |6 @1 Y: l1 H* q! K
- #include <linux/interrupt.h>9 ?" Y. T5 `# H
- #include <asm/io.h>
6 P/ h! Q; N, W2 `$ q# E - #include <linux/moduleparam.h>
% {6 ]& ~/ g4 Q2 c. U" @& J - #include <linux/sysctl.h>0 q! c1 f8 @3 S+ w% \
- #include <linux/mm.h>$ i' ^4 }9 L( t* K( o: g% ?- V; E# [
- #include <linux/dma-mapping.h>
; s; b. v4 d: ^
S# |5 `/ o; d# w- #include <mach/memory.h>
; G5 @' F$ t7 {) z8 G - #include <mach/hardware.h>% u8 b: r) o' s7 U& O D
- #include <mach/irqs.h>
! L/ e6 f9 ]6 o4 y6 o - #include <asm/hardware/edma.h>
$ T* x4 }% {# X% B) j - 5 |& e I$ Q7 Z) }4 I
- #undef EDMA3_DEBUG
2 N6 X) ]9 S7 R7 a5 Y8 U3 o8 \0 } - /*#define EDMA3_DEBUG*/
) l9 a# ]. N! G
4 j* P9 Z; r) Q- b- #ifdef EDMA3_DEBUG( r) C, C2 U' E2 `9 w* z& D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): a$ @% o4 A1 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* v/ l0 y/ h+ d- M4 N7 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ O+ D8 ]1 g! Q0 q. c& P* A - #else
5 X$ W5 o$ H* {6 h& g, Y0 ]: ^ ] - #define DMA_PRINTK( x... )% J" s3 u9 w$ w
- #define DMA_FN_IN
, e$ a0 f9 ?2 V& t Y2 S - #define DMA_FN_OUT
* ^: F8 y. u2 v9 |+ D& }# p$ V! r - #endif. _8 p: X' p1 I5 [' h" k
- 3 @7 _9 |; Z* u% I) J2 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Z! e" K- G R3 u8 Q6 |5 j - #define STATIC_SHIFT 3
9 h6 {5 a! _# ^& O% N6 i5 P; D: {6 O. W - #define TCINTEN_SHIFT 20
" Y6 e! `) u% Q1 X/ ]. _4 O" Z - #define ITCINTEN_SHIFT 21& ?' q# r: E3 u! m" T3 w
- #define TCCHEN_SHIFT 22- d3 N, x# z4 F* O7 h' n1 y: M' ~
- #define ITCCHEN_SHIFT 231 e1 ]: _& R% s. E
2 _4 Q" N7 {# } q9 w: w- static volatile int irqraised1 = 0;
+ M, w& k! D- R: ` \) c: ~1 I5 H: q - static volatile int irqraised2 = 0;
0 `' t6 Y" x# W: f
% D2 \8 N8 u0 U6 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I' N% N2 {; |5 G4 V3 l7 W: K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F: s/ Q8 d9 @+ Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H) a; `4 {2 B* R N Y
- 8 P5 Y+ |% g8 e$ ~9 ?1 w: l0 {+ O
- dma_addr_t dmaphyssrc1 = 0;; B& t# q2 W6 i' P
- dma_addr_t dmaphyssrc2 = 0;
3 T& t/ S2 L% L" L8 t - dma_addr_t dmaphysdest1 = 0;
1 J& j( z; S1 O5 i( Z - dma_addr_t dmaphysdest2 = 0;
8 U. x: J+ a6 [4 }' i, N& O
& |$ ?- [4 w+ Y! t; C. \# T- char *dmabufsrc1 = NULL;
/ p' l; W5 P7 @6 X5 ^ - char *dmabufsrc2 = NULL;9 T! D @! K& M! \/ F) K5 F
- char *dmabufdest1 = NULL;8 s7 b$ o0 J* O3 y: z; m
- char *dmabufdest2 = NULL;- z0 x# k( O" y1 i- }
- 8 e8 L6 L6 T: X* N7 [0 `' H! o( a+ ~
- static int acnt = 512;7 ?! S" h. k* s# O0 h! t
- static int bcnt = 8;
5 m, ^) u; x, |$ `1 l3 i' P - static int ccnt = 8;
* t5 ]- z5 T, H" C
6 _8 L8 q2 C6 c8 D- module_param(acnt, int, S_IRUGO);
A' O1 m$ t* L; i& n. f5 O# b3 k - module_param(bcnt, int, S_IRUGO);7 C- o7 u' M( k' q1 t& Z
- module_param(ccnt, int, S_IRUGO);
复制代码
4 u! k, F- p0 V/ l# a$ W
7 S; f: l3 J& W7 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( v J4 Q6 g6 z8 \7 ]& T; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" O( I1 @9 h0 r/ z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Z2 ^( @% X: [0 F$ k7 K2 E, a
* Y& y9 e" t$ k' n0 Y c
. [0 H' Q; q" t1 V0 I- b |
|