|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / a, |$ L/ G$ p4 o5 Z
- [code]EDMA sample test application
9 k* ]. C) D* |( m2 E. h4 j - /*+ L5 \# y" z$ T3 M
- * edma_test.c
+ ~4 K& ?, Z+ C( C - *) P; H. Y- M$ t$ q" p
- * brief EDMA3 Test Application6 U' U$ Q- ?2 m. \ Q
- *
: j4 f0 H) D; N+ C9 g - * This file contains EDMA3 Test code.1 J3 u9 M. Y$ g5 ?" {% [! D
- *
+ N1 j& `- ]9 e7 M/ Z$ F0 g; { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 P% K! B9 K. h5 |- y9 m( u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! V0 r( s9 M; d
- * TO CHANGE.6 V( r N5 g; |1 J* n5 e( s
- *" ]3 j8 H* J0 C6 J) ~5 n" |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 k, v; y y! q5 F/ m - *- S8 e. O) P) ^- A# p8 S
- * This program is free software; you can redistribute it and/or( k6 C8 x3 P1 l, W0 ~& K
- * modify it under the terms of the GNU General Public License as7 l, h4 U4 G6 T5 z7 ^" n' D i
- * published by the Free Software Foundation version 2.% ^% g4 C" r) X9 ? L' t/ W
- *$ ~% U8 r+ F! C, D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 E) p5 F, f8 _9 ^" w ]
- * kind, whether express or implied; without even the implied warranty
; v0 c$ |) h" g' r! d/ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& l4 q: A/ W6 K - * GNU General Public License for more details.. F! y; k4 I5 P8 f7 _6 g9 f
- */
& h7 ^: d( B7 w5 \5 ~! N( u - . @# h& l. ~/ A5 p& O; ?
- #include <linux/module.h>
0 e( f( x' J- \; u6 S - #include <linux/init.h>2 j, ]* F; [) L# S
- #include <linux/errno.h>8 R" Z: _8 P! Y4 E3 s; F
- #include <linux/types.h>& ]+ B3 V7 q( b, R. A' {, r
- #include <linux/interrupt.h>! R6 D4 y3 Y% O; S
- #include <asm/io.h>
$ \( |' h$ x" K W5 d" Z3 s& ` - #include <linux/moduleparam.h>
+ W( o1 f4 ]. o$ R - #include <linux/sysctl.h>2 o5 K3 a) B% ~
- #include <linux/mm.h>! ~! y+ {& G _2 a5 [# D E' r
- #include <linux/dma-mapping.h>
* a5 ]' J& R% @: c) Y
% j* x3 m( o. V% B- #include <mach/memory.h>
7 y* A" R5 S; [( [ - #include <mach/hardware.h>* b0 {% L% w7 a0 v# J, N2 F5 z; ]* w% ?
- #include <mach/irqs.h>* |0 v* f, S8 F9 m0 t
- #include <asm/hardware/edma.h>
8 @' \1 g3 y7 F; t2 z - 5 O3 T; E9 h% Z) n% v
- #undef EDMA3_DEBUG) N1 g8 ]4 j$ m, I
- /*#define EDMA3_DEBUG*/" q+ L3 c( M2 P4 t+ J9 q. e& C
9 _" a, Q7 U" [. j- #ifdef EDMA3_DEBUG
5 s( Q5 f, L- [8 O5 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- t- D9 M. F+ E. M% ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U; [/ l2 W) b2 G% G/ l) V: l0 y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ W" P, x* C0 x# y& v+ w - #else+ t& u" M5 A. l- E: B/ E' K+ J9 f- Q
- #define DMA_PRINTK( x... )
5 R" i q2 H8 j& J# C6 ] - #define DMA_FN_IN6 h3 j4 }! p; Q _/ c J$ @" C
- #define DMA_FN_OUT
' f1 L7 y4 I6 W9 f - #endif
9 `% a- Q- L4 h - 2 q" K4 h. d8 M2 Y3 L$ x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: F+ i/ C5 Z; p# \ - #define STATIC_SHIFT 3+ W& c! f; J% S/ m
- #define TCINTEN_SHIFT 20
$ ^5 {# s: P+ k9 C. T9 l: C - #define ITCINTEN_SHIFT 21
4 O1 J7 @2 y% |; C* Q( u: V - #define TCCHEN_SHIFT 225 Z' A# H$ L" ?6 `; \' H* Y
- #define ITCCHEN_SHIFT 23# f, r9 r- i" Y; i- m. M$ S4 i
- * O$ r( ~/ G- {6 x% ^
- static volatile int irqraised1 = 0; A7 M: M* U3 C( D4 H
- static volatile int irqraised2 = 0;" M0 ~% l- l6 e) V
- 6 Y( V v( Q4 }, ], P3 T: ~+ ~" Q, N8 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T4 D6 X& r+ ?7 T0 x$ u5 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" t/ [, w4 Z! P- P2 Q2 I6 W) Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e5 i' y0 t6 y6 m6 l4 p* a( f
- - d6 h5 t9 u8 f
- dma_addr_t dmaphyssrc1 = 0;
% ^4 C! D7 }3 M - dma_addr_t dmaphyssrc2 = 0;, O7 X+ v2 b9 z; _: Q, Y# P
- dma_addr_t dmaphysdest1 = 0;
: j& R) |9 z# H- h# q, C - dma_addr_t dmaphysdest2 = 0;
2 B+ b2 g- e2 R; Z" S" e
6 V; }0 n' N% c3 o, V- char *dmabufsrc1 = NULL;9 m( k4 h1 ]( s' @7 _1 @; ^
- char *dmabufsrc2 = NULL;
2 l2 i2 |$ T$ |9 v - char *dmabufdest1 = NULL;
* \/ e& ?" I6 W3 X - char *dmabufdest2 = NULL;
; t2 n4 t& P& U+ }
1 T6 I0 @2 j8 E" X- y. ?1 y- static int acnt = 512;4 X6 ]0 O( c3 q* E- @6 J
- static int bcnt = 8;
7 }1 H1 p/ o* C* R3 d, S - static int ccnt = 8;) o5 h4 y+ w6 ]; k4 r) r
. l" s3 G+ q5 g5 J. [& @- module_param(acnt, int, S_IRUGO);
: U- z! N$ E) w - module_param(bcnt, int, S_IRUGO);( z4 G% z7 \- T _4 ^, g
- module_param(ccnt, int, S_IRUGO);
复制代码 " H0 Q; r9 @# K
* `% \9 o q3 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! P2 a6 i! V: F2 O! G" b$ W- ~; |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 N7 y& b0 i) Q# c! ?) m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |2 H, B1 e. G( s
/ U) q) P+ K1 x! r9 S, W
7 I" x0 a& F- E |
|