|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 {8 v$ C7 C! h7 x
- [code]EDMA sample test application
* Y- c9 h( d) z' E6 k9 M4 h! G1 q A - /*# B* O- W* S) Y
- * edma_test.c
5 I( E4 Z5 e# w - *
- W$ ~7 J! _1 h) l* ] - * brief EDMA3 Test Application% V* c' p3 p3 h4 ?' S% g8 n
- *
: a8 p8 c% j6 @- f- j9 K/ o- E$ } - * This file contains EDMA3 Test code.
0 \1 W6 V0 q& n( z - *
1 O. P* t. ?% r, H/ m0 a T0 R H9 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 X- W/ a- i" b! q9 k1 t- [/ ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* p6 Z1 f+ ]9 J& k4 C6 y; g- \: Q
- * TO CHANGE.0 `" v4 W/ ?$ u- E4 G3 z
- *+ o+ i( ^, U9 w S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) h; n& Z* h7 r% g4 G- Q9 i4 t! j - *
, o# g9 }( e0 |) b) a - * This program is free software; you can redistribute it and/or* o* p! d/ K1 [' D* Y/ j
- * modify it under the terms of the GNU General Public License as( s! _& }0 r# y+ K; `: v' |
- * published by the Free Software Foundation version 2.+ r6 T5 v$ d" G# Y4 w: r
- *
! N% ~. E5 b' r0 `5 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 m6 c q [. A
- * kind, whether express or implied; without even the implied warranty# u' D4 @& d- {1 ~3 W! O1 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ l" s) E; E7 B5 z0 O2 M& y( [9 F) p
- * GNU General Public License for more details.0 [; ]0 N& X0 \
- */- \* `$ a$ }2 ?/ |7 `1 d
- n% l$ L: S! T5 U3 @- y- #include <linux/module.h>
) ~" e: W/ z+ |& R: F- \ - #include <linux/init.h>
" G8 L( a. |& h t - #include <linux/errno.h>
& o. G. Q3 u' [8 Q" h - #include <linux/types.h>
% I5 t$ r, |' M; ] - #include <linux/interrupt.h>6 A8 [# Y& L3 p, Y7 L+ e$ I. r; X
- #include <asm/io.h>
+ O" ]2 K- f; ^# B8 V - #include <linux/moduleparam.h>
7 s1 |' Z$ S" c5 H* m$ R" L - #include <linux/sysctl.h>, {) e3 a, G( M% }, ^- G% g# h
- #include <linux/mm.h>
6 G; d3 l6 ~! Q4 B - #include <linux/dma-mapping.h>
* I+ l, N" y3 J, @+ q) Q, N5 Q
0 y6 c9 R) E3 I' T: q i- #include <mach/memory.h>$ d$ ~6 I* F- |" n: ?1 c3 M, t! w3 K$ y
- #include <mach/hardware.h>
$ J' X6 y+ t2 X* z; ^/ l" ?2 G( p - #include <mach/irqs.h>. j& t4 X4 j/ L, P8 H
- #include <asm/hardware/edma.h>
- Z) D2 L7 i& a6 S. z7 P - * }: L5 s9 _% o4 g5 H9 R* A5 A
- #undef EDMA3_DEBUG
$ V9 p; S; r6 b: ~ - /*#define EDMA3_DEBUG*/
3 ]' Y1 [5 Y: ^ ~$ d
P' Z$ l# p+ C2 s; B/ T: R) t- #ifdef EDMA3_DEBUG
* ?5 t$ x. l6 A4 O1 o! u \6 \4 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) {0 O" [! x* S% w6 f7 d3 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: q6 e+ \, P, [- H0 R. {, H4 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) A& k, B8 L* h4 x
- #else' Z H. a2 Z6 M4 e2 c. S, k d, J
- #define DMA_PRINTK( x... )
7 J3 M9 o% q6 F' y' Q) W) Z - #define DMA_FN_IN9 k0 k/ O6 G( `1 M e- b: ^1 a
- #define DMA_FN_OUT# s* `) @# b# j
- #endif
' s+ o5 p/ u4 A; p9 I! v& R
/ R0 u3 V; a' o( y5 a& D/ P2 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; K" u+ T6 e a2 t - #define STATIC_SHIFT 36 M: e& n5 B/ ^$ z
- #define TCINTEN_SHIFT 20, e: p5 s1 V" E/ e$ o
- #define ITCINTEN_SHIFT 21
' }+ `" W: G( S - #define TCCHEN_SHIFT 22
7 g; G; L5 i9 l' X3 C6 I) {& Y - #define ITCCHEN_SHIFT 23
. W4 W: {4 g) S
* W& k& R" K, ]4 c. i' s9 B$ d! o- static volatile int irqraised1 = 0;
: v1 ^* T1 N( n6 w i1 A6 ^ - static volatile int irqraised2 = 0;) w! b) k) i& S
; b+ H% [! \: I& g7 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ E2 |# W/ n; f$ m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 W' h k# e1 }# A1 j: j1 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); J0 k& |2 r# B- ~& h9 w
- ( f8 v1 P' C0 u- W' W: Q! G
- dma_addr_t dmaphyssrc1 = 0;( T; ?+ i' J+ X
- dma_addr_t dmaphyssrc2 = 0;
4 a7 ? E1 @# i6 R0 z - dma_addr_t dmaphysdest1 = 0;
: j* x d ? E; g - dma_addr_t dmaphysdest2 = 0;, {0 p6 g9 R0 x& R( y* k
- 9 t: _& d& F- W8 }
- char *dmabufsrc1 = NULL;- M9 d4 B- S' o2 @) B" I
- char *dmabufsrc2 = NULL;5 `) t8 U' @* N6 Q' g8 N9 y
- char *dmabufdest1 = NULL;4 S+ l$ U7 e- g
- char *dmabufdest2 = NULL;
7 ^$ c. X' D7 y7 S; r; s
3 D7 E" P, D& u8 O0 ~- static int acnt = 512;
6 m. b5 a4 l) x0 M, Y - static int bcnt = 8;* K# `, f' u3 q" p: `8 l0 p
- static int ccnt = 8;1 {1 `$ k$ ~! [, J3 n* z
. a) u$ o/ }9 B7 R- O- module_param(acnt, int, S_IRUGO);
7 S0 T2 Y/ K7 A S - module_param(bcnt, int, S_IRUGO);) o8 @8 {3 ^0 W9 p4 `+ B2 E
- module_param(ccnt, int, S_IRUGO);
复制代码 # o6 o& T" X2 o4 s! [7 Z: x
3 @5 A, q* U/ O4 Z4 u- N1 A7 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- w9 l/ q; D+ K8 E* a6 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# E% F3 b O% K+ H+ [ R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, s8 w# n1 d) m( @4 `- f& ^/ P9 \: h; K5 M2 l
& x- l1 p- O" l, v% ]( s% h
|
|