|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * L8 Z! `' i/ \ |/ k- b1 l/ y
- [code]EDMA sample test application6 e; R- Y6 h( N! f
- /*
% e; A0 f( O5 i- g6 Q2 \" L - * edma_test.c
6 o5 [5 ?( o* E$ }6 W - ** R8 s$ P5 v5 K& d% R4 q& L6 B
- * brief EDMA3 Test Application* e; s- K* G* c w9 \3 G
- *) w1 \, }- J- D
- * This file contains EDMA3 Test code.
4 B) G/ W8 z) I/ ], Y - *
9 i- i* r4 x0 B4 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 X' l, Z- F. d1 s4 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! m) W# A$ N5 B! K+ A - * TO CHANGE.
: X+ G% Q( Y7 C/ J) F7 q - *% G+ t* w! a1 z- H+ O- Z7 Z, g4 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% y& x0 L" \4 p5 s - *& m, X- ]' R( N5 w/ \* q1 w- t
- * This program is free software; you can redistribute it and/or
) M' M& [" E+ B% @ - * modify it under the terms of the GNU General Public License as
3 @( M+ }# u5 u - * published by the Free Software Foundation version 2.: e5 T7 N7 _" o! L
- *. A: m' S, G" G* S8 c2 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J% B9 Y4 B, r
- * kind, whether express or implied; without even the implied warranty
H8 L# u$ C7 I4 B" `/ d& P" h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( m% s0 t2 y7 c+ c8 w3 C
- * GNU General Public License for more details.
, S0 @6 t6 @9 P. F& S - */
7 H" e' l) Q, }5 o z& O
1 v8 u* X% r2 h+ {# g; F( f9 Y- #include <linux/module.h>
6 L$ R4 ^; G6 P+ u8 n( _7 q - #include <linux/init.h>, v, ]5 i S3 V
- #include <linux/errno.h>2 z y0 D" @% D% `0 c$ R) E. t
- #include <linux/types.h>
$ {! z+ w" s. e4 M0 `5 o% c" c - #include <linux/interrupt.h>9 d; J6 N1 ^0 k) Y1 r0 a% B
- #include <asm/io.h>
: t9 @ P b P& @. V - #include <linux/moduleparam.h>) q+ u4 a7 s" U d2 v) z( \
- #include <linux/sysctl.h>
; T0 U6 y! q" ]6 _: f - #include <linux/mm.h>
$ c; ^; I/ W8 p - #include <linux/dma-mapping.h>; k/ X) x5 @) I% |; k+ m0 T- h8 d0 \
- * [9 d, j7 o" X8 X: P
- #include <mach/memory.h>
8 P; G5 f/ R9 u4 Q - #include <mach/hardware.h>
( i! Z5 t; u6 n5 T5 D+ i$ p; e - #include <mach/irqs.h># v5 T; C8 ^6 |! P) B+ G
- #include <asm/hardware/edma.h>
, {$ U. y& m4 B% b" C
. y$ Q- @$ m8 J8 N O/ R- #undef EDMA3_DEBUG/ [5 G+ c) R4 Q/ t& j1 q
- /*#define EDMA3_DEBUG*/9 |0 O t+ v( d# b" Z9 O
& s( v" a$ Q) s2 l- r# Y- #ifdef EDMA3_DEBUG
& l% I3 Q( @& v" B Z% w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _ ~6 m; c) s/ A0 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: M. _* |& S+ V& A$ ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Y$ R! D; D6 n D7 o
- #else9 S7 Z) Y6 [' n) v
- #define DMA_PRINTK( x... )5 t5 Q, F9 V+ E& w$ s& R8 x
- #define DMA_FN_IN' ^4 _8 W3 J; a; ~9 Y( ~5 o
- #define DMA_FN_OUT; i& D* W! s: _4 e/ X" r. }
- #endif
9 o3 p h& V! y1 v, k; ` - ! |( Y$ e$ n0 V- E! T* @& x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 P5 K- b7 ^) d" |
- #define STATIC_SHIFT 3+ a, }2 L/ e% B
- #define TCINTEN_SHIFT 20- v+ o- \5 U r) h0 m
- #define ITCINTEN_SHIFT 21
8 y) A n' V9 R' r7 W% H+ T - #define TCCHEN_SHIFT 22
4 v" t5 B2 t% l - #define ITCCHEN_SHIFT 23
1 k: Q1 b! x/ I7 M, w! c: H - + O- a& B+ x( l0 X! V0 A0 D
- static volatile int irqraised1 = 0;
9 r* ]6 Q, @# f/ j. \' A - static volatile int irqraised2 = 0;$ e* Z: P. {$ m' \6 a0 k& c
- % U6 ~2 c# g/ I {# N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" y/ i- t, E1 F# j3 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K2 ^9 x4 L) A, d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U J+ ^% H1 Z5 N, |, i# _
+ V* `4 e& h' q- dma_addr_t dmaphyssrc1 = 0;
F& @4 t2 O7 O9 _ - dma_addr_t dmaphyssrc2 = 0;
1 O9 B5 B2 {' n+ N - dma_addr_t dmaphysdest1 = 0;9 F; I- m6 y- U: j5 s9 p- Z! k& S
- dma_addr_t dmaphysdest2 = 0;8 R. }+ l# R# d- V
0 A* i2 V8 J7 K4 ^0 c4 Z- char *dmabufsrc1 = NULL;
- @- {6 K4 V4 o. a# o - char *dmabufsrc2 = NULL;
0 m8 ^1 G1 Q( C7 C - char *dmabufdest1 = NULL;
) U3 ]+ o8 s0 k# I" W5 \ - char *dmabufdest2 = NULL;$ a9 a6 _: }! Q8 v2 }8 z
b1 s4 z- R$ h' t- static int acnt = 512;8 p( a1 B$ r+ ]0 w1 Z/ ~6 j
- static int bcnt = 8;
4 `& V% J4 C d - static int ccnt = 8;
8 i% }% B. G' i: j# U, z2 ? - # }/ m. z* g; Z9 z8 H
- module_param(acnt, int, S_IRUGO);
* G- s! b+ E4 l. A" I! u7 }( Q - module_param(bcnt, int, S_IRUGO);) s2 c# u9 D9 `
- module_param(ccnt, int, S_IRUGO);
复制代码
" ^; \; I" I: o b
4 {5 l6 e7 U+ l" p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `5 _6 K2 F' v+ k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' h& I. A$ R H C7 m! r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e w4 J5 r c0 L
/ Z7 X; Q# v$ D3 Y' b6 u
1 F a3 q9 P4 o5 ]4 f. d |
|