|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 R$ H, e6 Q& u* a7 T" Y- [code]EDMA sample test application
2 `+ h) a3 z: ~* W+ }) G% `# q) H2 U - /*$ V+ M, O- |3 x0 Q* W/ f% K
- * edma_test.c
' @/ y8 q: E0 B7 r3 q - *
* `! e8 u6 q# ^6 x6 Q - * brief EDMA3 Test Application/ P& u( w9 m7 Z" x
- *
; e; z( M7 n/ _3 S* }7 V# L6 O - * This file contains EDMA3 Test code., Q7 C. q: X& [: B6 {( J; ~
- *
# j* {! U0 C) {% j7 q8 i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 T( l! A* \" y' ^5 D. d" O7 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; d: f4 [# [3 Q- B8 v - * TO CHANGE.
$ c; s" w; F7 n! G `1 b* _ - *8 F& M$ Y7 @: G6 E8 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: z4 g. [! Y9 R2 s4 t# j
- *
$ h8 f4 A" C+ D4 M - * This program is free software; you can redistribute it and/or7 h1 _# `. c3 a/ ?
- * modify it under the terms of the GNU General Public License as `3 ?0 m- `6 ~: Z. W
- * published by the Free Software Foundation version 2.0 ]6 n: t% H$ `
- *9 d% H) |$ M/ _9 U( Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 S0 [9 Q" G1 n! D/ i
- * kind, whether express or implied; without even the implied warranty
# Z4 Z, R0 G9 b7 ~1 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% p; |( ^2 O0 P( a. H9 o: r - * GNU General Public License for more details.# z' p2 \8 m$ x8 }" V7 {% ]
- */$ o1 }- }6 D) S
( G' x& @+ J. _. F, Z: A! u9 n- #include <linux/module.h>3 J" C# Z! j- y) {7 J! p; \5 E t& e8 _* z
- #include <linux/init.h>$ R) G& c" m6 m9 [- h3 ]
- #include <linux/errno.h>, v+ x9 r: ~, H' Z R; b
- #include <linux/types.h>
' d8 {0 O/ ?1 i# G% A - #include <linux/interrupt.h>
' E0 W8 F& s+ U$ [% l9 f8 q! f - #include <asm/io.h>
/ s' f" h/ n* p5 S - #include <linux/moduleparam.h>
# G2 x. Y' [& L4 ^6 x, v& R+ i% ^+ _ - #include <linux/sysctl.h>* Y! c& w8 ?4 n& ]; H/ E2 _/ w0 t/ H
- #include <linux/mm.h>
5 o8 p4 d5 G& C" `( S2 Y0 | - #include <linux/dma-mapping.h>/ q; `' v- p3 ]- n
1 m: F _# z7 z F. X) I- #include <mach/memory.h>
V8 V0 T, c& F8 i+ G; u/ e - #include <mach/hardware.h>" i* V( s: z# @& T5 X& r5 r
- #include <mach/irqs.h>& [' j+ V: ^9 x& J- d
- #include <asm/hardware/edma.h>; k' f+ {* o3 o
. O+ o! L% N5 M8 ]1 d- #undef EDMA3_DEBUG
6 ~! [: Y; X; J7 K" z4 Q9 k - /*#define EDMA3_DEBUG*/( @8 x5 i; k3 |+ ~4 s, k/ h5 x; `
: Z; q. ?+ t' J8 F8 A- #ifdef EDMA3_DEBUG: `! i3 F4 I0 s; ~5 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 }3 p' G7 e& C x! \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: ?. k( K( @; X& w2 x9 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. Y B8 k1 g, v- G; Z6 o - #else
! A5 S, K6 Q) |; u/ g - #define DMA_PRINTK( x... )7 a- C9 ]) J0 }
- #define DMA_FN_IN
( j) ]& j8 M8 \' ?8 e) t4 {. | - #define DMA_FN_OUT
% }7 j' Z8 k! A - #endif
! Y# L3 F# X5 @! t6 S0 A
9 }* g2 D1 G" D" L7 }: d1 P- G4 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. @6 S# o8 ^! D! ?0 f - #define STATIC_SHIFT 3# v6 r$ U' l/ L1 U$ l0 a1 R
- #define TCINTEN_SHIFT 200 L. P' N1 L3 J# Q$ A I
- #define ITCINTEN_SHIFT 21: `' y' m& q+ T- M7 [7 `/ M* v
- #define TCCHEN_SHIFT 22
; k( o( o! @2 \. G; ^5 O3 K M - #define ITCCHEN_SHIFT 234 |# q" r# L- f3 y# j
# R! U2 W8 H4 N z" k- static volatile int irqraised1 = 0;
% D n+ g y9 r c - static volatile int irqraised2 = 0;3 g* Y0 l3 h% D4 j m) Z2 n2 x0 a
- 7 o2 |9 O: d8 C! b1 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z. e, B- {/ ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. |0 P$ {; u- U2 m! V2 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t( D, V* Y4 L0 A - + c7 z& w# ~% D- [' d. x9 }! r4 V
- dma_addr_t dmaphyssrc1 = 0;8 O5 E; E) K" e3 p2 I$ a
- dma_addr_t dmaphyssrc2 = 0;2 H' Z) r6 m5 ^" P h0 V( s
- dma_addr_t dmaphysdest1 = 0;
- b! L' \' M1 e+ {, j# v- p' H, B - dma_addr_t dmaphysdest2 = 0;) C9 z K- C5 S$ T2 E
5 Z2 w# w" N1 ?6 k- char *dmabufsrc1 = NULL;
( H+ O% M6 q) D9 m: T - char *dmabufsrc2 = NULL;# e& Q( s& V# ^0 B& _: x+ N
- char *dmabufdest1 = NULL;+ M, L1 i5 i4 t6 R; N F9 n( @
- char *dmabufdest2 = NULL;( K7 s& c# V% ~% X$ g
6 ^8 D/ U" F3 {; p r- static int acnt = 512;
3 r# O# h# }1 L7 Z9 M - static int bcnt = 8;
/ S" `: z) k8 U - static int ccnt = 8;2 ?. u4 X+ k" f2 n; C7 J# C) H
1 W+ }. k8 ^- y* Y# n- module_param(acnt, int, S_IRUGO);
% G7 h2 }. g2 W" q0 N - module_param(bcnt, int, S_IRUGO);' B, f1 N- t1 B# H2 D6 N
- module_param(ccnt, int, S_IRUGO);
复制代码 . W0 ]+ [3 w( q9 C/ d3 H' ^8 G$ t
# Q5 K8 O. {$ c e) l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 {: W; {/ k0 Z" Q; l5 G, Varm-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 p" ^; ~, N. x7 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. [! h. F8 l3 j% P$ U0 ]
' c+ q3 M& W! X) F3 Y, L9 W4 W. W: B0 F* @$ I
|
|