|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N- A! h& |0 \: ~) L$ g, U! R7 b# O- [code]EDMA sample test application6 o2 A6 j1 ?. t
- /*
% [. Y6 [) u% Y) { - * edma_test.c
; ^% V# ]" i# o( [$ K1 e/ j - *9 f" ]! {8 s; k! T: M; n
- * brief EDMA3 Test Application
8 `; _3 f, W" h8 |9 }5 i - *6 H* h# S5 v& [# c- ]9 z
- * This file contains EDMA3 Test code.$ L0 a- T0 @( I4 K& i+ ]. a
- *
$ R( i# ~' d% [ [# A8 I, u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ r$ ^8 ]/ D) z0 i; ~7 u* O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT e x! }9 S* [5 M
- * TO CHANGE.% g T, @' K$ q8 j
- *, a- X( V" S$ ?2 Z9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E* K1 J4 P' s, G - *6 i h/ b: A- i0 N3 h$ C) j
- * This program is free software; you can redistribute it and/or
) i* Z+ i& @# f4 F' T ?; _5 L - * modify it under the terms of the GNU General Public License as
1 Q- d4 u# O% ]3 R - * published by the Free Software Foundation version 2.5 \' ?( A' ~$ ^/ x; W) z+ |
- ** a- ~; ?) ?& |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ G3 q# h# }* I, i
- * kind, whether express or implied; without even the implied warranty, @( v- E' c2 Z% P. ~- V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ J+ j4 n4 v2 y0 [: n
- * GNU General Public License for more details.9 Y; U9 q1 G3 z/ I% t
- */( B- G3 S, J! @- j2 t) o; O* d
* ?) O8 o' D1 @2 i. W7 K/ h0 J. b- #include <linux/module.h>- Z6 P$ I6 w; J0 q0 [9 u
- #include <linux/init.h>- ^# h6 L% C3 m: ?0 }4 T6 `! Y# E
- #include <linux/errno.h>
/ `% [1 q, n. f7 Q/ P1 e - #include <linux/types.h>
0 X4 K) p- N0 [+ Y - #include <linux/interrupt.h>1 @+ g/ n# ^! Z( ^4 k1 }
- #include <asm/io.h> j6 A' H8 e# \ U
- #include <linux/moduleparam.h>5 P ^3 s5 q, T* o+ n
- #include <linux/sysctl.h>2 L& A2 V h! N$ f) w6 Q
- #include <linux/mm.h>5 p! s5 [" k( g* U, f0 R
- #include <linux/dma-mapping.h>
9 H0 U4 K Y C4 w& ` - ! M. Y, ?7 e$ p
- #include <mach/memory.h>- P; q8 @$ y! p1 a; T
- #include <mach/hardware.h>, E1 B6 }* \4 s: s" x
- #include <mach/irqs.h>; h, t* u' W3 y9 q/ w1 B
- #include <asm/hardware/edma.h>7 ~4 F% q5 C2 L
- I) C/ s8 I. A) S _
- #undef EDMA3_DEBUG
/ @& {# E& m* Q5 ~ - /*#define EDMA3_DEBUG*/
5 J( }5 A3 Q" W# ]* G- U! u
& Z+ {+ A7 B* d/ O9 K9 o4 F- #ifdef EDMA3_DEBUG
; O6 @% ^; f* ~4 l6 |% j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I$ G F6 S) Y) V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ _5 _! M' V) G5 P- l1 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q+ U2 p; I6 W
- #else: j$ ?1 Z0 e' b+ y% a6 [9 v
- #define DMA_PRINTK( x... )0 a% X) O1 x& N
- #define DMA_FN_IN7 Z) u; D. }$ y! r. U
- #define DMA_FN_OUT% ?% B: W# K4 S# X
- #endif
5 \4 d# D1 k/ o/ t- F
! A+ O, J% g* a5 ?0 |6 O9 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: K8 a9 K# y4 h. Q3 \! N, v3 g5 j& ` - #define STATIC_SHIFT 3+ ^3 V) H5 p" K- o+ v& i
- #define TCINTEN_SHIFT 20
- C9 b5 q ~8 T3 o7 q - #define ITCINTEN_SHIFT 21/ _# n8 G$ l7 J. u+ R
- #define TCCHEN_SHIFT 22
% w: R3 t& E. Q7 v# E5 e - #define ITCCHEN_SHIFT 232 X8 g3 s7 @# H3 H3 z/ C
" P/ X: l* m5 B, m! R* M, N- static volatile int irqraised1 = 0;5 \0 I! Q6 `( k, ^) ] s+ P" P
- static volatile int irqraised2 = 0;) C; @9 e8 n# { y, d7 c
- 0 M9 b& a1 a4 _2 v' Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 U, ?4 T" S, ^) a6 g, i- x7 W$ i, V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ]! W/ T8 G: _9 s' c; O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 s# l0 i* Z) C0 f8 I, v
- 4 p0 h& A$ [* S# @# U
- dma_addr_t dmaphyssrc1 = 0;
! p# X) h3 c9 L& ]* C - dma_addr_t dmaphyssrc2 = 0;
B- K0 z2 N- | W - dma_addr_t dmaphysdest1 = 0;8 O1 v8 D2 D, {1 y3 P9 J4 Z$ X
- dma_addr_t dmaphysdest2 = 0;
+ ?+ V9 t1 S/ U/ U2 a3 t' ^/ ?
; g1 o% E" K& c2 l6 f" [0 B. r- char *dmabufsrc1 = NULL;
0 x5 P7 M8 g8 g - char *dmabufsrc2 = NULL;9 x2 ^) H% F& O- @ l1 w
- char *dmabufdest1 = NULL;
& |( q" w5 B, g9 \% m" k* n+ N: C - char *dmabufdest2 = NULL;
% E3 y& D J/ Z. p o9 n# @
9 Z! D2 G2 t/ D( B4 J# W- static int acnt = 512;
( P/ ?! Q4 I: X O+ X - static int bcnt = 8;
i- l# j2 P$ ] {! W8 n - static int ccnt = 8;
. O |: t. g; C2 `6 t, B1 P - : W8 L. u8 E! J7 }2 D% m
- module_param(acnt, int, S_IRUGO);
1 v4 S, h9 m- p4 |7 N5 o - module_param(bcnt, int, S_IRUGO);
) s6 o% E6 B1 A$ `' y+ S - module_param(ccnt, int, S_IRUGO);
复制代码 " R+ E1 N+ |9 R2 ]# C8 H: h# F
; [* Y. ^9 F# k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# D. }' x6 G& _% g! }$ u9 k5 `; }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& i9 v, I/ _- C8 k @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O. P; p/ F7 r3 j: h
, o1 @; b# s7 c( Z9 w- W
6 L- M! W' l+ R8 O8 g0 @! E( Q- f
|
|