|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D. H* S. ?$ w/ p; _- [code]EDMA sample test application# f/ h7 e" a \, e2 T( y! [
- /*
* n2 B1 E4 ] @( @+ `+ \0 \ - * edma_test.c
% U) w5 h# H* u w! _ - *3 F& T+ O+ Z6 B* `
- * brief EDMA3 Test Application) Q- k$ B5 D, c* z
- *) S& ] ?4 w/ ?3 C" E
- * This file contains EDMA3 Test code.
5 D; ]' k# R4 t - *
" D' X1 l) j: w6 C/ ^3 g5 G3 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ ?/ e+ Y1 l( x, X5 e9 q+ W* Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ g$ w& M* M4 S9 G - * TO CHANGE.8 M1 t+ }1 Y: c: G1 b* V
- *
* ?6 ^# B; b4 z$ I7 q8 y3 m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! O( ~& V5 Y! }2 l) L& ^ X" o% Q0 j - ** `0 h- }/ c6 D! R: {
- * This program is free software; you can redistribute it and/or) p- {6 z* |" M5 \' s0 l
- * modify it under the terms of the GNU General Public License as- ?- X2 b7 D2 _3 D2 m
- * published by the Free Software Foundation version 2.4 ~; u8 V" \: X5 [* h
- */ q, b* _$ D% Y; I6 e& j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 E! F# V$ X. w- T - * kind, whether express or implied; without even the implied warranty
7 X! l+ \4 m8 u6 @7 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; w: f& f( ~7 e - * GNU General Public License for more details.( H; W5 h& F! J& W4 r
- */% r+ e# ?9 ~, i/ X( s% L
+ s! C5 F% h8 D( C- #include <linux/module.h>4 L u: F( U9 a8 q: O' }$ V7 c
- #include <linux/init.h>' o8 v) N0 ~9 w' V& _6 P0 x! v! T
- #include <linux/errno.h>
* q r; h& ~* Q1 D! [' q q1 N( o0 h - #include <linux/types.h>
$ i5 j: w: V1 |) E9 { - #include <linux/interrupt.h>
9 f9 z& }* }- L9 P% Q/ ] - #include <asm/io.h>
- a2 e6 N z/ x" |; x2 j - #include <linux/moduleparam.h>
t& |" E# ?* @& Y7 f - #include <linux/sysctl.h>
( _7 W( C3 k, N8 j' g$ J% H - #include <linux/mm.h>& g& W* o( X. Q
- #include <linux/dma-mapping.h>
/ g* |% y/ }7 K2 N3 P: d# v1 b+ E" j - ! _/ ]) m4 J' M$ J8 U, V" u
- #include <mach/memory.h>% B) T; j) P0 T: O( h6 `! S/ ~
- #include <mach/hardware.h>
5 m$ q6 n& G. b: I7 V - #include <mach/irqs.h>7 C( g* K L' O7 M" X& B% c
- #include <asm/hardware/edma.h>
. T a# g! p$ j7 t+ Y! j$ ?1 p) o( c - , N1 O) {" z- }! K/ K
- #undef EDMA3_DEBUG0 v- A* M$ z- ^* }) i/ o
- /*#define EDMA3_DEBUG*/4 R7 x" X) B- i' Z5 E
7 W! j# R4 k# K& A: U8 q8 T+ q- #ifdef EDMA3_DEBUG
' R. t: s, S! V; [/ p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). F4 z' k7 d. Q) g7 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& g- ]: t& z; U$ h% Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 P5 @, G8 l7 R/ T' i
- #else6 {3 V6 I4 D0 W l
- #define DMA_PRINTK( x... )) v4 x% E0 f2 E1 {" _2 n$ Y" U
- #define DMA_FN_IN
7 ]+ z1 }+ @$ U% ` - #define DMA_FN_OUT
3 I/ ~7 Z" @; ^( B$ p0 { - #endif
0 @7 `0 R1 D \; A& [
. U& A1 F4 l# D. A/ J9 P# u) k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
_) @) G/ m$ J- M6 t7 ^. g - #define STATIC_SHIFT 39 @4 c- d/ u# c
- #define TCINTEN_SHIFT 20
. h$ \+ W! V b' @# i - #define ITCINTEN_SHIFT 21 W p8 d' N: @/ `
- #define TCCHEN_SHIFT 22+ }2 g2 p; i+ e' H
- #define ITCCHEN_SHIFT 23* c5 X2 C! Z- h5 m- f, L
4 P9 j( {2 t: K# r- static volatile int irqraised1 = 0;
6 @3 H; H3 w; w! X; z. X - static volatile int irqraised2 = 0;
, G; e# Q) k7 ~# o* ?8 ]# T5 m1 E
" }( G0 {7 k2 m: q5 v8 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s+ Z8 }# |+ Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 X' C3 y' C9 L$ O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 g4 M+ u% J0 _+ F5 O0 x
( A* g3 t( d; c- dma_addr_t dmaphyssrc1 = 0;
: A% }& U4 c( f- v. @3 k5 r - dma_addr_t dmaphyssrc2 = 0;
. x6 m1 L0 Z3 h - dma_addr_t dmaphysdest1 = 0;* [! C `" a. T( d8 r5 N
- dma_addr_t dmaphysdest2 = 0;
; @1 U( ]2 U7 J9 [/ L0 T
$ T* K" ?& {5 }- char *dmabufsrc1 = NULL; E2 ~8 ~' v7 B) t
- char *dmabufsrc2 = NULL;$ G- t( {) P$ @5 p, X
- char *dmabufdest1 = NULL;+ N" j/ c9 h' i3 A3 Z# E' @: W
- char *dmabufdest2 = NULL;
# X# v) e% ^! \
% E/ O8 P8 |/ E/ b- static int acnt = 512;
- g# R3 D3 x1 i( u6 g b - static int bcnt = 8;- E7 O# r& K" ]. i, {; v4 \% H: z
- static int ccnt = 8;' g8 w9 i! B5 Y' j" J+ g% K3 u
8 L. x: G3 R+ ^* G% n# B- module_param(acnt, int, S_IRUGO);3 _6 K4 R' x- {2 r& F( `! n! z6 H
- module_param(bcnt, int, S_IRUGO);
' D& R9 |0 M+ M2 S5 Y - module_param(ccnt, int, S_IRUGO);
复制代码
, W# {6 T' J Z2 j( ^4 e) s+ _) S" D" m! ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. C/ _0 M$ E& U, T6 s" r9 i& Z; Earm-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 G q$ `; c; V+ \. G% V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 o9 p- d4 F( c) K& Q2 g' V! N5 [7 D" D" R* {8 L- [5 E
8 c7 x# Z' ]/ S
|
|