|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T: V& \! V" h& v* j/ p$ _) d H5 P- [code]EDMA sample test application
. b0 i5 {* }) f+ x$ S - /*0 r' `& o' w- t+ K
- * edma_test.c
1 W; J, {5 L: \$ o% t7 i; O - *3 {$ H) z0 C4 d9 O n4 G2 L
- * brief EDMA3 Test Application
2 s8 ]8 R; m3 A5 x& p% ? - *
1 W( g% M* [7 x( }4 K - * This file contains EDMA3 Test code., m4 R) U! Z T6 i
- *
$ G! b! c; q) m* F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 u3 L2 k2 m8 [+ }: K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ i5 T' n% Y+ K7 q& X3 B - * TO CHANGE.6 F* S7 F/ y1 l0 G3 x6 E
- *
" l" H% A7 i' C1 N2 X1 \; M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A2 F- X# t q# R3 ?5 K, n8 j- g; X
- *
' |2 }6 Q d3 \# r6 L- X$ H - * This program is free software; you can redistribute it and/or
3 S1 X1 B- {5 B - * modify it under the terms of the GNU General Public License as
8 d2 L+ B1 {1 i' T# U - * published by the Free Software Foundation version 2.0 f- Y# ?/ d7 S" k
- *
5 q/ ?; l0 \! P8 D$ A9 L9 X* {7 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
}- X3 P; s: D6 b7 ^% \ b( T" w - * kind, whether express or implied; without even the implied warranty
$ E/ C, R. \: a2 t. W; B' P2 L# t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 A F$ m2 l T5 R; e8 P3 Y - * GNU General Public License for more details.
( F/ p' ^( g, w0 C) H - */
' l+ r" E" q8 P9 U* T8 ~% C l) W - 7 Z; w* l6 v7 X8 a4 h
- #include <linux/module.h>
/ G# W% g P, p T/ |2 W - #include <linux/init.h>
# B9 V& V5 k, v ^ - #include <linux/errno.h>* m; N( C8 {5 W, Z5 o
- #include <linux/types.h>
) S' Q d# Z4 Z - #include <linux/interrupt.h>
( }$ \4 G9 C! C" Q - #include <asm/io.h>
$ A6 ~; Y; c/ N5 a# R9 d/ N& x- g - #include <linux/moduleparam.h>
' l3 D$ g2 j3 } ?7 Q - #include <linux/sysctl.h>
+ P/ Y% e6 M3 j4 F - #include <linux/mm.h>
/ H' G) O7 m3 ?2 E6 z - #include <linux/dma-mapping.h>
# Q. x4 u9 p+ \# l. K/ @
$ K8 \! g9 J3 r: E9 P/ B- L2 K- #include <mach/memory.h>( r% q0 A% O% ]7 O* j
- #include <mach/hardware.h>1 I& X4 c9 f1 P+ I" {
- #include <mach/irqs.h>; l+ v' o' E, y) ~6 @
- #include <asm/hardware/edma.h>$ M2 a) q3 v7 c
- 8 a3 z) d# g# Q1 u
- #undef EDMA3_DEBUG5 \" H0 g$ I3 z) p" O6 i+ M
- /*#define EDMA3_DEBUG*/3 U) z R4 M2 R, C
0 k# b% w' p3 t/ `9 c- #ifdef EDMA3_DEBUG) j# k9 x1 k$ ?* Z: n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ m' y# T8 q) p4 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 I5 I* z7 X& l! i8 B( G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- V; d" A- x; B( s: ?0 a - #else
- Z) ^8 G- D% @# g* o - #define DMA_PRINTK( x... ) ^8 C, n: L; o
- #define DMA_FN_IN
2 z. W( O& {+ ^, C - #define DMA_FN_OUT
s" U4 F$ n% P1 o f - #endif* B7 E9 N3 T) \
- 4 h# Y3 _% w* N5 b, z' L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). W; h1 C5 {2 i, g! o/ T! _5 E+ I0 ]9 Q
- #define STATIC_SHIFT 3. t ?, J! e Q- h! t- R. `
- #define TCINTEN_SHIFT 20
% I" [, y# a( U - #define ITCINTEN_SHIFT 21
" \1 l% b# B/ O5 X - #define TCCHEN_SHIFT 22
9 }6 {/ ~; } ~9 U& ^# O" S2 B/ H - #define ITCCHEN_SHIFT 23
& D) l: O0 N3 }, E2 s, O K
5 F. r! s; x* d- static volatile int irqraised1 = 0;/ d& j) Q5 h8 ~1 C
- static volatile int irqraised2 = 0;
! F2 [$ e! s f
0 h! k' Z3 P7 j4 Y+ R* x8 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 f5 y* \, g# `/ e8 {+ }) ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Y) l: M& k% s0 ^3 O& w0 h/ @7 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m2 t* W) g2 h. S) }& u
- ! m; A: `+ J% q3 Z ]
- dma_addr_t dmaphyssrc1 = 0;, ?% T6 W7 ^ @2 I" _3 X2 ~
- dma_addr_t dmaphyssrc2 = 0;
9 e' E! P% T) b3 M# X - dma_addr_t dmaphysdest1 = 0;1 C' C) y+ f7 \$ L8 p( G
- dma_addr_t dmaphysdest2 = 0;
$ r) }6 q! i. y: F) c - , M6 o B$ f1 [; V. O
- char *dmabufsrc1 = NULL;
! [4 [( I2 P/ ^& H4 m - char *dmabufsrc2 = NULL;8 j! p6 B; W+ ^. ~
- char *dmabufdest1 = NULL;
7 k: T8 T# @8 X% M: r$ F) h - char *dmabufdest2 = NULL;$ s' ^" t+ |4 w
1 e! W5 O& Y' k9 O5 h2 c- static int acnt = 512;/ ]/ b9 Q( N; {1 E9 v$ [
- static int bcnt = 8;
5 S' T+ F9 j$ ^: K/ U8 ^9 n. Q - static int ccnt = 8;
- g% H$ M& }7 h- A6 N- |! q2 G9 ]9 F - $ M/ P5 Y% _4 J8 M, L
- module_param(acnt, int, S_IRUGO);
; {% N" ^8 [' s6 Y: i - module_param(bcnt, int, S_IRUGO);& d) v& E9 W2 h
- module_param(ccnt, int, S_IRUGO);
复制代码 3 E4 H5 g6 D$ o) }% ^
7 s8 u" Z7 v9 h; C" ~$ ^7 Z/ _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s% {- @, `, B4 d- m% K3 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 }5 t8 q0 w, K) T/ U7 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 R; T& J6 `& h# \
/ d8 S* @8 T; `# Q' m5 D& U
7 l) d# [" o/ b0 c9 ^* I |
|