|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W' z( p4 I# R5 k+ n5 ^1 V2 C
- [code]EDMA sample test application
$ g C5 E6 e* f/ y K! S+ ^8 [ - /*
$ d$ ]9 b8 T: C2 M% b( D& y7 w - * edma_test.c+ q4 y6 E4 J6 v" U0 Z/ \* y
- *- o, P$ N% {; }
- * brief EDMA3 Test Application
/ x3 m; d0 l2 H: |) j& ]3 O - *
" Y# ?5 g) I. O$ q* |/ O/ S - * This file contains EDMA3 Test code.9 X5 e7 {/ h7 y% ]
- *
+ U; I2 A; s; f6 r* a) W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 {$ q& N; O8 B0 [( S, Y9 I% a* H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& i: K; Q T4 A( T' ?$ z - * TO CHANGE.
' C& D5 o5 p: ?; D6 d - *
4 l& E9 R$ q: R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% }* ?* \2 l0 j8 v3 `+ P5 S - *
& c6 m0 j; a5 f& s8 ~9 a - * This program is free software; you can redistribute it and/or
- C0 k+ w( D. E+ v4 e- g, I - * modify it under the terms of the GNU General Public License as
; P& K+ C, v& ?; `$ J% i - * published by the Free Software Foundation version 2.
3 K6 y5 c0 F6 T1 A* I3 X8 L - *
- S; G* x' g6 C( {* b4 j& i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, J+ C# R( B$ E5 J
- * kind, whether express or implied; without even the implied warranty1 I1 D9 p, g, |" \. q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; r( l7 `. J+ ~6 } - * GNU General Public License for more details.
: ]3 K: \: E1 z6 X* m1 } - */
2 _4 l, d0 V: i! J! Z }8 r3 G
; a" M7 W; f3 R4 h- #include <linux/module.h>& l' f% A! E/ U' C$ i* ^. V
- #include <linux/init.h>- g& x8 m4 g2 H0 k5 ]7 R4 j
- #include <linux/errno.h>) G7 x! j& u( ?
- #include <linux/types.h>* a& |0 l, e1 `; K
- #include <linux/interrupt.h>6 @- [: U2 s% z
- #include <asm/io.h>$ A* L" o f4 o5 J/ b' v1 F! E
- #include <linux/moduleparam.h>0 z4 b D( E, Q4 i
- #include <linux/sysctl.h>
! n" @, f2 D% z, i- x- E - #include <linux/mm.h>
) [8 U. }' r* s# Y& v" P/ J/ @4 p - #include <linux/dma-mapping.h>; A# T& `4 N( H# g$ q9 A
- ]% Z$ J/ d; |8 B2 J( m9 u+ X) k0 b- #include <mach/memory.h>
% `" i8 o0 b8 i- W. h - #include <mach/hardware.h>1 J- ` m8 E3 I6 o+ m" K
- #include <mach/irqs.h>
, u3 Z. a! ]. E" ]" J1 ^% L. U2 s - #include <asm/hardware/edma.h>& [1 r4 i7 D/ @. P1 L. ]: f
- 9 v# J# O8 z8 q& Z% L+ L3 Y
- #undef EDMA3_DEBUG
1 M, h' E# h, W. _# R; w - /*#define EDMA3_DEBUG*/4 S2 s6 @. a* w1 y4 ?
- * E4 j, `' C+ C/ x. F* }. U5 }
- #ifdef EDMA3_DEBUG5 @2 _/ |3 E1 B, y3 ^' u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) @$ K7 Q& v+ Q" D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ J% K7 |" Y2 _9 D3 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& j% `! [7 g X6 ?, \9 e2 U2 O
- #else
1 j6 y, \) z% ~! l: t& l v - #define DMA_PRINTK( x... ). d% G3 P3 U2 z7 [5 Q
- #define DMA_FN_IN( O8 l+ h0 n |$ w4 |6 R
- #define DMA_FN_OUT. L6 W; q: |: N; ?" {3 Q6 [
- #endif
d5 i1 U" u& `$ E/ A8 o - / [: _3 N3 L6 T# k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( n( V e$ f0 g# P8 x - #define STATIC_SHIFT 34 G' F- H6 W5 y7 s% L
- #define TCINTEN_SHIFT 20
6 `0 Y+ |6 D' N# L - #define ITCINTEN_SHIFT 21
. e1 A0 R6 U8 t C - #define TCCHEN_SHIFT 22
" ]- M C2 l; N h* R# b5 G - #define ITCCHEN_SHIFT 23$ t4 Y1 Y! L, r3 O, F+ F
4 F/ U) N: ?8 u1 O; [+ s1 f- static volatile int irqraised1 = 0;' ~7 u M4 ~- w+ A: g5 V( J
- static volatile int irqraised2 = 0;9 a0 b, @, k; ~+ o
# K/ B& [% C( C( @/ g4 t2 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Y9 h0 D9 g* T' ~' N3 m7 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 q; B% g. C" i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \9 f9 [4 Y) b. M, E
- E+ y5 L. _% V; x& J
- dma_addr_t dmaphyssrc1 = 0;
3 S) w7 u- R& a- j - dma_addr_t dmaphyssrc2 = 0;
@& u' s) ^8 J - dma_addr_t dmaphysdest1 = 0;
: \6 |# y: x5 }, c) L l - dma_addr_t dmaphysdest2 = 0;
4 H0 t1 C; a K/ H/ S8 T+ @ - $ m& W. @+ b) R) Z2 T. n$ S
- char *dmabufsrc1 = NULL;& S4 _$ V+ ^ Y7 Y. K% T. Y0 F
- char *dmabufsrc2 = NULL;8 f8 J! f4 A0 v$ }6 l- K% |) |, C6 S
- char *dmabufdest1 = NULL;
}, Q- G) Q; ~" [3 V; p- o" P - char *dmabufdest2 = NULL;3 k- e3 t: d6 B0 X6 b5 T6 Q
- m4 j$ Y0 G5 I, p
- static int acnt = 512;
: I4 v9 m% B- B0 v - static int bcnt = 8;
) ?- o% j+ H6 B' E( m - static int ccnt = 8;; k4 P- Y, K6 ?; H
- 6 T2 Z. W' E; Y5 W" \/ k( E
- module_param(acnt, int, S_IRUGO);
+ V! }2 j; _ `8 h7 S+ b+ Y, y) @ - module_param(bcnt, int, S_IRUGO);2 Q2 C; k2 a7 @5 p
- module_param(ccnt, int, S_IRUGO);
复制代码 ; S$ ]9 {2 b- t3 R; P
1 v' L* i. u5 y" g! I# i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j' K, b; Q/ a( P6 R8 d. m- aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 V# C4 K4 K' ?# H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j( `* ?. h% U; g
. }* B& F9 d* W4 I: U/ Q. j1 A$ p/ v, z2 D
|
|