|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* @/ p8 q i+ e6 d% s9 P- [code]EDMA sample test application
! V% ?- U7 h) Z: N1 R. h - /*3 X$ J3 Z$ l6 v
- * edma_test.c( H; J0 n b% b2 x' c
- *
' e" g' I5 K* x# D2 |4 |) J; Z* h1 J - * brief EDMA3 Test Application
. A1 {- n. |. x8 ^5 l$ N2 P$ c - *
4 R/ o) Z; T+ ~& z/ i6 `% v g% f( Z( ~ - * This file contains EDMA3 Test code.. I% S0 @0 J# h. H' I V/ X; ?
- *
" ]: F+ V% r, p; n1 x/ o- Q' Z2 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& d2 k! M' m- }; l( c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: @; q3 K! M- Z
- * TO CHANGE.
- I1 M' L% s: N7 K3 l. \+ o' N - */ Y4 V, t' W- b! S' h: n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 S1 I1 w2 M/ R6 W% B - *7 d, a$ A! k% W( M9 [2 t
- * This program is free software; you can redistribute it and/or
: e, t$ y6 \: {, w1 G - * modify it under the terms of the GNU General Public License as. ]; ^3 t7 C* ^: P
- * published by the Free Software Foundation version 2.
2 J( h( X' h/ R" p' g - *! w( D8 u2 ?$ @2 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" o; k# H! P5 G9 I4 B, ^ - * kind, whether express or implied; without even the implied warranty
6 i% X; O8 O6 l' R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the U- B/ } \) W7 j
- * GNU General Public License for more details.! B4 E4 ]5 W' ]0 h( a
- */
4 n& M; q2 i& K - ) u) {" c5 A, X! X+ }! o8 \
- #include <linux/module.h>6 T. Z+ R& O/ U- o: W) L, V" y8 f. G# x
- #include <linux/init.h>
" L8 E0 D6 s: Y! d2 r - #include <linux/errno.h>* K) I4 B/ f/ q5 h& t9 c$ t
- #include <linux/types.h>/ d& `! E, X- ~# o$ K6 c
- #include <linux/interrupt.h>) t' w$ M, Q) r7 k J! D( r! ^# b
- #include <asm/io.h>
' I5 J0 ?8 j/ A& `- ~& w7 ?; E# } - #include <linux/moduleparam.h>8 _' Q. G9 p1 s4 \2 ?
- #include <linux/sysctl.h>
) x$ n9 q$ j* |7 ]5 F - #include <linux/mm.h>& Z) x$ i% l; J' d: p
- #include <linux/dma-mapping.h>
}! p" I5 {6 z- ~' Z
7 b7 a& T$ l1 f- I* j$ V- #include <mach/memory.h>
0 w0 C7 z: @1 I - #include <mach/hardware.h>9 s4 `5 z5 ~7 J
- #include <mach/irqs.h>
: d' F0 j6 i+ }5 X' ] y u - #include <asm/hardware/edma.h>
9 e2 \) n3 W" |* q) d
4 p- h6 q# m" j$ z# l- #undef EDMA3_DEBUG( O Y! z- ]8 f; i
- /*#define EDMA3_DEBUG*/# ?( ^' i; C8 l. R
/ C& B9 d" O8 _/ y- #ifdef EDMA3_DEBUG" S' ?) R9 _9 Y" A$ J# ~$ x3 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 i5 d0 M3 _" K/ M3 B$ F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& B) y# H& L9 }- T8 N& R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& D' @9 { m( x: ~ - #else
5 b& T& o/ N$ \$ G9 _ - #define DMA_PRINTK( x... )
, J$ i' ~. r" X4 z1 w - #define DMA_FN_IN9 ?3 ?9 y0 [- g# `1 n0 N! J
- #define DMA_FN_OUT
2 r9 m4 X$ A9 X% \8 o - #endif, x r2 T# B/ N- @# W) O
- ( b; E( k2 \; f, E7 `/ }/ K+ y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 W8 t9 a& Y' m/ Q% C1 @% P+ E
- #define STATIC_SHIFT 30 Z( M1 N; ~3 h+ e1 {4 `
- #define TCINTEN_SHIFT 20! \+ t+ a% o$ @2 t
- #define ITCINTEN_SHIFT 214 b5 B7 ]' r1 _
- #define TCCHEN_SHIFT 22
2 N& d. n, Z! ?0 A2 g - #define ITCCHEN_SHIFT 23# N% v$ N1 X3 f5 U5 T5 Z1 I* R
- + c+ v1 T$ Q0 {
- static volatile int irqraised1 = 0;
& T6 t! L& R- I7 L3 ^* e, l - static volatile int irqraised2 = 0;
- P4 |4 y( f7 K* j+ { - 4 A$ F9 G- e: l# _1 R: t) _7 h8 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
M! `6 s" c8 S1 B7 S+ j0 o: K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A$ z# P$ y7 j L- i. S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y c- K0 z! x" J# C! N! N8 D1 U
# J: ?/ L; f3 R* [* D" p; N* y- dma_addr_t dmaphyssrc1 = 0;$ C7 B4 i3 W) a0 I- K& T
- dma_addr_t dmaphyssrc2 = 0;) R! P, q+ O, R' R8 n
- dma_addr_t dmaphysdest1 = 0;. j( s8 _$ |, X' P1 P
- dma_addr_t dmaphysdest2 = 0;
1 {3 `2 ~+ [- Q* x3 `) }, R C1 p - 4 u; @ i. @4 x4 Q7 V
- char *dmabufsrc1 = NULL;
/ M# f" [8 h9 C% u0 }6 z - char *dmabufsrc2 = NULL;( z! [9 m2 Z: Y
- char *dmabufdest1 = NULL;. e% @. G( q. W1 B5 D9 A
- char *dmabufdest2 = NULL;
9 \4 z% |; c, F5 A
9 v+ e! n0 D* r) o0 b- static int acnt = 512;9 @$ e$ S9 U# r0 u
- static int bcnt = 8;$ S' O4 i+ K1 K5 K; |
- static int ccnt = 8;9 P1 w% N% d' B1 N u( B3 g" _( r
9 z( J. h" M6 {% B3 M6 _$ q4 b! H' @- module_param(acnt, int, S_IRUGO);+ x( ^3 Q9 v- c+ `4 i+ @/ u
- module_param(bcnt, int, S_IRUGO);
- X0 S3 V# i1 ?, Y8 O! e" ]. g. K' s - module_param(ccnt, int, S_IRUGO);
复制代码 / i( b$ f4 L& l( u% n+ \
2 g# i) t/ i8 ]; M M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ q: V0 d: ~7 u6 g/ {- n4 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& T2 r4 O; B. V3 E& [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Y8 e' h1 M* r- ]; a% q
k0 v, J7 [' k' f, z& H- ]* q6 S# L5 e
|
|