|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! m) T6 ]# x4 x l
- [code]EDMA sample test application3 R' S# ?5 C" F# ]
- /*
4 N& D n r: A h A* a- D( | n - * edma_test.c
5 N1 R4 N+ l, ^+ }" {( p - *
( d0 v8 A. B" u: a- t3 f+ m. M$ | - * brief EDMA3 Test Application8 _. r6 Y( U# t5 d
- *
6 L8 [" g6 s$ f- b; l - * This file contains EDMA3 Test code.
% p" g. R2 e$ c' w, X - *$ s* U0 _+ r9 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 O- M: h8 h! }* _) V# H& N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' {5 ^5 ^; W% u% S6 [! \+ u$ |0 a' u3 | - * TO CHANGE.& Y1 a- m9 ?4 }& |, L
- *( P" } {' v) T; ]5 O7 g; i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& N$ ]4 ]& N5 Z: ]9 F- p6 {" y8 Z
- *
5 y$ ]5 O" ?8 n8 { - * This program is free software; you can redistribute it and/or
: O5 M8 d: u4 Q - * modify it under the terms of the GNU General Public License as
2 u( M' t6 Z0 A$ a% O! [ - * published by the Free Software Foundation version 2.
0 \3 F. }* y4 I - *
4 }9 R3 c9 I- B. p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 h8 f% n* n/ B9 G - * kind, whether express or implied; without even the implied warranty2 V, d0 ?8 Y1 ^3 @! k3 z1 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; o; w# B5 a7 ]2 `4 R
- * GNU General Public License for more details.# E v5 ]# N; |$ c
- */
- e6 l+ q" x" W' g- a" z
# Q" v# M% }% K; f! j0 z' p! L- #include <linux/module.h>
4 \9 ]: n W7 e( H - #include <linux/init.h>& Q) u6 V" g$ Q( l
- #include <linux/errno.h>
! H3 k* g% v7 U* X - #include <linux/types.h>
4 H$ {# X% L6 ]3 H - #include <linux/interrupt.h>
0 n! _6 E; X& L: }! X - #include <asm/io.h>* l' m0 ? J; T6 Y, }5 `
- #include <linux/moduleparam.h>
+ P; s+ I, m& y* |) u - #include <linux/sysctl.h>
- |( R$ X+ F# f# H9 {, Z2 L - #include <linux/mm.h>
- l }4 s8 a2 F. ~$ W( s$ C3 s - #include <linux/dma-mapping.h>
; O2 D, x7 m. Z ~# ] - . m% a0 X* U# v: o) |8 F
- #include <mach/memory.h>9 t6 V) p) x$ u2 k! ~/ W1 X
- #include <mach/hardware.h>
0 T2 F6 V' V1 r0 y1 F+ y8 h# ^ - #include <mach/irqs.h>9 [( B9 o6 b z. [
- #include <asm/hardware/edma.h>4 d/ o2 X. T* t- j
. ]* A% ?9 v9 G0 `# X- #undef EDMA3_DEBUG1 a7 s w: i- Q! Q9 I
- /*#define EDMA3_DEBUG*/ j) I# ]# m" W
- ' @( i# D5 ]" F/ v
- #ifdef EDMA3_DEBUG
- T: P: y' H8 U0 k$ m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T5 m7 _9 N6 x E$ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); v! n0 z4 W3 d4 @6 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ R( s7 W6 S* g0 _' X1 P
- #else( e$ D! T, `: K g& D! v* Y% ^
- #define DMA_PRINTK( x... )9 l I- t% s/ G
- #define DMA_FN_IN
. Q% x! P6 A$ S, d5 ]+ F2 l$ J - #define DMA_FN_OUT. U( y8 p+ ]. _4 p
- #endif; i0 _; Y3 I1 b9 o% w8 [
- 1 p. g& H: F" {. H' F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* r' `5 b$ X( z1 y8 Z
- #define STATIC_SHIFT 3
4 U. |. S. H5 y/ U* K - #define TCINTEN_SHIFT 20* d9 M. e, u, p7 I4 K9 {. ^2 _' ?
- #define ITCINTEN_SHIFT 210 ^ `5 i1 r' w" X ]1 ?6 H+ a
- #define TCCHEN_SHIFT 22" m+ \ f$ Y4 [* D$ X4 `/ a
- #define ITCCHEN_SHIFT 23$ n2 q9 |/ Z* J" \2 V$ E. G3 C6 J, K7 @
2 _& X w0 ?# ^- static volatile int irqraised1 = 0;
/ q. }' f$ T& J2 f$ l - static volatile int irqraised2 = 0;
( B- d. u: ^; H/ p - ; N e: @+ p* {( u7 ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' P/ }7 F, Z0 H' P4 S, \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q, ^7 U- Q! \, F2 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 m2 R q$ ^" v/ d& N
1 p. i, K( I' f! z- dma_addr_t dmaphyssrc1 = 0;0 S4 M& Z0 P! p
- dma_addr_t dmaphyssrc2 = 0;& f2 @3 `) r) M5 f# \ N) B
- dma_addr_t dmaphysdest1 = 0;1 I/ L" D- {7 H5 _
- dma_addr_t dmaphysdest2 = 0;3 s: c: F) X! g. q9 r3 x
- 4 l* Y2 Y o+ x7 R- D
- char *dmabufsrc1 = NULL;
; o% Y$ ]; p# ?( q* s - char *dmabufsrc2 = NULL;
( I% K1 e- [' m& \: I1 |5 l - char *dmabufdest1 = NULL;
" b* S; N: h+ [2 N/ t! a) \ - char *dmabufdest2 = NULL;
! n8 r; E; _) F2 t - |! h6 ]2 M2 E, a
- static int acnt = 512;
. k0 t# X4 g, X# Z - static int bcnt = 8;
: D( Y5 a- G# H4 X - static int ccnt = 8;
. R, n1 |; o/ U; K8 Y! R - 0 v% P; c. ^+ N6 H; ~4 V# x
- module_param(acnt, int, S_IRUGO);& M$ o! E: t- A9 N e; Q$ p
- module_param(bcnt, int, S_IRUGO);7 I% {- ^" a' Y. ?0 y9 u
- module_param(ccnt, int, S_IRUGO);
复制代码
8 f! J8 S; m3 \) X# ^2 B
3 }& @5 r2 i0 G5 U5 \ q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 r1 u- Z* }, Z9 e8 x& \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, x: s+ b/ @ N( x/ K5 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" M# ?5 ^9 [! u8 d2 i3 J/ ~; [$ n) _9 I, x. ] j* P# n
- x' u7 b1 G7 a1 ?0 l: g- G
|
|