|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 N; ~$ _5 v1 X( w- [code]EDMA sample test application
3 |) L! ~8 X# d( q" \5 T4 ^0 m - /*+ p) x9 [ t5 e0 p; w, [
- * edma_test.c5 N! u/ H/ T- W$ r
- *
+ f) J; {" x7 {4 U, _ - * brief EDMA3 Test Application
& Y2 |' E$ L k) t/ Z$ x- c. } - *
; X( e* L% D5 q2 e/ K - * This file contains EDMA3 Test code.
$ q4 T. M6 L/ U! ` - */ Y9 j6 n# a+ o6 j! Z8 K; [2 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* C2 l( R7 h8 x6 }5 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! c7 k* I8 U, r5 m9 O8 \ - * TO CHANGE.* @8 A u* Z5 L5 t B$ E8 r$ a
- *1 M9 W$ H8 W# A- w( r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 b+ O( P( }+ `5 J9 N# L4 n) ` - *
; X8 C; k# F; N0 w# \7 N - * This program is free software; you can redistribute it and/or9 g6 R0 T5 S. m6 Z: l4 T, _ i
- * modify it under the terms of the GNU General Public License as
% X& b1 X" x6 T* `: S6 _' ~8 f9 { - * published by the Free Software Foundation version 2.3 S6 x2 j, l+ f1 ~* m/ _
- *& t5 i: q* N* l* Y4 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 {0 ]( v; O3 g5 e$ Y
- * kind, whether express or implied; without even the implied warranty
& K) D Z$ [3 p/ M, t9 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 w' t$ y6 I i' g& [9 X6 I% ], o - * GNU General Public License for more details.
& K, b+ P8 G/ I7 t5 H* l5 p" H w' M - */* ~% O) p7 o1 ?+ }8 I
- 5 D2 O# K& Y8 |# e0 o# D
- #include <linux/module.h>0 N7 m7 u# C2 \
- #include <linux/init.h>: _0 f/ F& c/ e8 C
- #include <linux/errno.h>
6 z2 [4 o6 ^& w( f1 E$ V - #include <linux/types.h>
! o8 n+ {* Q9 m2 A: {5 j - #include <linux/interrupt.h>
5 Y4 y( W# S0 l6 h1 I) m4 s - #include <asm/io.h>' l. E2 {3 @' @& z/ R0 z! V
- #include <linux/moduleparam.h>$ ]8 H2 A: H4 M6 [' }
- #include <linux/sysctl.h>( e& b; @4 ~4 K8 P% k O
- #include <linux/mm.h>4 n4 ]6 _) }" J
- #include <linux/dma-mapping.h>
1 P% c7 ^9 i7 b) I
2 e, G8 c: M2 r- #include <mach/memory.h>
/ M8 V l# Z9 P! P. a/ N+ W - #include <mach/hardware.h>7 _# a9 e7 f. p0 j
- #include <mach/irqs.h>
" y2 P/ f- X' E. A - #include <asm/hardware/edma.h>" V, P7 ` U2 v9 L$ J& f
- + ?4 x3 t9 o$ i4 d% G
- #undef EDMA3_DEBUG% U g) _2 |4 v4 i3 {8 c9 V; U
- /*#define EDMA3_DEBUG*/1 }" A, k, t" ^6 R+ N1 C5 }& w
- . n6 |) W& @( \" X- ?4 c j* [6 W
- #ifdef EDMA3_DEBUG
0 E5 V/ ?" f7 h( M, X. { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ I7 Y. L; m7 b. d+ C) ]* I! p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" s9 N o# {" y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h' v. u& n2 J9 u; R1 m( U3 x
- #else
8 \# P \, S: K% Y3 c% k; s - #define DMA_PRINTK( x... )
) P/ |- D4 a. _ - #define DMA_FN_IN
6 _% l# `2 S t7 n! d - #define DMA_FN_OUT
7 o! J! X- F6 q8 r2 s: W5 K - #endif
) D8 }' D7 W. D% |; P1 {' p2 w
# O% ?$ H) M# Q5 x6 @2 o5 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768) k. Q5 m% n! T3 s' G" y
- #define STATIC_SHIFT 3
( x! z) a8 p% B* _% { - #define TCINTEN_SHIFT 20
7 @ ~9 e3 j' g( A - #define ITCINTEN_SHIFT 21
2 ^* t5 `3 s ?" b* U7 o. B - #define TCCHEN_SHIFT 22
4 w5 s6 l" s' z6 Z3 t1 C2 L! Y& s! l - #define ITCCHEN_SHIFT 23" }, b5 Y! x! M7 s, |4 j
- 3 w7 _7 u- o; D' ^# W
- static volatile int irqraised1 = 0;
* M% [6 i& `, X/ o - static volatile int irqraised2 = 0;
) H, |, u+ w% e' G - - z3 m( X. M0 a1 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 l# B {0 i$ g: u( e0 V& n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, {9 I) X7 `+ {: ^# @% _& C1 i. m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
S6 p7 C" k! `0 x - " ]* d+ a+ q% _( ]; {
- dma_addr_t dmaphyssrc1 = 0;
3 m: p, `. `' J9 d0 Z - dma_addr_t dmaphyssrc2 = 0;
g6 B9 L- ]* q# U - dma_addr_t dmaphysdest1 = 0;
& s3 A7 }& k; w - dma_addr_t dmaphysdest2 = 0;
& x, M1 K8 r3 U2 n
" |0 Q! e2 ?/ ~0 r1 U3 G7 _- char *dmabufsrc1 = NULL;5 G4 c4 u: X6 C: U m0 c
- char *dmabufsrc2 = NULL;& ^( h( G4 {6 f4 f5 e
- char *dmabufdest1 = NULL;3 M0 H# l2 M+ o. ?/ M4 K
- char *dmabufdest2 = NULL;
) W1 Z1 t3 U/ S T4 A0 h0 b% @
- H$ q( ?/ A: F I- o0 p+ u- static int acnt = 512;) [7 j6 g5 M1 T
- static int bcnt = 8;
* X+ U- [8 j& @( C - static int ccnt = 8;
) a9 q* a0 ]* t% u! Z - : }5 l- u+ M* j7 k* C2 b* P
- module_param(acnt, int, S_IRUGO);
7 ?1 o0 D8 q- ]0 E1 j - module_param(bcnt, int, S_IRUGO);: F9 S3 s' M" U6 X! b* ~
- module_param(ccnt, int, S_IRUGO);
复制代码 % `& [ p5 d+ c o' o0 W- Y" F
/ n- M: \, h% R( y& A; S. w% f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ a; K! i' G9 @1 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& [3 r; j# d7 R c0 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 n V; D( R% Y2 r. j8 `" b; ?( L+ M5 X% y9 y4 i. i) Y
) P1 _8 F" J. \4 d |
|