|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! X' p& w* d0 ~- [code]EDMA sample test application/ t, w$ G& B# [" ?
- /*5 \+ J5 Z' k/ t! Y& w
- * edma_test.c
1 p5 \3 M; z7 H" }) { - *. h v g/ P. K9 g4 V# U
- * brief EDMA3 Test Application' h$ g3 L* k2 ?4 P2 t {* S
- *4 U5 l, {9 ^( C" n8 y
- * This file contains EDMA3 Test code. @( F! k* V# @/ u6 V: V
- *
" b3 Y8 |1 b0 z+ A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' S3 X' b% B8 M2 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. P) b' q) _2 F+ j; v6 a - * TO CHANGE.
7 u6 a3 e- `! @: G7 ?2 ~ - *
/ [' \; K" M6 O% Y' o. W4 y% S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 t t* p4 \% k( [2 c! j
- *
' k; W M, l( P% x# ^( s - * This program is free software; you can redistribute it and/or
$ O/ n% i& H5 T& ]$ C9 {; P, L - * modify it under the terms of the GNU General Public License as
; i' H8 D- t g2 | - * published by the Free Software Foundation version 2.) k! |1 Y- T) b; l
- ** A( x- ~9 E$ Q7 Q/ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( a, c2 d9 u! u. u: t5 n8 l9 z* ?
- * kind, whether express or implied; without even the implied warranty; v, k- a" n7 m$ d& N8 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 s1 G0 _# o" e8 p0 ?/ G - * GNU General Public License for more details.5 W" A3 g3 u. i' `' m+ I- E
- */
$ R5 Q) y @( l, t8 D - # G: C# k6 [7 {5 z' X1 M4 P
- #include <linux/module.h>
. d, N' w! _( W% l0 }1 u1 C - #include <linux/init.h>1 O8 A' ?+ m! E3 e9 ]
- #include <linux/errno.h> n6 S$ z# K, k5 {: H
- #include <linux/types.h>
0 {) G9 @1 y7 f- }: U' u& B - #include <linux/interrupt.h>" j+ v9 y5 `2 l6 G) P
- #include <asm/io.h>+ t; b" e+ A# n. _9 u
- #include <linux/moduleparam.h>
! ~& j; I; ^- [+ b - #include <linux/sysctl.h>
1 l5 }, n2 ?$ i( M( {7 S - #include <linux/mm.h>2 c# t% u/ `2 k6 r
- #include <linux/dma-mapping.h>
4 t' J* B2 m: j% |* T: R& G5 c& ~
6 v; C3 U7 E# j0 h0 p- #include <mach/memory.h>1 a* Y# ^! }) b6 p+ r
- #include <mach/hardware.h>
/ R9 x( \; y+ o! w - #include <mach/irqs.h>+ G& {* j) j d' K% b2 x5 Q
- #include <asm/hardware/edma.h>
! K9 ^, h3 _+ g* h2 N
$ M2 L& P* u, _- p6 a C% {* {! ?- #undef EDMA3_DEBUG
1 t, ] q, a ^. V - /*#define EDMA3_DEBUG*/" o0 _1 M: X; ]3 `4 h; q0 ?! F" R
- 9 a u/ O$ v+ k
- #ifdef EDMA3_DEBUG
# x3 ]# U' {* v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. E5 S! _, K, x% [. n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- d1 W L/ F5 f- v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% m( s9 g3 m* d - #else. ^! f5 B. H' \0 {; U+ ~
- #define DMA_PRINTK( x... )
2 v& e0 ]6 w" m! V5 ] - #define DMA_FN_IN7 b2 `7 Z% b$ t( @* g# ~2 Z
- #define DMA_FN_OUT
: B% L+ C# N/ z% ] - #endif! A& u: W s( m
0 T1 ~$ p+ ~* P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& [, [( e/ P+ s2 i: R Y
- #define STATIC_SHIFT 3 R) e- e3 K( ~: _7 W
- #define TCINTEN_SHIFT 20
$ u9 S+ l( H p& v: A7 ]1 I - #define ITCINTEN_SHIFT 21! @& z6 J) J5 b0 I! s' P1 r
- #define TCCHEN_SHIFT 22
1 D4 O9 \* J, u6 C - #define ITCCHEN_SHIFT 23
" p" R, t/ D- c9 A( A7 C
( p) l; c7 G( |7 U% f9 d) @- static volatile int irqraised1 = 0;
4 n/ z0 t# ], w- N1 k# W, i - static volatile int irqraised2 = 0;! y2 g! Q1 A. ~) w) Z! [
) k; ^3 T, E9 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 o( T0 Y8 b4 g! p% \) n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^; @. @( K: Q' X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?; F$ A% g: f8 R) f8 R - 6 i% \/ y7 W% Z4 l' G5 t' `' }
- dma_addr_t dmaphyssrc1 = 0;$ T5 h/ G5 ?/ ]; o4 K E6 T
- dma_addr_t dmaphyssrc2 = 0;- M* q) `8 S. ?2 H8 h( D1 w7 k
- dma_addr_t dmaphysdest1 = 0;
4 Z$ n8 [1 o9 U- v - dma_addr_t dmaphysdest2 = 0;
1 L0 a0 g8 c; B, n
0 j/ ?: F2 J. A9 D$ ]- char *dmabufsrc1 = NULL;" u; O' Q/ z1 g! T
- char *dmabufsrc2 = NULL;
; y# a" @3 W, k0 O* p - char *dmabufdest1 = NULL;
' o4 s. W! `5 F" p/ u1 f1 @ - char *dmabufdest2 = NULL;
, B; N: k( ]& u c
& [/ z9 @" M/ v# K" b6 @" f- static int acnt = 512;9 H d; v; }2 M6 X5 H
- static int bcnt = 8;
' D9 G% J! L5 D" c/ b0 V- ~7 S - static int ccnt = 8;; g, c+ f. P0 U* n( X
- * z2 y3 o7 l! k. C9 O6 x; _2 g
- module_param(acnt, int, S_IRUGO);/ c7 A+ C& O9 |9 D7 A* e7 Y+ o
- module_param(bcnt, int, S_IRUGO);
+ [. S. Z- M1 h1 p* k; Q3 B7 m2 J5 } - module_param(ccnt, int, S_IRUGO);
复制代码 ; T. c4 D* K1 K3 l, c8 g. c
8 {0 O, K. V# J. U+ u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 C y; R4 y. N. A8 E4 e' i! m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 W' e" `, X8 F3 |% s# U& |) R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 x3 j3 I, G/ N5 |. y. g' @3 s/ U. `6 T" t7 Q2 ?" q9 U
0 E( M& E& F9 x7 a8 e
|
|