|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & p' X1 f4 @( x- Y# g, O
- [code]EDMA sample test application
6 n/ W" x4 y/ g; V: _0 k - /*6 i3 }8 Y. C1 a4 g
- * edma_test.c
; K1 M4 Q& S+ G- U) } - *
6 l8 o5 h2 J1 i2 H. C8 S8 o: P - * brief EDMA3 Test Application; ]) m7 k( N# l7 D, m
- *9 h* E$ r4 S% F% G, S0 S& `5 u
- * This file contains EDMA3 Test code.. n' T$ Q& ^0 T* ]0 x4 i) s
- *
" T6 F. w6 G# O* X" e) P( C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m# I# ~! a+ L5 w7 K! h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Q3 q2 N: s% E' B9 I* d
- * TO CHANGE.
# ^* K4 b' C8 {& T- q' s4 B - *; y% ~, Z# Z; } T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 f' Z* r2 K5 E9 r' ~1 }
- *( o- g6 h2 k0 s8 G9 W$ |! _
- * This program is free software; you can redistribute it and/or
9 F2 o4 d) A @! V$ x( q3 o/ A - * modify it under the terms of the GNU General Public License as- h+ T# {; ?) H* O' z4 O5 g
- * published by the Free Software Foundation version 2.
# L1 c- C' x7 O/ _, o9 [+ G - *
4 t2 j9 i& q6 Y/ n2 y3 t( s: Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 ?9 M, R N1 U0 j5 l0 N2 G - * kind, whether express or implied; without even the implied warranty
4 Y+ X" _9 B/ {9 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 m! M$ S, q( N# \" [
- * GNU General Public License for more details.1 E4 A3 U" e8 S) I8 @/ g2 O n# R
- */% H; C/ K5 R( k& [; a% S3 g+ m
- ' E( ~) K3 I o5 M9 V; z
- #include <linux/module.h># @' i3 R) U: P$ C8 _: A
- #include <linux/init.h>4 R S+ @4 ?# l ?0 }
- #include <linux/errno.h>
6 ^5 [( H* I, W [2 i - #include <linux/types.h>
5 I5 e3 {5 P6 d0 z! p' H - #include <linux/interrupt.h>8 n( Z' w1 u' F% O
- #include <asm/io.h>' W" {: C+ c; p; S& B6 E6 h5 {
- #include <linux/moduleparam.h>
- }3 q! }1 O1 o$ t( y - #include <linux/sysctl.h>
: A: [2 \7 `$ O3 l) {' x. Z( { - #include <linux/mm.h>7 B, h1 U9 K/ e! i9 U: G6 \
- #include <linux/dma-mapping.h>/ L% T( f' H3 Q/ @3 ] [- W
- ' `! d: ^2 t. O7 v+ f
- #include <mach/memory.h>
. i5 ~3 ^1 C: ~# F& Y - #include <mach/hardware.h>% S9 @4 O' x- j r
- #include <mach/irqs.h>
' A p0 Z) k4 |" E$ u; s - #include <asm/hardware/edma.h>- @# A& L! f9 t: D! Y5 J+ C0 j a9 ]
- & f4 S6 R+ b3 ]/ i' y
- #undef EDMA3_DEBUG; H& L; p* q9 p" c/ B$ L8 J; V
- /*#define EDMA3_DEBUG*/5 \' O O9 t- G+ z+ p$ M& }' S; c
) k& ~# t# Z! c+ d3 C; q8 i, i- #ifdef EDMA3_DEBUG
: k& u4 {1 O3 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) N' B$ M# D; Y l- W7 U2 S, A7 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); }5 }8 h" F' |* j3 v2 x5 Q/ [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 _; n; `% E+ k2 k, x% t1 _2 P
- #else1 ^, A% Q7 N+ d# r
- #define DMA_PRINTK( x... )
! \2 x2 M) J( f3 ~ - #define DMA_FN_IN
: m$ U9 H: z# C: v6 M M - #define DMA_FN_OUT' z* `! A! {: ]5 w
- #endif
! A3 |; b/ R# H$ J8 R6 j7 j @6 x - 0 l) z. c/ M, x' ]( S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 _/ m6 G9 C: k" [. `% l - #define STATIC_SHIFT 3
; B% z5 Y* I9 s- ~ - #define TCINTEN_SHIFT 20: G1 R: r4 D' t; i" g% }) \- z, z, `* O
- #define ITCINTEN_SHIFT 21
! l4 @2 _. ~9 u - #define TCCHEN_SHIFT 22
% S/ i" O0 k* f. T$ C5 Q7 c( [0 { - #define ITCCHEN_SHIFT 23$ \& k, i* e& C# B
- - L( l/ x# `5 P* z( W" M. g
- static volatile int irqraised1 = 0;; m/ o/ N* h" n7 O
- static volatile int irqraised2 = 0;
8 V; ?0 I0 ~ l4 F& n
4 \0 f; m% ]% s/ {* N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 J. Z7 A: ~/ c4 d2 |& W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ~! @2 a8 N4 u8 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {- ~4 v3 M$ h" i! S
- 2 ?+ b# z1 c- U1 k/ W
- dma_addr_t dmaphyssrc1 = 0;, y$ D5 _) X7 Z" v- _+ R
- dma_addr_t dmaphyssrc2 = 0;
0 ]; \8 b) W1 Y; Z+ L7 N/ Z# _8 [ - dma_addr_t dmaphysdest1 = 0;& e2 F& i6 U6 d3 {( f/ E
- dma_addr_t dmaphysdest2 = 0;& y: l8 x4 y/ }% T9 G2 `* d1 V
% k9 M3 I; C8 M* v5 n- char *dmabufsrc1 = NULL;6 z5 l0 h @5 A. x
- char *dmabufsrc2 = NULL;' ]% [+ G2 ?5 M m6 y9 }7 B3 i
- char *dmabufdest1 = NULL;9 ?$ H- {+ N8 v/ S$ o
- char *dmabufdest2 = NULL;
9 h# [- V1 o' _ - 1 J) D. J0 R( R, U
- static int acnt = 512;
0 |" r# I1 Y8 [1 j' z6 E - static int bcnt = 8;
3 c) A! V2 Z7 A - static int ccnt = 8;
# \1 t( ~6 \" T/ V% J# S; R
- ?0 y8 F0 W4 f; v- module_param(acnt, int, S_IRUGO);7 ~' p* ?1 V) _
- module_param(bcnt, int, S_IRUGO);( B( [" I! ]1 u; J5 n
- module_param(ccnt, int, S_IRUGO);
复制代码 2 q- f8 ?0 V2 L, u
3 T! z3 j7 K. }2 h& w) P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. l6 U& V/ S/ g \8 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" H0 n& S' L( A- W- H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. o4 S% \9 b( u% n
% u" T# |' ]. J2 e% E" w; @# Q
3 U p8 P0 Y/ n4 o1 ` |
|