|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
W8 k. Z# p$ W) y; d- [code]EDMA sample test application: Y: n# C5 j) _, {$ ^
- /*
. C; ?: u+ U6 c( S( M - * edma_test.c2 X& t- o- C- [+ _0 [; ~) T5 a3 @9 E1 {
- *
( p, V* D I9 q( Z - * brief EDMA3 Test Application& r! ~) M! H% ~4 ]
- *
* i% G! U6 C# o9 ^ - * This file contains EDMA3 Test code.
], [0 F' l+ Z# k" G, f - *, K. C1 }1 y2 S# I' E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" s% G$ r1 w: K. z! b' f V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ d. G9 A5 \3 ]$ p% t1 [$ T - * TO CHANGE., s3 j1 M/ @; j# g" W# F8 B
- *
3 m& j( @9 k8 I" M; x6 @' ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ M3 Y; U, l; l2 ?9 U3 c, y; l
- */ j4 Z6 a5 C6 u
- * This program is free software; you can redistribute it and/or
% H J0 l/ ]6 X( x& V4 i - * modify it under the terms of the GNU General Public License as6 [" J I5 v v: q% d
- * published by the Free Software Foundation version 2.
0 Z1 Z4 [# e6 K; T. m8 X+ K; V - *
) X& T$ N' }6 Z0 w" ?0 q* x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; }* A8 b S% j9 c - * kind, whether express or implied; without even the implied warranty, `! }# H- m2 J0 O5 G! }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 h* ~' k1 j+ \5 T - * GNU General Public License for more details.
% Q% J$ o( m" `9 b+ U( M - */; R. N# {4 R4 _
1 q' l0 \% T3 c9 x7 T& C- #include <linux/module.h>
! o) b2 f% \! _# R0 H3 s - #include <linux/init.h>+ W" y' s* k; f4 y; }7 H1 t
- #include <linux/errno.h>) H" g+ Y5 A3 w/ ~
- #include <linux/types.h> D# K3 L/ l$ a/ a5 F% }) P
- #include <linux/interrupt.h>
4 y8 d. s; W7 A - #include <asm/io.h>
; x6 s/ v ]% q - #include <linux/moduleparam.h>
v; O8 J2 l' R3 k. p9 ?: ~ - #include <linux/sysctl.h>! ~0 w% f D, P
- #include <linux/mm.h>
, _+ f& o8 U5 z9 B) U - #include <linux/dma-mapping.h>
* q4 ^' u7 c4 `5 K - : c; T7 p' F; W. m$ ]& E+ s, M8 e
- #include <mach/memory.h>! Y. V8 G8 u$ K
- #include <mach/hardware.h>
7 s: Y N# g' {7 A* ` - #include <mach/irqs.h>
" V5 j' w6 [% A+ T4 d - #include <asm/hardware/edma.h>- ~1 g X" V/ N4 s' `( _
) i+ g, S/ l) G& d; A- #undef EDMA3_DEBUG0 |1 }- j4 |6 ]
- /*#define EDMA3_DEBUG*/
1 r2 o0 ]2 z) Q6 v, n
4 U1 H) R4 y7 V E0 m* J$ ]- #ifdef EDMA3_DEBUG1 }8 |" G4 r6 `$ p# S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ^: h' F" t5 v7 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 P2 a$ p5 X# F/ n3 k6 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ `2 j; a8 K) G7 \# `* e' ~
- #else8 }6 F/ s5 @% n! _$ e5 q. ]0 O
- #define DMA_PRINTK( x... )$ y6 a3 W& m2 \( ^- P
- #define DMA_FN_IN
8 O* y1 j& F0 r7 t - #define DMA_FN_OUT# c& Z; p: N1 m, `1 b
- #endif
! W* i0 g$ f7 g6 {; z" ] - . a3 S5 W* S: a2 B# }3 s0 @ X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, M- E9 H5 u' O0 ~& P, S; q - #define STATIC_SHIFT 3
/ Q' c0 w) h# E. T$ K! |/ ? - #define TCINTEN_SHIFT 20
3 P) G6 q3 @" d; z8 F0 X$ Y" ?$ V - #define ITCINTEN_SHIFT 21- o! f, s& F' }+ b7 r3 l
- #define TCCHEN_SHIFT 22
3 Q7 q' b; q3 H8 c- H - #define ITCCHEN_SHIFT 23* ]' I4 B0 r6 o' E5 b
* c; u2 P5 I* P7 t* v8 a- static volatile int irqraised1 = 0;# q4 W. z; q# u9 A4 c
- static volatile int irqraised2 = 0;$ B# D3 v0 f8 V7 ?" @
- / Q& ]3 R7 W% H2 ^9 y, }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j& |0 z/ z$ [7 c+ L2 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L6 D6 T% a; T7 m# J6 \; U( c1 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E1 ^5 E. @1 E8 i
- % Z! t/ V0 r, q7 ]' B8 M7 a
- dma_addr_t dmaphyssrc1 = 0;" ^: o, F) |" z. T: S
- dma_addr_t dmaphyssrc2 = 0;
- P4 W* t. k( u8 ?: b* i5 m - dma_addr_t dmaphysdest1 = 0;
5 r& \5 W* e) m! K5 J6 K) }, a - dma_addr_t dmaphysdest2 = 0;& C& ]0 R/ m. W ?
/ m7 ^- l- ~: P/ ~, A. }- char *dmabufsrc1 = NULL;& z) N, @$ o9 l* i7 L
- char *dmabufsrc2 = NULL;
, E1 _" {& g p1 | e0 [ - char *dmabufdest1 = NULL;. e' _$ C0 O% ` B' U" g+ `
- char *dmabufdest2 = NULL;
0 e L/ J# [ l# P
& E* g% p/ j# P I- static int acnt = 512;
1 E: d# R4 E( h2 C - static int bcnt = 8;
8 V, v A9 y3 g% d( R; l; X* H4 T - static int ccnt = 8;* K+ Q7 u& F& |0 M* w8 g
$ {% @% w+ }8 r; N, M- K \- module_param(acnt, int, S_IRUGO);8 F0 C) }$ P3 ]* g' r, L- k
- module_param(bcnt, int, S_IRUGO);; h! |7 L8 x1 k% C4 K# t
- module_param(ccnt, int, S_IRUGO);
复制代码
' D \% u5 ]6 F9 d! M- m& t) u: L/ R/ W Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Q2 {4 J# U/ \; p+ ?7 @7 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& y6 k$ y: n9 A& U; n' c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 u% O: ?+ f+ B, S: N% U" R4 D6 n, L1 s9 ]% P
1 E3 b- N; R6 S
|
|