|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# M% ]: v5 f9 w* Q. j- [code]EDMA sample test application
4 y! T+ J3 G# w e - /*
1 n- p) X6 S6 ]' r8 q! K5 Y: C, o - * edma_test.c
7 w! Z# P: s, q1 R+ `# X - *" \) z P. Z: U$ c
- * brief EDMA3 Test Application
1 t9 J( g: q( n - *4 K' f+ r; S0 G' P! j( N) n
- * This file contains EDMA3 Test code.- Q8 v7 ^# C- S& K, R
- *
; @. y. Q( ?& `5 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* v! y$ a5 l6 c& a$ o- [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ {1 Z; i/ J: | - * TO CHANGE.
' I' H4 y0 j; @% _8 D( V& A - *, R- e ~ v3 i8 ?0 V; s5 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 T/ s8 Q& }( j6 ]; r, v - *
% J8 \7 R* } [7 l0 O- a - * This program is free software; you can redistribute it and/or/ v ?/ Y, P5 E* A0 c7 D
- * modify it under the terms of the GNU General Public License as
* F/ F% E9 {7 C% i - * published by the Free Software Foundation version 2.
% p2 _- {' T: I0 d - *
. O( l% p' |( c6 c- ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 l W/ `) k* T- C - * kind, whether express or implied; without even the implied warranty
8 Z/ o8 m: G! U1 i- _' M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, _8 d; r3 u6 T* f4 _
- * GNU General Public License for more details.3 n8 ^6 U! m H! v
- */
6 {/ \3 x8 m5 c' m) o) @
$ {% u/ K$ V# J3 Q' R5 _; E- #include <linux/module.h>
# |% q* `$ e+ X4 J q ]; [: d - #include <linux/init.h>5 U- _9 ]3 V; R+ r' A
- #include <linux/errno.h>
3 {" e* S8 k9 U" l9 W - #include <linux/types.h># q) M/ N- C* s8 ~
- #include <linux/interrupt.h>6 a9 P' k; P5 g7 C U4 V! T% [, L
- #include <asm/io.h>. R: G; m% p3 G3 w
- #include <linux/moduleparam.h>
( e- m- r/ c1 t& ? - #include <linux/sysctl.h>
% d0 [; b4 C/ h1 l2 y - #include <linux/mm.h>
$ H0 M; ~. |/ ^9 |; ^" ~. d7 z+ M - #include <linux/dma-mapping.h>9 B, F' h9 ~* n1 |. _
' B# v) p# `1 E, `) t+ ? S- #include <mach/memory.h>
6 }$ ?# {& V2 q; J+ n$ A - #include <mach/hardware.h>4 M! l# N+ d8 c9 e# a; t! R& m: i W
- #include <mach/irqs.h>8 \' t/ t6 L9 y* X% I' ~' d
- #include <asm/hardware/edma.h>
# E4 g: Q! T# T8 o0 g& }9 d - p- f: p$ ?8 } g6 o- Y! ~
- #undef EDMA3_DEBUG
2 G$ |; m4 E' L7 z" [& O: h - /*#define EDMA3_DEBUG*/4 P! B& u- J+ }7 I; ^, v
7 _5 S+ \7 A' E0 p- #ifdef EDMA3_DEBUG0 z+ B3 ^( u) |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ O \+ X8 X0 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% J2 Q% H3 W9 s4 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" c! a# y+ p) y* F7 ~ - #else
/ j: j' b# _+ t* v: ^ - #define DMA_PRINTK( x... )4 E) [3 Z' G4 Y* N) O" w
- #define DMA_FN_IN6 `. T: ~8 \0 H1 [% |' J
- #define DMA_FN_OUT
: C8 j6 d- @) a - #endif1 m. u5 Q5 k& D% W. ]7 U6 Q$ @
% p8 l: K2 ^/ Z) B3 C9 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* l: z/ f0 Z0 O2 z5 I4 M, B
- #define STATIC_SHIFT 3
7 { I1 H$ H' [. w5 y( f - #define TCINTEN_SHIFT 20
" N" u4 E% d/ V# x/ X- f9 n - #define ITCINTEN_SHIFT 21
1 k" J$ Z: r9 ]2 | - #define TCCHEN_SHIFT 22
, x2 W4 j* ~1 z - #define ITCCHEN_SHIFT 23
$ D5 D) T- \" r/ v3 h& p1 @
: j4 g3 ]- M V: _* l( l1 @; V7 M- static volatile int irqraised1 = 0;) N8 t( V5 M! B+ L4 u3 c
- static volatile int irqraised2 = 0;
1 V: O/ d9 Z3 B4 P - 2 t& @% c% R/ y5 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r$ T7 R9 A& q* |+ [& _5 Z4 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G+ J1 Q' Y! e! g$ J0 A* v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
m" o4 v3 L# @. G$ P2 b
6 r% s0 A5 k, }$ Y- r% w) {- dma_addr_t dmaphyssrc1 = 0;; _) n. l5 k" v
- dma_addr_t dmaphyssrc2 = 0;4 A: B: e1 q7 b7 D6 I/ g6 ]! z
- dma_addr_t dmaphysdest1 = 0;
0 E; I% J; C) W' K - dma_addr_t dmaphysdest2 = 0;4 d9 F+ E' [; |7 z6 s% \$ q/ W
9 c6 N* r6 P! ~+ o: q- char *dmabufsrc1 = NULL;
9 n; e8 x! O% `6 f k: | - char *dmabufsrc2 = NULL;: Z/ B# s3 W1 L( K& M" A$ {
- char *dmabufdest1 = NULL;
" D6 x/ X u1 Z+ t; S - char *dmabufdest2 = NULL;! G( D1 K& l4 V8 E% J3 Z
- , U9 I6 J! l* b' `$ U8 V7 y |" U' x
- static int acnt = 512;
0 `8 O8 {0 [% U H - static int bcnt = 8;. K+ l: W: J; t/ Y
- static int ccnt = 8;7 `2 c Z' ?# ^. R9 B5 w2 q
- , ~/ ~% L- n% M6 t; F
- module_param(acnt, int, S_IRUGO);7 e W+ N( G. v
- module_param(bcnt, int, S_IRUGO);& H+ X; R$ u' L; ^) a2 { [4 y- @
- module_param(ccnt, int, S_IRUGO);
复制代码 ) |* [- K& B6 k: w( P: K
3 W3 u* X& @" G% Z, M2 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `" `" W% z9 y; z1 ~* |
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" R8 {0 L8 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. z& F2 `4 K7 X! z) U
6 M1 w" ?- A" I9 U8 G1 N/ u( b; ?
0 q# Y/ l6 W4 W' t0 \) u |
|