|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* K2 f% j& K' W6 N# K- [code]EDMA sample test application' t( x9 J. `5 I
- /*1 G5 Q* Y4 n2 ]* v
- * edma_test.c, G$ ] i: v+ v6 x
- *
) q M+ x7 h4 g1 b+ y - * brief EDMA3 Test Application# ?: I3 H; |6 T% Z' _
- *
% G: u; r- Y8 O5 ^# V - * This file contains EDMA3 Test code.. P# H9 a9 X+ P# F# C; H1 G7 z
- *
% a, ]' t, n7 P' x5 ]- j; ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 F _& ^" Q- b8 I a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; E% e5 K$ n4 O( t0 H - * TO CHANGE.- o5 b2 W' I. }
- *
* a6 p. \0 K7 Q0 ]7 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( Y! `( l1 a; U+ l2 J3 [& g9 A% h - *& D2 R* f( |. o5 g! \8 W9 |3 S+ E
- * This program is free software; you can redistribute it and/or& Q' t. E6 s: q$ G1 ~
- * modify it under the terms of the GNU General Public License as
9 J9 r" O( C1 e) k: T! S2 J - * published by the Free Software Foundation version 2.
' _, f, p2 l/ X( R' S A) o- x - *
; N C3 W: k1 z+ g( N. ^0 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' z( C1 l( s5 b& o" u/ S - * kind, whether express or implied; without even the implied warranty
% k# |1 E2 G g. @- G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. T. i$ ^. W" j6 Z" m
- * GNU General Public License for more details.
" ]* | p) Q; ~* x7 M m# Y - */9 u2 r3 O2 }7 P; J
- ; [. y4 t% F* M/ `. n$ g
- #include <linux/module.h>/ E" [ r$ f) ]' v' s: k! i" ]
- #include <linux/init.h>
: E" \* K& R7 w2 E* x - #include <linux/errno.h>. |, N, @& y3 n% P
- #include <linux/types.h>
7 X2 h1 @9 W* M* B - #include <linux/interrupt.h> z8 |9 f* y" S* N% V9 S
- #include <asm/io.h>
) N( |- J6 O$ s# F - #include <linux/moduleparam.h>- n! \7 T4 q2 k; v9 E8 U
- #include <linux/sysctl.h>
6 U5 s: \$ @: A0 O - #include <linux/mm.h>
6 S+ t2 Q+ l! X3 i1 l) L - #include <linux/dma-mapping.h>
" J' t8 J% E4 T5 B2 |% ^
4 S& E s4 f* L9 d- c5 ?% u) O, z- #include <mach/memory.h>
6 Q( ^8 Z) K" M) D) |1 F - #include <mach/hardware.h>/ D% Z6 K3 q: K/ T( F
- #include <mach/irqs.h>
]5 r7 V1 [1 D9 L - #include <asm/hardware/edma.h>: Y0 x& h9 i6 ?* G8 f0 W7 k3 X. Y
- " d* J$ p' S8 ?' W. z) a/ |
- #undef EDMA3_DEBUG) v: p# e3 y$ B% @! M
- /*#define EDMA3_DEBUG*/
" X. M2 V' |2 d. \
$ K! d, W' y5 @" ]3 j, A K/ m6 G% H- #ifdef EDMA3_DEBUG! T9 Q% o' z; T9 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ~; Z( P# f3 p* H4 s0 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) t. T1 _& G; F* K0 F+ Y" o- w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 {! X6 B3 M6 w9 I7 f2 u
- #else
f+ ]* a1 d" L - #define DMA_PRINTK( x... )
: q7 G1 g) Q1 O( r2 Y7 G5 R+ C - #define DMA_FN_IN( Q6 _ ~! z' u. i
- #define DMA_FN_OUT& v; H$ K$ M5 N6 R7 @
- #endif
8 Y" u& I* Q* x0 h+ i - ' S7 w, s; ?% X' r. U5 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ^/ n$ K+ d8 n( j8 y9 _
- #define STATIC_SHIFT 3' O7 G F7 W+ q8 ~" j( n+ B
- #define TCINTEN_SHIFT 20% j. h9 |( b2 q: D
- #define ITCINTEN_SHIFT 21. T) p9 ~. v; u/ g( |
- #define TCCHEN_SHIFT 22 L! x, Q: w2 m9 m, Q
- #define ITCCHEN_SHIFT 23( V9 h$ _( X7 S2 G
6 V! I2 N5 e1 v! f5 O w" @. y, b- static volatile int irqraised1 = 0;
/ y' v' ^* U0 }, w' L - static volatile int irqraised2 = 0;9 v2 V" c4 e0 b8 ]
- 1 r0 V- R. }% K. ~( A4 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N, c% u+ K6 ^2 ^2 i5 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ` k9 Y# v* }" W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E& [5 |2 J, g3 ^5 m
- 4 l, Q5 d% K9 K2 G% v% V" y4 J
- dma_addr_t dmaphyssrc1 = 0;3 h% F, i1 {5 n/ Q4 `0 n5 d; t
- dma_addr_t dmaphyssrc2 = 0;* B- V0 l- A# u' g) ]1 l A
- dma_addr_t dmaphysdest1 = 0;6 T9 S2 S, N Y3 w0 N
- dma_addr_t dmaphysdest2 = 0;
8 \# v+ w* i c' Y
' j( k0 w8 ]! {0 l, e$ _2 t- char *dmabufsrc1 = NULL;
& G% q9 W5 p3 m" z6 A4 `3 D - char *dmabufsrc2 = NULL;
$ o+ A& [4 e0 z2 t J$ N - char *dmabufdest1 = NULL;
! @& e+ v3 ^! d - char *dmabufdest2 = NULL;) X- U8 Z5 R( @! h6 ~
- 3 Q$ A8 a# K% r% g
- static int acnt = 512;
2 I9 L5 [9 P( r# X$ B - static int bcnt = 8;
* n* h+ m+ c9 w1 z- B$ X; F - static int ccnt = 8;
1 l1 \9 q! _3 ]: n! D) G, g
$ p0 \* N* B$ v& S+ x; c- module_param(acnt, int, S_IRUGO);6 S& Q9 ]3 s* M" f$ x
- module_param(bcnt, int, S_IRUGO);
: P( U- Z2 L J: m - module_param(ccnt, int, S_IRUGO);
复制代码
1 O# i' n) D# Y& b' M0 \- Q* g6 L6 g) l$ {& J6 i$ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 c1 n) g+ X9 ]5 V+ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 t% ]5 B' {5 ^* ^/ c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 u! [4 I" g6 g! h- ]9 Q( N _& \
4 f) o6 F) w- z: Q( P
- Y$ c a6 x2 a* _$ a |
|