|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Q5 s$ w8 I4 d( {& w: T* ?; O- [code]EDMA sample test application9 h6 ~# L" @, d: p, b( L
- /*
/ u* `; J: O2 y# b. N - * edma_test.c
3 y: ~$ r L- I2 w% I" H7 _9 K! Y - *
7 S2 I0 M$ w1 E5 e$ n3 ] - * brief EDMA3 Test Application9 `, \1 ?3 W) T: L/ D' S4 i, O8 t
- *
, s& U& z. d0 B- `6 }6 x, f: R - * This file contains EDMA3 Test code.0 d: q3 g, m! n
- *
& B& @/ `' f3 D, G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* }# ?" R: f; r$ W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 |. ^3 x# Z7 A' d1 Z1 H! o7 W
- * TO CHANGE.
7 h. v5 G- L/ Q - *
) W" H1 f% U/ y1 D, Y( ~3 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 E, I- ?1 B" q4 q5 R - *
* {! Z" J; m/ w2 y4 x/ G& ^ - * This program is free software; you can redistribute it and/or
. e6 s9 H% I: t( r4 t& y4 ~1 N - * modify it under the terms of the GNU General Public License as4 |2 w7 K" Q, Z/ c
- * published by the Free Software Foundation version 2.
+ M/ \) @& w6 S - *0 n# x$ O2 E# a0 D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z, O2 a- t0 N- j
- * kind, whether express or implied; without even the implied warranty% E- y' U) v5 Y+ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) ~- b) i: h1 p- a+ i6 ` - * GNU General Public License for more details.+ Q/ H7 m7 J' q8 \% T3 d. I
- */
& i: D( {8 z/ ^ @1 y$ u o& h5 k - # b: o4 `2 `8 S6 f7 j6 _6 {
- #include <linux/module.h>4 B. d" W' P$ J( H1 V$ i% U
- #include <linux/init.h>
4 o7 G, h* l2 a7 G( H0 _$ {' Q4 ` - #include <linux/errno.h>
/ o A a3 B# G6 H6 w; l - #include <linux/types.h>* h( P! k; Y) R
- #include <linux/interrupt.h>
: L5 N) o9 X/ r& Q - #include <asm/io.h>! N1 Z9 a# V I0 A
- #include <linux/moduleparam.h>
5 f0 F; o G" S3 r* Z - #include <linux/sysctl.h>3 Y2 n) c; ]0 ]# y4 u7 z
- #include <linux/mm.h>
, S- c& V4 z* `. y$ z) k+ V: b - #include <linux/dma-mapping.h>
, U# a, I9 ~6 g, \6 c0 v+ ^! { - " _0 A% G( D0 v2 _
- #include <mach/memory.h>
8 u# E( Q6 i5 W2 m* s0 }% e! T9 a! T - #include <mach/hardware.h>
& t/ m- f/ o7 m( _$ J - #include <mach/irqs.h># s6 V) r" q& ^3 T% n" v* v1 |
- #include <asm/hardware/edma.h>: M* L3 E. `) b* B1 y; U
- 6 u( b( h- [/ s+ t3 R
- #undef EDMA3_DEBUG
+ h: ]$ H& x! _6 `- i: B9 Z3 l+ N: o - /*#define EDMA3_DEBUG*// j) k1 K5 I( n' y! |" K; d' }9 K
- 0 d* ?: i3 ^$ f: Z5 W+ N$ E& A
- #ifdef EDMA3_DEBUG
/ E/ z' U5 N* @# f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 [' k2 Y5 h- F9 K- w) H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 x& J" j J- f. L, F7 U; { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& i: F# e5 K; N: T& _+ a( k9 q t - #else0 J1 Z; {! s+ F H
- #define DMA_PRINTK( x... )
3 m' ^* p3 u: _2 K2 J) s - #define DMA_FN_IN+ F" w8 l0 n f8 E
- #define DMA_FN_OUT+ g2 |) L; I) d$ j+ s( O
- #endif& R2 C& f5 M& E5 k$ \) A
- 0 Y& K$ k* U! {9 X. a5 v; Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 C9 y* _% }# p) s3 K5 E: e - #define STATIC_SHIFT 3: ]6 P3 H2 H2 N! [/ H% @# H
- #define TCINTEN_SHIFT 20- K" O+ y7 {4 D
- #define ITCINTEN_SHIFT 21
; D) r0 {) b3 c& M - #define TCCHEN_SHIFT 22
: S# B- L# d& u7 w0 i* J- D' \ - #define ITCCHEN_SHIFT 23
# N" |0 V7 C) j
8 z2 c- o8 i7 c- static volatile int irqraised1 = 0;
- q% D$ U* |) X) U- } - static volatile int irqraised2 = 0;3 @' z' K( b- w M( C) k, M, x
- $ P" k, F+ ^. [' v( d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {6 d# m& ]! `3 g5 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X+ }/ W' b( }# N; o' t9 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ F# T, M& p- V! x5 _( @4 {
3 I0 j; P0 O- _- dma_addr_t dmaphyssrc1 = 0;
8 |1 T3 ]$ ]) J4 c% u - dma_addr_t dmaphyssrc2 = 0;
5 _; p3 N. c5 ~2 A! R! A - dma_addr_t dmaphysdest1 = 0;2 {# W) {7 L: [* D/ N' z, _
- dma_addr_t dmaphysdest2 = 0;
- R; d* C/ N4 \7 o& Q1 I. v: @' @1 E; m - 6 c- |' }$ Q7 z) ]! T
- char *dmabufsrc1 = NULL;
( c/ Z! I8 K& g$ y0 O5 h* Z; M - char *dmabufsrc2 = NULL;
. E" k9 ?" P$ E0 C - char *dmabufdest1 = NULL;9 ~8 A7 ?3 `5 n6 ^1 [" k- N
- char *dmabufdest2 = NULL;% E! u4 {1 h; \9 a3 I5 }
' ]; o; R2 L9 C2 o. a- static int acnt = 512;7 k5 a0 M$ N% J$ W' h) J; F
- static int bcnt = 8;. b) u$ O& r5 v5 }
- static int ccnt = 8;. E# K% w" ~0 s) _* v( L
- ) O3 @# i9 B5 [( m% } z! x
- module_param(acnt, int, S_IRUGO);. y8 X; @5 t8 L, _7 y, {- A" {3 N
- module_param(bcnt, int, S_IRUGO);
9 ~/ {( k& {: c% y4 R7 ~& L$ F8 a - module_param(ccnt, int, S_IRUGO);
复制代码 / g) a0 z2 e! {' \+ x( _
# w2 N) z+ J. C9 h: F+ c4 l3 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N% Q$ t8 d- K# }7 q2 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( {' ]3 I: ^; U6 [: J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ V' f3 H: B7 V/ b
- l5 K+ @0 d$ Z# }7 d
4 f( N- m9 p+ c2 r0 J& t |
|