|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ], h" ]' `" q$ K3 C$ ]1 D
- [code]EDMA sample test application$ \9 n8 v. n% t. I+ h9 z: N
- /*: f+ u% g" O+ ]7 ^
- * edma_test.c3 t% |: n/ ]2 @0 T. A: b0 ]
- *' q) e* K' J% m" {! S, Z% N) I
- * brief EDMA3 Test Application5 e6 \% a4 T- V, ?4 g) S
- *' ~. A- O$ c$ |/ |' m/ r+ w2 y4 |
- * This file contains EDMA3 Test code.
2 w7 b' H8 T2 y - * S1 v4 h0 y/ L: O8 b9 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! i) l% G0 _- v0 S# X0 p8 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q) u3 {; n% c6 J
- * TO CHANGE.
% h0 n; |8 L$ r5 h. m - *
6 i, ?9 {6 v9 }8 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" f i: n4 R8 A C - *
$ c- f2 W8 C% k# ~% |/ F( X - * This program is free software; you can redistribute it and/or( u: d \% w' i5 {3 H4 x! l
- * modify it under the terms of the GNU General Public License as" J L- {) N, U
- * published by the Free Software Foundation version 2.! }1 \2 b! h$ `+ D) {. h
- *
* r4 W& E7 j3 Z. q/ _( @# E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 J1 _! f" x* [2 n Z - * kind, whether express or implied; without even the implied warranty2 V8 ^- s" R/ i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 E1 d' C4 w: O& F; ~9 z; U - * GNU General Public License for more details./ V M* f- e# D1 `+ Z* T7 U
- */
9 N2 a q9 W* f; s8 y
M! Z7 h% Q! \% U- #include <linux/module.h>5 q( w' ^" v6 D& H1 ]1 g5 q& [
- #include <linux/init.h>2 O- ^9 _, ?8 Y P$ A) i% q
- #include <linux/errno.h>
# h3 x: {- Q H) h - #include <linux/types.h>
. n5 M9 _; s4 x$ |- V2 W& i - #include <linux/interrupt.h>. @- H8 R: g/ @5 N$ l
- #include <asm/io.h>
4 Q8 ^! c, K( E - #include <linux/moduleparam.h>
" C: v0 W. h6 @6 V; Y- a - #include <linux/sysctl.h> S) b$ A- U8 L) ~; x1 [
- #include <linux/mm.h>
2 Z7 I. j5 h5 U! S) ^3 d - #include <linux/dma-mapping.h>; T( Z; q8 W8 O/ N
! q4 Y, B1 f( T& Q- #include <mach/memory.h>
8 p& M8 p& U3 C( U - #include <mach/hardware.h>" ?; S* I" j) S8 z
- #include <mach/irqs.h>( s9 G2 j& `4 D! ^# d- [7 E3 Z
- #include <asm/hardware/edma.h>
/ d; l; O% u# x1 {+ I
3 \ Y; o" ?/ L$ W9 S- #undef EDMA3_DEBUG( [+ e; \1 o+ t* d r3 L
- /*#define EDMA3_DEBUG*/
; Y+ S% K0 ?+ L% Y1 d - 7 D6 } i9 \& u7 b$ U G; Y
- #ifdef EDMA3_DEBUG
" I! Y& A z. w; I7 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 f% t. d! B7 Z4 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 W4 l3 \ b6 t7 t; k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ C5 V1 \% ` j- Q, B* A% W1 E7 m
- #else. n$ @3 o& y; \& m; A0 S
- #define DMA_PRINTK( x... )5 {$ {8 j! J2 S% O7 K' C2 \: u6 p/ q+ J
- #define DMA_FN_IN
$ w0 q$ y4 h: R - #define DMA_FN_OUT8 g& G1 E* I% C7 L* A4 X
- #endif+ K5 f1 A v7 j% q4 W
- 7 g @: K! P1 o- D0 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; S- j; U; o$ V8 J' X - #define STATIC_SHIFT 3" R1 _( a8 [% M; a1 B" {
- #define TCINTEN_SHIFT 20 t) f8 b% D# q9 s8 i1 Z
- #define ITCINTEN_SHIFT 215 j# S' f/ i' o; @! z
- #define TCCHEN_SHIFT 22. @& P8 e( P( a% s8 R
- #define ITCCHEN_SHIFT 23% |3 P! n) U" e9 l6 w
0 x/ C x( s* @$ ~- static volatile int irqraised1 = 0;$ ?7 j+ `7 Z" ]/ ?' l# j
- static volatile int irqraised2 = 0;
0 L; u% |- S B. I1 p/ q' M4 W6 H5 j
4 `. y+ [& F9 O- z7 A& B5 _2 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ b4 y7 ?) l5 e# w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m% \% q" V: j8 A2 @2 z- S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O3 X; B S6 X) L
2 D' ~5 l6 E$ V+ a- @- dma_addr_t dmaphyssrc1 = 0;) N" ~% K2 o, z; i4 G9 P" C4 G* A
- dma_addr_t dmaphyssrc2 = 0;# G. [5 v! k9 m8 }! J
- dma_addr_t dmaphysdest1 = 0;
7 L7 s$ a- H) p3 |. Q - dma_addr_t dmaphysdest2 = 0;
9 N* f* Y+ K# P# ~" U - 8 }& _" p. a) T" e9 e! |; G
- char *dmabufsrc1 = NULL; C2 X" w& h+ Q
- char *dmabufsrc2 = NULL;! f5 [) N/ f% j3 y
- char *dmabufdest1 = NULL;7 t: Q1 d$ G3 @: }6 d! g3 Z
- char *dmabufdest2 = NULL;
4 e8 k3 m% H3 s3 p, r' ] - 6 A% R8 ?2 ]& j5 [$ h
- static int acnt = 512;
# p% p+ R' p- z- x7 E7 r - static int bcnt = 8;7 w" f& B+ p/ f' H9 o4 }
- static int ccnt = 8;5 v1 X" a. X) B6 e
- 6 l& ?# T& y W) {; L
- module_param(acnt, int, S_IRUGO);
* W8 }' P0 W5 Q# E& i. l7 B6 } - module_param(bcnt, int, S_IRUGO);
: h5 A; S" X% Z - module_param(ccnt, int, S_IRUGO);
复制代码 2 m) \# t; }2 a% j* J' Q
" q& K, V4 H0 e6 Q/ M3 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ k$ T- }0 m/ U) B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 n$ h& D; h8 m9 L1 H; x- v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) a' ^6 z& e% u. ~
* n1 S0 ?( y5 F5 k6 n9 `$ {4 f8 E/ ]; U. y
|
|