|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 i6 f# S# K5 q6 S
- [code]EDMA sample test application( J! C' K1 Y' L0 I, Y
- /*
* J' ~4 o" S x* J' s - * edma_test.c
3 Z4 U1 W" G# `& v6 v% I) z# X - *$ K( s1 b, O! e# d
- * brief EDMA3 Test Application h& E0 Z+ c( f2 `
- * Q7 U, P9 z/ W& D8 I% {+ V; P2 L
- * This file contains EDMA3 Test code.2 I' Q+ E8 x/ H2 [7 c1 ?: x
- *7 p4 _6 ^! W2 m) Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% Q! F: \$ m: \) }! e# V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, E$ |, v2 o5 f" h' c, q - * TO CHANGE.5 u( C, N; T9 Z$ z( U8 q4 g/ c' ]
- *
& ]% {. U. I; g4 t! _! d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 }3 {" H4 g- [2 p+ S0 { - *
- K, ^; w5 t' Z. H2 x - * This program is free software; you can redistribute it and/or
+ ^ r# u5 w: o - * modify it under the terms of the GNU General Public License as$ N6 x( @- Y; m6 {& B; }" H. P
- * published by the Free Software Foundation version 2./ L0 c- I) c" `" j0 X4 ^0 b
- *: v A# D5 i" R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! k5 h2 I# ?& S% H5 _2 N; A/ p - * kind, whether express or implied; without even the implied warranty+ H1 @( D" t; H4 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% f% O, `$ s- t1 ~7 Z3 F
- * GNU General Public License for more details.. K9 C- B2 J% v
- */+ g! U3 M k7 T7 a
6 l9 }+ S' { j- A z+ z9 P) ]* d; g- #include <linux/module.h>
' A; I+ k) y3 L) x2 _9 a - #include <linux/init.h>
. n" l1 O) m! E! P0 _2 f- N7 E; r - #include <linux/errno.h>. m' x, S e1 O$ ` `% h6 f, L
- #include <linux/types.h>2 k5 c; s0 H' a0 l* j( f: }0 x+ S
- #include <linux/interrupt.h>
/ {( \ q. t1 e5 i. g6 j - #include <asm/io.h>
/ X& V. j' E8 W( B' |& K$ ] - #include <linux/moduleparam.h>
4 T3 G. I8 u3 d1 o - #include <linux/sysctl.h>
3 o- N$ I' t# k# d x9 [8 S3 k* K - #include <linux/mm.h>' O! x( O9 p/ k5 W7 G; c
- #include <linux/dma-mapping.h>$ t$ M+ D7 a- {* ?* q# X2 Z
- 6 I. ^, ^( ]! I7 Z
- #include <mach/memory.h>
1 t8 X$ U0 v$ P: m, k; \% C/ r - #include <mach/hardware.h>
* D, B D' ~6 k; o4 D; c - #include <mach/irqs.h>, Y$ f4 s% ^+ w- m; `7 m: u9 d) p
- #include <asm/hardware/edma.h>
/ k4 }' A2 r' Q; p% B6 g/ y - 7 u9 |/ r0 ]$ `
- #undef EDMA3_DEBUG
+ V0 `2 M! p: ~; E- V/ H - /*#define EDMA3_DEBUG*/
" a% `1 ~4 E" V, s. o& M& L
' @* N f/ k' [/ i- #ifdef EDMA3_DEBUG
5 d u$ J1 r2 B8 m8 u# b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ v4 ^" O* w. C+ k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 s8 o! \) O% \% @" h, ?2 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 z) }0 {" g: \9 H3 D! S$ a- } - #else
% Q g. d5 [+ S- [( x6 d7 _ - #define DMA_PRINTK( x... )
& t- n3 J- W2 W4 K; r - #define DMA_FN_IN; @6 A4 u$ H1 b2 {: `, G9 N- h
- #define DMA_FN_OUT$ ~9 q# `% c: ?8 h7 [7 b0 C
- #endif
9 [! t8 z# V6 R- K
^" d, o4 d7 r1 l7 t' `4 M, u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 K% a Q' m6 Y8 P" b2 R
- #define STATIC_SHIFT 3
# n9 `$ m/ v5 Y) t9 x! ~, E( j - #define TCINTEN_SHIFT 205 y, n- |+ s D( S4 E. l5 O
- #define ITCINTEN_SHIFT 21
, ^6 v3 `. R% O1 [& { - #define TCCHEN_SHIFT 22
0 [; `3 K3 U; G' b - #define ITCCHEN_SHIFT 235 l* J) S1 O O! {' u+ d
- % _7 C% f( {. s7 X( G/ v M
- static volatile int irqraised1 = 0;$ _2 {- v! `0 s8 Z
- static volatile int irqraised2 = 0;
; T% g3 N$ Q- Q+ ~
6 Z$ W/ D1 Y" O$ i& L% x/ }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 @# L7 B9 P8 \1 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L5 _+ \7 Y9 ~; m; ~/ Z: I/ \+ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. w! ]3 u2 M$ h4 |7 Z! `
0 `0 T1 m' t* O {6 P# F. x6 g- dma_addr_t dmaphyssrc1 = 0;
& R$ s5 A; V8 Q8 {$ h; c% ^4 W - dma_addr_t dmaphyssrc2 = 0;4 f, ~: _ V3 Q* A' h2 j0 b
- dma_addr_t dmaphysdest1 = 0;
$ o" t! ~5 h1 f- y - dma_addr_t dmaphysdest2 = 0;
" P2 u$ E& ?, S% M5 t - * G5 \* L7 Z0 x: ]6 D5 r( D4 i
- char *dmabufsrc1 = NULL;
* |, b9 C- a) M( d1 a, X - char *dmabufsrc2 = NULL;
9 m/ G+ h0 r( N! \ - char *dmabufdest1 = NULL;
4 Z$ U0 s$ ?* H - char *dmabufdest2 = NULL;* N/ N; z' J' l5 J
- , T6 i; P7 u7 n( i
- static int acnt = 512;
8 P' i" t5 ?- g - static int bcnt = 8;; r. m( b! A# a* y$ x' m" I
- static int ccnt = 8;
7 P3 q: c* C; K7 S3 j
- K) @6 j! t* v( j- module_param(acnt, int, S_IRUGO);/ d! c! g7 z1 L6 m
- module_param(bcnt, int, S_IRUGO);
' V5 y* |" A$ @! M. h q0 ] - module_param(ccnt, int, S_IRUGO);
复制代码 . Z, d. Q. \6 [" ^1 Z
- C M% b/ J, _$ K0 t3 f6 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ^! D, r5 u6 o! g7 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m0 m8 @8 L% q' @: j* [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 @7 y" X# h! w; V3 ^- [2 R! m) g
( z% ?0 X! Q) e9 W4 w- j; x: w
: s& J/ T5 h" {3 X |
|