|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 T& A( e; t. m w Z+ x- [code]EDMA sample test application Z7 Q- \4 b" W' d- U' c, n1 k
- /*
A. x0 K% z! o! J' b - * edma_test.c0 N- U. J. K3 v
- *$ i6 F/ U0 J( f2 d# g" X2 N
- * brief EDMA3 Test Application2 w0 Q/ K7 R6 q3 P
- *
( Z. U" x4 w( g1 U" i, t - * This file contains EDMA3 Test code.
# R: u9 d" D! N/ C4 x6 z - *
' i. [) G5 S0 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* H3 }- R8 [+ Q* S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 [ Z1 w* C" w; `
- * TO CHANGE.
m2 ^/ u3 a: x* X \ - *3 \2 z3 d+ U& R" R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 ?3 t, L# Q% O; y6 M - *
+ |! g* r6 z. Z0 Z! | - * This program is free software; you can redistribute it and/or
% \3 m/ p) ?* C u! w - * modify it under the terms of the GNU General Public License as0 t* Q: u, P1 X, a3 D
- * published by the Free Software Foundation version 2.( f; I; b" W& J) ^1 m
- *$ d" T% [8 v4 O: v" D5 c8 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% K) P2 g" w) [ - * kind, whether express or implied; without even the implied warranty
% p8 d" p1 m, T/ r" ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 b L" g) F* G) W+ c- N
- * GNU General Public License for more details.* L+ j7 x( E/ K, R
- */
! h6 g2 _ I5 P7 S% S; Q
# W* {( g; T; w. {- F6 C- #include <linux/module.h>
5 ]* _ }4 Z0 \# n# t& }" P - #include <linux/init.h>
& a7 H- M' O8 |6 G. l - #include <linux/errno.h>; ~3 x- }5 r/ L5 f, ^
- #include <linux/types.h>
6 E+ x- k+ s# [( ?8 H$ D - #include <linux/interrupt.h>2 Y" ?4 A# H- i
- #include <asm/io.h>6 X5 C: s; |& O
- #include <linux/moduleparam.h>' }- S* O! j- i3 y! q
- #include <linux/sysctl.h>
3 p& P* A0 v( X2 ]* J0 f1 I( ] - #include <linux/mm.h>
. n$ p8 ]5 `% d9 O# x4 q - #include <linux/dma-mapping.h> I" u& s$ ~) C+ Y' C5 ^
# D8 R. U. E( z6 O H- #include <mach/memory.h>: [ o. V" s! V% F
- #include <mach/hardware.h>
! f* f- q2 g6 I5 c2 M9 b3 a - #include <mach/irqs.h>4 W& V' ^" c2 l# M7 }. S# g* ~, t, @! |
- #include <asm/hardware/edma.h>
" c7 z" R; t2 C" |) T; j6 k0 i. t2 {0 o
6 R z7 W$ q5 ]2 ^3 _2 d- #undef EDMA3_DEBUG+ Z( h8 I* ?" a% N: A2 V
- /*#define EDMA3_DEBUG*/- J: L: e6 E9 v5 E
- + Y0 Y1 R9 J' T3 S3 l2 t) ~
- #ifdef EDMA3_DEBUG. f4 g a; \' w! p/ i; S; I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! D8 W7 Y, E% q) g/ r: Q( k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ J# l/ E E% Z- Z+ B0 a" W" [: J _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, S% f4 |) g& W" v - #else0 y) M5 U3 r# p% i! S& O
- #define DMA_PRINTK( x... )
! E0 ]% i- t" ?! i8 w M. [" c - #define DMA_FN_IN
5 h6 a; r+ c/ I$ e - #define DMA_FN_OUT3 u) j0 z/ `* X( O. V T
- #endif+ P" ^! }$ Z W( l1 u2 U$ ]1 D
- # \4 U6 c1 ^& q" y, |, ]9 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! }1 K9 U! J( W0 r - #define STATIC_SHIFT 3: n D& D/ ^6 Z( Q; A6 @
- #define TCINTEN_SHIFT 20
9 o& E) L" Z2 L' g2 f+ `# `8 D* I - #define ITCINTEN_SHIFT 21. I4 `* z+ h1 T9 ?+ U# e
- #define TCCHEN_SHIFT 22
" k, @* b; [9 _( c - #define ITCCHEN_SHIFT 23
$ x5 w# a& q- c5 D. ~$ g! Y - 3 M# h3 `* x- s/ Z" O- {% Y8 f
- static volatile int irqraised1 = 0;
# B8 K# f F% w% R2 Q - static volatile int irqraised2 = 0;1 P9 C4 C: R r0 Y" v7 @7 m& z
- ) \ b& |% B( O* I- S# I. b8 K$ c" t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X$ u: H# @- {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U" Q( e; }2 \8 h4 \& G! r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, r+ W l% m+ U7 w
- . j q! I8 p! k
- dma_addr_t dmaphyssrc1 = 0;
, A7 [' O6 C( {6 e* _6 ~! R7 M - dma_addr_t dmaphyssrc2 = 0;: ~, }2 I# s# [
- dma_addr_t dmaphysdest1 = 0;
8 [9 Q# u9 X8 |9 R+ G8 H - dma_addr_t dmaphysdest2 = 0;
8 S$ C }) {5 e$ P
0 Y, o% |% j& a; J+ m- char *dmabufsrc1 = NULL;9 `8 w, E0 M" E
- char *dmabufsrc2 = NULL;% @" Y, `' o/ D8 _
- char *dmabufdest1 = NULL;3 S4 N' Y; n0 ?- I8 N
- char *dmabufdest2 = NULL;3 W' l. \' d9 D# t# q+ n$ [
1 K. J/ i$ u+ ]( b, a0 y- static int acnt = 512;4 S1 t: n+ Q" l) L0 Z; ]3 N6 S
- static int bcnt = 8;. b$ Y9 C, ~, U/ _9 N/ Q
- static int ccnt = 8;
( w: n& v6 m) a
) I: ~: @' w. V% Z) o/ S5 l) d3 Q- module_param(acnt, int, S_IRUGO);; x5 O6 o* V* T* h
- module_param(bcnt, int, S_IRUGO);) J+ o$ n) v3 T% P0 t# N* }
- module_param(ccnt, int, S_IRUGO);
复制代码
Z2 z' F, J/ m0 o4 L6 T
: j! {1 S. m, B2 Z1 n# ]; N7 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) F9 O# M9 i' K+ i6 a3 O) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 b+ s9 j- ~$ m3 y' S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 l! v% R9 a3 [% r6 e" o8 a
2 ?2 c7 C0 u) z( v1 v1 {+ C
! z4 D! l2 s2 e6 ~, K0 G/ L |
|