|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : }# w9 B+ ^# v5 t! M( L
- [code]EDMA sample test application
& X' {* n o' }: ~3 b) Z% R - /*7 G0 q+ {' H n3 U. p. `1 o/ v
- * edma_test.c& o5 v* O5 m0 ^8 A4 ?& H: F- l" O
- *9 ~ n- E+ z2 A/ Z
- * brief EDMA3 Test Application
) U8 t; B6 |" ?9 k$ ]/ e% T; B - *" l2 I8 f5 ~8 s4 y3 ?& M6 u
- * This file contains EDMA3 Test code.
4 }# l) l' o9 t. M$ [ - *7 b: m+ [+ e4 ?3 s" i4 Y& x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 F% a1 A4 D& C" {/ \4 _9 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# ~, E$ f+ b- d9 { - * TO CHANGE.2 J; O8 W7 Q/ G4 q% ^
- *
8 f5 x; G) h6 m v9 \! j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 T3 P0 F' z3 {" } b
- *, T; o7 f. J" b0 e: G! b6 Q
- * This program is free software; you can redistribute it and/or y2 G) i: \1 @$ B U3 A
- * modify it under the terms of the GNU General Public License as
1 Y+ B2 Z7 N$ z& p( {; { - * published by the Free Software Foundation version 2.
% n6 \4 [4 S0 v7 z* r - *
& T: y+ k% s- x$ L4 r D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' C: B3 W1 q7 K M1 u$ _ - * kind, whether express or implied; without even the implied warranty8 e6 u% Z1 I9 ?3 m4 E- K: ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& C0 u- }1 ^, v
- * GNU General Public License for more details.! l; }& N8 ^% G2 w* g* j& B
- */2 A9 O3 t! @# a% ]* K1 s) X. Q
3 u" b! f V. Z- #include <linux/module.h>
5 \. V# U* H5 c8 P# P - #include <linux/init.h>/ q5 o/ P# E/ _4 s( P1 m! z
- #include <linux/errno.h>
) x- o {+ Y+ I$ ?- q - #include <linux/types.h>; A e1 @- y5 O& `
- #include <linux/interrupt.h># ~. f6 r. T. }
- #include <asm/io.h>. i( E. f; l( T: D0 v% h5 }1 F
- #include <linux/moduleparam.h>
S s, h% {% b; C - #include <linux/sysctl.h>+ I7 z7 d2 e- g( _# ]
- #include <linux/mm.h>- }- n7 T9 J: e; c8 n k
- #include <linux/dma-mapping.h>- u' S6 R$ Q4 W+ k% h3 t9 D, }
- - O% e# P# A4 j6 d0 k4 B3 m4 M7 [
- #include <mach/memory.h>
8 U: i) }5 b" m# V; A) l( Z - #include <mach/hardware.h>% Q" ?3 A5 J0 h" x
- #include <mach/irqs.h> U1 g, e/ f5 _. G! ]4 F' r
- #include <asm/hardware/edma.h> M2 p5 y0 g: \
- - M0 g$ }0 r. D9 H( O$ S/ e
- #undef EDMA3_DEBUG
, n O. a3 {5 C2 b6 i; O+ l( E - /*#define EDMA3_DEBUG*/
+ y+ j3 A1 w" @! E0 u0 t6 v, J" k - . c5 K' o8 O. G7 \6 u& g
- #ifdef EDMA3_DEBUG
. @$ n4 t4 y' Z# | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 @5 ^& j) \8 b3 o2 Q) Y8 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
F; b: }+ P) M( ^- `, F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; s9 I6 ?# @. r& t6 f - #else4 z" L4 U: N% d: U2 L
- #define DMA_PRINTK( x... ), Z! H F* p+ l* z. b' s
- #define DMA_FN_IN
, Z% i% W- V1 f# A. M' N - #define DMA_FN_OUT
4 T% c6 t, ]: y. Z5 X6 u v - #endif
9 s* X9 e; }# ?4 {2 s0 }$ w' d: g+ J
1 F1 o. t1 T0 B* p7 y* L- #define MAX_DMA_TRANSFER_IN_BYTES (32768) u* U% @$ ] l+ l" r! o% S6 Q
- #define STATIC_SHIFT 3! G0 d# l9 @6 w% b _9 w2 x
- #define TCINTEN_SHIFT 20
' m- a+ H. G! `2 w* O4 P0 K - #define ITCINTEN_SHIFT 21
/ J u% N! t" P7 \% X - #define TCCHEN_SHIFT 22! Z1 {% c+ t) p9 t7 I+ I& N9 X
- #define ITCCHEN_SHIFT 23 [+ S" ^; d( Y4 r% T, G& F
- 0 H* _& I- K& R" K& M
- static volatile int irqraised1 = 0;# K1 c; ^9 O5 N
- static volatile int irqraised2 = 0;
5 V# A7 l4 }, ~; N t& N - , B; Y9 U2 d1 r( c0 R, f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \- R9 x" H$ o+ ~/ `- ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j1 i* a( l) {$ ^, ?9 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q [8 z0 B% f1 X/ q
) ?3 t/ l* o+ s* B+ b$ M- dma_addr_t dmaphyssrc1 = 0;8 e1 u2 g y0 v% ^
- dma_addr_t dmaphyssrc2 = 0;# G4 Y$ p- _& m8 g. c
- dma_addr_t dmaphysdest1 = 0;
! q. T. |0 T( Q' _6 w; o7 L - dma_addr_t dmaphysdest2 = 0;2 O6 h( x( M; b3 ^" i5 ]
- 1 p" x; Z; v- e5 R3 C
- char *dmabufsrc1 = NULL;! f' c3 s6 g3 ], U9 S' t& I
- char *dmabufsrc2 = NULL;
! g% r6 y9 U; |- c - char *dmabufdest1 = NULL;+ _, x" ]' [4 B# V4 T+ X
- char *dmabufdest2 = NULL; v" |' a% }) r1 v* y+ k
- $ q' @" W! t5 M4 p- G
- static int acnt = 512;& B3 W, c7 J7 P( Q
- static int bcnt = 8;( l3 b. ~9 ?/ o' z- }1 Y
- static int ccnt = 8;$ |. N" v/ ^$ B4 I f$ A
* @# l) U* [/ f$ U( B3 K2 w/ T3 z- module_param(acnt, int, S_IRUGO);4 k! |) ^/ m; {) f0 q# k$ v
- module_param(bcnt, int, S_IRUGO);; r% O# M, R$ s5 j
- module_param(ccnt, int, S_IRUGO);
复制代码
: d; F, g/ \' k
: p5 K/ M$ @& x" b' ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Z" p( }# }$ K# M3 ~6 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 Y9 p; y% \& |* i5 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K! A, C* |+ o) M) l7 K$ l( a) h
7 a$ b2 b& m7 s& O( [* }0 U4 T/ X& c+ ~- |
|
|