|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, s& S; j2 T1 ]! T: [7 |/ ?+ z- [code]EDMA sample test application
% }3 {- ^7 ~5 t: _8 [0 ~+ v. Y - /*
% D5 \4 Y' \% D, x3 q7 ~ - * edma_test.c
! ?8 Y( S* s$ s) g - *
$ q! v7 o, U) `1 i! r - * brief EDMA3 Test Application
3 `3 S/ ~8 F% g( e8 u8 ]# z - */ n- e6 j9 x& n- f0 h' h8 P+ a1 n
- * This file contains EDMA3 Test code.6 o' h! I# `$ m6 X
- *
% M* R7 K8 Y e8 c7 `1 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! [ [7 L9 Y4 i# o! P2 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |% F4 q r1 y
- * TO CHANGE.! ~. g/ f" W' |3 B% X4 J) B% c
- *: n( C* m4 x8 F7 q- O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 s' |7 e7 f( u* r* | - *8 e" N! d4 P+ z" Z
- * This program is free software; you can redistribute it and/or5 E. f* V) O+ u [1 F, l0 \
- * modify it under the terms of the GNU General Public License as) U# R3 u, c% b- }
- * published by the Free Software Foundation version 2.
& @% b9 {5 T, B8 O8 v9 x7 a( \. n - *' E5 e4 s: V- I: ?: V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" S1 P0 v6 |$ @9 ? - * kind, whether express or implied; without even the implied warranty
. O; w5 V, o% T5 \/ d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, q# p) e( j6 Y; W3 u3 Z4 |
- * GNU General Public License for more details.
$ G& `2 ]* x3 |' o, m [. L - */
* R2 m6 A6 {. p; B% c
9 a9 V# |: D& ^- #include <linux/module.h>9 z% A% w' a8 o
- #include <linux/init.h>
9 ~, q$ N& P& U4 c - #include <linux/errno.h>
$ m/ e+ q( D. \% t - #include <linux/types.h># Q* B F, k- C1 t" C2 U2 ]$ K! z! x
- #include <linux/interrupt.h>5 `: A. @2 s) I% {9 X0 C# A
- #include <asm/io.h>
$ z7 H5 m; v6 e- e) V - #include <linux/moduleparam.h> y0 w2 z# J* Z6 p5 w [
- #include <linux/sysctl.h>/ K' l3 f& X! [( y3 {
- #include <linux/mm.h>
8 Q/ U7 S- P! }$ ?, p - #include <linux/dma-mapping.h>; Z/ E; m% G l3 I/ Y
- 9 {0 X ^/ r- ?0 D' X
- #include <mach/memory.h> i9 d# \5 [- S$ o
- #include <mach/hardware.h>
" X$ w! }5 `( \! Q& y# r7 T% t - #include <mach/irqs.h>- R& ]+ }9 R: a4 \/ {. S
- #include <asm/hardware/edma.h>
6 I! j- M6 D3 a9 V, F/ C: w6 f9 M
, {+ R( Y: K7 a& [- #undef EDMA3_DEBUG0 |7 }+ h: W8 K, l2 {. [
- /*#define EDMA3_DEBUG*/
. T2 d0 H3 u' B5 J - F( ]& ?5 L4 A( x0 M& R
- #ifdef EDMA3_DEBUG
" g5 O3 o& i9 @7 v- A# l3 s& W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ @3 V2 R% C/ S, m4 b+ x/ N5 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& X& h- C/ @! ]5 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! l3 y% l& _* S* C9 x
- #else2 i6 \% g5 W7 T' J F& s9 a; a! r
- #define DMA_PRINTK( x... )0 o% G( H9 Y7 M& e
- #define DMA_FN_IN1 N; v; ?: M* U4 z
- #define DMA_FN_OUT
, c; _% l6 w; j6 p" g ^7 ^0 v - #endif
9 A9 W) S4 c" G - 6 W: ]# { U: S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
y' g( `* S. p - #define STATIC_SHIFT 3/ Z' P" A9 z% [5 a
- #define TCINTEN_SHIFT 20) `7 ^, s& h* C
- #define ITCINTEN_SHIFT 21! A9 T1 `9 |. F1 f' y
- #define TCCHEN_SHIFT 221 f P. U% V5 o- a: K6 d
- #define ITCCHEN_SHIFT 23
! \1 S% H: j0 g7 q& u% M& b
1 l, Q7 j3 X% k/ \5 A- q- static volatile int irqraised1 = 0;6 s& O8 y0 }( d# o
- static volatile int irqraised2 = 0;
, _- s& z( ^" q5 W- @
3 w1 R# G. G" m. v' f8 k4 k0 ~# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Y. i: x+ I2 ]0 i: X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. L r* m, A: j2 |# C' t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# u& h: p/ w$ {- q# _/ @
* l7 b0 x5 z" S& M* l8 l- dma_addr_t dmaphyssrc1 = 0;$ `$ D6 D' [! |) o7 V" U2 f1 q8 c! I
- dma_addr_t dmaphyssrc2 = 0;
: m. y& x! M! |( A Q+ p - dma_addr_t dmaphysdest1 = 0;
- ~' _* ~- }4 J3 X$ d - dma_addr_t dmaphysdest2 = 0;
& d Y! K* {8 t1 S! _1 t
9 {4 s g8 Q# O3 A; H/ y' E- char *dmabufsrc1 = NULL;# O; z- j" N7 ~, e) A3 f
- char *dmabufsrc2 = NULL;
" ~6 ]: {. x; h) j - char *dmabufdest1 = NULL;# y' H; G' h3 {( t! {! H+ u9 F
- char *dmabufdest2 = NULL;1 e2 y6 N/ Z" f% q- a. {4 f
! d N3 Q& q& d | I$ }8 z% N& e- static int acnt = 512;( o0 t: ?8 Y& Q8 Z
- static int bcnt = 8;6 @1 i2 J+ F* k6 S: `! Q# `8 s$ V
- static int ccnt = 8; {, |( U, E9 h- N6 y% ?
. ~0 p" H, d( w/ k8 n- module_param(acnt, int, S_IRUGO);
3 F" @2 E) z4 c$ M7 h+ Z% R - module_param(bcnt, int, S_IRUGO);% o, [% z1 d' H+ x
- module_param(ccnt, int, S_IRUGO);
复制代码 ! X* O9 Y8 o* V8 ?/ l
2 y, Q& p6 {' Z9 j! C* E5 q4 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) {- s2 y B- W! C+ Z/ n2 [# darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ U7 M) B/ g7 [/ ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 ]2 S; m% @3 D) o$ F1 A3 P9 e3 k
) Q Y! r9 k! r/ w2 H) P- g: a9 ?$ u! g% a6 l b4 v# `
|
|