|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 |, d, E. ^: [) U3 W* L
- [code]EDMA sample test application
" i: T( @9 p: A6 W- j0 x - /*
" I4 g2 p% W, [ Q6 @ - * edma_test.c
$ d. C4 T& l6 m# L' ^" r: g - *% E6 U7 z8 d1 |, A/ K# B3 w( }% |
- * brief EDMA3 Test Application
: Q. P' m4 v+ f - *
W& C9 s+ N/ K! C3 _$ z- t. _. F6 Q - * This file contains EDMA3 Test code.. ~/ N5 Y: ^6 ^4 n* t* r4 Q
- *
( F1 b B( D* L" C ]* M, @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 m2 {+ r) h( S( f( q# h6 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" c/ l$ v% M- Z( W - * TO CHANGE." t) [ u- b, W
- *9 U; _- S @8 p% R+ C2 D0 Z. w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& @9 s! s" _: e4 O - *
& P {2 ]" p5 C q0 }+ D* k - * This program is free software; you can redistribute it and/or7 A0 W' Q2 [* R& k4 H
- * modify it under the terms of the GNU General Public License as
, I' y! y; T4 K: S! A, ~. ^( c - * published by the Free Software Foundation version 2.* z6 d; j+ L& g( J/ D9 {
- *
* H. M8 W( }! O: c; w! B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; a: f3 p6 b# q# D2 u4 k9 h, h
- * kind, whether express or implied; without even the implied warranty
" w4 h1 X8 x* F* _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: z5 `+ P4 j, Z$ b) d; K# S4 d - * GNU General Public License for more details.
( {$ b$ ?3 B; x5 D, v: ? - */, y" ]1 j4 w p! G# a. W
( I* x9 H( y2 X9 Y4 j) `- #include <linux/module.h>
3 S, g% m8 O' x5 f - #include <linux/init.h>* ?, m7 a" H6 K$ b, Y/ X
- #include <linux/errno.h>) d) L4 q- ]( x- O, w! G& X& K
- #include <linux/types.h>- z) m* m9 p6 u2 a- Q6 F% T
- #include <linux/interrupt.h>0 K, c/ L6 b: A7 P
- #include <asm/io.h>
9 L. p: j4 b0 r0 M - #include <linux/moduleparam.h>
: t, X- P a) I0 O9 J - #include <linux/sysctl.h>) {/ q0 @( I- Q3 J* ^' u
- #include <linux/mm.h>
0 |8 j- U) x5 f8 Q5 | - #include <linux/dma-mapping.h> W+ o" v( F2 v
" f3 ]* }9 J/ J) _; F* Q- #include <mach/memory.h>; x) n( u, ] H! E
- #include <mach/hardware.h> n) q- q! K5 s% Z2 I" j. j
- #include <mach/irqs.h>1 _) c! v/ t- k- y( q
- #include <asm/hardware/edma.h>) t. q: F8 y$ m
3 e2 N& h4 G* p& L( ? S- #undef EDMA3_DEBUG0 i* y& Y$ a% Y l
- /*#define EDMA3_DEBUG*/
+ u* E6 W2 E$ R2 o. K: v
3 J7 I9 h+ p3 G. P- #ifdef EDMA3_DEBUG
5 o: o7 E4 O7 `5 m9 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 C% ?8 c2 g0 v* `/ N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M% r" \# ~ q! N0 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* X& h P$ k. `( M - #else
' @6 z! T8 B: B9 C( W9 ?" N - #define DMA_PRINTK( x... )7 Z- w/ j: `- V4 o8 y% S+ s8 q6 N
- #define DMA_FN_IN+ ^9 x" Y5 v1 |! N
- #define DMA_FN_OUT) W+ y9 u% J1 w1 }. m# p
- #endif; @& r8 u# W% Q2 }; [
$ `( {$ Y% X. N; y) a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 N4 g3 {! I' M - #define STATIC_SHIFT 3
' p6 A9 T, q9 p$ e& c - #define TCINTEN_SHIFT 20
6 ~$ ~8 Z4 I6 [! X2 ` - #define ITCINTEN_SHIFT 212 v2 `5 n0 @' p) k3 z% ]: p
- #define TCCHEN_SHIFT 22+ L1 a0 z% `8 [; \3 W' j
- #define ITCCHEN_SHIFT 238 N, \8 i* h$ E! W# W- e
- & h8 [' B; d6 L! e& a5 k
- static volatile int irqraised1 = 0;
. N6 Y0 x S! i' Q - static volatile int irqraised2 = 0;
8 t* q: b6 H+ K( M9 M% B+ T - 9 G0 f1 b t5 ]6 `4 J. l0 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k4 G8 l- S0 |; Z$ O/ G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# W7 \5 a# Z6 T7 x: g; L8 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. E6 H3 D4 i# ]8 O6 A- _ u - 6 e9 a% ` W+ v" w
- dma_addr_t dmaphyssrc1 = 0;& l# e7 k" H+ g* b
- dma_addr_t dmaphyssrc2 = 0;
2 ]* @* t% a! \5 R9 u; K8 D# u! @ - dma_addr_t dmaphysdest1 = 0;
0 Y ^3 M% c* X6 x! j7 T - dma_addr_t dmaphysdest2 = 0;& c1 o* V9 I6 @1 Y* D) o
- % J7 }9 J# _" z& c
- char *dmabufsrc1 = NULL;, E# H2 x( L; F( ^6 f5 @
- char *dmabufsrc2 = NULL;
. ?( M( N% I3 P - char *dmabufdest1 = NULL;
. c, A8 g0 ?: E2 J - char *dmabufdest2 = NULL;
# J% |& |+ G3 N - $ z' Z. t; O) a. w1 U9 A
- static int acnt = 512;
+ O% m1 N) q0 ~4 S/ |) x - static int bcnt = 8;
3 o) D" g: F! I) v- _ - static int ccnt = 8;# t }# t' _; o& m
/ `! H- d: v8 Y0 p8 b M* Y- module_param(acnt, int, S_IRUGO);, G' d* A/ w; G' A5 e9 W
- module_param(bcnt, int, S_IRUGO);
0 w) B8 `5 K) S' T4 h4 C - module_param(ccnt, int, S_IRUGO);
复制代码 ! J" [0 c. L' j* |% c3 U' ~
) c4 u, Y: W: z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 V8 {$ y, G8 u: L; ]' R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 b! e8 N% f7 S! a- E4 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ w* N% Y; |* J% a( J1 V: g7 z
+ e0 \. H( O/ Z9 t9 c
3 p. v* F& c* s1 g2 o! L9 O |
|