|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 t* z& L) O% Z5 J; S+ A! q* L0 W- [code]EDMA sample test application
4 P2 m& F8 s. }9 Z - /*
. L' H' l6 \/ M, p+ ~$ v - * edma_test.c @3 _ y( Z+ O3 _, o! ?
- *
; S3 y+ W e( l! L: M - * brief EDMA3 Test Application% c6 ~- F& E) {; p3 V8 B6 s
- *2 }: j- S& U O9 J
- * This file contains EDMA3 Test code.9 \* n( U& e3 l' {
- *" q4 ]* n" c3 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 x& u/ z/ b/ P5 a/ P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A+ c5 b3 g) T. a+ j0 ?
- * TO CHANGE.1 J6 V3 D" b6 d
- *4 K8 D& x4 D! Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# E2 B( k, {: h. t1 L - *4 K4 h# |0 I8 E! N
- * This program is free software; you can redistribute it and/or3 H3 T2 A* x% o" A, `8 e
- * modify it under the terms of the GNU General Public License as
1 h& ?+ b& R7 z& G3 y - * published by the Free Software Foundation version 2.5 U% w6 {+ s+ V: Z5 W" O5 H
- *
- U0 b, l c" _7 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! [5 }# E! I: }; r
- * kind, whether express or implied; without even the implied warranty
2 Q* { r/ q& t+ r. u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ V. Z9 |6 \' F8 ]' ~1 ^ - * GNU General Public License for more details.2 R) d3 ?: A% k- j1 l8 F/ b8 I
- */+ r" b- {1 g# v5 r. N R# e* P
8 X( A: O* _; ~/ Q" I- I, H- #include <linux/module.h>
7 X0 s; C0 _9 u6 g$ u4 G - #include <linux/init.h>
, k& O% k- Z4 r9 H" @ - #include <linux/errno.h>
6 R. t0 {2 d4 @' [! I# ] - #include <linux/types.h> c1 \# O0 h, u" l7 ^7 W
- #include <linux/interrupt.h>
1 j0 @* [5 L+ w: x( G8 J g5 U - #include <asm/io.h>* j+ H3 |6 ?# g) | b
- #include <linux/moduleparam.h>
{3 d8 f: b. A1 C$ I - #include <linux/sysctl.h>! y, H6 D5 }$ M9 X
- #include <linux/mm.h>
) @' g) ~: g1 ]8 F) b6 C! ]5 w5 P - #include <linux/dma-mapping.h>' o l5 T& x, t3 W G, x
8 T W! ~3 C, U- #include <mach/memory.h>, l" S' N4 Z' @7 B% }# K- M# q+ z
- #include <mach/hardware.h>
; E: o! z4 P, @1 L1 p - #include <mach/irqs.h>5 y6 r2 X; V; @2 w. B$ U4 k( T
- #include <asm/hardware/edma.h>
, f% a) S' G3 h7 h - : z' }5 D( R; i9 z* B
- #undef EDMA3_DEBUG
! D/ R& ^' j! y - /*#define EDMA3_DEBUG*/" e( Z. r# z& f( ~, W+ w* y( ]$ u
- 0 P. g2 V8 d8 D& G! R
- #ifdef EDMA3_DEBUG# A6 b% A" ]+ V; [9 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ x1 C- I5 ?# m1 ]# w% |# v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 H% z; |) \( Y' H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]( ^7 m. h5 C9 h
- #else9 t2 d% E; L! t2 w
- #define DMA_PRINTK( x... )
% W) U/ F$ R9 o( B - #define DMA_FN_IN
: `, J6 [& [: X7 z0 ] - #define DMA_FN_OUT- X. a1 E- t( b0 g) F
- #endif2 j. A5 O6 o4 g/ H5 \
- T3 R& W3 h" K6 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768); W7 _& @. F- n
- #define STATIC_SHIFT 3
& G' a0 R5 {) E# r) Z ~ - #define TCINTEN_SHIFT 20
; ?; v- o+ \# a - #define ITCINTEN_SHIFT 21 H$ L0 A# {! S
- #define TCCHEN_SHIFT 22% Z v. C/ d5 }6 N( |( |
- #define ITCCHEN_SHIFT 23, ^8 G* Q% @5 v1 m
' h9 \1 N% T1 D0 p- static volatile int irqraised1 = 0;; D+ j; k9 ~3 R, W) [
- static volatile int irqraised2 = 0;8 I* W( ~! c6 n+ F& b) e: w
- - y* y' f4 A$ B& k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h& r3 v. \. T4 O$ ~) l& C$ O: B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 k5 J6 o( U6 r+ _8 _+ \# a! u9 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* V& X! ~6 m, X0 U! y1 \ - 0 Z) N% T4 d8 b: ]" e; G7 ~; ~" P1 A
- dma_addr_t dmaphyssrc1 = 0;5 U$ s# l$ C( U1 d
- dma_addr_t dmaphyssrc2 = 0;& R" U9 A5 k0 }" Y) w8 T7 k |0 L
- dma_addr_t dmaphysdest1 = 0;/ D$ ~2 m- E# ^1 S; b. A8 w
- dma_addr_t dmaphysdest2 = 0; E: g) |& O0 F3 h+ Y t0 g6 v) ^/ F% J
1 r7 b; z- B) m7 L$ R4 h7 O- char *dmabufsrc1 = NULL;% U7 y5 b* w/ X, \% P( H
- char *dmabufsrc2 = NULL;
* _ a" H8 h' b6 w- P) _, n - char *dmabufdest1 = NULL;* J' i1 @$ L2 M8 \
- char *dmabufdest2 = NULL;9 \) i! o% h3 J5 g& L3 k0 O9 }
- & l" k+ O( f8 I. P7 f& L$ v8 C
- static int acnt = 512;
7 K- T; \6 J4 H5 ? C. _) y0 k - static int bcnt = 8;
8 |: v# O. F* k& k8 U1 B$ ?) e - static int ccnt = 8;5 W1 a m% S r- `, u: l2 y
+ h) c2 u" Q2 C- module_param(acnt, int, S_IRUGO);
% C& f( A3 Z C0 S' i4 G, U6 F - module_param(bcnt, int, S_IRUGO);
& D0 n0 H/ B- p - module_param(ccnt, int, S_IRUGO);
复制代码
& Y/ k$ `$ w. c" Q A6 a: g9 S8 ]8 y: O2 D2 W: D( P) @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) o+ s+ y1 { a2 {4 u! |; D. qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I- F& K1 T3 [% w0 f5 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( i2 ^4 U) D5 v% f6 V
2 @: a) T/ K( d2 k% }) z/ C
( p. T7 H! T' B5 d |
|