|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 e1 E* v0 e$ W$ [# O6 d& }" z
- [code]EDMA sample test application5 G' q2 m3 H) }+ A6 r
- /*
# I. s. N: B) ^4 y* n - * edma_test.c$ i, A q/ ]7 [6 ]6 O: h5 A! N
- *
; ^; s/ i( Q* Y# f - * brief EDMA3 Test Application& Z5 E$ b7 K: l; Q" m
- *
8 H7 m- ^! ?5 m( T - * This file contains EDMA3 Test code.8 _7 [4 G4 O. D$ q }# p2 H8 G
- *9 K& f# u0 j( D# c$ ?4 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 I3 S8 p) D- q3 y: K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 {$ [ X# K2 {, |5 [, c" H0 f& L - * TO CHANGE.
% r% q, P- R! I8 k$ ] - *
7 {! x4 F4 Q0 w- W- g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, C/ v+ _* k3 s! n" o - * t% C% M4 g& A, E/ I
- * This program is free software; you can redistribute it and/or( w; H6 r# I( h5 z a
- * modify it under the terms of the GNU General Public License as
7 @ ~: ~2 j: V9 @9 ]# C - * published by the Free Software Foundation version 2.( Z# D6 L: O$ ^# k8 y$ ^3 s
- *
* o' X0 H9 M- ]1 v* f* O6 Y! |7 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! v7 N( p; ?% Z6 e c
- * kind, whether express or implied; without even the implied warranty5 [1 U0 }( n# h/ F& k8 f9 v8 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: Y+ p3 w# |' B
- * GNU General Public License for more details.) N# }% W2 I2 _) [% ?+ t$ V
- */
! @" z$ J. U5 @% [6 b& |3 l4 R - % A4 P2 f9 f7 T2 N0 j. c0 L
- #include <linux/module.h>) p+ c- K4 _: Q Q3 [# e
- #include <linux/init.h>: }; ]5 V) G5 R. ~* l/ A/ R
- #include <linux/errno.h>% F6 G2 u! ?2 u+ n( D1 w
- #include <linux/types.h>5 f+ X+ C1 |: j; p
- #include <linux/interrupt.h>
8 Z: M+ p# m$ r2 C# }( y - #include <asm/io.h>
+ m- ]) T: ]7 @ `: z. S2 h) H e - #include <linux/moduleparam.h>
( V" P0 \' D( y" y - #include <linux/sysctl.h>
# t: N7 V4 s- D - #include <linux/mm.h>9 E! B9 f% ^9 d+ B! D% ], f# f
- #include <linux/dma-mapping.h>
( }: G6 O' l9 N% n" H/ |; M+ G0 D/ F - . ~. ?! Q! B3 \1 ]6 e
- #include <mach/memory.h>
8 r, m7 t4 u6 w0 c: q" q$ b- C - #include <mach/hardware.h>6 R J0 J- K# U2 \$ {& J* u. n
- #include <mach/irqs.h>3 I( Y5 S5 |* `: E& u
- #include <asm/hardware/edma.h>
( R9 e( A' b3 T! t - 0 ^9 F7 _& v( w" W1 U
- #undef EDMA3_DEBUG
2 ~4 i# t9 o/ s9 ^7 g! L y - /*#define EDMA3_DEBUG*/
2 w) e2 W4 d: q5 U8 U, F7 v; {! Y
$ f- C+ ~+ r9 U. S- S- #ifdef EDMA3_DEBUG: j5 w' p. ~: K0 J* {7 g* i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" ~. w- S4 g/ u- H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) ^/ I' L, p9 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): W7 s z7 d: t8 ]
- #else6 K, ?& Z9 |5 B: `4 D9 ~4 r" T. k ^. @
- #define DMA_PRINTK( x... )
8 l) e" E! z, E. ?: V* _+ j - #define DMA_FN_IN
* D3 N* y4 p' i2 } - #define DMA_FN_OUT
0 W4 Q$ F. W# ]# p - #endif
& R: n' ]' l3 M, K - 7 S8 t7 {$ |+ D: G* y& p! K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Q8 k; a( Q* S* G7 o - #define STATIC_SHIFT 3
' h1 E0 n3 a2 w" `; v2 d7 s - #define TCINTEN_SHIFT 20
% O* p8 P' a% ?5 O( F$ a - #define ITCINTEN_SHIFT 21
& J6 @7 I- b8 m' C - #define TCCHEN_SHIFT 221 c* K) e! ~% f+ S* x3 E l% u F% q
- #define ITCCHEN_SHIFT 23& k! h& O+ _' H# K: e
; h6 ] l% ^& M! m* [8 y) j$ E* @4 R- static volatile int irqraised1 = 0;9 n3 R8 o* I8 Q! Q6 M# M$ U" ~) p% _
- static volatile int irqraised2 = 0;8 b: V u( G9 S" x7 v' T' I
- - Z$ \! T' M3 ~1 B) ?. _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?! C& s* a9 R6 W$ B2 L9 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j, j7 M4 O7 y+ P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }3 l" v5 l8 F+ ]' V2 q
+ n+ _1 w2 x5 j% l& q- dma_addr_t dmaphyssrc1 = 0;
( G$ o& e8 s6 }5 X. Y, A7 Z1 E$ r - dma_addr_t dmaphyssrc2 = 0;
0 j. t, h& `: u! U3 F - dma_addr_t dmaphysdest1 = 0;8 |& D) d4 T; J* _
- dma_addr_t dmaphysdest2 = 0; p9 W' j" R: H$ v/ D3 @
8 c: C. ~% G4 V& E5 u- char *dmabufsrc1 = NULL;/ J8 \0 x: Q+ R9 b9 Q
- char *dmabufsrc2 = NULL;
% E. {& R9 r f3 k% ]" |* r - char *dmabufdest1 = NULL;
. \# h9 W# U( _6 l5 J$ P" k - char *dmabufdest2 = NULL;) L; Q5 y1 C- |6 e# p" ^8 x
4 I1 W* L# O8 l% O3 l- static int acnt = 512;
/ _! t4 h" _) m. u - static int bcnt = 8;
0 v0 y0 d2 G. e& u7 S5 ?1 w3 i4 q - static int ccnt = 8;/ Z) P8 b5 E) V' S4 L9 D
- ) y0 s: w9 K' S/ I4 V0 q9 z8 m
- module_param(acnt, int, S_IRUGO);
6 {$ x6 O+ {$ w; x% i - module_param(bcnt, int, S_IRUGO);! I' D8 k) v4 J! S; ?
- module_param(ccnt, int, S_IRUGO);
复制代码
( e/ f2 S F% Q2 X. W% K# i# w: x" b( @5 ~# a) I( Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- R; s o% B# F+ ]) R6 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% x! ~7 X2 K' r3 X8 |! E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# @0 K z$ q& M( v# z+ s" v
8 N9 x+ \7 o2 M4 z- L8 D6 E6 K3 \, U$ t
|
|