|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
y. G' V& @: C6 ?% ]4 Q- [code]EDMA sample test application) F$ I8 ?0 ^1 `- I: Q7 X
- /*
' M' P4 C3 o" u$ Z - * edma_test.c
1 o: n- y' a5 P9 Q4 q! O - *
' e% Z1 p+ w. ~ - * brief EDMA3 Test Application
! o6 H- @! c& @1 u - *- t" p& Q0 i: h/ Y' h0 ^; \, s
- * This file contains EDMA3 Test code.
\6 d& Y5 k- E9 A - *& t8 }- e4 C' C1 m7 a. N. B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ A0 e& I" K0 U* u/ h# }! i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* [) `5 H3 S& u) [; x, s - * TO CHANGE.
! Q: B- D- d t" }: ?4 a - *
. K( t" C$ _; v/ a8 K" u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! b/ B! J- `+ \! c
- *
; u( Z' d9 l) L" R! y# X! o - * This program is free software; you can redistribute it and/or
& z3 Y! r) o' P# ~6 x( t - * modify it under the terms of the GNU General Public License as5 i$ I! R* Y, C
- * published by the Free Software Foundation version 2.
y% i* H! @5 \: S - *
! a2 Y) w O7 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, a7 J/ j; e2 K7 N/ C. C
- * kind, whether express or implied; without even the implied warranty
! l# }7 X: E$ T% W& ?* e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 S4 v6 ~# u r) M: V- J& h. c- k+ F - * GNU General Public License for more details.
" }# p1 G4 V; p, X8 t; j7 j - */
3 q/ X2 p$ C) l' b1 [( x# ^# A3 l
; i/ n1 G* O* t. J- #include <linux/module.h>4 h0 d7 L ~; w& K
- #include <linux/init.h>
) Q: J' Q; F& U4 Q; P( F - #include <linux/errno.h> S1 Y: O& K! r- ^% o7 S0 v
- #include <linux/types.h>
5 S5 x9 n+ f$ V- s+ e* @ - #include <linux/interrupt.h>
# S: A" {) W3 S2 W3 I# a' x# Q - #include <asm/io.h>, d, P6 L) ^2 m3 d0 ~
- #include <linux/moduleparam.h>
9 I+ z# E2 A3 R, x7 S2 F' Y - #include <linux/sysctl.h>
# y& E- y4 g5 C/ S - #include <linux/mm.h>8 D( q3 [, X# ~2 m E! \9 v
- #include <linux/dma-mapping.h>; e: p8 K% U1 r
- * K* e3 y* h; K& u- Z
- #include <mach/memory.h>3 z7 [& r/ b2 x4 W
- #include <mach/hardware.h>
9 E1 C; k* y2 T - #include <mach/irqs.h>
& f! u+ p( L% M8 ^( c - #include <asm/hardware/edma.h>4 @/ R; ^. h5 @" x! b! @0 N
- $ p3 R; j9 r, F
- #undef EDMA3_DEBUG
" l2 n) H; }( J0 F. V" k - /*#define EDMA3_DEBUG*/
) h6 `) A, r$ @. u1 b
; v Z# {2 {: s# O. i5 L- #ifdef EDMA3_DEBUG
' c9 {- Q$ \3 u* E5 C/ W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 s; N. O' Z+ D3 m! _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( Z9 T" R( Z. ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 t8 x: t9 T* N3 ^( } V4 ~
- #else" T+ |1 X% L2 B
- #define DMA_PRINTK( x... )
+ u: M. l4 O# r: x' f2 ` - #define DMA_FN_IN
# O: n7 T, u4 }: z: s - #define DMA_FN_OUT" o4 C# @0 Y# B8 I4 d2 s- P4 \. ^5 P
- #endif
5 O5 Z( n+ Q$ h1 x N" l - 3 F2 a0 A. T# N3 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). h6 D1 }3 f- t/ C9 E) \; r m
- #define STATIC_SHIFT 3
3 t* b3 @0 G$ ? A. t. x3 d0 y4 t2 z - #define TCINTEN_SHIFT 20) f* B& ~; _0 Z9 h
- #define ITCINTEN_SHIFT 21. `/ r5 V5 O2 g% `
- #define TCCHEN_SHIFT 22& i, l+ _2 ?9 Y5 j: J
- #define ITCCHEN_SHIFT 237 s _1 w$ G6 I2 i( V
- 6 n% H" [! d$ J% B: E$ \: T9 Y
- static volatile int irqraised1 = 0;+ T& w4 q5 Y" B B$ L
- static volatile int irqraised2 = 0;
4 B4 B9 O' ?( l4 y, N& C
! Z* t( S) D h( u% g7 P% A0 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J9 z( o) I" p' \2 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f L8 m9 L9 w a! R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D8 ~3 V1 B& A% f( h) t1 l
- ( w0 F5 y$ ]" G+ A, I% H3 I ^" [
- dma_addr_t dmaphyssrc1 = 0;- r: ? U/ h( ~2 R& a I0 Y& o0 s
- dma_addr_t dmaphyssrc2 = 0;
8 ^7 e: ~2 K8 q+ y- V - dma_addr_t dmaphysdest1 = 0;/ F* L. @+ J) }$ v- J
- dma_addr_t dmaphysdest2 = 0;
& s/ D) {$ c- x( p$ U0 Y# G - $ Q. J; F0 T {
- char *dmabufsrc1 = NULL;
9 G$ Z/ E# E' t% a8 u - char *dmabufsrc2 = NULL;
2 {2 f( y" |. q" V. W - char *dmabufdest1 = NULL;
' k+ |7 I. f( J+ D/ L - char *dmabufdest2 = NULL;: Z3 X5 F& P; f) O! j
- - f. X6 `4 l; s! b
- static int acnt = 512;% Z2 x* \4 H4 G* F( X, q# T4 Q
- static int bcnt = 8;' l# c+ N: O# }6 R' |
- static int ccnt = 8;
7 {: h$ m4 r u8 w/ r% R0 ~# W
3 y) b( ?( D8 i" c4 I- module_param(acnt, int, S_IRUGO);: s/ f3 C( @; O- u9 S) R8 x
- module_param(bcnt, int, S_IRUGO);% \! ^2 o8 I1 U1 m' h, I' |$ R% w
- module_param(ccnt, int, S_IRUGO);
复制代码
9 O0 b/ k( K4 e+ e) h
c: R. Q6 t# s+ G& N: l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
k4 x) P4 B3 q) varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% y1 j8 w/ m) U5 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |. N% t2 @7 _. {+ c, [$ C+ R
1 q) @2 I+ y3 y! C3 r8 U, g, V
4 w. ^! W8 w( h5 I% y
|
|