|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# \+ ^3 a+ M9 \' }- [code]EDMA sample test application
" J) I, E) X: L. a( k+ D& K - /*
3 f: r4 C7 p) f - * edma_test.c; W1 n; j: D0 H0 q
- *
; [, `' h; x. S) K4 N9 d - * brief EDMA3 Test Application
% W5 J- B3 m- t1 Z$ w0 Y) R - *
" ]. P( D! u/ Q7 H3 F! u* K - * This file contains EDMA3 Test code.1 ]% Q( L2 n1 S/ \% x
- *3 g7 v3 I: ~+ @/ G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 o- K0 Z0 m& m% ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 T: L8 T2 _% C. K9 B# j, @9 f+ p
- * TO CHANGE.
u$ v6 G; D7 F8 l/ b, @# r - *
4 V" r& c+ Y( Q3 c. `2 d+ s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 S& ?9 g) A! _- @
- *
' I# N% _. `0 ?$ M; t. I - * This program is free software; you can redistribute it and/or# r7 P( k: e. f
- * modify it under the terms of the GNU General Public License as* i% c! f3 ?! E, h- }
- * published by the Free Software Foundation version 2. Q: F* B6 C1 N, e, U% `
- *
3 i0 ?3 }+ o2 Q1 b0 z n6 \# K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- P- K* i% ^( Y; \& ~0 }
- * kind, whether express or implied; without even the implied warranty
2 n, k4 T5 \ f) ]& [" Z7 @" N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" L! V( o4 o o - * GNU General Public License for more details.
3 D4 q5 c b! L- g - */) y) ~4 r" q! ?, b" w9 C
6 _6 ]! f. q- E4 [. g- #include <linux/module.h>
) n: ^3 n) X k3 a - #include <linux/init.h>
: y/ W1 B3 O5 k2 v3 X - #include <linux/errno.h>5 U. M* i. {4 r2 p8 _' B( r
- #include <linux/types.h>& [5 q1 H7 B2 G/ O
- #include <linux/interrupt.h>
! t; }0 s% ~2 j& d/ \. W- z - #include <asm/io.h>
$ d, a2 I; a j& y1 V% D" S: T - #include <linux/moduleparam.h>
. L" B# y4 W# v0 a3 n - #include <linux/sysctl.h>! {/ e+ [+ K; O6 b7 j7 e+ Y
- #include <linux/mm.h>
0 ?" `$ B) n4 r9 d( Q - #include <linux/dma-mapping.h>
# _. B; j9 A4 g) g - ( b2 q Z8 S$ m) Z, @: M! c7 N2 _
- #include <mach/memory.h>
& o6 j6 U3 E+ X+ F; m - #include <mach/hardware.h>* M f; v3 V+ p8 c: x. D& I
- #include <mach/irqs.h>1 D6 p# y) M; P9 m& i5 ?9 b
- #include <asm/hardware/edma.h>5 ?4 _( }4 _2 \/ r. K
: ?5 {3 X) S% z) V- #undef EDMA3_DEBUG
& q% F7 ~; O- J, H5 h - /*#define EDMA3_DEBUG*/# W/ P' {+ z% i' n) I3 \
6 G4 d( e% L' R5 i: h. n- #ifdef EDMA3_DEBUG
$ g! h9 h4 u; w- d! k3 v/ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 e' [. |; N9 m3 I3 o! B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d* t9 I: e. M. e$ Y G, `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! U1 _2 F0 B, B- y/ j
- #else# Z/ t; J; f- u- d( g: }
- #define DMA_PRINTK( x... ): d) z% y6 Q, O5 f
- #define DMA_FN_IN5 w. ^& q3 f: j
- #define DMA_FN_OUT
3 J* k! U1 P6 I) w5 ~- p - #endif
, G8 o* V3 _) y9 B# G
$ O/ O9 o( k1 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) F% W* j+ }& X d - #define STATIC_SHIFT 32 N5 ?2 t D- I* k) M' Y- `! |( H
- #define TCINTEN_SHIFT 20( i# D% a. v5 j+ S3 \/ X
- #define ITCINTEN_SHIFT 21
9 g( Q& n1 E/ f - #define TCCHEN_SHIFT 22
" c- d9 _" g( \* v7 g. S' B; e1 X" T" N - #define ITCCHEN_SHIFT 237 ?* c; k! y" Y1 V) o4 ]' }3 H# A( R
- % |9 n! f$ y+ o3 y
- static volatile int irqraised1 = 0;
; `. b: C9 I! P: y - static volatile int irqraised2 = 0;
: g: }" V8 g, l' v1 f
" C- X. @. E& _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 @& P5 |1 f4 t' Y$ w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' `- Y/ P) W: K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \. O% N( I* @& ~) ~! M" C; X* _6 I' [
- ' X! G$ }( X4 \# N$ y& J- U' ]
- dma_addr_t dmaphyssrc1 = 0;: q; |& l ]0 q. J3 J) `2 m
- dma_addr_t dmaphyssrc2 = 0;: u/ u3 E. S5 e+ v- E& B }; e& n
- dma_addr_t dmaphysdest1 = 0;# L$ `- X5 e u0 g7 X* z
- dma_addr_t dmaphysdest2 = 0;
7 l) }/ Z7 `+ N7 C/ s; K - ; Q/ r& K* k" p. s, F9 T
- char *dmabufsrc1 = NULL;# a0 P; z- F& G: a
- char *dmabufsrc2 = NULL;
" t* v' y/ q- s9 m, N2 V - char *dmabufdest1 = NULL;3 Z, i, C( d" h# J6 ~' e
- char *dmabufdest2 = NULL;
" }' n6 s, T6 J
$ x1 k8 A. C7 x- static int acnt = 512;7 i& c4 e( ^/ E
- static int bcnt = 8;* A( Z! R0 H9 i$ R* }/ s, u
- static int ccnt = 8;; e6 U: D# ?! a
8 R$ o2 x( }" n/ ?# t- module_param(acnt, int, S_IRUGO);
! ^+ V; v* @3 L - module_param(bcnt, int, S_IRUGO);
' F, o1 z- H( S6 _ - module_param(ccnt, int, S_IRUGO);
复制代码 & R+ S7 j1 ^; t' \2 y
2 I" |, V3 [3 y# {- o! N* a1 u0 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; z' r9 M6 |9 l5 z/ v# h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: S |$ r# C6 M! o- j+ v& _8 L, r/ _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 N4 ` B6 n8 n" G* K+ ~1 y. r8 e: _" M: X! o! Y1 a
8 \+ G! I6 E4 M0 C- y2 j" i
|
|