|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 F. ?4 [7 F& L' z0 n7 f V3 c! ~- [code]EDMA sample test application
- ]% i& N4 W5 B. K. E* [: C - /*! F k& J5 h) f, M
- * edma_test.c7 ?9 y) G9 M O4 i, Z7 k9 s1 B) ~
- *
& X9 M; h+ P% S - * brief EDMA3 Test Application: W4 j! I {/ \9 ^
- *
" R; D- n0 ^/ Z& r8 ~+ ` - * This file contains EDMA3 Test code.) w, {+ I& y, A; U
- *
I' U* s8 P( ^* U0 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 d% t4 y# x1 s( Z$ p! t; x* W6 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# @3 v: P% T% e; W' u" | - * TO CHANGE.
( D6 a- f1 l& O, P$ a% u( x# u: x - *
9 R; r& X. W# ^9 p8 i) Q) o5 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 g# U* V8 Q5 y6 I5 l( B: L6 S
- *; D3 s1 L V8 j3 y) U7 W
- * This program is free software; you can redistribute it and/or
( x3 {" P0 P+ h5 u2 l - * modify it under the terms of the GNU General Public License as
7 f; C' v9 Z* y, ?/ r1 w - * published by the Free Software Foundation version 2.
6 f4 h! ?9 j2 e" u - *8 ?$ z$ y2 o: ?! K* }' f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ G4 o+ W$ k' L% w3 o
- * kind, whether express or implied; without even the implied warranty
7 L, z3 Y9 S6 j& i! l7 ]* [* f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& d6 R+ o/ I! ]) f
- * GNU General Public License for more details.4 t& I; l' W) |: t4 }
- */
+ o" i% R& L( F9 X! }
; |3 ^$ _; C% ~0 m/ F- #include <linux/module.h>
# M) S8 l! Z. N9 F5 J, D; O - #include <linux/init.h># t# `) U$ m) v" X X
- #include <linux/errno.h>
4 K( f9 s- h" C7 r* O - #include <linux/types.h>
/ W8 z" F5 w4 U$ v" e9 E( X, @ U - #include <linux/interrupt.h>
, u6 \- S# h/ U7 v* f* x+ D# H - #include <asm/io.h>% }* O7 o$ S2 ~2 g
- #include <linux/moduleparam.h>5 o. d4 P( ]: i( J; H
- #include <linux/sysctl.h>
- s. [5 Z5 T8 X) _ - #include <linux/mm.h>
/ K r9 @9 ]1 w8 S2 I8 C/ C - #include <linux/dma-mapping.h>
$ f( R3 H: M4 X4 z( I; x" b - - `' Q* E' Z, T1 w$ t
- #include <mach/memory.h>
+ P' D- a2 [/ H0 S7 | ^' k3 s5 G: X - #include <mach/hardware.h>3 x7 p6 R( O8 `& i8 o
- #include <mach/irqs.h>( |6 X c8 `7 x( c4 S6 h! [
- #include <asm/hardware/edma.h>" P: [/ }9 U! l7 p0 O
- $ c5 Y3 ~" C/ U0 w% i9 ?: L7 K
- #undef EDMA3_DEBUG
+ ^2 p0 S1 m% _ b6 D& ^ - /*#define EDMA3_DEBUG*/! \& ?3 o$ s& k. G/ v% x
4 r4 S2 p( P& |9 o0 S+ o1 w- #ifdef EDMA3_DEBUG
# t1 _6 z& B* A. P2 Z- p! G+ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ M2 ~6 K/ a8 K+ ^( s, G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& N, M8 e3 X/ i* W, E) B$ n# s2 q1 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ?7 k: \% v5 z) T
- #else! R! d$ p, s% t% d- w
- #define DMA_PRINTK( x... )
8 u2 k; o$ S: u+ d7 r3 s b+ g% v - #define DMA_FN_IN
* \3 L+ w& P* j' }: Q* P - #define DMA_FN_OUT' u5 F3 k. Y, Y8 j
- #endif9 E! `/ E7 P" o; a
Z8 y" H1 ~" L7 A$ v/ w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 O; P" [1 p8 E# ` - #define STATIC_SHIFT 3
/ M6 C0 w9 P" ?/ @- W Z - #define TCINTEN_SHIFT 20! R, r/ v& Z. G
- #define ITCINTEN_SHIFT 21
8 B& w$ S2 L5 z( T - #define TCCHEN_SHIFT 223 |# w) \ T5 d- q' B
- #define ITCCHEN_SHIFT 23
' R) }$ O8 J |! e - 1 l( ?; s' ]% @2 @+ a' H$ z/ \
- static volatile int irqraised1 = 0;$ z) c N I, w
- static volatile int irqraised2 = 0;0 n, R: R; O( S2 J7 p5 `: M& ^
- , J9 J/ }# Y! f% e& }& D6 g& B0 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H! u8 {1 ?0 |- s8 A, H3 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
g; A7 c/ W. m; {# M: Z4 @7 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t) w" y) H( m1 |1 k# s) H
; I2 J* y- r- X( \3 }( u- dma_addr_t dmaphyssrc1 = 0;
6 M F8 |; I; a4 w! A - dma_addr_t dmaphyssrc2 = 0;4 m0 |0 C" w- m
- dma_addr_t dmaphysdest1 = 0;) M( _9 W9 `% r. X
- dma_addr_t dmaphysdest2 = 0;/ Z- D- ]1 f8 s6 Z
7 O& [ S+ T; W3 y3 ~- char *dmabufsrc1 = NULL;
- u7 C3 g8 T( H - char *dmabufsrc2 = NULL;# _, z4 p9 `, w3 X4 L$ k
- char *dmabufdest1 = NULL;
! I0 v5 w, ^' Y' i9 }8 r' t - char *dmabufdest2 = NULL;
6 d; \+ B$ d# w* Y
$ b+ y5 N) Z% Z. I) {' i$ T- static int acnt = 512;7 { y4 D4 ^, ^! O- h0 U0 w# m
- static int bcnt = 8;
. @' v. b K( ?: X- Y2 k - static int ccnt = 8;9 G3 W4 D& X% x$ G" k E
- - E9 H# n$ C- x5 [# U8 |
- module_param(acnt, int, S_IRUGO);4 P8 i9 y0 `) N
- module_param(bcnt, int, S_IRUGO);8 u; k/ v5 ~3 A0 }/ m
- module_param(ccnt, int, S_IRUGO);
复制代码
. e4 P$ I% ~8 {
$ n' o G) p9 I; t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 s9 _- j& H1 N i7 i9 `8 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `' O! _7 e3 ? ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h1 g/ O' ^' j; A& a9 H
% t: u. X1 W. z
- v& Q+ F, G6 F/ Q0 U |
|