|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # I, V3 t1 E/ E, Y% j1 l" d
- [code]EDMA sample test application
7 B; R" X3 w+ A - /*: _/ e! j, A4 s( b
- * edma_test.c
6 ?9 n3 C3 e$ D. ] - *
! s0 P+ ]* x, t/ c1 [ - * brief EDMA3 Test Application
; s, `* Z8 ]8 w8 i- }" T# E - *
2 N5 t4 L% G0 c - * This file contains EDMA3 Test code.) ^6 g# }0 f8 b0 y# W- B; {
- *7 k0 S7 o5 i8 G5 Q- F# n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Q! ^" K3 P# M/ a: d+ b% g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 @6 J' g4 j1 Z4 r
- * TO CHANGE.
+ u; u* t/ a4 l. |. v, g - *0 q7 _- t% ^" _( c4 Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ ^7 ~+ h' Z+ s7 }7 i
- *3 ]# s. o. D% a$ `3 `7 F
- * This program is free software; you can redistribute it and/or! D. k2 q& C5 m1 u
- * modify it under the terms of the GNU General Public License as& s" X- W m B) D
- * published by the Free Software Foundation version 2.+ h; d; A. y. k: ?" [6 o7 X' W
- *
1 y+ e7 n" V0 Y& I1 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 c7 t1 ^# }2 z5 t# O5 F - * kind, whether express or implied; without even the implied warranty
9 c- r& J2 I/ U4 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
t* \" ^/ ~5 p2 x5 V! ~, ~* ~ Q - * GNU General Public License for more details.+ r% L/ V; s: v. z( F% n
- */
- z( q' d$ h: s: d3 ~- W- K# r+ D; V/ |& r
' A9 b7 n9 n0 K2 q8 |8 H- #include <linux/module.h>
! S# H) `. f5 J: A/ d - #include <linux/init.h>8 s) m9 A' J5 n3 A4 i; m' G
- #include <linux/errno.h>" E) D0 W1 x8 M4 k& E2 a
- #include <linux/types.h>& O+ _ {% i1 A" V1 W# s
- #include <linux/interrupt.h>/ O; i+ F5 u: R% s( {) v, G
- #include <asm/io.h>, j+ I' K* i0 W9 \* b
- #include <linux/moduleparam.h>7 S* g) \8 J, ^8 B1 U) U/ z
- #include <linux/sysctl.h>- E! Y" X z- c+ T" A0 f
- #include <linux/mm.h>% A8 N- d; a- M0 X/ f
- #include <linux/dma-mapping.h>
1 u5 J' Q& Q* y. ~+ i2 n. ^! W
g9 ~- B- j p! H- R- #include <mach/memory.h>8 K" z' t" [: t) z
- #include <mach/hardware.h>
2 R- o/ u8 B3 H2 b$ A) F! K4 f - #include <mach/irqs.h>
3 Y5 I- E' ?+ b, c7 V, {# h/ z- p - #include <asm/hardware/edma.h>: D5 i, E; u$ L" d: \
- 3 f4 B5 @" O; B! m
- #undef EDMA3_DEBUG1 ?; T: M0 c3 B C
- /*#define EDMA3_DEBUG*/
3 y0 y9 [8 u, `2 h q
/ J' M* y; S8 t4 f1 O- #ifdef EDMA3_DEBUG" W- o4 k# \" {$ Q! Q( S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ T5 j8 \9 Y! C6 H. R1 e' |! _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 i% G4 Q* v; q* j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o% b- Q) a& L/ C7 _/ S' Y4 m [2 }
- #else% ]0 Q9 S2 C/ w$ S
- #define DMA_PRINTK( x... )
' a v% _" ]' J. K* g5 e - #define DMA_FN_IN
: c- o) K( [, d" ]) B5 |4 n L. J - #define DMA_FN_OUT5 d5 f" k4 ~: C; E4 z; u' c) |
- #endif
+ z% @7 y: M* p7 V& \" _& |
+ l4 p7 b4 J. `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) a5 Q/ F) J) J8 A+ _% _% X6 T
- #define STATIC_SHIFT 3
9 |1 J$ ~& b( T6 _! ] - #define TCINTEN_SHIFT 20
' C3 n: U8 p5 i: L) s2 y2 m! Z - #define ITCINTEN_SHIFT 21
3 I; \9 A# O( w( s' [ - #define TCCHEN_SHIFT 22
( s! o3 e( V# i1 w: _ - #define ITCCHEN_SHIFT 23+ A2 B4 f4 s* t- j) E
- $ V5 H9 U' h0 `2 |
- static volatile int irqraised1 = 0;" k" ~# J# E# I1 h% \' k+ m
- static volatile int irqraised2 = 0;
# J: h- ^8 z4 F/ ?& X
5 W1 {6 W9 ~) l* k1 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Z# Z4 F! i: K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 E" G' {$ y$ L6 r/ K5 U7 \& Z% O4 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v6 N7 y1 z& Y9 [& f" B, f
- O. e& V7 F4 Y7 t. m2 d- dma_addr_t dmaphyssrc1 = 0;; s- f5 G; {& l$ ?3 k+ t/ ?" p
- dma_addr_t dmaphyssrc2 = 0;0 p" W0 o. s$ d! J- k& S* o. Q& V
- dma_addr_t dmaphysdest1 = 0;
, [ Q+ E/ T- [ L) B% e2 h% b8 Z - dma_addr_t dmaphysdest2 = 0;) R; A6 e3 i/ C8 q$ I, ]
7 Y3 j3 z2 z0 H4 ^( @* Q3 Q @7 N- char *dmabufsrc1 = NULL;
. X) j: u/ M& k, l( f - char *dmabufsrc2 = NULL;! K7 I* k! Q) f6 ?* Y
- char *dmabufdest1 = NULL;. d4 t9 T" g7 ~$ g/ b5 H
- char *dmabufdest2 = NULL; x; P' O! n. G( Z( n$ H
- ! a6 b& e; y0 M6 h O+ Y
- static int acnt = 512;
" i5 T4 ~# m( r, o. B - static int bcnt = 8;
6 `9 E% w2 O6 O' h$ o6 @3 e - static int ccnt = 8;7 O0 \# F# d2 c3 b5 n( E& |
- ! z0 o0 [9 Q k, g( G: [0 [
- module_param(acnt, int, S_IRUGO);: E/ K7 `8 }# W9 x' p" p( P
- module_param(bcnt, int, S_IRUGO);
% y/ H$ w. m5 j1 K4 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 * \# J0 i: c6 S3 A
# n2 u& D1 D7 ~) Y# _6 q9 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 _# K/ c) _1 d p$ r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ K% \5 }8 C# W2 S9 U- n5 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. e8 C: d0 v& Y
- T" q# Y5 E7 k" @- e: T/ |9 j
0 V& X/ r- {2 W7 d |
|