|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 I9 o3 O/ U: f8 H
- [code]EDMA sample test application: M% h" b0 Y3 m
- /*
3 {, y' u- l1 T8 w' x. c( W - * edma_test.c$ F, q" `/ O# h O
- *( @$ G' m' t' t6 s g* _
- * brief EDMA3 Test Application2 _% q0 i5 t2 L
- *& {3 d- x9 U* R+ f- o
- * This file contains EDMA3 Test code.
( Z" S; w) @0 G) ?; K: G: k - *
; \/ H5 c4 _: f! U$ s1 o9 K% X8 _: [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ x% P, q9 }5 v3 _' x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) V1 L& b7 h$ u0 K1 W; h' r7 U. E
- * TO CHANGE.
$ O( m' M0 P/ R - *6 e$ _& g I* A/ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 E; i, n4 u: E/ Z( ~3 I* q# p - *# u9 v+ v+ _8 ~5 U3 \# Y7 r
- * This program is free software; you can redistribute it and/or
9 ~7 ~4 e1 t1 r4 Z/ ^ - * modify it under the terms of the GNU General Public License as6 M, b6 R& z) H) f' g- x! U- c4 ]
- * published by the Free Software Foundation version 2.+ K6 `- U/ F! e" J) v. h$ u2 u+ h
- *1 O+ T* l$ {% w' \ m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 M8 `9 a# k% N! S* }0 M7 K
- * kind, whether express or implied; without even the implied warranty
. s! u4 U2 }) r# n5 M% e. z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( D. L3 t% @; Y/ L% L
- * GNU General Public License for more details.% u* O: @3 f- \9 N4 u5 F/ d1 \
- */0 l& G3 X! ~5 w6 y5 P
% t. t1 G+ d( ?) G- #include <linux/module.h>: w" F( k! r; {5 }
- #include <linux/init.h>+ p8 i: F. ~* ?
- #include <linux/errno.h>
! @% n; M- W% x7 b# `( a) {8 R - #include <linux/types.h>. D3 k% @+ N- ?. d2 }5 m" V9 ~
- #include <linux/interrupt.h>' `' Y- ^$ C* q- ?) p$ j5 |0 O
- #include <asm/io.h>- j( d1 a8 H3 p _' Z
- #include <linux/moduleparam.h>; R" M" u3 y% ~# T
- #include <linux/sysctl.h>/ k2 `/ J2 ?* X Y X
- #include <linux/mm.h>
9 ]" y0 _& b' }7 T - #include <linux/dma-mapping.h>
% K3 X0 w5 i/ S; K - 2 l" K2 w' p1 \' `, s7 h
- #include <mach/memory.h>
- @ H. |- G' D5 q$ l8 U% W, H8 D; Z - #include <mach/hardware.h>
$ v. F0 c6 S) W. k; F" Y! n7 H5 M, t: j - #include <mach/irqs.h>& k. G7 m x+ |1 e
- #include <asm/hardware/edma.h>0 A; q) x7 |, A- T5 K/ i' R
+ w+ E5 W1 o8 K& [& Z- #undef EDMA3_DEBUG0 x. `( v9 x( Q% `( a- h
- /*#define EDMA3_DEBUG*/
- K) c! o( m* S! y) P
! Y' E/ ~ c% y! x4 A4 j0 D- #ifdef EDMA3_DEBUG
; O% J V) ]. A0 m8 ~6 N w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. b# ^) P5 _7 I: p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ r9 O4 F) i& B4 o1 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 U; ?# G$ \3 W$ y7 W - #else1 ]$ i: Z2 L) {: L
- #define DMA_PRINTK( x... )1 X+ e3 [# G( d& p: ~- J5 G
- #define DMA_FN_IN
/ q" Z/ ^4 B( v8 V1 X - #define DMA_FN_OUT, V0 o, M+ y4 f9 |! [4 N+ Z4 r1 o& }
- #endif+ a4 ^* o8 N$ v- I0 J0 }
8 V. v9 j! D- E; v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' G: b! J: h, g
- #define STATIC_SHIFT 3
! g, P$ \/ N) {& v2 ~5 k8 H - #define TCINTEN_SHIFT 20
3 E1 g! Q5 \" _4 H3 X$ z, |: t - #define ITCINTEN_SHIFT 21
% a' h2 Y" Z$ y1 M! ^" X - #define TCCHEN_SHIFT 22
6 e3 k9 v: m; P - #define ITCCHEN_SHIFT 23: J) a6 @2 l% [/ ^5 [8 ^
- 1 z) }3 |- a# X& e; u
- static volatile int irqraised1 = 0;% H; Q. M$ X1 Q4 g" I
- static volatile int irqraised2 = 0;$ {5 b4 I. D1 U& d) `- y0 G4 f0 m1 {
1 f3 D/ w% V: @6 [) H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 h' m; L) A- v# h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d5 y6 C7 b: z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Q3 c# ^7 L6 ~, a7 c( ~7 K- [" B - % t( F4 ^/ G5 y5 ?5 c5 S
- dma_addr_t dmaphyssrc1 = 0;* c( |' U1 W7 J8 y s& M6 b
- dma_addr_t dmaphyssrc2 = 0;' f$ H7 M6 D) L
- dma_addr_t dmaphysdest1 = 0;# V* z0 N! Q1 x- F; w2 d
- dma_addr_t dmaphysdest2 = 0;' b1 @/ H+ K8 _* T ^
- 4 q& a. k& n& Z. l# I3 C f
- char *dmabufsrc1 = NULL;! ?" L* E/ x8 i
- char *dmabufsrc2 = NULL;
2 ]/ F3 l3 V3 T! b. |/ z6 q - char *dmabufdest1 = NULL;
1 y2 p' j- @) U6 m) W - char *dmabufdest2 = NULL;) ~; ]* k1 ~9 m+ P3 C
- 3 l4 |/ a. r2 x) c: [' e3 K; h0 l7 [
- static int acnt = 512;
+ `0 n' A+ g# q - static int bcnt = 8;
8 y4 }. f* N/ z: d9 U - static int ccnt = 8;
6 J3 _( Q z2 A
4 w) K1 H5 K+ ^9 G( U& k c. a4 y- module_param(acnt, int, S_IRUGO);$ Y: x, ^6 J, ^9 j
- module_param(bcnt, int, S_IRUGO);
6 m# L. J% k) C/ y6 ^ - module_param(ccnt, int, S_IRUGO);
复制代码
5 Y! _4 ]+ D9 V6 ~7 p1 m& ~. } P; O9 `+ M! |0 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j9 U* }6 a, q6 s1 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d( }1 V L+ R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Q2 j, r5 I1 D L3 D# `
' E) g5 e- X- Z- F
! {$ O0 l, i4 S" E% M |
|