|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ y# B4 [/ j& |- [code]EDMA sample test application! E* N+ g% s" Z$ @
- /*
9 I! a3 ~0 X+ x! R5 Y - * edma_test.c8 K+ m5 G5 ?' x; a$ ^- g9 X
- *
( g$ x+ v- C- O3 M) m2 O3 [: \0 _ - * brief EDMA3 Test Application' j0 @/ i, z+ @
- *
2 W0 G- D6 v+ F6 N/ f - * This file contains EDMA3 Test code.- T( @# k! c m4 f' Q% b' R
- *
9 Y" ]* \1 X4 U/ s1 o+ g m. W* K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 v/ I% t5 R9 m3 o# d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" c Q" x, J! l% W4 z - * TO CHANGE.
) D+ w! l8 W% m7 K - *- r L4 A$ x1 `* d$ o R5 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 r. [- Y( Z) @
- *% a# g5 \+ S" q; C+ k* ]8 Z
- * This program is free software; you can redistribute it and/or
t( [/ f7 Z. {* X9 r9 k2 t& k - * modify it under the terms of the GNU General Public License as
. D r j V" i+ Z - * published by the Free Software Foundation version 2.
: _: D `) D/ _8 B4 l - *, I% _6 p9 H8 a! F& h/ G/ l! Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 r1 ?8 H6 E$ u/ T/ `5 \$ h
- * kind, whether express or implied; without even the implied warranty3 A$ s/ F- s; h: E& \8 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& Z9 b' M/ F& {! e, ^& A' M - * GNU General Public License for more details.
1 }- C% X$ e4 @; ~% K% D* @ - */# t5 }/ Q$ i! F2 @
2 E& G% }8 [4 _- B- #include <linux/module.h>
; m6 t2 l* u* S- n. B4 K - #include <linux/init.h>5 C) T/ n. k2 o5 Z& ~" e+ P2 A# u
- #include <linux/errno.h>
. ~+ z+ M4 V+ j& t - #include <linux/types.h>2 I) ?8 Z$ l6 J/ i) T, a5 H4 p
- #include <linux/interrupt.h>3 ?) Q) I- f B- M8 j+ v2 V
- #include <asm/io.h>
c4 `4 o6 U4 y# |( V9 C6 A9 b - #include <linux/moduleparam.h>
. J; @- R0 q1 R o- d: }1 Q% ]) q9 r* e - #include <linux/sysctl.h>1 _* Q6 @% f1 `2 Q" \1 q O3 J7 q, X
- #include <linux/mm.h>
, i. y1 D, N. w3 p - #include <linux/dma-mapping.h>
$ b d3 T+ L, C" U
0 n/ F( {/ B- j! P4 V% r5 F9 `$ Q- #include <mach/memory.h>
" Q' O9 u* t4 Y4 S# T6 j - #include <mach/hardware.h>
/ I. g3 h& [2 E4 R - #include <mach/irqs.h>
' W" m" j: j, W3 R. y, k0 A - #include <asm/hardware/edma.h>! W/ f, c U/ P; Z- P) Q2 @
8 ]3 J ]( V: J: L6 L5 @: [- #undef EDMA3_DEBUG
( c( t% w* P6 ]+ E0 Y- u' X+ ~ - /*#define EDMA3_DEBUG*/
- J8 {! E; O5 L- z3 o/ _2 ~8 P. {- h% W - / M% G- S! [0 q- Z1 Y6 v. G* r
- #ifdef EDMA3_DEBUG
5 A, \- ~# e' b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). q) `1 W" C" w2 ^( ?5 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, S, Q6 v7 G* T' y! T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' \; x( r! w& T. E. b! A9 \& O
- #else0 o! X7 r! h, a- x& p
- #define DMA_PRINTK( x... )
. R7 b6 K F2 O+ R" s - #define DMA_FN_IN
/ L7 {+ t2 P- N+ ^) Y - #define DMA_FN_OUT
- C; u/ c0 K# J' T6 z; v+ q2 g# y - #endif% U% {' w6 F( d2 s2 Z
_; ^, C/ v: r& `0 H( a- ^, d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; T) ~ p* s7 V3 r# {+ r2 ~ - #define STATIC_SHIFT 3
7 {" I: m9 S/ ?# X - #define TCINTEN_SHIFT 20
7 s n- I) i+ G: d2 f. c# K6 Y - #define ITCINTEN_SHIFT 219 |5 G& @, C) P5 ^: N2 B2 J
- #define TCCHEN_SHIFT 227 g+ Y; B' S+ a; ~6 ^/ I7 L1 Y R8 y
- #define ITCCHEN_SHIFT 23
9 T# a4 i) g5 Q( G. ?$ o2 s
6 q0 [1 ~* _2 Y2 ]- c" p, ]4 a- static volatile int irqraised1 = 0;
; ~7 n" N/ v- J6 L - static volatile int irqraised2 = 0;' a5 K$ r! Q8 p; O
9 |- f4 t, d. _1 \& l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o5 k& t* ?& c4 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& h/ O* Z. y" X7 q2 N) Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 c$ T2 M- U& D' [, @6 | - 4 V4 r/ ^# P- j/ w
- dma_addr_t dmaphyssrc1 = 0;! D9 O) A7 M) p0 R; \" l
- dma_addr_t dmaphyssrc2 = 0;
$ J0 M8 Q% j' c0 q# s$ \, h - dma_addr_t dmaphysdest1 = 0;
! ]0 M" j' u% @ - dma_addr_t dmaphysdest2 = 0;
/ T- I0 {2 F" O - : w$ o* {+ V4 n, s8 M2 P
- char *dmabufsrc1 = NULL;
9 i+ o1 {* y5 [ M2 X) e" u# i - char *dmabufsrc2 = NULL;
]6 o: M$ |# C. o/ e, i5 i - char *dmabufdest1 = NULL;
. Q% L* S7 Q# Z - char *dmabufdest2 = NULL;& p- J4 _; S% h) P% [, X3 c
1 {6 J. a6 i5 Z4 c1 ^7 L- static int acnt = 512;
4 T/ y# W4 e7 |5 q - static int bcnt = 8;
- v, R6 q. s8 t* `6 ^* R6 C* G - static int ccnt = 8;% X! W" P) F1 S6 V
7 V9 I3 C1 Y$ k5 e- module_param(acnt, int, S_IRUGO);
6 `7 T; V' G6 q( ^ Y - module_param(bcnt, int, S_IRUGO);9 \8 _) p0 L. N
- module_param(ccnt, int, S_IRUGO);
复制代码 , K: z% y. D# }0 \) N7 \% r
& P2 W9 w- p9 R7 Z7 D, e* q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 |/ L L3 q- g5 B3 B" Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 u# N+ p& x! P5 p. o8 I+ H8 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]7 x: y3 i7 p) o0 W: I' W
# N3 G3 l% h$ h( P+ ]3 C: j: E$ m) H1 M
|
|