|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 I+ v6 Q2 \7 t1 L- [code]EDMA sample test application
- |1 h, O. p; R2 S - /*
5 c* k% `' K3 F; E - * edma_test.c1 A+ T$ t9 u) i' K- F( R5 k
- *
. ^: C/ M$ h! @' {7 _4 ^8 _ - * brief EDMA3 Test Application1 b* W$ l( ^9 x, r
- *; _# _0 i5 I! ]/ H+ ?8 l8 c4 j
- * This file contains EDMA3 Test code.
. [) P! T8 \. _ - *
6 d7 \) P( q! R' P4 @) W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; u. s+ g4 S1 f/ n( f- r5 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ l2 O1 b$ S2 L8 f0 b/ E
- * TO CHANGE.$ }9 O0 R- Q8 C
- *
) M+ o O$ E9 `5 k+ | I; f: m9 @1 Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ A: j3 J U# d: W
- *: B2 d6 }3 o: p2 |& I! c
- * This program is free software; you can redistribute it and/or
, ~* D- b* A/ d9 g3 _/ j: u, e( _ - * modify it under the terms of the GNU General Public License as
" b8 w6 s, w# _6 Y4 O3 ?2 ^ - * published by the Free Software Foundation version 2.3 g7 m* r, Z2 N' s$ q
- *& e9 j1 y" }' }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' ?0 Q4 a. c5 x7 S" z4 G
- * kind, whether express or implied; without even the implied warranty6 l- { `7 w9 B: c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the l, K# v, }+ W+ i
- * GNU General Public License for more details.
) r: V3 g. y+ p i" S ` - */2 G8 N& l; O* ?1 A: m
- ) |) K! r$ x. o" |( R* s3 k
- #include <linux/module.h>1 E. d/ H! U0 Z2 b- B
- #include <linux/init.h>0 p& l- W# e+ W, U, T
- #include <linux/errno.h>
0 E0 O' |+ m' C/ t: S - #include <linux/types.h>0 J H) _9 Z! ^! T* c* U2 l! @+ Z+ |
- #include <linux/interrupt.h>$ B/ A& S, ]- }$ c8 W. N/ G
- #include <asm/io.h>0 w8 q0 R, l" V/ Z: l, s4 X
- #include <linux/moduleparam.h>" K1 q' I3 Z% m! |8 a9 N& l
- #include <linux/sysctl.h>+ c9 ^0 U3 z3 n# f- L4 k
- #include <linux/mm.h>
S* e9 u% r m# s/ [ - #include <linux/dma-mapping.h>2 U. h0 Z2 i: _0 ^" G
" Y# L4 H r; s' d |% a- #include <mach/memory.h>8 ?& z; M# I" o$ F+ U! T
- #include <mach/hardware.h># `: G( Q+ w. n; j
- #include <mach/irqs.h>
* N9 a; n0 C' q( C - #include <asm/hardware/edma.h>$ A1 o/ V" a$ E w1 ]
- # h; J6 {" B0 i# A
- #undef EDMA3_DEBUG( R; v% E/ o V( m
- /*#define EDMA3_DEBUG*/5 n: Z8 r" U- g7 G
4 g+ V) I1 M8 o- #ifdef EDMA3_DEBUG
; x P6 Q- G, N, e$ O9 \; X3 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ i8 A( J+ S9 `6 X6 I+ |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 _0 k7 C Z. V- c/ g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 X$ a9 {. T, T$ _* ^* h
- #else
5 v" E- v; f: A" ` - #define DMA_PRINTK( x... )- ]& [4 h2 M9 V4 U. n; ], j( C" ?
- #define DMA_FN_IN
! C5 A" j+ t% x. t" o - #define DMA_FN_OUT; F# [, W+ I, [9 L; d) k
- #endif7 k" K6 |) g% u- Y, Q1 w
- d6 t$ Z+ N' A# q- V2 Z) E/ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 R1 L2 T; i4 b1 Q( s' a3 M - #define STATIC_SHIFT 3% L5 u7 b5 K0 u! n8 {/ u: K
- #define TCINTEN_SHIFT 20: _0 y6 k) J a4 k
- #define ITCINTEN_SHIFT 21
3 B9 Y* d: n: a$ D; h( h - #define TCCHEN_SHIFT 22
; z7 D# \: K" h) N2 B- h - #define ITCCHEN_SHIFT 233 a1 K3 T4 u5 ~ C8 d6 Z
- 0 ?5 e( i% J+ O: f3 c& u5 h0 V) ~
- static volatile int irqraised1 = 0;7 I% N- [/ O( Q! }% v4 y) Q
- static volatile int irqraised2 = 0;9 m, \$ c% M- Z
- " O, E. ^' t) y' A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 G8 Z$ G3 G- M$ J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X3 j2 o: S! c! r" k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' H) D6 g/ j9 U
; L$ T; H- H5 i" R( ~3 a- dma_addr_t dmaphyssrc1 = 0;% W+ M( N6 I, I) e/ {3 r
- dma_addr_t dmaphyssrc2 = 0;; D- a# N2 h3 s `9 L. N
- dma_addr_t dmaphysdest1 = 0;
& T/ [7 E ]+ A, V3 h - dma_addr_t dmaphysdest2 = 0;4 N9 f: p3 e/ Y8 ]: [
6 R% h4 u- h/ g; @ u# z- char *dmabufsrc1 = NULL;
- n7 T6 z8 [2 O1 E& ` - char *dmabufsrc2 = NULL;' M7 U- ]& f8 h7 S2 e( z4 k, T
- char *dmabufdest1 = NULL;! k1 h1 E7 X! g' K
- char *dmabufdest2 = NULL;; X, k- I+ G; K0 [3 [2 Q
- ) Z% o4 i! v' d$ H7 }
- static int acnt = 512;
& \2 s2 G0 Y! H: {8 m- ?, s3 b: y+ ^ - static int bcnt = 8;
3 `2 S$ U" V: R0 ^ j& O# m - static int ccnt = 8;. q, ^' B1 X* s( Z0 J9 d V
- ' `/ z# @) @; {
- module_param(acnt, int, S_IRUGO);5 C3 [, y' n9 d1 i/ K. a8 I/ ^' G
- module_param(bcnt, int, S_IRUGO);# J9 t% K- m/ g) V1 p
- module_param(ccnt, int, S_IRUGO);
复制代码 " N9 p. Q& U( X* f! W
8 K0 j S* G# ?2 _: t& |2 B% S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @8 s: [+ r/ |- e3 y# P: M% farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 z% `, T" |) W5 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Q3 `( L# R# L. ]
6 G6 Z) I6 _/ w2 G( w1 I. E! K4 m! v0 j* a9 M7 p7 s# d% U9 x& S. j# q
|
|