|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 V6 r1 }) a# {( H( l* M- [code]EDMA sample test application( V! ^" }5 X% w$ ^. C$ L
- /*
0 ~. c h* G) V, g; h) D5 u - * edma_test.c
) k4 m7 @& W6 h - *& [/ A& s& S. R6 A8 |
- * brief EDMA3 Test Application
- U* t, y3 r: ^) `* U: O0 S - *
" W2 z' R+ G# a0 u8 u3 `1 v - * This file contains EDMA3 Test code.- `) A, h3 d$ a' T
- *
# L% }& b* z5 C/ Q4 G% S+ a& }% ^* | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ?' j" b" @& u, v+ o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 V* a4 D( G6 ?7 @# N7 u" K - * TO CHANGE.
) K- i; H2 z9 J0 |: x - *7 F. @& }/ l; ?' o" d7 m6 v8 b5 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* s5 i# p+ r1 B3 `6 f! F - *, [/ A# M! }) S9 S6 G" y
- * This program is free software; you can redistribute it and/or+ R) ?. h1 l) Q) l( X' M/ B
- * modify it under the terms of the GNU General Public License as
7 r% K0 k3 ~: ~ - * published by the Free Software Foundation version 2.1 X6 m. {1 e( _3 Q' _( K' h) z' D3 p+ y
- *. L0 S3 c7 H r' W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 W1 t8 e; X7 X! p8 t U" v8 t - * kind, whether express or implied; without even the implied warranty. ^* Q" t) H* B/ G8 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; s/ n. d# K' p. n* @
- * GNU General Public License for more details.' U5 i' @1 u# W8 a( _, L
- */
! A2 g" _8 [, U% N! O. L2 v
4 ]; \" H! m* c: L9 Y" m8 G6 X- #include <linux/module.h>. V4 f8 P/ Y y5 e0 t
- #include <linux/init.h>- t# |6 q# s2 |9 c. H6 G& N
- #include <linux/errno.h> V+ _2 R; g' t f8 B$ |3 E
- #include <linux/types.h>
" c. Y' t, H9 J1 Q d8 B3 o# A - #include <linux/interrupt.h>' O% \3 [7 I3 q' ?% a4 o9 D/ ?, G! m
- #include <asm/io.h>2 W# J4 ^: e, v! b7 L) F6 r5 w$ ~/ r
- #include <linux/moduleparam.h>
' _ M. H R) _( _ ?0 g3 B - #include <linux/sysctl.h>
7 I/ i# |1 _: W* H0 ~( v! w - #include <linux/mm.h>) g! G' ^% q& C8 h
- #include <linux/dma-mapping.h>% R4 l+ V6 q: Y0 I4 {& r. r
. B: ~0 R% E0 j+ A2 n2 _- #include <mach/memory.h>
. k* `1 k1 d6 l3 B - #include <mach/hardware.h>
2 _; F3 h/ M6 j% X. \* Z2 E. Q ] - #include <mach/irqs.h>+ d K6 y h; J: l0 `* O/ h
- #include <asm/hardware/edma.h>
8 H: Z9 I, o6 o; _" t+ O( x/ s M; d - 2 Q! o) D6 y7 s: ^
- #undef EDMA3_DEBUG* Q" T d: t% t' J
- /*#define EDMA3_DEBUG*/- h( I0 V! t5 D B0 q4 n
& R. I! y0 `4 P/ D# z3 S2 Q- #ifdef EDMA3_DEBUG
8 S0 A+ ~2 m F" E( v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ M. J- C% q4 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 {. L* S* M: I" ]* W3 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, R2 F A: u' B - #else
5 l3 x9 s2 H: i$ Z/ }* { - #define DMA_PRINTK( x... )
2 A/ ?/ j' [! s- R, q, N# ~. B - #define DMA_FN_IN: q- r9 ]1 l% |) T$ T
- #define DMA_FN_OUT V, }; t! Z1 H# f& t0 P
- #endif
0 f' q$ R7 R' x4 P4 }* i - - q% J. s* d5 ^3 l7 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( x" Z) r1 H3 \- D2 ~# I/ m - #define STATIC_SHIFT 3' v9 }3 |. C4 g+ {. Q
- #define TCINTEN_SHIFT 20
9 p. \" ?8 t. r1 p/ V R - #define ITCINTEN_SHIFT 21
* w: J+ j! h: ~5 B - #define TCCHEN_SHIFT 22$ j" J% Q: \9 {5 f& r
- #define ITCCHEN_SHIFT 23; _, }6 D: |1 \& Q. o7 Q/ ~
/ m- }" S; z' V9 H/ Y# ?8 x* f- static volatile int irqraised1 = 0;
' l( u5 U, Y+ L% p5 b" v - static volatile int irqraised2 = 0;
/ W& Q3 X) I Z" c9 E6 C! N B L
0 J' }9 z. ^: E0 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ t% b$ e! P+ U8 X, c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) l* J0 ~: q; b% x1 h. H4 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `3 C! P6 m( o" G' h, k8 j' `
- / _" V' ?1 T6 J9 O. x; t
- dma_addr_t dmaphyssrc1 = 0;$ \) v3 @. c# i: E7 { s
- dma_addr_t dmaphyssrc2 = 0;0 {5 X5 N9 g0 F# m, _
- dma_addr_t dmaphysdest1 = 0;( S+ m! N- ]9 G: ?5 \. C$ o
- dma_addr_t dmaphysdest2 = 0;& ^- v, G4 p/ c" f
5 P6 @6 T. d4 |6 @+ h0 L# m- char *dmabufsrc1 = NULL;, }& x u* {) Q- H& ^- x3 \
- char *dmabufsrc2 = NULL;$ C+ v$ Z- y! Q9 n; e
- char *dmabufdest1 = NULL;
" R f( ?* s3 b6 B3 n7 {5 k - char *dmabufdest2 = NULL;
; S2 c/ c/ N, Y - 6 j% N: E' q; T& V
- static int acnt = 512;% g+ S2 H; w* E X+ C
- static int bcnt = 8;
2 ?' @: I# V: p' s, E* r - static int ccnt = 8;+ b+ B. v7 E, M
- 1 T; A- f3 z, @2 G g( o' A
- module_param(acnt, int, S_IRUGO);
8 r7 R( l1 _4 u8 X+ } - module_param(bcnt, int, S_IRUGO);! P9 b2 A3 z4 m; P" i) Z
- module_param(ccnt, int, S_IRUGO);
复制代码 ' E, G/ F, c7 V& F
4 `' v5 a b0 q% o" x$ I' h- j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 }1 \1 J) F2 ~# R/ U/ U: C, larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 r# N+ }, S. h2 a0 M5 [# i7 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k4 K! Z9 ]: p! Y' U
6 b& I& {) S+ U; }- D
2 o+ B' Z. W" `8 w6 E, e
|
|