|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ e2 h! n0 s' ^- }
- [code]EDMA sample test application1 \0 V l" R* C" o8 B( B' N- Z- v
- /*
7 v6 k7 P7 d) ?. ~+ n# m1 }+ ~9 W _3 L - * edma_test.c
. `5 g6 K/ u- I' r% y: [ - *
% u+ g7 p! O# m: O% u- t, E+ y# o5 K - * brief EDMA3 Test Application. z9 x1 f( i; k7 u! ^% u
- *7 ~, C+ c+ r; P: \; `. y
- * This file contains EDMA3 Test code.
/ ?0 w' s* d8 H" Z# m2 H( f9 N/ M - *
3 d' K/ i; B# i8 q2 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, T0 q# n! \" G; V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 f" R; u, K0 x% o- t7 y - * TO CHANGE.! A! X- g& K+ O
- *; g; n$ U- m4 J$ M. {) t8 x% I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 k' c) O1 ~9 P" [3 {! O$ v
- *: F% u' g* |0 p& J
- * This program is free software; you can redistribute it and/or
/ M: v l% F$ c2 x4 Y4 b - * modify it under the terms of the GNU General Public License as
# H ~7 C# f1 h# E - * published by the Free Software Foundation version 2.% x+ X$ I& R! r+ L
- *9 n9 B* i# }, u8 \- i {# |7 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ [0 b& i1 p8 c( x
- * kind, whether express or implied; without even the implied warranty2 b) i3 `. j2 f; p6 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ r; g! ~3 D. ]0 D9 M6 t; X; G
- * GNU General Public License for more details.
$ x+ c. F" {7 i) B - */
8 a8 A" V" Q$ z
9 h) N: I" i0 _" `2 f6 K9 |- #include <linux/module.h>
3 I' Y( B* t p3 `. P/ ]3 y. Z* h - #include <linux/init.h>1 x5 y& T* Z+ V5 g, j
- #include <linux/errno.h>
4 [! y# |' c+ J, u1 H - #include <linux/types.h>4 E8 k* h! `2 J" Y) [1 U
- #include <linux/interrupt.h>
7 j2 O8 p. A+ s; L0 W) U4 l1 X- } - #include <asm/io.h>
& h# [% e5 `: q/ N - #include <linux/moduleparam.h>( ^+ i( f' u. q( n
- #include <linux/sysctl.h>- G+ W+ w6 C9 F# z7 W. W% T/ G
- #include <linux/mm.h>$ K5 {1 t+ x( Q! @, n5 S
- #include <linux/dma-mapping.h>
2 l. S$ x; N+ s8 J0 [0 j - : K& ?% X1 J: B. H8 }
- #include <mach/memory.h>! @" i' u" e$ T
- #include <mach/hardware.h>
8 @) B, g# |) z6 R3 c - #include <mach/irqs.h>* m+ ?+ f3 @" G7 ]- g
- #include <asm/hardware/edma.h>1 E; a+ R& i4 y7 ~5 g
- 4 M7 p+ w+ v5 s7 l' O: }# G
- #undef EDMA3_DEBUG$ r7 x1 h* P# L& {7 U" X
- /*#define EDMA3_DEBUG*/( R/ f4 W( n/ p7 Z8 J2 }: O- [
- " M0 p/ |$ Y1 E& M! o+ x8 d% F
- #ifdef EDMA3_DEBUG
& X% |$ F( Z/ J+ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ?7 \2 h' [) c) f- r7 E# t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z! _; J1 O, z) i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 N- Z; {& Y' f6 ]9 _* E - #else5 a S' `$ n! q, w8 p
- #define DMA_PRINTK( x... )
. V3 d4 ~. X/ v: Y8 r - #define DMA_FN_IN, g2 M! P1 ^& U+ ?- Q& m
- #define DMA_FN_OUT+ b% o5 U& y2 {8 H- i4 m
- #endif3 A' O! Z% a5 m1 a8 f9 ] i
- ' m7 R, z1 Q" x( j" o7 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ^' [/ m" |: {* ] - #define STATIC_SHIFT 35 z( M) m6 z5 s' p; N5 E6 G0 g
- #define TCINTEN_SHIFT 20# ?5 O& S( }2 O* Y6 u5 T
- #define ITCINTEN_SHIFT 21
: r3 K3 d( n& j- M& p2 ^+ _5 o - #define TCCHEN_SHIFT 22
! n/ G8 J+ O; a( y) `# b - #define ITCCHEN_SHIFT 23
% @6 ~0 g, D& D8 S( k$ w - 1 ~* I9 L& d& j6 a, |" h
- static volatile int irqraised1 = 0;0 T$ \' ?& z [. i
- static volatile int irqraised2 = 0;0 Y. V9 y6 \" i
: J7 F" w+ b+ Y! ^+ ~, L" v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x! @0 ~+ Z2 m! c5 @+ I0 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q- }3 c( O' s3 V/ ?6 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E2 p( }. Q# R" d2 m [
* ?5 u! C; `1 A+ w7 {2 O- dma_addr_t dmaphyssrc1 = 0;' W# H- s( a3 ?2 P" `
- dma_addr_t dmaphyssrc2 = 0;6 F4 T- U3 r9 h) Y' g. o5 q
- dma_addr_t dmaphysdest1 = 0;
( ?6 N( i3 n% |1 L - dma_addr_t dmaphysdest2 = 0;
3 O( j+ Z5 J9 ?. J
) ^0 g( W! \" u( r" Q8 M- char *dmabufsrc1 = NULL;4 V' {. Y3 ^6 ~% t6 Y
- char *dmabufsrc2 = NULL;
1 T' x' r# x" }* g5 Z - char *dmabufdest1 = NULL;( t: N7 R7 P5 E! K7 {! M! B
- char *dmabufdest2 = NULL;) N! H2 g0 S$ ?9 B
- % v. y ^6 J* h7 t
- static int acnt = 512;
2 k/ a( T) g5 m2 H2 P% r - static int bcnt = 8;. u0 D3 }7 A0 V/ _' L1 r
- static int ccnt = 8;" h' p Y/ W6 X. D
- ) H G9 t7 x g# e. ^
- module_param(acnt, int, S_IRUGO);9 k$ s( q: r9 D4 j( I4 _1 i9 z3 j$ N
- module_param(bcnt, int, S_IRUGO);# ^* M7 J$ j2 `3 j+ V0 ?5 W. _
- module_param(ccnt, int, S_IRUGO);
复制代码 1 m) d- D% _! C2 s' ]; G
3 I" C! P1 B: v. A9 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
x8 ]/ f) y X3 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b2 }; W( D4 d; h- R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: u" q8 D6 v; H' ^
& b. M; g; J& f1 ~0 W: A, i
2 c& x* ?4 C* O1 p z |
|