|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# `" u/ W( J! Q* M; f, R* p- [code]EDMA sample test application" L8 ^* a9 Z. b! N! o
- /*
- N, K' n2 y6 r$ r: p: R$ k# D& P - * edma_test.c' }, B. O) D! n. B* Z5 z# j
- *5 _# `; f7 p# g
- * brief EDMA3 Test Application0 }% `; o5 ~( E* }- i6 e6 ]1 ~
- *
# t8 g/ R p% V+ } - * This file contains EDMA3 Test code.
; [+ Q. |9 X6 d# b" n w5 o - *
' }( B8 k& v. b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; l. q% F+ ?, J" E! X. f" N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- B( }6 R- c$ o+ n! @( Q* d' \
- * TO CHANGE.
* [9 d- B1 h' g4 k5 Y' s* n/ k - *8 W0 R) ]# N D9 p( U# ^- p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ c, s8 [5 S0 d! j/ \' W
- *
. q7 V) z- W8 m' W. i - * This program is free software; you can redistribute it and/or
) O' ]* J) _' F; V& }& n - * modify it under the terms of the GNU General Public License as& N+ T* Y5 T& }1 A, f
- * published by the Free Software Foundation version 2.( E8 l% X! L4 ]6 `$ p' e" p
- *
1 R5 b5 `. y' Z& T7 ^; X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ^# A# A! ^& Z. c% a; @ - * kind, whether express or implied; without even the implied warranty
: e) m) r7 P2 R' ?6 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 _* q7 Y3 Y7 R! Y$ _ - * GNU General Public License for more details.
$ J3 c. T# t" f9 o& f - */7 {2 {$ A# `: H' B- O, K- R
- 7 z4 k5 t7 t: A) X S6 _; `
- #include <linux/module.h>
1 k2 p& q7 L4 n( C# r - #include <linux/init.h>
$ Z* Y F$ x: k' J! {+ x2 L - #include <linux/errno.h>% y. L" @4 ^% A/ P" }
- #include <linux/types.h>3 W8 \+ h# s% H
- #include <linux/interrupt.h>
Z, A: g% `: J) Z" @7 D1 [* q5 { - #include <asm/io.h>3 f& r( X% S$ A3 b. e/ h
- #include <linux/moduleparam.h>, }. `; H2 j6 j
- #include <linux/sysctl.h>' F, V, q) Z4 k1 x2 ]
- #include <linux/mm.h>
8 R& N# X. w7 p( e( s, @5 b - #include <linux/dma-mapping.h>
4 O6 p; y9 d* j$ J& r3 F& d4 ^ - * r2 g* f6 X, Z, t5 i$ ^8 E; c
- #include <mach/memory.h>6 R) G, G; e' B4 y, P
- #include <mach/hardware.h>
8 B3 |" K( x! R p( `# C; ] - #include <mach/irqs.h>
+ O& S: l7 e6 ~# B3 {' n+ e - #include <asm/hardware/edma.h>* }! b0 v( d% i
- $ R2 m' r3 I7 ]9 K. i5 B
- #undef EDMA3_DEBUG
* V7 D, n. t# }/ ? - /*#define EDMA3_DEBUG*/, L. {2 |' q# B* }0 @! o/ G
! x2 p$ h0 @. w" o. a. a- B3 j. }- #ifdef EDMA3_DEBUG r& Z/ Z1 I& L6 b% A! g) c9 a4 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 X* H9 {4 w: r4 s3 W( s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 y, M3 u- u# f( Y! S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 W9 E2 E- F9 k" Z Z( L$ Y' F2 d
- #else6 `$ _' {6 Y$ S+ h! z: W5 o
- #define DMA_PRINTK( x... )
, ?# n; A5 y) Q1 Z - #define DMA_FN_IN
' K; D) K% Z7 Q/ ]- A0 l9 T - #define DMA_FN_OUT
4 J2 P7 z- |4 I. o& v- U" X - #endif) l2 V2 \, a. L. \ ] `5 q
- ' `+ C/ k M, f3 w9 y6 Q$ x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' @( ~/ ]/ D6 E* Y9 _ - #define STATIC_SHIFT 3* I, k) C5 c9 v5 y4 p7 n3 j) K& ?) B
- #define TCINTEN_SHIFT 20
' ]% u2 T, x, Z' p5 c3 b* H+ g9 a - #define ITCINTEN_SHIFT 21( ^. O9 R: L* w4 w
- #define TCCHEN_SHIFT 226 h1 b( V g# t! G8 t0 n& N
- #define ITCCHEN_SHIFT 23- }1 m, w E- G9 [
1 p) Q0 g4 \$ O, C4 Z8 M- static volatile int irqraised1 = 0;3 a1 F" e7 Y) K9 s @' g! \
- static volatile int irqraised2 = 0;
0 y5 ?2 e* n" a# K4 P - ; l+ Y* y' y6 j: q5 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 N4 l0 w/ ~6 v% |1 W+ K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h0 H [) C* b0 X. D$ p" e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ o" s& t" ~4 f+ i: ~9 h4 e* V% \
f0 Q% j4 {6 W3 E7 [- dma_addr_t dmaphyssrc1 = 0;
! Q& D1 y: N7 L! x, c; M - dma_addr_t dmaphyssrc2 = 0;
" X$ ?7 T, O7 U8 g o4 n' h/ ?' P - dma_addr_t dmaphysdest1 = 0;' j4 H4 G* x$ V$ F: x! U
- dma_addr_t dmaphysdest2 = 0;' ~3 h; M* y& n7 M# w" k2 N: G. e
- # n% I' i: l) A9 U1 j$ e
- char *dmabufsrc1 = NULL;
# q$ ~. F" q9 L+ N" \ - char *dmabufsrc2 = NULL;) ~; _) x% U& X$ r' k' t0 ?( D
- char *dmabufdest1 = NULL; b3 j9 b" M S' d
- char *dmabufdest2 = NULL;4 E5 a) {' v: }
; K3 d) n& ~$ h- static int acnt = 512;! Y) w/ g5 G* x) X8 y5 ?( S3 x( I) ~
- static int bcnt = 8;
% |" k2 i& O) E: d% \- O9 h - static int ccnt = 8;
r1 \3 v, T5 `! V
6 m) U( Z2 o+ ]; {. @- module_param(acnt, int, S_IRUGO);" D8 [0 G3 J2 U- j& r! a" t
- module_param(bcnt, int, S_IRUGO);2 R5 ?& Y4 L+ F! F, p/ @* Q+ s0 v: L' Y
- module_param(ccnt, int, S_IRUGO);
复制代码 6 I% A! W! Y% O2 _* C7 S
' N7 ?$ i8 x- x. n5 k6 Q" u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( y n2 q, ~( @0 D. O# C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 }6 H& ^0 F0 A9 I* X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. {! ^3 s- b( z& z5 J" Q
2 c: P/ g' _2 N8 M& U( A% i' g& f; o4 d
|
|