|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 x+ u2 r! |# ]; d1 |
- [code]EDMA sample test application
|1 S1 _& a" x Y - /*; [) V$ z3 V1 W0 M& l; o
- * edma_test.c# N+ g9 t+ W% t3 T
- *3 R- w7 k4 |/ i& u0 l
- * brief EDMA3 Test Application8 b p# k+ t& t* d7 K& t6 Q+ |
- *0 ?6 u! K- |+ ]- k% K6 `2 h
- * This file contains EDMA3 Test code.6 G" @- @: ^( A# v& {/ Q7 g; ]
- *, x1 I5 p; Z8 O9 M0 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 ? @: t, Q" e4 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 R4 J: P1 F4 V( C+ W* P - * TO CHANGE.
: b" C" y6 C! F1 e) L* R& M" b8 J - *. L* J, X- q0 r# m" ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ?7 i- H; @' ^( U1 x0 Z$ x - *- q4 g% p. {( }' U
- * This program is free software; you can redistribute it and/or
/ x4 p0 F# U$ `: z - * modify it under the terms of the GNU General Public License as! X5 o1 p3 A. z* Q
- * published by the Free Software Foundation version 2.
5 h& }1 I. {& _ - *
! s7 @# V& o( U* R# ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' N3 a- o5 e; F7 [/ D7 |4 E( E& z - * kind, whether express or implied; without even the implied warranty
- ]& d% h3 m) e$ i5 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' Y% T1 Z7 S! t6 | - * GNU General Public License for more details.5 t. d4 {4 o e8 n5 J1 D
- */. y" I! T* [) Y! e% J2 }. l
2 ?/ D, T8 F0 n' Q6 Z# ]( a- #include <linux/module.h>
5 X# V2 A+ y8 x4 i5 v6 V# R6 d$ G - #include <linux/init.h># s2 k- l0 y+ U- z6 x
- #include <linux/errno.h>, w9 K+ W( s8 w( e
- #include <linux/types.h>, {$ z, b4 h# P3 C
- #include <linux/interrupt.h>
! \' h+ J1 v) \, H1 N - #include <asm/io.h>
/ q" G4 x3 X8 _1 n& e1 P1 n& n d - #include <linux/moduleparam.h>& g- g9 z9 ]* ~! O$ _5 o: h% j" G
- #include <linux/sysctl.h>
% X# T3 ^7 [9 ~- |) m& x7 B ^) ? - #include <linux/mm.h>
% m$ W0 L4 Y9 | - #include <linux/dma-mapping.h>1 V% B. G/ a: U7 y
9 J( L2 V/ J$ d' Z& D0 [$ d- #include <mach/memory.h>. L2 f/ H; s$ J3 F+ K
- #include <mach/hardware.h>
7 T6 r7 J6 w$ A V1 N - #include <mach/irqs.h>
k0 m/ f$ O' L - #include <asm/hardware/edma.h>
2 v- ~9 ~9 E5 }4 h4 q; H5 I - ) {5 j8 V# U) O; |7 u3 x2 t1 a. d& P
- #undef EDMA3_DEBUG9 }* Y" H% b8 p ?7 ?+ \
- /*#define EDMA3_DEBUG*/& }5 R1 d( d+ U% [
- 0 K' A: e5 o: f* _
- #ifdef EDMA3_DEBUG9 a6 L: A: K! Z% }! t& I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 U0 l# L# z# y7 ?& S v! ~; ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! X a' h6 H ~; \3 A) s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
c9 Y( c9 `% U. c( j* P/ f; D - #else9 d: e* Y7 W$ b
- #define DMA_PRINTK( x... )
7 R) o2 G/ a& g2 C - #define DMA_FN_IN
% D b# ]4 v% I1 ?# w - #define DMA_FN_OUT
: f/ j4 N# z: n) P - #endif
2 `$ j; V/ H+ z% b2 e/ k. ^ - 5 Z# u [* S) h6 G" V2 _3 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 T6 [% S+ K3 ? - #define STATIC_SHIFT 3 @! ]7 C4 S, ~9 i2 X' l6 a
- #define TCINTEN_SHIFT 20+ ]+ \ b [4 r% r8 D. @
- #define ITCINTEN_SHIFT 21
2 w9 K) H7 e& @( R- ?) o - #define TCCHEN_SHIFT 22
8 U7 i5 ~! t2 U' Y - #define ITCCHEN_SHIFT 23' C* w- c/ m, |* [
1 ^& e& S7 r, ^* I$ c% d$ L Z- static volatile int irqraised1 = 0;
$ |' v* ^; S, W ^, V' L; p - static volatile int irqraised2 = 0;7 u9 X, Q# L# `8 ^; ?
- 5 c/ R0 _- g; ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' D8 E" }; `1 |& E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- `$ s, M& X" X+ `4 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B3 g% U, t6 D, Z/ H% ]$ G! ]
- ) ?6 A# C6 b4 B) \9 I8 S
- dma_addr_t dmaphyssrc1 = 0;
' g3 D9 ^; Z |4 A/ ~. U8 ~" S - dma_addr_t dmaphyssrc2 = 0;
" G! \+ C' C- [; U8 v* P1 m& c - dma_addr_t dmaphysdest1 = 0;4 t+ {' \6 ~1 ~1 d5 \+ ?
- dma_addr_t dmaphysdest2 = 0;! m' H) l( _5 |; L8 A1 F, F- h
5 K' ^; D1 d" A, f- char *dmabufsrc1 = NULL;/ M' g$ e$ V# d1 l0 T
- char *dmabufsrc2 = NULL;; ^8 K2 E) c; D+ P: C
- char *dmabufdest1 = NULL; v) W) u( K n \% a
- char *dmabufdest2 = NULL;4 u- e1 E: H8 V
- ' S) P& T3 {( y) e! l/ V2 I
- static int acnt = 512;" s' b" P8 u# S) j$ A! x( I
- static int bcnt = 8;6 L1 a5 [7 A7 {7 n9 l( Z5 ?& S
- static int ccnt = 8;
5 T; k6 @ q9 v Y
/ d. f% [* ]- E8 U7 S5 d# O- module_param(acnt, int, S_IRUGO);+ i7 q# f5 |# k2 G) S5 `( t
- module_param(bcnt, int, S_IRUGO);
% G' X: M/ K; ~* {, i5 m - module_param(ccnt, int, S_IRUGO);
复制代码
|+ ^( @8 @% G) X4 ^: R1 F) n% v1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ h i( @) o5 u- Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& w5 q4 D' @% P' C3 D& x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ n5 c: Y* |& {5 b" t' p' e/ F+ d1 j, M. }% W4 |4 |* l
0 W% n# y, ^8 Z% ^* R9 x
|
|