|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) `/ ]+ h! K- ~" k9 o
- [code]EDMA sample test application
5 P5 N/ T! U, H. f, [ - /*
$ c: O: Z- R' K1 {# b9 l$ z - * edma_test.c8 _6 _2 L* g) ^3 d
- * w% ~, M c% o2 w9 G) V
- * brief EDMA3 Test Application
& b1 s% I5 X) \: I- ? - *& x( m* w" E% r3 V/ w$ a& D. O
- * This file contains EDMA3 Test code.
5 a6 Q; ?1 b$ h2 y - *1 W9 n0 S* [3 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 [4 z! L+ U6 w' b& s" B6 Q7 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ?; W6 A* K1 V% Y/ H3 W- I
- * TO CHANGE.2 }; v N7 F; r$ B
- *
' c& a- U- i0 h2 [5 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 {" E: g3 `. u E( L - ** h' }# S8 S! [$ b& ]
- * This program is free software; you can redistribute it and/or
7 Q7 W8 G2 v" H+ e! [ - * modify it under the terms of the GNU General Public License as
* w) e5 V& L: {* W F - * published by the Free Software Foundation version 2.
6 K% H, e' \' S8 a' S" \% q9 N( ~$ T - *, M3 k5 a* Y# J2 @; {+ |0 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 A% a- Q$ D. g5 v. _5 x - * kind, whether express or implied; without even the implied warranty
$ b" M# a; ]+ O/ a! { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 U8 b4 c+ C/ W - * GNU General Public License for more details.% c( X0 i* i! O& |& `5 t
- */
' _4 T1 z! T" j0 {6 m( Z" q3 {6 Z) i - 1 a: q! G/ Z: y7 X+ H
- #include <linux/module.h>8 C- E$ T4 V1 ], Z2 w7 Y, i5 C7 B
- #include <linux/init.h>( }$ V; P2 I' ]- P; Q7 ]4 {
- #include <linux/errno.h>
8 L4 s. g9 R) Z/ T/ y0 O - #include <linux/types.h>
% ]1 c" d7 S" W% H* K! l- q - #include <linux/interrupt.h>
( U# Z: F: _' |, a - #include <asm/io.h>
1 g0 X* |- E9 w - #include <linux/moduleparam.h>
# \0 P# g2 V; J& E - #include <linux/sysctl.h>
7 b4 |- t" ~% |+ j! O5 q5 v4 @- K - #include <linux/mm.h>
: J1 ~7 z8 o( Z$ c# f ?# H - #include <linux/dma-mapping.h>3 ?: }4 k* n# G# g8 M
- 6 O9 D) r- l* o' ]; M
- #include <mach/memory.h>6 d- @1 S5 }; N/ g& R# a
- #include <mach/hardware.h>
7 i( Q K# U! P' h, A" j5 F3 Y - #include <mach/irqs.h>
8 v$ k6 y0 g' c- t/ N4 \ - #include <asm/hardware/edma.h>
" X5 E: {9 x3 U2 Y - 5 @0 y2 c' ^5 b
- #undef EDMA3_DEBUG7 N' `7 ?3 y3 P
- /*#define EDMA3_DEBUG*/
6 D% B! c( S! A! Q% K
+ P. J( Z x* q# F- #ifdef EDMA3_DEBUG; B7 \9 ]3 e, n7 Y) V9 V6 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! |' k% Z$ M0 @& D2 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& e3 g `7 ]5 N# ^$ B# f( o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- h, ?* U; h$ r4 w- m
- #else
& e+ A/ y' @ f5 S$ W - #define DMA_PRINTK( x... )
0 O4 w+ N! M0 O) S- N8 ?* d- b - #define DMA_FN_IN! L) f) P6 _. _! z
- #define DMA_FN_OUT
, c/ C. k, a% W$ P v6 R - #endif+ D# J7 N4 T; p+ b u3 N4 H
- - G% ]- c! U; K, Q) @, s; t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 U$ Y5 ~/ X( w+ ?0 n
- #define STATIC_SHIFT 3$ S8 J1 J2 r h/ [4 S- s
- #define TCINTEN_SHIFT 20
7 e! X" Q1 n: ^) m - #define ITCINTEN_SHIFT 21
, a4 Q* c/ _9 b) _ ~) M - #define TCCHEN_SHIFT 22 x* t \, B, F( ?, G% [- T
- #define ITCCHEN_SHIFT 23
3 N5 B- w' t" [% @: Z7 j, P5 Z - ( d9 s( V n8 e; R' M' i
- static volatile int irqraised1 = 0;4 p2 f- B% U& _) @8 ~8 |
- static volatile int irqraised2 = 0;
% A7 t% N5 g0 O$ c7 L) e: d# D
6 ]. t4 j2 W/ l' z J+ I8 X, o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& U* P* @; i0 \$ C+ T- \' _0 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J. r6 @+ v$ n; z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 B2 {( {+ E; t - ) @7 M& C) z! {; b1 G, I0 j
- dma_addr_t dmaphyssrc1 = 0;/ H, j q; ^' _7 d
- dma_addr_t dmaphyssrc2 = 0;
! z9 S3 E. Q- d0 `. w - dma_addr_t dmaphysdest1 = 0;% A. u' n- Y, H2 I- Y( L M
- dma_addr_t dmaphysdest2 = 0;; ]( Z" v# i1 j2 t _+ z
7 {' V4 C2 v& l# T. }- X& Z# B- char *dmabufsrc1 = NULL;
% h7 l x( C+ ]7 x y' H7 ? - char *dmabufsrc2 = NULL;
9 C0 j: w6 A( e2 Q+ u - char *dmabufdest1 = NULL;: ~ v& Y- k; @# r( t
- char *dmabufdest2 = NULL;6 D* m# u' ^( j$ s' O. h
- 6 [9 E+ X0 U3 i X% C
- static int acnt = 512;" l4 e! D4 [( S% x) `
- static int bcnt = 8;
, N+ r7 F' G& F: _ - static int ccnt = 8;. a" E5 ^0 G5 f& ^* g1 B
4 a' h- w* s1 E1 s% ?& h: }- module_param(acnt, int, S_IRUGO);! ?7 N! S6 n- f8 B- j
- module_param(bcnt, int, S_IRUGO);
2 H; Q( q1 q# u& Q/ F - module_param(ccnt, int, S_IRUGO);
复制代码 ( Q: }- x( d8 r+ }1 A; @6 a2 `
: J& E9 M% e; h3 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ x7 K5 A/ |& c9 D' V2 e: barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( @ W& a2 K4 B: y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' j: {4 t- U. A" y0 f4 z$ l4 x7 r) `9 [) ~
( V; f {/ J& A1 e2 \4 q3 m0 n8 ~) f |
|