|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % Y, i' X3 E/ S D
- [code]EDMA sample test application4 c) B; V8 R$ }$ A/ T* I! c8 }/ R
- /*' J' H6 a6 |6 g8 ^3 T0 k# W
- * edma_test.c
" T+ f3 Y P2 r - *
* l/ ]0 n/ |; T0 I - * brief EDMA3 Test Application
# e4 e$ f% N# G4 T" C - *. u. I" p+ J: `% _! Z
- * This file contains EDMA3 Test code.
; B9 X8 E, V% U1 ]2 T - *
* X2 {, L* T9 u2 U A# { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 X7 W: _2 L1 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 w2 h: _: x1 X/ m" _
- * TO CHANGE.
" e% U, E7 I: ? - *
: w" ?& q! ~9 H. }. \! {, O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: o& x) n7 J2 j' R8 L/ a! l
- *8 ^+ }3 q/ W8 U; _6 T$ J
- * This program is free software; you can redistribute it and/or
4 G% O1 T- j: u7 \4 ? - * modify it under the terms of the GNU General Public License as' R; [2 g$ f5 {9 x. ~
- * published by the Free Software Foundation version 2.
. r7 \" G" M' `$ B+ F - *
5 L. y t9 I" D$ v/ [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 B" |. {+ D0 H0 ]" R, @
- * kind, whether express or implied; without even the implied warranty
! q3 K% c4 W* @* x) e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 K! C0 e' { t9 ]0 w) D
- * GNU General Public License for more details.6 c' R5 u4 [! v+ m
- *// @. t2 F6 R) C' W" O
9 c/ `6 b: z# j j# R- #include <linux/module.h>( @6 ]& {2 z& Q) B8 \
- #include <linux/init.h>
( d4 v5 ^3 S# B; @4 m - #include <linux/errno.h>
( g9 [9 w4 [1 F% ^# `9 g - #include <linux/types.h>
Q" \' m; ~7 A9 | - #include <linux/interrupt.h>
: ?9 c& W7 J# [5 ]% m6 [ ^ O$ G: k - #include <asm/io.h>
5 @# M0 A# l2 K7 c! I. k* n - #include <linux/moduleparam.h>5 c5 F0 K" h( |. G3 U. Y$ J0 Y0 N
- #include <linux/sysctl.h>3 `9 a) g& k8 K& y, c* i! z* \ Z
- #include <linux/mm.h>; @3 u3 `! G" [0 D
- #include <linux/dma-mapping.h>/ U$ j; X9 D) z- G1 s
- + e1 G" t0 I# E+ U z
- #include <mach/memory.h>
6 f7 e+ Q6 e% X( G4 o' k" S - #include <mach/hardware.h>
( \ q4 Q- V, _) T" e# } - #include <mach/irqs.h>7 U5 ^1 i! N6 H/ i2 T
- #include <asm/hardware/edma.h>* m/ ~# z8 G: z9 U2 n, _
- }% n% g w& t ~. N5 E- #undef EDMA3_DEBUG# B' J# K* J2 O P! v
- /*#define EDMA3_DEBUG*/
8 Q f5 G' u0 U* P6 R8 m7 | - 6 e+ A2 _- ]. f. W. Q* N6 f% g
- #ifdef EDMA3_DEBUG
; U- A/ v/ M; p0 \( _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% @9 N' ?6 M1 A. U" v( @! l9 Z2 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 }3 q4 V* ^ ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( |6 D9 t/ r% S - #else
& v/ d* z$ k! O7 Y& @9 p) m' T - #define DMA_PRINTK( x... )7 x* e/ `! j9 j7 A! N
- #define DMA_FN_IN
7 ?/ P$ f9 Z% R$ _ - #define DMA_FN_OUT
' I& b; b6 d" z; W8 F - #endif
8 ^. k: C1 }; B! B l
. k' ~& |0 ^0 \8 d+ `# ?$ ~- Y6 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768); k. C0 _: P' N
- #define STATIC_SHIFT 3" K- J0 _5 D1 z
- #define TCINTEN_SHIFT 20; \' H: i, P/ z
- #define ITCINTEN_SHIFT 21
8 w& H( e; }3 x0 } - #define TCCHEN_SHIFT 22
: N6 A. K U; E2 ~) s) Q; w$ v O - #define ITCCHEN_SHIFT 23: I% J/ r* A' p: {( _
- & ]' q; b. I+ O
- static volatile int irqraised1 = 0;# l4 a3 t7 V4 ^! N$ v6 Y
- static volatile int irqraised2 = 0; t5 \% _4 l+ \: d. l, a
- , b3 L& P8 l% u& k! _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: z* z# e% X; N* ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?" _) z* H3 C3 v4 x. b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 a% h& J1 n# ~ @ - 4 p1 i- B% U( R6 @3 ^' ]6 L
- dma_addr_t dmaphyssrc1 = 0;: l$ k; d& ] L4 H3 i& v# d
- dma_addr_t dmaphyssrc2 = 0;
' F9 W( V/ ]" Q5 Q- U9 l - dma_addr_t dmaphysdest1 = 0;
$ k( _+ v5 V8 d$ d - dma_addr_t dmaphysdest2 = 0;
3 g8 R, K7 ?9 @+ U, _% w* _
) [- Z7 S: M) h7 b$ P- char *dmabufsrc1 = NULL;
. e* x8 z' p3 w9 K9 K - char *dmabufsrc2 = NULL;4 [2 c) i4 Y& h
- char *dmabufdest1 = NULL;
$ G$ r2 U, R" Z# z - char *dmabufdest2 = NULL;. a# r. C/ F: @: Z5 | Y+ t$ o7 D; A
7 @0 ^( D7 u; r+ V! Q- static int acnt = 512;
- j8 `5 l4 ]8 q5 k6 t7 h0 _ - static int bcnt = 8;$ @1 j, _0 j6 S% @* L* k
- static int ccnt = 8;& R6 x D; x. H& g* R2 k
* T* I% k( o5 j& n5 S- module_param(acnt, int, S_IRUGO);8 j- }3 |1 q) ?5 d J: \
- module_param(bcnt, int, S_IRUGO);* G( T1 k$ ~1 |8 p
- module_param(ccnt, int, S_IRUGO);
复制代码
5 I# `0 H1 n, y
$ V% X9 c; b0 p" V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Z u d) E. @* Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |; A( |/ L- k8 F! Q$ I. I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~; S" { `% k/ h0 s d+ x3 Y
) I/ A4 `* g* }2 d; Q x' p4 V' \$ |4 W
|
|