|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: j: j2 D* E% M5 H& h4 ]; G- [code]EDMA sample test application
4 q8 F0 N; ?2 I* u6 Z: g - /*' H- H" ^- W) ~0 q7 O
- * edma_test.c: P/ y& k3 |3 e% ?/ H4 q
- *
3 e* Z7 y' N& u: H4 p4 y0 Z - * brief EDMA3 Test Application e) U6 e _, a1 e5 A7 g* P
- *
% Y0 Q- _6 q C" { f* N7 L - * This file contains EDMA3 Test code.
0 B9 E' G9 T ` - *
1 o- z6 u6 P' [9 e. {! N& s4 C4 \7 l4 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Z1 w. G1 v2 y. R6 ^8 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
y4 d7 a4 { c# G# e3 i - * TO CHANGE.
! q4 n0 n8 V3 }# E - *9 ^9 T" `. V4 y2 M" j5 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 G+ _! G% t- G/ G* N: C$ W - *
3 I6 E) a; x) n9 ]/ Q, I; ]( i6 l - * This program is free software; you can redistribute it and/or; ?$ j" ^; |6 }" {+ ?& P
- * modify it under the terms of the GNU General Public License as
& g7 _" u! h9 l7 e" \ - * published by the Free Software Foundation version 2.! ^9 a: |, r; {& ]( y
- *+ w6 v$ W; s3 y- d! P1 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# Z% E5 e6 y O - * kind, whether express or implied; without even the implied warranty2 F B) N5 H T# v( _8 l1 r( O2 w4 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
t# z( s3 Q1 k6 `1 v - * GNU General Public License for more details., w! ]% w8 x+ v5 Q7 K! s1 @/ q
- */9 i- E1 a4 Y) Z+ h* ~
- % M4 V. B9 R& V
- #include <linux/module.h>6 r$ }& Z8 k( v$ W
- #include <linux/init.h>0 ]! P3 b# C* K, l+ b
- #include <linux/errno.h>) [# d4 a0 a# B
- #include <linux/types.h>
, }8 o1 K% S5 p7 Q* t - #include <linux/interrupt.h>+ S( w& O. |+ f" r7 L
- #include <asm/io.h>1 H4 B4 [5 K) i f/ F I2 G
- #include <linux/moduleparam.h>! A9 G7 p/ O; N
- #include <linux/sysctl.h>
; [7 _$ g: D: e ` - #include <linux/mm.h>: s, M d0 g/ @/ a* X
- #include <linux/dma-mapping.h>6 g5 D, V! X$ S" a* v3 F0 g3 |- S1 x
5 y# s8 q6 t5 A4 |- #include <mach/memory.h> @1 M5 i4 |# |
- #include <mach/hardware.h># K' e% w, e I/ q! @; n) a: F
- #include <mach/irqs.h>+ o j6 P: `0 o9 J+ Y# a) F/ M
- #include <asm/hardware/edma.h>1 M* v8 B- |" \) O7 o6 X& B' U( F' q
; {& b: y: Z! F" e- #undef EDMA3_DEBUG
- t0 ?4 f( O% x' G# R: I+ { - /*#define EDMA3_DEBUG*/9 W8 w! @% G" r# x/ ^: Y
2 M8 e2 j4 x- \ j2 l$ X- #ifdef EDMA3_DEBUG- E7 v1 ~6 b6 r p1 M& u$ E: v4 }) c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ e, i# c, J. M( O) a) o1 T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 r+ d" i" d/ v+ o: s2 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ }- f$ Y* O% x; R( b) L( O5 Z
- #else
; n7 U: x' P( ]* ~2 m7 ` - #define DMA_PRINTK( x... ): J; b# j! L: ]# a$ C! U) s# o
- #define DMA_FN_IN1 C& D( d- x. [" |3 }: ~" _
- #define DMA_FN_OUT
# ^* l% ?. s9 ?- F* L4 f - #endif
# |* X m- V9 x8 |7 H: N
& b1 N6 @3 ]3 T/ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768): w- I$ }8 Q) l. G. i+ W1 c% @
- #define STATIC_SHIFT 37 N/ X0 y7 ]( J( N5 k0 A
- #define TCINTEN_SHIFT 20% ?/ i, _: j, c: P5 D8 z6 A* F
- #define ITCINTEN_SHIFT 21 z/ a3 _" P0 ~) W$ i4 S) ]
- #define TCCHEN_SHIFT 22
/ D( d' s3 r$ D& e+ ^+ K - #define ITCCHEN_SHIFT 23! i+ k) M1 p& O+ X
0 n3 t# D1 {- |, |) R% I- static volatile int irqraised1 = 0;
+ b# b! ^% M! W3 g+ v- M - static volatile int irqraised2 = 0;
8 j( \- ^5 N0 f9 ], x' g. |
4 V8 O. n D& D, S9 X3 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 \) |( h5 n7 y6 o$ |+ X) ]# `& q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ A4 L4 D5 ~2 N+ T$ s6 H4 k. ~9 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& l6 M- Z) y' G+ y. H j$ j9 ~7 T5 p- q
; y& m& l! j" D: ]# W$ m& @7 d: N- dma_addr_t dmaphyssrc1 = 0; Y; k# G- e- U; `( A+ j7 ~' C
- dma_addr_t dmaphyssrc2 = 0;" K y& o. c% u8 H" V1 E5 _4 J/ p
- dma_addr_t dmaphysdest1 = 0;) s1 I: u4 P F* g# L
- dma_addr_t dmaphysdest2 = 0;0 K- z+ L' y9 {% v9 K! j3 t9 J: ]
7 g/ P4 x; S2 F# g- char *dmabufsrc1 = NULL;
`8 }! u4 _6 t' {& G0 w. F7 L- ?! S - char *dmabufsrc2 = NULL;
1 U5 C. ^3 X; B8 ^9 b - char *dmabufdest1 = NULL;: Q) Q( d0 S! K+ O' ]+ t
- char *dmabufdest2 = NULL;
' n( _5 ~1 x3 S" M' J9 _) U
% _6 W3 H( w3 K4 a; X: N/ \# W- static int acnt = 512;4 ~! F" j/ |# L/ z5 v7 {
- static int bcnt = 8;
9 d; |$ B: y( z( [ - static int ccnt = 8;
8 T6 s. E; o3 t; A - % I( H9 P( e6 S/ s2 {8 K
- module_param(acnt, int, S_IRUGO);- A9 y" u: q2 A8 Q6 ^9 ^
- module_param(bcnt, int, S_IRUGO);( j4 R, y) |% q+ v
- module_param(ccnt, int, S_IRUGO);
复制代码 - i8 {* [1 [" w$ M+ |: u) q! i8 c
' G( }5 q0 q+ e( [/ \2 }0 z$ G3 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ?1 i8 Q" ?; T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 s) k* Z" R2 v% z% a2 t$ B6 q) u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) @' m# }9 {5 s- I9 |
+ d) u% [5 I" Z9 `) X2 A! B& H8 H& ~* T% }' M
|
|