|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; J8 _0 L' T B$ ]2 h. @( R& y
- [code]EDMA sample test application
4 }% S. k) S) V; `% k# I0 a! ?& U - /*
9 C. d7 [. F: u2 h4 o. C7 U - * edma_test.c+ a; h% w1 U5 O. E) M- R4 }
- *- |* i! {4 k" R L
- * brief EDMA3 Test Application5 D$ s* E* {! ]7 k0 i2 o
- *
" X. x! T" r6 \2 I+ `. W; c. t - * This file contains EDMA3 Test code.5 T9 p8 j Y5 e8 `
- *3 W4 r# R( J( E3 c4 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& x8 ^1 q2 F& U: q8 X9 d) R5 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 R: E) H, |' X7 i$ L
- * TO CHANGE.
; }! \2 Y3 H0 k, U: o - *' I" m5 S2 l( n6 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" g: a# a; t+ u f, X# P* g
- *
7 ?9 O3 S5 w5 E0 {: r' x - * This program is free software; you can redistribute it and/or
" ]) n7 H+ `, x8 b - * modify it under the terms of the GNU General Public License as
" H& w: b* u" T$ i8 f) v - * published by the Free Software Foundation version 2.
, }: v' ]( i0 Q: { - *
/ O6 _$ J6 k) m7 x6 m6 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. ?$ }3 s6 N# L
- * kind, whether express or implied; without even the implied warranty
/ h% j6 K3 u) f% j3 R! U! v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& K# ~6 I: W; P5 S - * GNU General Public License for more details.
/ S) U# `( O4 b; z! u - */- ]3 S9 ^/ g1 W9 F% J* D7 q) K, N
! J0 g( l! m& {5 l, k9 u- #include <linux/module.h>
* u/ S8 E) `; `' I - #include <linux/init.h>2 M( R" ]1 J6 O( y; g
- #include <linux/errno.h>
+ y( K; A) v+ N" o% P" g. V$ Z* v - #include <linux/types.h>
8 K/ s/ \6 |1 m, ? ~9 M6 ]9 N - #include <linux/interrupt.h>
) G, U8 }# j3 s, ?4 U9 q: K - #include <asm/io.h>% m! w9 W# t; d% E
- #include <linux/moduleparam.h> }7 N9 Q/ V6 U% z
- #include <linux/sysctl.h>/ A' J x5 n8 B0 @; c
- #include <linux/mm.h>3 J. R4 |, `; ]# E1 ]
- #include <linux/dma-mapping.h>
% y, i; o7 y0 k& I
: y8 m0 K1 Z# n7 Q! D6 _- #include <mach/memory.h>% Z7 F" K5 R) P3 f$ v/ z
- #include <mach/hardware.h>
8 M5 b$ I; f( ?3 P - #include <mach/irqs.h>% e2 t8 B: V& \; l) \" [- h
- #include <asm/hardware/edma.h>
' y, Y7 T" g5 C$ p; f
2 y" }. N# T2 P0 ]/ j- #undef EDMA3_DEBUG2 D. o4 y) y5 g5 v5 w. Q! A
- /*#define EDMA3_DEBUG*/
2 e1 p7 Y7 ^) c1 n
" M4 ?6 g" Z, Q5 O& Q- #ifdef EDMA3_DEBUG
. z; o' {( N0 p) X8 l5 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): s0 ^- f I$ ]0 g; o3 ?7 R: }, e' e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 A, n" h7 C) s9 L- b. l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) x3 r( G# J g- I8 K# k/ X - #else b# i0 {" e: y' N; k: z2 r* T) H
- #define DMA_PRINTK( x... ): _, X" i: c! F, ]3 }$ l% z: s
- #define DMA_FN_IN
5 }+ c0 Y$ p, G! e( T F6 v- R F - #define DMA_FN_OUT
# V5 I" ?( o0 Y1 r( o/ v! V - #endif
# k9 Z# A0 m' Z, [
% ?. Z0 c+ g/ ^7 E6 T5 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! e. L" S% T6 t1 p! j/ s2 \- C5 X
- #define STATIC_SHIFT 34 }& c. S6 x1 ?5 L& [
- #define TCINTEN_SHIFT 20. W: J2 G# l L$ d
- #define ITCINTEN_SHIFT 21
) a1 \+ J8 Q: b* G8 f+ W- k+ Z5 F$ o( t - #define TCCHEN_SHIFT 22
. k# p3 Z! u) `) f2 M& N# h0 x - #define ITCCHEN_SHIFT 23+ S. ^1 {& A8 h3 D
6 O7 |0 B. K8 B8 |& D$ I' E- static volatile int irqraised1 = 0;
B) J5 y _" J% ^+ W7 o - static volatile int irqraised2 = 0;% u/ h, B2 ?/ t9 e8 O/ `1 F
2 f: A0 ]" D+ \3 {3 d) `5 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 _! J# T# P$ H* ?$ M* M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ?8 g* i* Q3 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& w2 [5 l' t" }( d& `" K* k - " b; y# }; ^, P3 z" d) K
- dma_addr_t dmaphyssrc1 = 0;
( \3 K1 l' h# H0 t2 P* ?- d4 ^# o - dma_addr_t dmaphyssrc2 = 0; L! k& N# y1 R( M
- dma_addr_t dmaphysdest1 = 0;7 L3 ]- L& E& ^! g3 h4 C0 `, p
- dma_addr_t dmaphysdest2 = 0;# y2 k1 J5 o' G
- $ }4 d( Y' {' t T
- char *dmabufsrc1 = NULL;) F- q0 k' e/ A& Z7 s, A+ y
- char *dmabufsrc2 = NULL;+ f! T! k+ V& ^& u$ E
- char *dmabufdest1 = NULL;" e( H% p# I* x+ Q
- char *dmabufdest2 = NULL;
# C) D7 I% U8 ~9 u: k6 a6 A9 l& w! m - ; w+ ^- S( U8 }0 l
- static int acnt = 512;
2 ~4 \0 Y w' @" i* x; j C6 b1 x - static int bcnt = 8;5 u3 d3 Q& k' ^5 A
- static int ccnt = 8;# ^6 I4 I' r) S% n
- ; Y! L# M- t- h/ D: l1 d6 w
- module_param(acnt, int, S_IRUGO);
# U, \* u( A4 w; k2 G) s& z - module_param(bcnt, int, S_IRUGO);
! r X# y. m+ g5 V- Q7 O8 j1 | - module_param(ccnt, int, S_IRUGO);
复制代码
7 F0 A5 `$ @' B/ G4 U' b" Q1 A0 W( B- d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, \- E3 ?7 D% r1 O/ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ j/ O. v3 U7 _5 i" Y3 L1 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 o! e# J% j6 J, k
' ?, S! s/ w4 f. Q/ i) K: B. \' ^) m! Y- w u
|
|