|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U- S `/ ~7 b
- [code]EDMA sample test application5 V; b; L3 T6 ?
- /*
: x8 n3 }5 p3 r- ^) B e - * edma_test.c6 B. i& y+ Z+ a" S! Q
- *0 t" {' ~) c" D% Z
- * brief EDMA3 Test Application
. A4 r7 N0 I& s/ {+ d1 F! N - *
5 {6 b) l4 Q. P9 Z. H( [6 P9 T - * This file contains EDMA3 Test code.
) d* W/ i7 p) o) G p0 P' D - *
! s7 m# | {0 n; d3 N+ j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- b9 P9 g3 ~% A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 h# O! V( i! d$ ^5 A. o% s
- * TO CHANGE.0 v& L3 {1 e( d, x! }7 E
- *% f% Z0 W2 K# v F; g8 u" H6 N/ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 K- v0 I* {# ]0 D7 T
- *
' }; y7 i+ I& ^* a. Y1 j% _, n - * This program is free software; you can redistribute it and/or; c3 J4 T3 N+ e0 Y' h3 Y$ h4 ^
- * modify it under the terms of the GNU General Public License as
& ^$ u; ~5 A! o2 } - * published by the Free Software Foundation version 2.. P f' i' E: I) X
- *
) T+ |6 G, n: s: [, H. w. r7 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" g# p& z+ i8 U - * kind, whether express or implied; without even the implied warranty2 C7 i. J s* N7 }7 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" d3 H( d5 ?5 W# {: Z
- * GNU General Public License for more details.
! q, ?6 {+ L4 e' ?7 @ - */+ O. @5 J3 \# G3 A/ ~
1 `- Z' B% Q' H+ o- #include <linux/module.h>
3 s& u6 F* F+ \7 W% p+ x# P& M9 T$ h) P - #include <linux/init.h>
, _+ J3 @8 ]9 i: A! i7 J - #include <linux/errno.h>; D: E+ ]+ R/ J% Y1 I& Z
- #include <linux/types.h>
2 Z1 V# w y0 W0 E4 C! i2 n$ u: b - #include <linux/interrupt.h>
6 t% Y" h* X3 A9 v - #include <asm/io.h>
y) x# y! f0 Z6 u v( W - #include <linux/moduleparam.h>
0 n" Y- w! u9 o; r# E - #include <linux/sysctl.h>, v( m% X. C' r- T% ]" |0 c5 G
- #include <linux/mm.h>
; \, g7 j1 N# i* \ - #include <linux/dma-mapping.h>
1 Y; i' t; v; h1 x$ c9 W+ K) b
& w( t Y; h: e& w- #include <mach/memory.h>6 |/ A1 S8 \4 G8 C2 u( P
- #include <mach/hardware.h>9 k' r% B" T4 W) d8 _
- #include <mach/irqs.h>
/ |9 n3 P2 J1 K& I. I$ e3 F5 I - #include <asm/hardware/edma.h>9 ?9 j* l4 S' R& m2 b5 Q, B- b
' Z8 V$ y9 Y7 y8 ?- #undef EDMA3_DEBUG
* V: U8 W5 t5 g, y' |' K" F1 p) D - /*#define EDMA3_DEBUG*/
2 G+ S/ W! x4 ]+ _/ _ - 4 Q% ~! h' e s# @
- #ifdef EDMA3_DEBUG/ [& \# R3 b7 d, e! b' S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 r, [4 L- D! @$ P. Y4 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 T2 W5 p. I2 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); g$ ]( u2 v: S2 ]* S
- #else
4 W1 F4 ~0 X# z+ B) Q6 l _, P - #define DMA_PRINTK( x... )
8 a! P4 G' M* O% d# q# [ - #define DMA_FN_IN
N- B1 y# H0 L9 S - #define DMA_FN_OUT
5 L& B& p! ^6 K) g( l* Q5 i9 e/ w - #endif% Y" v. N2 u1 o6 F2 X+ O+ U
- 1 f1 E6 M" j+ I+ ]' |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# y; w3 w* h" c9 C3 k - #define STATIC_SHIFT 3
* c p N0 e: X0 R8 P$ b Z! M - #define TCINTEN_SHIFT 20
# h# B# c, j# q0 c0 S8 ^8 c) R - #define ITCINTEN_SHIFT 21
9 n, P( ~" P8 F# L( \) h& [, j6 N; t - #define TCCHEN_SHIFT 223 m& z4 e! {6 S% f
- #define ITCCHEN_SHIFT 23
# O9 M+ b# H# c4 u6 R* W G - * K$ @6 Y; K1 A. \
- static volatile int irqraised1 = 0;
+ a; D: s+ p* A4 `0 C - static volatile int irqraised2 = 0;
" [; b# A: u: M% O( E
; S6 e- Z! t) M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J7 A0 V5 t+ j! h" ^3 t, H' k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, \; }& h- }5 ?! F# a/ w+ i2 R- ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* k: y6 B& p. J: L7 a! u9 H
3 @" H' h! n5 Y H- dma_addr_t dmaphyssrc1 = 0;6 X4 f0 y. P6 v9 f- O
- dma_addr_t dmaphyssrc2 = 0;
5 X$ t" ?# U8 I% E: q1 c - dma_addr_t dmaphysdest1 = 0;
1 a2 j6 u/ K$ l) v6 O/ P - dma_addr_t dmaphysdest2 = 0;" c; T6 I/ l( ?- X/ r1 Y
- ; U2 S8 D q0 k `. s+ V
- char *dmabufsrc1 = NULL;3 o; D: f- D- U- }- v1 |
- char *dmabufsrc2 = NULL;9 L& F6 C- Z: O% F
- char *dmabufdest1 = NULL;
" w% ?, m( d! p, _ - char *dmabufdest2 = NULL;
: h- n1 P$ J; N: S" z
; l) ~, r, |. b" c- static int acnt = 512;
0 x5 f/ b/ I; D0 X5 K4 N - static int bcnt = 8;# }, S- E& ?; _- H2 q- w& i
- static int ccnt = 8;7 i) L: q" ^; o+ f
! O4 E6 j3 c7 O7 Q- module_param(acnt, int, S_IRUGO);
. y8 H" c4 O! ]( q - module_param(bcnt, int, S_IRUGO);1 H2 Z# \0 G) Z, `/ `$ D6 q& M
- module_param(ccnt, int, S_IRUGO);
复制代码 m/ J7 u5 a: v! g/ U( ~4 j* V
" Y, T0 H8 S$ O4 x* R; L: m' ^. L% J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# E0 ?+ {$ u6 C) oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Y Y& J+ d8 b T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 i3 v& _& S, \2 L* {3 z
# b7 ]# u1 v1 B- G- y& `6 s+ h8 _# m7 H& d7 n0 ^! q: j. J
|
|