|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O2 A; D* Q2 z' ^ B- [code]EDMA sample test application7 _% P. ]- i! }. O5 \5 F6 m9 u
- /*7 V0 F/ {" @# A& h7 a
- * edma_test.c/ I0 C' b5 R3 C' ]
- *
: `; b7 p9 b% I8 i0 p - * brief EDMA3 Test Application* Y$ X! ?2 M( e! ^/ P5 k* C5 W
- *
. C- o0 ~/ b8 \; E9 ` - * This file contains EDMA3 Test code.: Q) `; d& h$ Z# G5 }+ Q# D) z
- *
' r- O9 N7 P6 b( }& p \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, s( r5 p8 C$ {" n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; F7 j: g3 \8 T2 n - * TO CHANGE.
( ]% Z# Q1 T0 D [$ P4 M - *6 ?3 k4 y- V8 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 \, V# H) J2 v( @" U - *: g$ o: M9 [* _# ~' k n" W" X
- * This program is free software; you can redistribute it and/or
' u5 K2 J8 K5 z0 J- X1 A3 s - * modify it under the terms of the GNU General Public License as
% ]1 o$ x( c* D5 e6 g2 O% o - * published by the Free Software Foundation version 2.
8 E/ ~3 @ C7 h, \ E* s" x - *
9 j8 \0 }+ y% n8 D& x0 _; j% ~- Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ p7 g) L, T" T1 [/ R7 v5 e
- * kind, whether express or implied; without even the implied warranty+ g M& B( X. O6 v: D% g# I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- o: O% V6 Y8 N, @* V, }
- * GNU General Public License for more details.4 i8 G! e% @3 l( d$ V: @' j3 k
- */
2 C$ Q$ x3 y" K9 W2 l: {
( x& J6 I$ J; E% G7 s+ {: j ?- #include <linux/module.h>
0 J: K% I0 P3 o - #include <linux/init.h>
0 ?; w. Z3 t( `6 j9 y - #include <linux/errno.h>; U' K! T6 v! J% C" b; q
- #include <linux/types.h>
( t' ]8 f$ ?1 Q ?9 }, X3 m, d+ w- ? - #include <linux/interrupt.h>$ b9 S* B: L7 N( I
- #include <asm/io.h>; D( P0 y. z: Q8 o4 Y8 k
- #include <linux/moduleparam.h>) f- ^& l8 k9 _/ j/ e/ H# B9 h+ S5 H c
- #include <linux/sysctl.h>
1 n# r' ^" M& J - #include <linux/mm.h>0 Z. v" c, I; ?) D
- #include <linux/dma-mapping.h>+ [2 J$ ]6 F# e- D* J
- . E" ]7 t7 U1 Q+ H8 q6 C4 [
- #include <mach/memory.h>
! X& l! J! q" u" A0 O - #include <mach/hardware.h>" n7 ~9 W! a8 O1 W8 T0 A, l
- #include <mach/irqs.h>2 ?: g# Q$ G# [5 g6 ~6 _# O
- #include <asm/hardware/edma.h>: f" S# p; Z) a* v0 p& S; D
- ! P: s; A) U$ @2 Q" }" M5 ~4 }
- #undef EDMA3_DEBUG( j! r% T3 b9 k: w4 {/ @/ u
- /*#define EDMA3_DEBUG*/. L+ D7 o y: x* [" u( D" e5 Z
- 9 D' l" q6 L# n& H8 V
- #ifdef EDMA3_DEBUG0 r8 L# D- n% C R& J, ?% J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 U+ t( j8 c8 n0 O: s# p( a% ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): N* H: l8 I3 {" g: W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 A( K5 n D* U7 Y" h5 O
- #else0 B* b$ M: Q& S$ D
- #define DMA_PRINTK( x... )
$ a; ~" C* n) i5 s3 {3 d - #define DMA_FN_IN# l( J! Q) z) `# }( s( B
- #define DMA_FN_OUT
3 _ v- I/ U9 }' o - #endif4 h( ]3 c& M$ @, B' \( ^* x/ F
- - g5 y: b# ?4 ]5 M0 ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): A% {% M, K, k, W+ K2 E& u
- #define STATIC_SHIFT 3
: } X9 g1 Y+ \3 I+ z7 ~ - #define TCINTEN_SHIFT 20
: x2 T0 _% ]; M- X - #define ITCINTEN_SHIFT 212 G6 e4 j1 {5 X4 u3 p
- #define TCCHEN_SHIFT 224 |* i+ U' Q9 B2 S
- #define ITCCHEN_SHIFT 23
' d( Z6 Q6 A! w* Q - % h4 c& o% p- T0 W
- static volatile int irqraised1 = 0;
- h0 w3 G9 d, ` - static volatile int irqraised2 = 0;. }" H! l0 n. f# T& u0 m1 b- M1 c
% z( J$ ?0 R! t4 b) L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U7 P7 I5 K8 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% D+ K; H- G$ z# Q9 f# Y0 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E Q/ @9 N$ A* @- m% `# d2 P4 v
9 Z. F2 t' m' [8 d- dma_addr_t dmaphyssrc1 = 0;
4 Z" f8 o2 A! _* R - dma_addr_t dmaphyssrc2 = 0;$ W: O" g! h& r: Q- U
- dma_addr_t dmaphysdest1 = 0;. p/ D* p/ A7 o2 P9 `6 _
- dma_addr_t dmaphysdest2 = 0;
- g$ T& b/ R! m - 5 R' j* N, a% o4 M" E! N* i
- char *dmabufsrc1 = NULL;3 k7 E. I1 {# K8 R, G& v; Y* b! d
- char *dmabufsrc2 = NULL;( N8 g/ n3 S$ I6 f4 R
- char *dmabufdest1 = NULL;
5 Z4 ] K& x1 k5 H" z, s - char *dmabufdest2 = NULL;
" Z. H% S6 \8 g* _5 S+ h- b' H- j - 1 {1 |' F2 A) \9 v' ~. G
- static int acnt = 512;
; E4 o3 G4 @2 J# n$ c; W8 }" C" x - static int bcnt = 8;
% A; G/ l& B! v% k - static int ccnt = 8;* U$ Y+ o8 r# p% r* r" A
- , E! {$ O% k u" r! S
- module_param(acnt, int, S_IRUGO);
F: q# S& q, x" ?7 j; k - module_param(bcnt, int, S_IRUGO);
' \ Q( N- R- u - module_param(ccnt, int, S_IRUGO);
复制代码 : K. O" l6 O4 n( g* f
4 U/ O% |3 K. o* H$ b3 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* X: \& _6 i& t" \3 h- ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, ?* I9 i7 T% e X. M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- h4 } _- G6 {7 ~; C! \
* G* U- H, y' ?+ ]# b: J
$ l+ O/ O! ^8 o3 M1 k, B+ I
|
|