|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l! s& l' z# D* c9 r
- [code]EDMA sample test application! L3 w0 X$ H( z% S( C
- /*
# y" c( E+ C* R0 t" t3 k+ m - * edma_test.c8 b2 B S2 N8 z& J2 c3 K( K) [
- *
/ U7 N: R9 b/ y: L3 ?) I - * brief EDMA3 Test Application% G3 r9 g( k* D/ f: Y, \& K
- *
4 T y; }* p" P" F4 F5 [- { - * This file contains EDMA3 Test code.5 j; Q2 c! K' B, u2 l, j
- *
! o' _1 F) @% h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 t" o% G% m& ]( f% O0 f) y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
C1 J2 P" r( b' C" b6 J' l3 F - * TO CHANGE.
; R: M/ [+ ^; T$ E - *! |# e C5 x1 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! g$ r% d! e& ~4 p1 K# F - * h1 L. _; U& x& Z; e; T
- * This program is free software; you can redistribute it and/or9 t) s' W3 i# d5 F) K- `) b
- * modify it under the terms of the GNU General Public License as! B' d5 L; G% M
- * published by the Free Software Foundation version 2.
- W7 ~3 `$ Q1 p" C - *: y) J& P- @7 E1 R& ?& k! Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. {' M" ^+ P* e7 E2 ^ c6 t% o - * kind, whether express or implied; without even the implied warranty$ {9 V( E' v6 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. W0 @+ Q; {* l3 @$ |0 G8 h
- * GNU General Public License for more details.& }1 @9 {) B" I0 O/ x3 x
- */
9 Q- z- t3 _7 q0 c/ R+ k7 m - 3 \& O9 G6 Y- G0 h! @
- #include <linux/module.h>
* [4 c1 v' w2 _7 @% N - #include <linux/init.h>
+ A1 T9 F: L f2 z - #include <linux/errno.h>2 c _5 t- W& f7 D8 k; }
- #include <linux/types.h>3 h' C! b6 t! H( y1 h; y
- #include <linux/interrupt.h>
+ @. z' e. N t; ?: C - #include <asm/io.h>5 x$ J& U+ v/ h! v- V
- #include <linux/moduleparam.h>
+ H; |: z7 B9 ?* B - #include <linux/sysctl.h>9 r7 z2 v+ _% M. K' X8 ?: J
- #include <linux/mm.h>
) t) f1 i# ]7 T$ M( w; H - #include <linux/dma-mapping.h>
# X5 u. Q, o3 m* G5 l
8 W: z' s" R- E* E; L- #include <mach/memory.h>8 R" ]+ F$ v/ ?0 R0 b
- #include <mach/hardware.h>
7 q! j! F3 e q - #include <mach/irqs.h>
' Y# W8 u0 ]. H' x - #include <asm/hardware/edma.h>9 E" r* N9 A( K: d9 p
: K7 E8 M: p4 c+ V- #undef EDMA3_DEBUG
* ?# B B6 Q* \ - /*#define EDMA3_DEBUG*/8 g" I) h' \1 l' {
- 3 U% b1 g+ R& V* `: P# ]0 z
- #ifdef EDMA3_DEBUG
: m1 A! G. [6 N, |8 f% [2 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I& i; y- }3 z& U2 s i& @; e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ Y' B* W6 R0 h. g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). H+ E$ J1 [3 h! Y3 L+ `6 _
- #else
* b$ C( {9 P$ | - #define DMA_PRINTK( x... )
' D& x d! I p% f6 {6 X' Z - #define DMA_FN_IN6 q" V+ Q+ v; c
- #define DMA_FN_OUT
, w5 X- H% n$ O, ~ - #endif
1 w& a- J4 I1 F5 J# g& c) Q/ [4 g
% }, K7 k( j0 y6 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768) g d7 Z% q% w
- #define STATIC_SHIFT 3
2 ?3 {! U; {( l: x' L+ N - #define TCINTEN_SHIFT 20
) N3 h2 T! G0 K - #define ITCINTEN_SHIFT 21
5 ?( X W: E' H+ x/ A4 @4 G - #define TCCHEN_SHIFT 22
; U) j) E, ^1 V. N8 \* N) t! d - #define ITCCHEN_SHIFT 236 Q: k8 x- a+ C9 h1 e/ `
- 0 J& V' {! X5 K, h/ V5 r; A" ]
- static volatile int irqraised1 = 0;
# j+ [4 S% @- O y/ l - static volatile int irqraised2 = 0;6 i2 F8 U* a0 y7 f x) y6 u
5 t- v0 l$ Z( p, i* E5 F+ I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, a) y5 E. Z& b, m6 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {$ I. N) ]/ C- L( q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {; Q- ?& J* [
& \9 U& ^3 u" T \3 E" Q2 d- dma_addr_t dmaphyssrc1 = 0;. F- j, f+ e9 ?! ]
- dma_addr_t dmaphyssrc2 = 0;6 \# G2 o- q! g8 n7 Y/ q
- dma_addr_t dmaphysdest1 = 0;
6 Y) H0 C& q% I( A7 ^# O- }5 H - dma_addr_t dmaphysdest2 = 0;
$ e. b# Z0 y: u& a0 Q5 z - " S B0 M: k& D" l
- char *dmabufsrc1 = NULL;
" e% G( g( v, q; B9 v: A - char *dmabufsrc2 = NULL;; B% T' m- V; D: N7 ], {
- char *dmabufdest1 = NULL;+ l1 O4 N8 T: L7 d+ `
- char *dmabufdest2 = NULL;
# o w6 o2 f. r$ h* i3 i+ e
2 Q( U. f/ [, o5 d- static int acnt = 512;) Z# V: p5 B) B4 a; U! J
- static int bcnt = 8;
/ J0 _4 c- H; q0 x - static int ccnt = 8;
" _# G% ^) V8 O' T7 g% T. h" Q - ! Z a8 _" t3 s o( u5 m0 `
- module_param(acnt, int, S_IRUGO);: b9 m H: D3 B" E9 k
- module_param(bcnt, int, S_IRUGO);
& {' n/ i: `/ @3 `3 O - module_param(ccnt, int, S_IRUGO);
复制代码 - h# W) S) c) T2 Z6 z
& r7 s/ R) \" N! M& i' u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, u' c+ @8 s4 ]% X* Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ a2 ~) f% ?& t: g( d' _+ \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# B& G) A( j& E n9 c3 C9 D
. ~8 B1 b7 x6 t5 `' B4 n* s
. z% N% C6 }7 M' k9 ]1 @4 X |
|