|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & J( Q3 c. f0 Q7 m, m# Y. J7 K
- [code]EDMA sample test application
/ G" K# \7 ?8 C0 f3 J- w. ~, @ - /*5 y6 _8 N4 B6 l( N$ s# g; \
- * edma_test.c/ A) ], A# S, e, x) |% ^6 z$ L
- *
0 t$ ]- ^* q/ b- w - * brief EDMA3 Test Application
9 z( y1 {9 V3 L+ ]6 ] - *
; l# J& h* e' |3 E - * This file contains EDMA3 Test code." U( {7 N8 l) _( Z
- *
4 v' R9 g/ @9 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: c9 D$ z9 A ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! i/ |7 p& v% k9 W* ?
- * TO CHANGE.
! V& n+ n; l9 E* m# a# G8 z% J - *$ `$ j d/ \2 V0 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
c0 \- J" {4 u+ S2 _0 ^* p& ]2 J) S - */ Y7 S* S* B4 E' }1 N& M V
- * This program is free software; you can redistribute it and/or
+ r, v: Q3 A. ^; K) x& O% l - * modify it under the terms of the GNU General Public License as
8 \# L+ Q; G; R" t4 H6 u1 y - * published by the Free Software Foundation version 2./ l8 a- G6 u7 D+ Z
- *) x. f3 {# G* r C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# ^1 N+ c3 Q6 K& o9 j - * kind, whether express or implied; without even the implied warranty/ |! q3 ?5 _& Z! l9 \0 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- T* h) X' H4 A- x+ O$ {$ z - * GNU General Public License for more details.
( S! j6 V: t$ r! r6 j - */! o' [( W. }# v# o: d
: E3 H0 Z5 T" |/ u1 G+ b# o3 ~- #include <linux/module.h> o# `. P) ~# E: c, O* b$ V
- #include <linux/init.h>! r8 F* v+ [. J
- #include <linux/errno.h>
: _. p! O% M% H" Y$ J - #include <linux/types.h>
2 k9 m5 x( ]2 ?8 p* o - #include <linux/interrupt.h>
1 v9 ^7 E$ K2 g# F - #include <asm/io.h>
6 H; }( w6 O. k/ ~ - #include <linux/moduleparam.h>$ u2 ]& M% m0 v( w* S
- #include <linux/sysctl.h>
! Q9 A9 v. f; G$ V" C( s+ m - #include <linux/mm.h>6 N6 a+ g+ v. q. T
- #include <linux/dma-mapping.h>
+ r# X! M( \, e
# v; u G! q- W1 E: |, {1 t- #include <mach/memory.h>
# [; {2 ~' B; ]$ @' z# K0 v - #include <mach/hardware.h>4 d6 B/ [. u+ n) N/ u
- #include <mach/irqs.h>
8 A, K* h6 a4 p- } - #include <asm/hardware/edma.h>
# b4 b V+ u4 W+ R: M - ) M4 O- X$ B9 t7 U3 `" S
- #undef EDMA3_DEBUG# a. s& M) D- ?1 f
- /*#define EDMA3_DEBUG*/5 b& o3 m# P2 Z4 }! _
- 0 k8 |$ e1 j& [
- #ifdef EDMA3_DEBUG
0 S, w: r0 ]" N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% _, O, l1 M7 V" ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( ~ ]" o4 @+ r5 p8 t" [, J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I8 K9 B2 ~: d M3 p
- #else' d- O6 z: `% v; A$ }
- #define DMA_PRINTK( x... )
, y4 F; g$ Z3 _2 N0 ~ - #define DMA_FN_IN* j/ ]+ N' r0 s: v
- #define DMA_FN_OUT2 z2 ~- \* {; K
- #endif
% {' S/ z1 n1 k' g3 s - & f: x* r3 v! A; X* i/ }8 ^: E6 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) C/ X0 E% Z2 s. ~
- #define STATIC_SHIFT 3
* M/ R( { I7 V6 K( |, T/ a" V! _ - #define TCINTEN_SHIFT 20! h& X: W: W: Q' l* _
- #define ITCINTEN_SHIFT 21
! _$ N8 M) [) ?+ I - #define TCCHEN_SHIFT 22% T. G) w$ R {# {1 _
- #define ITCCHEN_SHIFT 23
0 T8 @( r- y& h5 k0 j( m - % c8 E" H. ]4 ^- L, w: \8 }1 |" R, B9 L
- static volatile int irqraised1 = 0;# Y2 \: {* B( k5 B5 L3 Y
- static volatile int irqraised2 = 0;
; {& q; ^+ S2 ]. l" Y! p4 ~
5 @9 M/ S. B! H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f8 ~" N: y K6 j* H4 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: M$ u2 t( q5 M8 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {, r8 f, J: t - 0 q2 \. f5 R: `( f& n. N
- dma_addr_t dmaphyssrc1 = 0;
7 N) v: }$ p/ z" @% \" N5 V - dma_addr_t dmaphyssrc2 = 0;: C! [3 c/ r! m- b
- dma_addr_t dmaphysdest1 = 0;
5 U M; R: l. ?5 r - dma_addr_t dmaphysdest2 = 0;% @3 J6 z5 v) ^* ?! X
- " u5 v# I Y8 Z! J2 e
- char *dmabufsrc1 = NULL;& _& }7 o: P) R& t, Y, J3 h# c& q
- char *dmabufsrc2 = NULL;# S5 O i* Y+ Q
- char *dmabufdest1 = NULL;# B. o. w% h" S9 m1 r
- char *dmabufdest2 = NULL;' R# t! I7 w, ~& x4 q
. s+ m* F0 R+ M# k- static int acnt = 512;7 P4 f3 \6 ]7 r2 C) m8 O$ q
- static int bcnt = 8;
. D$ ?3 e! z; T3 L - static int ccnt = 8;$ I" m/ b$ D. w% N
1 \/ l: m! s* i- module_param(acnt, int, S_IRUGO);
& h6 v: w7 | `- o' t1 A1 A; U - module_param(bcnt, int, S_IRUGO);
* x% f2 x3 z$ W" g6 J - module_param(ccnt, int, S_IRUGO);
复制代码 . m1 m- M7 s& r. [+ y
$ q1 _! Q1 w/ [) P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) E: B/ m' j4 S" R2 F3 y: u. K' iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K. J3 X5 Z% q% U) n* J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, b* G$ b5 m4 F( S2 U" d) |) K
}1 a+ j4 }0 ^5 W0 z: [# S7 {. x! @; X. Z0 ?- r
|
|