|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 g& i) i' Y' @( @ M0 Q% \
- [code]EDMA sample test application
. e' U2 Q& H: t$ A1 k) L2 N3 x% _ - /*
P c- c0 n8 ] t% a - * edma_test.c, e! b/ e; \/ ^" e
- *3 w8 S/ T" |0 ]6 o4 f
- * brief EDMA3 Test Application
% H. q8 T& ^6 z5 ?. W+ o - *# o3 l `- I7 \
- * This file contains EDMA3 Test code.
& w3 {+ v$ b! D7 x# o% [ - *
+ O* q( M/ b+ _7 v; E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# _( R9 A5 o9 ?/ Y% Q! u( w* c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ w# P$ ~# c" V6 z5 ]3 I& } - * TO CHANGE.& c/ `5 _0 @3 u1 s7 a: p8 x
- *
6 A( @% W2 B* D2 F2 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ i9 Y+ P2 u' D% Z, m |% a$ u1 t - *
) E% i; \1 Z, A, N; [& ` o - * This program is free software; you can redistribute it and/or
$ J% ^/ Y! X0 U' D; w0 y - * modify it under the terms of the GNU General Public License as
/ f: c" W) o( D" U1 R' k - * published by the Free Software Foundation version 2.
* l! H) n% n6 v1 N2 t$ B' [5 u - *
& z# U [+ Y$ ?4 Z: a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 c% b' I$ O( q9 W
- * kind, whether express or implied; without even the implied warranty" b4 \4 |$ o2 G3 A* |; y R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* d4 l" ^1 h3 \. ~# i9 C - * GNU General Public License for more details.' f, v6 d& b0 w$ y1 T8 V! v2 I
- */
# ^+ k# `3 k: C. w6 U" u. L8 {: y& T - ( A6 {" L1 _0 ?& x' R. v( \
- #include <linux/module.h>, ~( H Q# I+ M2 ~/ ]; r- ]' f) l6 p
- #include <linux/init.h>8 N2 v1 {( O" e! r7 a
- #include <linux/errno.h>
$ k+ u0 E. o# r: P+ V- t D - #include <linux/types.h>" B9 \# m" f2 W/ y J$ p; q$ O. J
- #include <linux/interrupt.h>
6 j/ M( V+ U9 v1 k% D - #include <asm/io.h>0 q4 i/ p$ q' j) S
- #include <linux/moduleparam.h>9 z9 J0 o# k/ h# y' [: W" u
- #include <linux/sysctl.h>
8 a( t6 F! W2 N0 e - #include <linux/mm.h>3 o$ }; Z1 P3 ?9 o, N) N& z8 W
- #include <linux/dma-mapping.h>/ ?7 U+ E( Y$ f% p* @8 p, T
0 p4 D( T5 p7 K" z; U( e- #include <mach/memory.h>$ v$ Z; N0 ^2 G7 u
- #include <mach/hardware.h>% V6 n% x# _( K! C! ^
- #include <mach/irqs.h>; F# z+ M# O& S7 i3 U
- #include <asm/hardware/edma.h>+ O7 B$ N! Y% K7 I% q" O0 B
- 0 K" Q( N% q5 p% f2 _
- #undef EDMA3_DEBUG
0 ]: P& T- [2 \: b - /*#define EDMA3_DEBUG*/ ^: [" s& B7 q5 B. L# m8 P2 U
- u9 h& W$ H* G* ?. z2 x0 }- S. o
- #ifdef EDMA3_DEBUG# Q# [# C4 F, r: J: d. x5 K/ g- \$ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 L, X1 u$ F7 k/ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ K7 n: _: ^( A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s, S+ o" i# P; b) s" h
- #else, H. k- H( {4 e1 N" r( T! ^
- #define DMA_PRINTK( x... )
/ L1 {4 s; h' [6 v5 [$ K - #define DMA_FN_IN
1 r, ?; b4 M* T. ~# M: E; U - #define DMA_FN_OUT
/ V, l' @4 E; ?# V! W. w - #endif p$ |; n' m; {8 U" S+ g. x
" J0 a+ @7 q& A4 I- S8 J, S4 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768); v5 {9 c% B6 {0 w' y
- #define STATIC_SHIFT 3, c8 w) G9 ?8 j1 r% A- G" [3 v* B& f
- #define TCINTEN_SHIFT 205 l* V; L! n8 H t: S0 h
- #define ITCINTEN_SHIFT 216 t3 W% W3 c& `$ G5 b8 b$ e
- #define TCCHEN_SHIFT 22
+ ^# g/ r0 f" X/ G6 V) e - #define ITCCHEN_SHIFT 239 w3 F5 N3 w4 M5 [+ Q
+ }- X6 ]4 e* n- o& R( B+ z- static volatile int irqraised1 = 0;
9 u' L3 w H$ K( ? - static volatile int irqraised2 = 0;6 \: E. k0 R( L( c7 s& Q
- ( j/ A8 Z# A5 c' j1 R9 `) k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @& p. G- t6 A& k3 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 H+ ?: i1 k- T8 w5 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 g% D3 E8 V# j$ {$ f
& y ~. q- w! W- dma_addr_t dmaphyssrc1 = 0;
; i$ Z6 L/ g+ N# I; G8 p% [. Z - dma_addr_t dmaphyssrc2 = 0;# @6 b/ _+ v: i
- dma_addr_t dmaphysdest1 = 0;
' O3 y6 K: h& N9 T - dma_addr_t dmaphysdest2 = 0;
6 o, {% ?" P2 G) ] - ! I+ [8 u j7 c( M1 Q
- char *dmabufsrc1 = NULL;( R5 B$ _3 ~1 A, Z2 ?/ ]3 |. ?
- char *dmabufsrc2 = NULL;
" S U, g7 P' @ - char *dmabufdest1 = NULL;
$ ]. B1 v) p& e5 v' D - char *dmabufdest2 = NULL;3 X5 S% }& e4 T9 r! R& A8 B
- ( x0 M# G% G- |5 R
- static int acnt = 512;
( A, U4 h+ S; O+ e- L2 C- Q! X1 f - static int bcnt = 8;) M$ Z& ~. Y; ~* ?; q" @$ b- X1 T
- static int ccnt = 8;( Y5 G3 H$ G) q) N; |2 _
# G5 [( B1 s( z6 _' x+ D- module_param(acnt, int, S_IRUGO);
% }) c# K) T' W' p$ @ - module_param(bcnt, int, S_IRUGO);( i, R' f' D8 a) {# O
- module_param(ccnt, int, S_IRUGO);
复制代码
: \& k4 I+ c0 @; Q4 r( ~' F6 A% W. [( I$ o& M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _/ n7 C8 L8 m& F; { s( T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% v6 `( a9 c( V9 j" I) o3 ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, i( J2 Q& ?3 T2 i# x- \# V# y5 L6 k! R! Z1 Z9 f3 L! a
# v! R- M. C: m |
|