|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( F u7 Q# |/ S j; w0 z
- [code]EDMA sample test application3 Y+ w. E$ m) l/ r8 }
- /*
. m- Q$ @# d3 r2 ^1 K( g- R - * edma_test.c
/ D* a- V5 |+ i: z( w3 j) \ - *
- Z' R1 H6 p9 G$ f: Z - * brief EDMA3 Test Application1 M. v0 z: a4 X/ b3 ^6 k
- *
; D! n# p+ q" I* x5 B - * This file contains EDMA3 Test code.3 g" [9 q$ \2 A3 i7 ]
- *& q1 h( m) s# v% B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 O) R. [/ n1 A$ I# g! y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 d' p( S. |; X0 Q0 e% m/ b
- * TO CHANGE.9 g9 Y7 K6 J9 p, a% Y1 l
- *8 P# C2 R* u, v6 ?* @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, P9 W# A; v6 U* Z r( [$ p# y0 K
- *( J( n& Y6 @4 x9 a* d9 r
- * This program is free software; you can redistribute it and/or
6 C) w/ d+ Z/ X. |4 g - * modify it under the terms of the GNU General Public License as
( |& d0 R& n8 U* n, E - * published by the Free Software Foundation version 2.' n# j6 Q, t% T- {/ }
- *' E& m4 N+ Y' Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- J( b. b& w5 Q) E
- * kind, whether express or implied; without even the implied warranty
2 P/ ?6 C& ?( Q% \# r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, V; C( F {; C! M7 L/ u9 y' ~ - * GNU General Public License for more details.
" v5 s! b1 Q) h3 F$ { - */
, T/ s4 L! e# R3 D) _3 f2 s/ _; \ - 4 z e* @& b- V
- #include <linux/module.h>& Z" w" j* D0 {9 u8 A+ n
- #include <linux/init.h>
c. R( A p! l9 H$ I - #include <linux/errno.h>& ]9 a, Q: i) n3 ~
- #include <linux/types.h>+ q w6 A! J$ L/ N
- #include <linux/interrupt.h>
, |: z9 o) D+ F) z6 [' \ - #include <asm/io.h>5 u$ W" U- ?$ H2 O
- #include <linux/moduleparam.h>
1 I/ r! c$ j$ r: a& d - #include <linux/sysctl.h>
: U, X/ Y' L/ P - #include <linux/mm.h>
; d8 W5 g- b% b- R4 O - #include <linux/dma-mapping.h>
: `5 D( O) X- y9 U, ?$ V - 9 }$ z: x* n4 E* x
- #include <mach/memory.h>
5 R7 x6 k1 g+ |8 b. r, d3 W" Q - #include <mach/hardware.h>. {+ k# P W1 v. G# N- H6 O
- #include <mach/irqs.h>
3 b& x \; G# ~) A; N - #include <asm/hardware/edma.h>( A! }3 p+ O O4 b9 q, S; `% l0 f
3 y2 a0 e) D3 a5 N( j- #undef EDMA3_DEBUG
' T, ~* H/ c7 C& }- u' R( k - /*#define EDMA3_DEBUG*/& t8 I8 w+ Y. ~3 D6 z7 S3 F
4 r5 j/ N) f& Q3 {4 K- w$ h8 w& m- #ifdef EDMA3_DEBUG
" U& l/ ]3 j0 P! g, U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# r$ S- k% Y+ u3 V* Q1 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Q( x/ B/ I; ]. V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- D. z2 Z3 ]3 p7 @/ D, E
- #else7 N1 Y( Y' n/ _1 d
- #define DMA_PRINTK( x... )
/ V+ ~. C2 }; E$ N: ?- p - #define DMA_FN_IN
! {' R" A2 t7 r5 y" n- r - #define DMA_FN_OUT
; b4 p5 N) a+ K; y2 s% w - #endif2 E' f f: B7 l( O) a- }9 r
- 9 x' l8 s4 m2 f& L0 C, ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. `: S. _5 d h' Y% e; H( E/ ^1 m5 C - #define STATIC_SHIFT 3
3 E/ T1 X$ T2 U. W6 {) ^ - #define TCINTEN_SHIFT 20
2 e' X; q) W8 ~! a# ~ - #define ITCINTEN_SHIFT 21
: n6 f. ~3 V5 q# z- ]0 P - #define TCCHEN_SHIFT 227 w9 j& Q" E& `4 i0 ]' w# H
- #define ITCCHEN_SHIFT 23
* O! f, Z9 Y& | - 2 r7 w9 G) j. S1 Y$ [4 l
- static volatile int irqraised1 = 0;
8 U! I% M$ x6 R, l& a( p. m+ b - static volatile int irqraised2 = 0;
! o0 o4 n$ x9 P% G - % k. S+ \# T5 h9 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ v. x) ?0 b: ~* A8 m! f7 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o- S- ]( D2 c( [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z+ \2 ^/ m9 c% T( w
- / o+ B2 K# C/ r6 N
- dma_addr_t dmaphyssrc1 = 0;" ]1 s$ U6 j- W
- dma_addr_t dmaphyssrc2 = 0;7 S, U& N+ V! |" C( ^
- dma_addr_t dmaphysdest1 = 0;# ^& x' Q6 j1 M/ r
- dma_addr_t dmaphysdest2 = 0;9 x/ I& j) C; [
- 3 v( W, {/ C! f) q" c
- char *dmabufsrc1 = NULL;* [0 G; b& X2 c. m% p
- char *dmabufsrc2 = NULL;
) o* [) y2 T. r, m( n. a6 Q; R - char *dmabufdest1 = NULL;
1 r/ G; [% k% b7 h: S1 f: b - char *dmabufdest2 = NULL;9 j7 \8 Q9 G( Q* o( B* k& ` v8 h# `$ f
6 D5 l" g/ X- j! R6 r- static int acnt = 512;7 o5 V; K6 Y( E; D
- static int bcnt = 8;
0 ]# ^* f/ C& H6 t" L+ } - static int ccnt = 8;
3 M0 }/ C% s( _3 \( p' p6 _
/ g- | o2 i( b0 d7 S7 ~( k! W- module_param(acnt, int, S_IRUGO);
\1 u+ `6 x4 I - module_param(bcnt, int, S_IRUGO);7 B; A t# m5 K" k9 q3 B7 `
- module_param(ccnt, int, S_IRUGO);
复制代码
* p' s' g4 B! Y1 C' i
, r- [0 ~/ j: p( Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. R, X% N( ?9 J# s; Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! p* n" p* ^ l' I6 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t# s5 i* J2 G0 S) r6 J) @3 A# o( P4 }' Q6 h1 n
0 u0 @ P* `) e; A+ y. W7 l
|
|