|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' O/ X1 I1 Z6 q+ d
- [code]EDMA sample test application
$ J1 }3 u" p% p: S2 g - /*
8 o. m/ t: z o5 O. f0 W - * edma_test.c a8 {' Z7 s9 e+ Z0 {
- *7 R4 k' `8 h7 n5 ]# N
- * brief EDMA3 Test Application
6 r% G1 J, I$ D" b - *! k) X% ]" }% |( I" q, w/ Y
- * This file contains EDMA3 Test code./ M" E5 W: a/ N0 Y! y' {( M. P. w1 D
- *- Y5 L& S! Z, L& S- r) Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- |, |; C$ u; w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ M& o& R+ m/ d! A" P2 |2 F" r' [# ~ - * TO CHANGE.
( X& I0 K9 t) M' Q4 v - *
% |- X' q0 N% y; a6 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ ^/ V) y0 o5 k" B* t - *8 q$ C9 K3 f, {4 A/ E. h y1 o5 Y
- * This program is free software; you can redistribute it and/or- A8 a! h+ @+ _- W
- * modify it under the terms of the GNU General Public License as
1 _& d& F& C; {5 r - * published by the Free Software Foundation version 2.
# D* ?6 f( N3 m" ^* R: [ - *: Y5 U* e9 F! A! d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Z: m$ K" b% m/ ]- v
- * kind, whether express or implied; without even the implied warranty$ G B. w( q9 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- h9 z7 O, |$ ?5 k& l. U
- * GNU General Public License for more details. ~3 |( u1 M& g/ d' L( j
- */
8 o o/ a& N0 [# C( [) o, n' C% h
! d* L1 D" j/ ~' U4 O- #include <linux/module.h>% N- R+ m6 s) |% ?& n4 `( _
- #include <linux/init.h>- J' @* k! h; Z( _( T# U6 S
- #include <linux/errno.h>
0 R8 B1 L2 G* p# m4 z/ I g - #include <linux/types.h>
* |' `$ P' h: K - #include <linux/interrupt.h>
1 x; l, L, g% D( C$ t - #include <asm/io.h>/ m/ E5 O$ k9 x- z- o$ A; Z
- #include <linux/moduleparam.h>
- H% H' A; W0 n. L M - #include <linux/sysctl.h>5 I: k; E0 N8 g% m, F
- #include <linux/mm.h>& a+ d. j/ S. F/ L8 N% J4 p
- #include <linux/dma-mapping.h>. M8 ^1 ?- \+ |8 p
5 b* M5 S* h; B$ g" c- #include <mach/memory.h>" J: W; m6 s, O# [
- #include <mach/hardware.h>* K3 M5 X7 n; U. M* z. W. y& R1 ]
- #include <mach/irqs.h>7 u# V. o) i* r
- #include <asm/hardware/edma.h>
9 ?0 n- t& {! q9 ^3 s0 @6 G - . M7 _' T# }. C3 X
- #undef EDMA3_DEBUG
( ]3 |' p/ z0 r4 h7 n; e - /*#define EDMA3_DEBUG*/3 o5 r5 s) A& ?- y
- ! h A0 O- x, @& x! w
- #ifdef EDMA3_DEBUG
3 ?. j' @$ Y ~# t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' J, u# s6 |! i$ P4 a& C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 v1 O5 k/ N3 j/ E0 Z, Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 d; ^* H: c7 r7 c - #else& u$ K: A% G; z. n; l4 M6 [, z2 v5 y
- #define DMA_PRINTK( x... )' `* O K5 I4 L$ P9 X- k
- #define DMA_FN_IN0 ]2 o7 n. D/ f; S. H! S/ [. p
- #define DMA_FN_OUT7 W- u5 T. K/ z4 K' A* |0 L- j7 U
- #endif
. v4 J. ]' S$ {. o& B# v+ o - 0 \# v! W" ?( Y B4 @& g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& H+ F, h B6 I* ?) |
- #define STATIC_SHIFT 3
/ u- f/ D/ `) p7 N - #define TCINTEN_SHIFT 201 ~; k- A u0 P4 Q
- #define ITCINTEN_SHIFT 21
- A& ~ m* ^; l3 q# b# ^: T - #define TCCHEN_SHIFT 22( H) r w( W- U& Z4 V
- #define ITCCHEN_SHIFT 23) i* q* U5 O4 l0 {3 F; i3 R; p
( X' @$ v6 w4 R! e0 W4 D- static volatile int irqraised1 = 0;
7 d0 W7 ^4 O8 } - static volatile int irqraised2 = 0;" e9 Z6 G8 e* H& J, n7 T
- 3 w3 O) l6 O. v% R1 _/ d% c2 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 l6 N8 y' a9 ~6 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^8 G, D& [! w' ~) E$ ~4 \, t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T, p( a3 l# c. I5 N
3 J7 @6 U, H8 j Z3 d- P; x3 X- dma_addr_t dmaphyssrc1 = 0;
* G8 n k& V8 _ - dma_addr_t dmaphyssrc2 = 0;
6 ]1 n4 o( L) i' W" t% T - dma_addr_t dmaphysdest1 = 0;4 j1 V+ j* e1 b+ x* S- w
- dma_addr_t dmaphysdest2 = 0;
; ^5 G' x2 W. x! S Y' ?( w( h+ J - & D4 U7 L" C2 G y8 E3 Y
- char *dmabufsrc1 = NULL;
" ?# {! U7 f2 ]1 Q& x+ T - char *dmabufsrc2 = NULL;
) U: j! q' S; s( K/ ?! [' d' G2 n - char *dmabufdest1 = NULL;
+ m- {& E, w: V& C" _ d( A - char *dmabufdest2 = NULL;" A" P l, c% {4 ?, J2 Q
- ' G3 T( D! _0 ~. V# b- `2 Q5 E
- static int acnt = 512;
' Y! T' e- a- v, W: ~ - static int bcnt = 8;" Q. J6 h0 b. E2 b6 b- }" a
- static int ccnt = 8; X3 P$ l. r. {2 z4 E: M+ d
- 1 e& W7 p* f& p0 M2 L$ K7 N, \7 }
- module_param(acnt, int, S_IRUGO);6 T& E( N" V; U( _& R4 S9 G8 f
- module_param(bcnt, int, S_IRUGO);2 Z+ ?+ _1 W' a0 _- @
- module_param(ccnt, int, S_IRUGO);
复制代码
2 }9 o6 C5 x6 [ `7 V* A+ o4 {/ \; R0 P% V
( Y. q" ]& h) m) q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" G0 Y. O6 @0 }, E [! harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Z+ q/ E' S; ?+ o: h2 ^( g$ M: s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 c' S8 e2 V0 d: ]1 h: c- Y+ c
& ]( ]6 y7 Z, i
& \- @. p/ C7 R, o+ q: b |
|