|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& P" f' ]5 i9 r8 F6 b+ E. ]( p- [code]EDMA sample test application
0 I6 N( D1 }9 A& x5 y3 H/ ` - /*
0 D" A b8 [6 Y* B - * edma_test.c1 x! F& J5 E) _! R4 r ]
- *
2 ?* c, b* o% B - * brief EDMA3 Test Application
6 ?' L+ }* D5 a; |# X. C; p0 G: o$ k - *( l1 F# [& r" g
- * This file contains EDMA3 Test code.* Y. }: e- P* E. q9 Q- F
- *! q' D" w5 `0 V/ @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% I/ |1 t2 | b+ @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W6 K0 e) ?/ m% A
- * TO CHANGE.2 P# V% b4 v2 y6 q8 Q+ o
- *
b) ]+ f' b0 I% M* _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( Z2 Z6 p! ` X/ ^/ C - *0 \' O$ `4 X! I! c
- * This program is free software; you can redistribute it and/or
; H1 Y: R# r7 x% [5 B# o& A - * modify it under the terms of the GNU General Public License as
3 y% W0 p% z( O4 l" e - * published by the Free Software Foundation version 2.8 A* b3 V( h: Z( A0 L, `
- *8 X6 c! ]$ A0 _, q& y! L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) c9 w! u6 v# t! S8 t* F+ Z; q* ^( ] - * kind, whether express or implied; without even the implied warranty
" g* ]6 q& v$ L, o% J" y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 W9 O( h" W% k. i) y# @% d# r - * GNU General Public License for more details., X2 M& X* x+ W; r+ Z
- */
% D; K# y1 v' [& p; ~* x" _ r - 3 h6 _2 n! g% V1 a1 e! }
- #include <linux/module.h>
9 p- h8 I; O7 m& J6 s* N - #include <linux/init.h>
% Y: }! L# ?. k/ ?: r- I8 f& ~ - #include <linux/errno.h>* t; V; ^0 V: i( W3 g
- #include <linux/types.h>/ C% \: S- [7 v6 ^9 u8 q
- #include <linux/interrupt.h>1 B, }7 |2 j% x
- #include <asm/io.h>& i# P, S) r4 I7 A }( ~3 |
- #include <linux/moduleparam.h>
z: S+ z+ g$ ] k - #include <linux/sysctl.h>
/ Q2 a# ]' ^9 x( V: B2 Q - #include <linux/mm.h>5 R0 |! m! V% W; U# F) m5 v
- #include <linux/dma-mapping.h>
) f/ Z# H% a# g- k
1 o- q% B/ i# g) N) e; V& h! r" P- #include <mach/memory.h>; g* P. ~/ d) w% i* w
- #include <mach/hardware.h>3 q, P. K' s% ]4 W1 O, A$ { s* ]7 U
- #include <mach/irqs.h>- W7 `) ]# C9 y: P
- #include <asm/hardware/edma.h>
0 z; e0 g3 O5 C4 x# E - 1 E8 x$ m9 w" k8 K$ Y% T a G
- #undef EDMA3_DEBUG: f" `5 G9 m: {3 x" k* a
- /*#define EDMA3_DEBUG*/) Q' r% W) F# U/ j
- ) K+ c# M2 J$ S; Q! [, @
- #ifdef EDMA3_DEBUG
8 G/ w% C# @1 k) `& ]8 o( ^" o. v% q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# R8 _1 U& x( q% R3 T3 N9 t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 P8 p5 C) n, N% b* n1 o) r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 w" z2 ? C7 ]' v! A
- #else# Z3 y1 r/ y' ?: s6 D. s& X( ~7 ?1 }5 d
- #define DMA_PRINTK( x... )" f. K* ?: h3 a! Q. l8 g: C
- #define DMA_FN_IN$ Y6 v5 o: Q% K8 B0 n' L$ p* v2 j( P% m
- #define DMA_FN_OUT# P1 t" ^+ e3 \: P, I% {" q
- #endif7 T4 M. e# U: j' V8 ?. i8 \; E( ]
- 2 w6 g. y! J- S: A4 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 L- T5 H' c* |& j1 [
- #define STATIC_SHIFT 3& u, I' p, y, N: K/ j/ J3 G
- #define TCINTEN_SHIFT 20
# J! A+ {" `2 m, H - #define ITCINTEN_SHIFT 21
+ r9 n$ ~" l3 f - #define TCCHEN_SHIFT 22+ y4 M" f# j9 i m+ R8 q* m
- #define ITCCHEN_SHIFT 23, T( t7 A% I2 P- @! I
- ! A3 [6 ?2 {4 ~2 ]# ]0 s6 e7 c
- static volatile int irqraised1 = 0;$ D* s% N0 N& B: i3 X
- static volatile int irqraised2 = 0;
% x2 p6 l" L( q - B. p1 K8 u, _3 L0 W; x% ]6 P. M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' R. _* N2 q0 X7 J1 @+ S0 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {, L; J: O7 H4 V9 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' |6 P! c) j' ]' n5 U7 u - ( O9 ~1 w; U9 r
- dma_addr_t dmaphyssrc1 = 0; G- V2 b1 b/ D- [; X
- dma_addr_t dmaphyssrc2 = 0;, h! ^, K$ o1 I8 p1 c" u: C0 |1 _# E
- dma_addr_t dmaphysdest1 = 0;% I+ F0 r9 \8 w5 ~* o0 o, `
- dma_addr_t dmaphysdest2 = 0;
. p+ B" Z: m' L! Y% y6 _/ w - : {' a( w6 Q: O
- char *dmabufsrc1 = NULL;, b2 A- q. x! }) t, ]: F1 `- w
- char *dmabufsrc2 = NULL;: y% ]: G f! t
- char *dmabufdest1 = NULL;! S. ~! X4 w1 I/ }
- char *dmabufdest2 = NULL;
) V1 b! ]' d+ b2 l6 o Y
8 G A4 t5 V$ X- @2 ~- static int acnt = 512;) n5 z- D; b5 r% C0 O. _
- static int bcnt = 8;
5 Z: X) Y- _5 K$ Z$ F c - static int ccnt = 8;
4 i0 c! D; \- d- A7 [
$ l' Q: \* l9 L/ P" [- module_param(acnt, int, S_IRUGO);
: I& q* T9 x Y" F. f" \. M - module_param(bcnt, int, S_IRUGO);/ |6 E, b. I) K. O; l7 |5 d
- module_param(ccnt, int, S_IRUGO);
复制代码
1 L' U; T% T G+ ?7 r) D
2 n. G; k) F% Z6 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ y: w5 e( R% O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 N7 z0 M8 j5 f" w5 \: N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, k5 m$ Y* N! a' `. J
6 D/ |/ A2 {' e$ Z( T S
! G. n4 _8 w7 v |
|