|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Z0 O# T9 P- j7 t, J0 d+ d- [code]EDMA sample test application! G6 Q' {, X( y/ A
- /*- G; Y* W( N Y% o. O
- * edma_test.c
! g! P% T4 p1 [. m6 A - *
( M3 q! l8 F$ Q6 {& Y. ]" M - * brief EDMA3 Test Application# t' s0 s) q" H `+ H7 x
- *
5 `1 `; j, X) q3 ~& e3 B) X) ^ - * This file contains EDMA3 Test code.
1 I! n9 q! o- N- v- `- | - *& U# J8 W) a$ f1 k+ A- H2 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 P6 @% t# r# Q g3 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B* t& @; x6 ?$ e( k% \8 l: b& A. d
- * TO CHANGE.4 i& `/ a$ \; B4 d3 F
- *- W7 C& a }; Y. O$ ]1 F4 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% W2 }# A5 a& G - ** ~7 g' ^. _% z
- * This program is free software; you can redistribute it and/or7 k6 n' T2 @ e9 h0 _
- * modify it under the terms of the GNU General Public License as
) F7 |8 _$ _; `& \/ K( @ - * published by the Free Software Foundation version 2.
( d( l, P. h4 N/ l4 E5 }& ]3 m - * e6 ~* A8 Z# v2 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ p) j; j8 K6 p, w
- * kind, whether express or implied; without even the implied warranty( R1 W* {+ E2 V) B# l$ o3 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- D; \/ F4 e4 q/ t
- * GNU General Public License for more details.; r' D# y% a' E/ M, N8 m" n3 e9 {! f
- */: `3 `5 b6 h, S t
- 6 p. V9 H, w7 n' s
- #include <linux/module.h>
! i) F0 P2 l+ | E - #include <linux/init.h>- e8 l5 V Q# j+ ?; m7 J& W; a9 P
- #include <linux/errno.h>
1 {" V+ N7 C J - #include <linux/types.h>
0 _- W+ o ]8 e* Z - #include <linux/interrupt.h>
3 }& m7 @6 L2 Q% ~' B; ?7 l, i- W9 l - #include <asm/io.h>/ s& s4 x7 o; P+ M7 n7 o3 }
- #include <linux/moduleparam.h>8 ^! N9 h, ]$ c5 a; g
- #include <linux/sysctl.h>
7 L) T* W+ ^) b; l! y - #include <linux/mm.h>
! x0 x* W% g; W- f - #include <linux/dma-mapping.h>
& P9 g7 b1 o* G( {0 U
% t4 M" z0 d% h: h+ P- #include <mach/memory.h>) U3 z! b3 Y9 X. S9 s/ r
- #include <mach/hardware.h>7 W. r: y. y% V9 h( ~& m/ d
- #include <mach/irqs.h>
X. H& i2 n r2 r- n - #include <asm/hardware/edma.h>
) B8 c. ^3 y& B+ g+ @$ p5 T* a
$ a- @0 v" e7 S: o3 A6 e6 H- ]- #undef EDMA3_DEBUG9 H/ M: y# f! i2 @5 U
- /*#define EDMA3_DEBUG*/& D2 U/ d& C) b7 _* N9 E& O
# h/ ?0 K! `+ ?" m- #ifdef EDMA3_DEBUG
2 L3 N# v: n p* v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" i3 t9 \4 ^, N' p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). L% v: y# ^! F, q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 `5 y6 \2 [* N% h. n
- #else5 t4 I+ d( h: B2 @3 K. p
- #define DMA_PRINTK( x... )
4 h3 v( h. f# @7 e( i7 F8 h2 _" H7 N4 S - #define DMA_FN_IN" I$ B K* t2 y0 Y; F3 Q5 c
- #define DMA_FN_OUT
& ]) ?4 u+ T( ^7 w; B4 P" x0 W - #endif& L) c" A0 Y9 v: d+ D% R7 M
- ! \) q' z/ x5 s; D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; X' S/ m! p& D- P) i - #define STATIC_SHIFT 3+ S! D/ o' r* p
- #define TCINTEN_SHIFT 20( F+ f2 \& }+ ^% A! g
- #define ITCINTEN_SHIFT 21
: l Q/ i3 q! J* e5 j - #define TCCHEN_SHIFT 22( ^$ L6 T3 ^+ y6 W5 L* s
- #define ITCCHEN_SHIFT 23* z7 [2 a+ Y+ I4 o* e( _
- ( X& t- B# h8 i$ \% G8 D: i
- static volatile int irqraised1 = 0;9 H' }, ^5 ?8 _
- static volatile int irqraised2 = 0;- t) Y5 r2 s! B( d$ Y! d$ q O
5 y: p. P$ S0 A# V8 f& ~) G8 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: }* a# {4 _( U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _% s K7 |- i" j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ^8 u! O* Q. L) j% p3 T0 j
9 j/ l. [6 p a5 K- l# \" ~# k- dma_addr_t dmaphyssrc1 = 0;
% r" e! J. e. Z3 v& m - dma_addr_t dmaphyssrc2 = 0;8 S& K7 n% {4 E0 f! S, W
- dma_addr_t dmaphysdest1 = 0;
8 O6 M0 X& J) O - dma_addr_t dmaphysdest2 = 0;: b# Z( ]0 ]3 e+ O
4 z4 q+ N& _2 H! y: W* j* U- char *dmabufsrc1 = NULL;
& W7 M& R3 k2 O. [% { - char *dmabufsrc2 = NULL;
+ t/ o2 B& p8 ?$ l( P I( u - char *dmabufdest1 = NULL;, A8 {' z2 G% w k4 M" S7 U; t; |
- char *dmabufdest2 = NULL;5 p5 C$ y+ F% l
- 3 m( b3 I7 d9 h6 U- l
- static int acnt = 512;, {& a7 b% I" w! J
- static int bcnt = 8;1 x% L( S) e3 C8 i! T8 c" o( k0 ^
- static int ccnt = 8;
) D# N; F5 \1 O) N - & _. {0 {! p& u7 B& m- a
- module_param(acnt, int, S_IRUGO);+ ~# J) ~7 v% ]) o3 ^, m
- module_param(bcnt, int, S_IRUGO);
; o& [+ G0 F# j+ |% o - module_param(ccnt, int, S_IRUGO);
复制代码
9 _# [1 I4 }, w4 W% y* y
4 v$ g: v( Y: g! t' _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 T, D* G" @' ~0 C# g; k7 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
Y: l z# y. |' W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 r0 X3 S. `: E+ v) e9 }
! S! c( `$ L0 Y( h# Z4 | ^1 H* Q4 d8 X$ n& k0 s
|
|