|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( \8 _7 f+ u% N. f7 D' C2 `
- [code]EDMA sample test application
' S" E) C; z. }$ u% a8 _ - /*
1 R3 ?" J5 f% T$ K' m4 z9 I - * edma_test.c
+ \( x& y( I( W6 S - *3 R2 W, Z# u* b! p# N0 ?0 i
- * brief EDMA3 Test Application& }% |, N$ d' L% D( R& N) H
- */ ~! G4 [' O% ]7 f+ @0 c
- * This file contains EDMA3 Test code.
. x; y7 D3 I8 L3 C4 z" q - *. C& r: R$ Z! T9 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E3 ]" L9 F( q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ~, q: Y4 R$ Q* }4 w3 [9 w ~2 @
- * TO CHANGE./ `3 w, ]# q) `; ^' }
- *- u* N+ e7 Z) Y$ |- x1 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 X/ M B! ?2 [9 r2 {! V3 w1 f - *, q( O* R5 l8 _$ E
- * This program is free software; you can redistribute it and/or
( B& q; O, U: i- W8 @& P4 T - * modify it under the terms of the GNU General Public License as3 J" ?9 Y/ p/ g' J+ \! g8 G
- * published by the Free Software Foundation version 2.2 Y4 N) M1 {& ?1 U" L9 Y; Q; ^, x
- *6 \- \( C# P# j5 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 f4 ~- x8 t7 f# i: B: Y - * kind, whether express or implied; without even the implied warranty
, R& Q. T& [5 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Q5 [4 g$ x* V: i
- * GNU General Public License for more details.
+ Y) C. U6 {! X k0 v% G' C - */
1 H7 G* ^! ?# B% u/ ]( t
9 p g2 I: s9 W5 U# ]) L Z- #include <linux/module.h>
7 _; A& V6 O' ^ - #include <linux/init.h>
1 a3 ]8 ^+ ~, s' W" ] - #include <linux/errno.h>4 V2 j, ]% b1 r3 s
- #include <linux/types.h>0 \6 N2 w1 t/ x8 o0 n
- #include <linux/interrupt.h>
% @9 k2 W" h4 a8 V$ ` - #include <asm/io.h>
5 [; y# B6 Q9 K# f# z3 O- d - #include <linux/moduleparam.h> [) M( U& |$ z' V, r4 G/ T
- #include <linux/sysctl.h>4 {" v0 A0 d4 e' n6 J7 H! E
- #include <linux/mm.h>2 \. }, U% N* ^( |- L
- #include <linux/dma-mapping.h>
. g1 Z3 M) x2 K3 U2 C; n3 m - 5 K" b; R2 T* z# D' s
- #include <mach/memory.h>( \+ q- G- r7 h0 `7 D1 r
- #include <mach/hardware.h>' [& m0 i. e2 x3 i/ T5 q" l8 N
- #include <mach/irqs.h>5 g5 ?: n6 [/ `
- #include <asm/hardware/edma.h>
3 T9 J- r5 z2 X+ i9 B2 i5 D - , f) _1 Y, K% p
- #undef EDMA3_DEBUG* B# ]. I7 R, K! e( X/ }5 N7 G3 S+ n
- /*#define EDMA3_DEBUG*/# _( t) M) N! e# ?8 Y( s
- . J8 J w- Y6 N$ p) E2 W
- #ifdef EDMA3_DEBUG
$ u6 S. Y2 m4 n. t# i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D, q9 ~3 o0 u0 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# f4 M! N6 p0 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; O% n: p' q) `7 s8 h, T s - #else
" n0 M2 ?, ~* J5 F5 a% g6 \/ o - #define DMA_PRINTK( x... ) {/ V5 r8 O: _( T6 `1 c9 w
- #define DMA_FN_IN
+ _% t7 a% f6 H% W - #define DMA_FN_OUT/ p( o l- j& [3 u7 Z$ K" P
- #endif
7 ^/ n/ M3 D# S6 x% [# Z, q - # Y7 y/ C/ ?# v: B/ a; a; ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 W3 b8 M2 O: H% p9 X$ w# v4 y- o' d - #define STATIC_SHIFT 3: }, P) H+ Y! @' ]
- #define TCINTEN_SHIFT 200 @2 c" K9 ]6 s! o$ X; o/ q
- #define ITCINTEN_SHIFT 21
9 O3 w# W* u* E1 N! S' M - #define TCCHEN_SHIFT 22' o* }3 V) E5 K# h
- #define ITCCHEN_SHIFT 23* U Y- f4 |+ J7 o% I& g
! w8 i( w& T' e e) w! \) P- static volatile int irqraised1 = 0;- b$ W# D Z. W* b
- static volatile int irqraised2 = 0;
6 ?/ J0 Y2 I* P# l
, n: \ Z2 F: H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~- n% R" H$ v. t$ _, d$ a. ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q- r& g; D4 N( U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 v4 s& }1 Z z/ l+ T
7 S0 u/ h1 B* p4 _; p( }- dma_addr_t dmaphyssrc1 = 0;9 K1 f$ `8 R. k i# V
- dma_addr_t dmaphyssrc2 = 0;0 l, u- n9 i y( q0 S
- dma_addr_t dmaphysdest1 = 0;1 @3 L- r$ D; M; c9 V& }: x
- dma_addr_t dmaphysdest2 = 0;- y( Z6 ~ _# { y! u8 z
0 i1 V* U/ \7 G; I# Q- char *dmabufsrc1 = NULL;# t/ I2 ]0 Z U) R P* ]
- char *dmabufsrc2 = NULL;% ^; \& @ ^$ h
- char *dmabufdest1 = NULL;
8 u( r; R' S$ p; m - char *dmabufdest2 = NULL;+ @5 F6 ~& N2 z3 m v: @2 R( q
5 w) W. W1 S6 R, I2 ~0 y- static int acnt = 512;
+ h' _- T$ U0 \+ U - static int bcnt = 8;% U8 R2 n2 j' ]6 ? s( r
- static int ccnt = 8;. J* w! O/ n8 {+ O/ @. E- ]& A k
- % H$ K8 y9 Z7 t! j" i. d
- module_param(acnt, int, S_IRUGO);
/ I; x" m, Q# s, e' g+ f% C - module_param(bcnt, int, S_IRUGO);# K% d* b* {8 ?; y
- module_param(ccnt, int, S_IRUGO);
复制代码
9 y$ o8 h, R$ l$ E F2 x% f, P; i+ V* W7 `# t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 r5 S; v; K2 I: M j" Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 {, v5 Z! Y! i; l; `& U& B0 R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ]! E: l; x$ S4 l& T
7 ^9 O h6 c, [" B# ?3 d; O
% g3 a- O7 n6 T( L+ h o7 _ |
|