|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & I: C4 ^' w0 D0 W" v3 `; h) N
- [code]EDMA sample test application R- I3 Y) A* f3 K; i- Z) Y
- /*
9 G6 V1 W. R- L8 p, i& u: m - * edma_test.c9 H' o& |& K+ S5 p) E0 L
- *
0 |. z+ B3 o t a2 v1 t# I - * brief EDMA3 Test Application L) C. e& q0 ] q+ [
- ** c' @+ ?7 \4 b; m
- * This file contains EDMA3 Test code.4 x) J1 b0 H$ G: H2 e
- *' i+ F+ W2 G) b$ s! G' w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% C2 {0 G4 I/ A4 _8 W; ~9 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Z' g" W0 k t9 K; ~
- * TO CHANGE.
- T% T* W8 O7 i) N; }9 \, D" G; _. d o - *
5 D/ f6 \/ g! t& E2 Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 H# K: N5 \* I( _# z. U - *
6 }5 K4 `, V5 _8 ` - * This program is free software; you can redistribute it and/or1 ^+ H0 o; q1 \5 V6 [( n1 P# T- }
- * modify it under the terms of the GNU General Public License as
' h$ X" R# Y* Z* }( h - * published by the Free Software Foundation version 2.3 S/ ^9 s8 H. q
- *- T8 Z, C4 ?: y# W( ?8 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
L) r2 f' f0 C$ v8 Y - * kind, whether express or implied; without even the implied warranty- ^+ w* v# Q4 q" s, f C: `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ p3 u( S) D/ x# o- j& S
- * GNU General Public License for more details.
/ q) v3 {! r5 ]! B" _6 B) t f - */
# a( l2 I$ G3 p - " x7 U- U' D/ T4 n
- #include <linux/module.h>
5 c$ u1 D6 D& u9 P& v1 b% B - #include <linux/init.h>, B- |) |' d/ B; M2 g7 z
- #include <linux/errno.h>
! g/ ^) C" T2 }, l" J& W - #include <linux/types.h>" l. [, l! h: n0 |/ c$ z: y
- #include <linux/interrupt.h># A/ x4 f' R2 M' u* Y9 L/ p
- #include <asm/io.h>
2 o2 @$ m0 {0 S s, }; W. j - #include <linux/moduleparam.h>: s- L; R+ `; L) x* m
- #include <linux/sysctl.h>
* X: o& }0 f( } - #include <linux/mm.h>
6 J5 w2 h6 K6 O7 s - #include <linux/dma-mapping.h>5 A3 H2 ?" s$ a1 Q2 y* R) t0 X
- 5 B; {( u. F' Y i* l5 v" u
- #include <mach/memory.h>* G! {3 Z' w& r* N
- #include <mach/hardware.h>9 O6 D4 w/ V3 b7 o& R! R7 ?
- #include <mach/irqs.h>7 k: @8 Z0 L' J0 } A2 d3 C
- #include <asm/hardware/edma.h>
# `4 C* {8 d$ h l3 F# Z
+ D7 `, H6 T# y) C& I. d- #undef EDMA3_DEBUG# l* _6 `0 e0 I+ ], d+ `# s' W
- /*#define EDMA3_DEBUG*/
, ~& B: q9 c$ M4 }" N6 _2 ~
D4 p; z4 Y2 }5 X: x- #ifdef EDMA3_DEBUG
; `) G, z- a8 C) c) n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Q( [: k# E, D* y7 [: d6 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) R, O& ^+ D. a; {, I; w& m* n- A: M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 W# A9 `, ^# A1 H) _0 G* U - #else4 y" M5 L L, y ]/ @
- #define DMA_PRINTK( x... )
/ M; `% m+ T* t- t% |$ Y8 n/ G - #define DMA_FN_IN6 `1 l2 z1 T, N3 `' {+ {
- #define DMA_FN_OUT0 n9 E; d. x; [! ~; E" c5 H
- #endif; t& q$ V. J" L3 A P- Z5 V
- {$ d8 G @ Z8 p# z! |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ e- u) l6 b" Q - #define STATIC_SHIFT 3
6 a% V7 U" P& _ } - #define TCINTEN_SHIFT 20; u- Q* O/ t' r2 A. i k, D# T. S
- #define ITCINTEN_SHIFT 21, t2 P. o4 n" M
- #define TCCHEN_SHIFT 22
7 Q* H+ O2 I+ I: }& }; D& S, j - #define ITCCHEN_SHIFT 23, K, Z# O' R% G3 Z
- 6 m+ N* `, a0 _0 ?9 J4 \
- static volatile int irqraised1 = 0;
" P; M) E! H F) J7 V/ R. ] - static volatile int irqraised2 = 0;
% y( g' i! E6 U- [- T - / W. b* f- x; b- X H* W7 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n% Z7 _1 M# r5 @/ U' c) S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u+ I. B! N8 a& O5 V' e4 D9 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m2 g5 e* G/ u: Y
7 J/ e% s5 Q- u7 G, s. J5 ~- dma_addr_t dmaphyssrc1 = 0;' X; G. a/ H4 ?7 G
- dma_addr_t dmaphyssrc2 = 0;
, s7 k2 V. o, w8 v - dma_addr_t dmaphysdest1 = 0;
+ N- w6 J+ q1 q7 y" D - dma_addr_t dmaphysdest2 = 0;9 I z' J3 {7 z& v+ ?$ n
- ( `4 k' e* M% ?
- char *dmabufsrc1 = NULL;, W. R7 |* Z3 c+ `( i. o/ i# w
- char *dmabufsrc2 = NULL;
2 }1 d% Y9 M& x/ m( e* |' X - char *dmabufdest1 = NULL;2 A0 C2 c4 H! k5 L! s
- char *dmabufdest2 = NULL;4 O2 P2 O$ `# f7 U" Q$ k. M9 D! b
- $ X, ~; C& m( r7 \7 y
- static int acnt = 512;
: k1 g1 I4 ~2 H; { - static int bcnt = 8;
- E, k0 t7 W K" e4 Z - static int ccnt = 8;
0 ^' @5 I. E( i6 O) K3 P' t
. Q/ ~6 ?! r6 }" M6 D, `- module_param(acnt, int, S_IRUGO);0 D! l9 z' k8 f- u# |% j
- module_param(bcnt, int, S_IRUGO); F4 D" ^6 s4 W
- module_param(ccnt, int, S_IRUGO);
复制代码 ' s% M, B& k5 Z V
! A7 [7 B% n( {# R! Q3 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 h9 X2 {+ h0 A6 }8 \5 j8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% {/ x4 V6 c( t0 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# }% F4 \5 D7 g# h1 y1 q* Q y
! K! e+ l9 h. P& y- x
3 a7 O- i; u1 w |
|