|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 x- K8 e h. k. y q- \4 M; V t
- [code]EDMA sample test application
& A/ {9 b5 P2 Y" }8 V - /*
& ~+ B5 X6 x6 ?( N - * edma_test.c
4 O# N/ |" c$ W& U3 R% X0 E6 ? - *% u/ O ~" m' J+ ?& ~
- * brief EDMA3 Test Application
$ x4 I% @( c4 b- ~3 z; k4 y/ V# W - *
# H- `. Y5 `/ R( J - * This file contains EDMA3 Test code.! x( X( t i p8 L
- *
# |* X6 |3 f; [$ C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! `# l2 U" `5 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% {5 m4 U# x3 F8 {" P! b
- * TO CHANGE.( }- j# T5 B$ A0 v$ J
- *- c, A' W6 R# E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& m/ _* K+ C2 c8 ] - *7 K$ Y4 l0 [7 h' G
- * This program is free software; you can redistribute it and/or
3 ?( `6 q6 h7 u2 e9 o - * modify it under the terms of the GNU General Public License as6 D# c* H" O: V9 m
- * published by the Free Software Foundation version 2.) p+ i# P, l' I6 ]. f8 s2 X
- *
! x& i* v6 u/ Y, |) l' Z) ~' Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ ]# {" e# M2 g9 ?$ T
- * kind, whether express or implied; without even the implied warranty" | g. J2 `( W0 i Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. y5 k" H$ D, z, B9 H8 S
- * GNU General Public License for more details." \4 g1 C9 i, m/ z. o' R2 ~/ @9 H
- */. o8 R- m0 b+ ?3 }
- 3 W3 T. D; z/ ]( U1 r
- #include <linux/module.h>: a5 c' J$ Q. u) D, R2 A6 @' w
- #include <linux/init.h>
4 h% {, _$ |( P" ?& x0 ^# L2 m( z - #include <linux/errno.h>3 H( D/ b: N9 ]: b; R: Y
- #include <linux/types.h>5 m, [) g3 U$ D1 {9 U2 I% @. M
- #include <linux/interrupt.h># |/ b4 B* n! u0 w/ h, j
- #include <asm/io.h>
: M* G$ ?* z8 ^% |" c) f1 A6 s" t# S - #include <linux/moduleparam.h>9 y% U3 P" ]/ ~5 J' w
- #include <linux/sysctl.h>' L" V a* z3 ^0 {
- #include <linux/mm.h>
& f+ x; W' o! N" a1 f - #include <linux/dma-mapping.h>
$ u2 J" O+ A) y: v0 P - : w( l5 S T: v: x" \! A7 c
- #include <mach/memory.h>3 L2 L" u: z8 x2 O& E( C3 b* s. z% P' {
- #include <mach/hardware.h>
* o+ E3 {8 b) o' a - #include <mach/irqs.h>. ~% ]- H1 N6 Y2 h" q' P
- #include <asm/hardware/edma.h>0 L h% [9 U3 z" s2 F
. e& D5 c1 `7 x- #undef EDMA3_DEBUG& d0 G! {) m6 c0 w0 ^: N
- /*#define EDMA3_DEBUG*/5 A3 P6 G% v7 B0 G0 }
; F8 ]3 s$ V4 G/ x- #ifdef EDMA3_DEBUG0 `3 J3 c5 f% |( E% d1 S' k+ \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' `; f) l: a. {( m# d! l/ A( ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& n2 l% j7 j4 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ C& C @$ i8 a% F+ C
- #else* ^! t6 G5 o) H( u7 ^; l' z
- #define DMA_PRINTK( x... )8 t# c3 ?2 l s* k+ h
- #define DMA_FN_IN5 T" B9 x: b- ~
- #define DMA_FN_OUT7 C0 N* ~ }* f) [
- #endif
, E2 o `' e/ V) D' K: e2 J0 m# p! k - 4 [5 k2 w! l; z. f- T; x$ a/ N. o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 q9 v8 C1 b; A2 @& t6 O" `5 g
- #define STATIC_SHIFT 3, Q" Z+ v! a5 C6 V, X
- #define TCINTEN_SHIFT 209 v- w7 j- x1 B0 G
- #define ITCINTEN_SHIFT 21
* f: ]) w8 ^6 ]* \ - #define TCCHEN_SHIFT 22$ Y8 p6 x8 P7 u A* c& U, |; x
- #define ITCCHEN_SHIFT 23
; K8 Y9 p9 n1 l! ]. o( M
; v" o; t- d; K% S- static volatile int irqraised1 = 0;/ d% @' h7 M2 d0 W
- static volatile int irqraised2 = 0;
1 j* d* `6 ?9 l4 F7 Y - 7 e. g! _* t6 {2 \! W9 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
_' t5 z4 v3 h& C" l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ {/ g5 ?. T6 i3 z. q6 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z: B* i- I5 W- O( b- V - . }+ C, ~9 V1 R; ~6 `
- dma_addr_t dmaphyssrc1 = 0;3 I" G( F2 }6 B6 E0 U
- dma_addr_t dmaphyssrc2 = 0;6 @: `% K. `! F6 D; e! r
- dma_addr_t dmaphysdest1 = 0;
" d: o; Z/ ?" K8 w0 q; \1 _7 N - dma_addr_t dmaphysdest2 = 0;
* \" C" x3 @% ^! z! _" A6 Y9 w - 7 O) o/ X) @- P7 n
- char *dmabufsrc1 = NULL;3 @1 P* k4 H# F* T
- char *dmabufsrc2 = NULL;
* {" y* d# Q, H; z8 k& D - char *dmabufdest1 = NULL;6 m% I) a/ C! L: J4 L
- char *dmabufdest2 = NULL;$ |2 e4 ]* \4 X- w" d$ k0 x
- / m. i8 K! K# F3 k% U$ l. v
- static int acnt = 512;: a( [+ C* m7 N; U+ d y
- static int bcnt = 8;# E, M6 D1 E5 N U; K2 f( d
- static int ccnt = 8;
2 c I, ]8 j; `) I _ - 0 N. h; c1 p0 C1 _: ?7 S
- module_param(acnt, int, S_IRUGO);
- G7 Q( ?- w1 |7 x1 X4 D5 D y - module_param(bcnt, int, S_IRUGO);
* [. ?; P8 b7 ~ - module_param(ccnt, int, S_IRUGO);
复制代码
/ B6 ]* m7 b; _( e9 v, V
8 s! h+ z( s$ z0 c9 s6 u2 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 q6 O0 V: j: F% E& |9 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f6 c4 c* p% h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: d$ `5 B4 X$ r- l6 n
6 r+ H1 t4 K- A3 @( u3 \4 Q: u2 O( N0 C
|
|