|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Z' a- J8 y. X9 V: h, h+ y% e
- [code]EDMA sample test application |- A% D% P' J) p
- /*
+ K0 P A7 H4 j1 b. v: u - * edma_test.c
, n$ E- H/ G3 [+ ? - *
; ]: C+ M1 A z+ S; ]( d - * brief EDMA3 Test Application7 s ^! q# \" j9 w3 Y# l% r4 s
- *
+ H! {7 K: ^0 W& N+ q, m - * This file contains EDMA3 Test code.+ h8 W1 [) P: C* b- u$ p" n% R% J
- *
' U1 ] ^" ~3 l+ W5 j% S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! f4 u% ~. L- R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ]$ ^: T, h0 ^ - * TO CHANGE.: a6 y# g1 g7 `4 S, _ E2 ]
- *
! r M+ Y; O, p7 }( R: V9 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( n8 Y% y# Z0 y" C: A, w+ e - *+ K; I# y, ^ e1 @% m
- * This program is free software; you can redistribute it and/or
+ I5 }! E; i* u" t9 v9 c - * modify it under the terms of the GNU General Public License as
* W" p- T9 m$ i/ D5 V - * published by the Free Software Foundation version 2.
# k+ u/ g1 y$ i2 Q+ `. d& M - *
+ m; ]- @5 X% Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 F+ Y; R; O+ _) l. E/ @9 ] - * kind, whether express or implied; without even the implied warranty* i$ p% H3 W2 Q6 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* o( \4 F4 L/ }1 _
- * GNU General Public License for more details.3 i' C& P& @( a+ w
- */
! O! ]* v6 r+ Z, L3 C8 A a
( U9 q& ]* A. h, p5 E- #include <linux/module.h>/ i1 o4 f5 z- u6 ]8 E' N+ h
- #include <linux/init.h>
0 e, x! k4 G y1 ~& M5 \& { - #include <linux/errno.h>: G1 q8 v1 b8 y1 k1 B! A
- #include <linux/types.h>
3 T& ~& |; h7 ^0 c, s - #include <linux/interrupt.h>
; l8 D/ G( y% D6 g9 e" M - #include <asm/io.h>
4 H1 D. U5 T+ `: y& T - #include <linux/moduleparam.h>
. P% Y! m. @6 @' [ - #include <linux/sysctl.h>, b! v1 c5 ^" U8 T% C; w$ m/ V- `
- #include <linux/mm.h>
( p6 R1 `- u8 D) u& w+ h - #include <linux/dma-mapping.h>$ ^- m' J2 ?; L
- . a3 R2 l2 X: u2 m2 J1 K/ Z. B4 h
- #include <mach/memory.h>
; q( ^4 m8 z- C* q: |5 m9 ~6 v% N - #include <mach/hardware.h>; K8 \8 I' Y% l3 i' X0 X0 {; @. t
- #include <mach/irqs.h>% x) T5 v; \3 |1 a# R, t0 y
- #include <asm/hardware/edma.h>
- B1 N+ P T. g8 w
+ A) |$ X6 B0 }9 o4 K' E- #undef EDMA3_DEBUG; i5 t- ?% ]% }$ ~& Y' v- j
- /*#define EDMA3_DEBUG*/
9 B* k" M. J7 w+ q# r; t% d
7 {5 s* p! h7 B+ L- #ifdef EDMA3_DEBUG0 V. W) o9 U; i" S2 U! R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 J0 D1 g, X! L5 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ X1 g1 S+ A, C3 ?8 h" ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U/ p5 F# h; h5 ]- e
- #else/ s4 @6 M- P1 \! ?
- #define DMA_PRINTK( x... )
9 L1 j& F6 h5 j - #define DMA_FN_IN
d/ t9 j6 } t - #define DMA_FN_OUT6 x2 @4 w( T% _7 `5 e5 a; U& z
- #endif
3 ^9 k, D" o6 t4 [
/ Y' L, N8 d4 w. G! R' w4 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* {: q! J) u! ]0 k+ R* u
- #define STATIC_SHIFT 3
% y+ r' J# g& L# a4 t* u/ H - #define TCINTEN_SHIFT 20
$ B( T8 ]1 d4 B C. a- w - #define ITCINTEN_SHIFT 215 E, J( `) C* Z
- #define TCCHEN_SHIFT 22# j+ i: [- w/ `7 Q; \6 T
- #define ITCCHEN_SHIFT 23. b- M9 K4 G* p% f4 l# C
) L; ^ I; `& Q" d- static volatile int irqraised1 = 0;7 a4 E9 W1 n. O
- static volatile int irqraised2 = 0;* n; P- Y$ }* Q/ s
- & z! Z! Y7 P1 ~# e: g1 u! I6 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ]9 z1 }: k& g1 S* g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x ^8 U! F4 c% r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z; T" g$ g( |; c+ b& F, I4 D
3 x$ c3 k: m% o- y( I+ L- dma_addr_t dmaphyssrc1 = 0;
& n* J* B; A( _3 B - dma_addr_t dmaphyssrc2 = 0;
- U. f. G( K1 b9 a! h - dma_addr_t dmaphysdest1 = 0;# M. V q/ b" q+ z: W0 G
- dma_addr_t dmaphysdest2 = 0;
( S P, j) l( K8 T m) [# |
0 p5 U+ q9 Q* b; s$ [. j- char *dmabufsrc1 = NULL;
r. q* K$ ^! s7 E% H - char *dmabufsrc2 = NULL;, U6 ~/ _# e/ U5 _
- char *dmabufdest1 = NULL;
; x5 l$ [: \4 [+ _3 ?5 C' g - char *dmabufdest2 = NULL;; U' h& b( F' r" u
9 m: f* l9 _, \9 J3 j& J% D- static int acnt = 512;& W0 b8 r: u# j. {7 F4 u+ b
- static int bcnt = 8;
1 k- V& J5 h& K - static int ccnt = 8;
' f* I( x& r/ M8 u
' O7 R7 V' S: K# J* N8 I- module_param(acnt, int, S_IRUGO);) b! d/ M: j1 \* ~# }& y: F+ |. K
- module_param(bcnt, int, S_IRUGO);
+ u; s4 y4 b0 T! A5 U- O# h" q - module_param(ccnt, int, S_IRUGO);
复制代码
9 O) Q2 Q* I7 N1 ~+ M% T0 p( D( I* U) z! y7 z, O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
t6 n2 o4 ^2 R) zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Y" E" D$ ?/ L$ t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, U/ R C0 f8 X {1 `# s; c- Z) w: k7 F% X( a' T
2 u) n1 ^# a( k# |( {
|
|