|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _9 @, L$ p; |& X Y" C, O+ h
- [code]EDMA sample test application
# d% Q9 b& ?# t' }! a V4 b5 U - /*3 L" {0 Q& _7 Q2 I+ U
- * edma_test.c5 K/ }% c/ P2 I3 d
- *, V/ J# I5 ?6 {* f& Y
- * brief EDMA3 Test Application6 Y9 y' Z2 @1 V
- *
/ q m2 l2 y- L- s - * This file contains EDMA3 Test code.- t6 {/ f- {0 I& T9 V2 c$ U0 k
- *
# M( b+ Z7 d( _6 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) i( r1 l3 \. Y8 E \* ?5 q0 F* { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( |. c" g- u; T4 k5 y; E
- * TO CHANGE.0 S' y4 V5 E1 K4 Y( g9 L! z
- *
1 u; l- u3 z. X Q% i9 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 @$ E# _: K, X. g+ s
- *5 @$ j! _6 O# I* \% X' j
- * This program is free software; you can redistribute it and/or& ?9 E' M: a9 g' Z( ?
- * modify it under the terms of the GNU General Public License as
( i2 r! |/ B. Q! c! M4 `* o - * published by the Free Software Foundation version 2.5 _9 v/ ~; E7 r
- ** R8 O6 B+ r. m2 p% S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 r. I6 @. z7 G9 j& h% y4 \9 P - * kind, whether express or implied; without even the implied warranty
' H5 t: Z/ J8 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 Z) z! r) N/ {; N' D1 d2 ]$ E
- * GNU General Public License for more details.
d: E; h6 r- S3 d - */
8 I6 B) z6 H8 f4 U1 |3 ]
$ o* W0 e% N( [, `$ z6 g- #include <linux/module.h>
' l: _" a" Q. C- [8 I5 N - #include <linux/init.h>0 G' T+ m: W' j7 L$ p
- #include <linux/errno.h>
& |1 [' d7 M. G& T8 h, \$ W - #include <linux/types.h>! A2 b; v/ [5 h
- #include <linux/interrupt.h>5 { s+ ]7 n! Q7 q
- #include <asm/io.h>
) ?: r' X2 n. b+ g; s - #include <linux/moduleparam.h>0 I3 G$ U |* [& x* t
- #include <linux/sysctl.h>' E4 h7 ~+ G; m! J2 N3 K& y: l
- #include <linux/mm.h>
/ w% L* q# e# x$ @# x2 \# K - #include <linux/dma-mapping.h>
2 I4 ?* m# ~6 N. Y& v
; ?6 N, B, S+ P' U! H4 X, t2 K- #include <mach/memory.h>
& ~" w! P+ E2 w0 _) D$ s - #include <mach/hardware.h>% Q7 T5 P4 r8 }
- #include <mach/irqs.h>( ^2 c! f/ i! l# c/ H) p
- #include <asm/hardware/edma.h>. O8 u2 D7 J+ k, H: N- V" h, v: I
- 1 Y( J3 x- u5 \ ~7 P5 d* s
- #undef EDMA3_DEBUG6 A3 r! d/ v" Z0 F0 d- m
- /*#define EDMA3_DEBUG*/
2 S' l' x! U4 y9 ?5 P
" Z+ \4 e0 y8 a- #ifdef EDMA3_DEBUG
. s! A2 d# A7 [5 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). x% e4 p! b+ ^; C6 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 x% q& n% j: h* L1 C/ C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ j2 g. J( K' u3 b) I3 t3 S! E
- #else8 ]" \- H7 b! r( n
- #define DMA_PRINTK( x... )& Q$ }8 G: p9 Q3 l" w
- #define DMA_FN_IN
7 M" q' ~9 m' ^: P3 Q) k - #define DMA_FN_OUT
# H. s2 Z0 Y" W% c5 a6 O - #endif( ^, O% y \6 f K
- 3 {: Q7 @1 R! d2 o' L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- ^ T6 j! U- H" G* [
- #define STATIC_SHIFT 3
) U. q ] t! s* f8 u) u, Q - #define TCINTEN_SHIFT 20
7 q* R, }7 W9 J8 X( k, u - #define ITCINTEN_SHIFT 214 m; D- x0 [) L- X
- #define TCCHEN_SHIFT 22
/ ~' y0 x+ {& v/ ?7 ^5 N% k& e8 Z - #define ITCCHEN_SHIFT 23; N ~6 `& B( Y6 x& J
& P; _4 r1 s8 b' G. p- static volatile int irqraised1 = 0;
# h: G1 K! x( T/ N - static volatile int irqraised2 = 0;
Z. |' [3 k: h0 { - : N# `9 ~3 E. b) h4 j+ d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h! }% P0 J+ e% y# | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# D5 u" e" ^ d K2 Y. m/ s. y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Q( L& ~ J0 h( I* ] G
: p7 R3 W) X9 v# Q, V) J2 i9 A! n- dma_addr_t dmaphyssrc1 = 0;
0 [ ?% U* ]: X, _9 V - dma_addr_t dmaphyssrc2 = 0;0 f, _+ Y. W, ]( z8 ~/ y8 T
- dma_addr_t dmaphysdest1 = 0;
; m$ a* a+ f) I0 \; w# x - dma_addr_t dmaphysdest2 = 0;' y6 |# Q* }: I$ @. u
- & u# T' R* e6 O/ b( S: X( _
- char *dmabufsrc1 = NULL;
6 y2 {( I( C! e4 @) @4 B5 B - char *dmabufsrc2 = NULL;
/ `8 o1 U7 R* y - char *dmabufdest1 = NULL;5 F9 I! a8 O2 J2 k0 \2 \
- char *dmabufdest2 = NULL;3 X. T4 Q: X$ W0 c" v
- 1 y; y0 H x3 P) h U
- static int acnt = 512;; j; Q, F7 F, L I
- static int bcnt = 8;7 x) l9 L: V$ }5 v) b: X
- static int ccnt = 8;
# Z# M$ p9 V( _, _4 r# Q
8 Y8 X" }1 [& N6 ^" _- module_param(acnt, int, S_IRUGO);% O; C9 ~! X$ M
- module_param(bcnt, int, S_IRUGO);
! t6 G" V9 D- ~" n; E - module_param(ccnt, int, S_IRUGO);
复制代码 7 K( S6 b" |4 A
8 U3 k! j% ]: ^6 D. L* G: \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y& u: ^3 M8 {" ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' o5 x1 E5 B X5 j/ |2 {, d& e( |& z7 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p+ K9 s! U( g3 s; G" K/ i, m; ^5 E% R2 U
9 H% k8 y0 A! z. @4 a! I' X3 ]
|
|