|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 p% Z0 i" h6 s3 C; f- [code]EDMA sample test application$ V) p) j$ [5 D+ L
- /*
- W% L3 s3 z( a. F - * edma_test.c
' Y2 d/ f! r; g+ ~$ w - * t6 _! ~ q. ^- ?
- * brief EDMA3 Test Application
" ]/ @- ?1 x. t+ W$ v9 N- A - *
& y' M3 `3 K5 k8 s$ r( W: r- ?: S - * This file contains EDMA3 Test code.
& U" I/ n2 d# {) [3 S+ o - *) c7 c K* U5 m6 w% Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( z& W. J% ^+ r$ z* X2 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ \& y6 X% A8 \8 k/ G2 E# m - * TO CHANGE.. V# }5 v9 B" i$ G: G0 c
- *
, l6 t+ i+ F! e& C# k; @, @+ A; n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 V' A5 i" M9 G* ]1 R$ n* n0 I
- *
8 X" E% C* E* ?1 W+ a. E3 o1 \; r - * This program is free software; you can redistribute it and/or# N+ G* \ d% z9 q
- * modify it under the terms of the GNU General Public License as
+ T c3 U0 c8 d: B - * published by the Free Software Foundation version 2.
0 b3 x V. L* W) _: Q/ ?: \ - *
* _' y! @9 D5 l I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! X, y! R/ ~) W3 H2 D( g' n. {& v
- * kind, whether express or implied; without even the implied warranty+ R! k3 c% |2 w! c3 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( C" ?% T( G1 t% A/ l
- * GNU General Public License for more details.
( i+ U/ D2 y `6 _: p, j6 n# X - */
$ f K8 a1 C5 T( F' @0 N
- |. `' A. m5 _. v8 p/ p- #include <linux/module.h>
# ^, m9 k* S- X6 I# n - #include <linux/init.h>
. g6 q: D( n' o8 R - #include <linux/errno.h>
& `$ |7 y: k# P7 Y2 b, Q+ Q( j - #include <linux/types.h>
9 D7 ]8 r, c2 H8 G6 H3 o - #include <linux/interrupt.h>
* H, _5 V. Q$ t% h+ D - #include <asm/io.h>! t J0 h( f* J# O4 w
- #include <linux/moduleparam.h>: @0 @6 P2 T8 }: t, j3 D
- #include <linux/sysctl.h>
, k" _0 [- a% a - #include <linux/mm.h>
0 }' q* A, Q1 u7 a9 |3 u% U - #include <linux/dma-mapping.h>
; \& v: ]; J, w1 h9 s
3 q: N6 j, r- j- M4 q, F' i$ t- #include <mach/memory.h>
. p0 c# d/ y" h5 |* N) J0 z, [ - #include <mach/hardware.h>1 Q! D8 B+ v6 Y O% i- s
- #include <mach/irqs.h>
2 M( r+ ^4 p8 N" v2 n! g- m - #include <asm/hardware/edma.h>
; L; A5 I a) p0 r
3 [7 `9 @6 J+ Y$ C3 ~5 c6 c- #undef EDMA3_DEBUG
# J. p% I2 V( z$ l, [8 I - /*#define EDMA3_DEBUG*/. r* v3 V% b& e
- : ^" g' S6 V2 s) Z; n
- #ifdef EDMA3_DEBUG
6 l" E1 l* }+ ^1 r( u. [$ q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( M0 F: V. ^0 J$ o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 m0 L+ r2 H j6 `2 d E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; v2 Q3 W& m1 S - #else
3 [% A4 K5 t; y3 w1 J5 l( a7 @ - #define DMA_PRINTK( x... )( }2 O6 q! ^# c% c0 X( j
- #define DMA_FN_IN& B; n3 a( O! A" ~1 O* o: v3 r
- #define DMA_FN_OUT# \" P q. |3 U, [
- #endif4 \: P5 P* Z) Q! i6 Q
+ B, k2 K0 i9 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' O$ i# M4 t( ]" `: V/ e! r% ~
- #define STATIC_SHIFT 3
: C4 R z# l# N4 K+ f! `" b - #define TCINTEN_SHIFT 20
: D+ {4 w5 T Z+ l - #define ITCINTEN_SHIFT 21
% Y: G2 `: @) F! P4 `. {: { - #define TCCHEN_SHIFT 22
4 @! c! f1 T( m6 G# j o2 A, o - #define ITCCHEN_SHIFT 23' f: g0 H: f: c7 Z8 h
1 M5 t( {0 E5 G: f% C; W- static volatile int irqraised1 = 0;& L5 I# o9 t& S# `: x0 C8 M
- static volatile int irqraised2 = 0;' e. T: {; e) X, d3 k
- 5 N, E0 a" t9 p. T; B1 G$ \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I( ~& c. }% O' o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& _+ g; P& ?, [6 M0 q% `+ C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* E5 p# t% a1 t- p; |1 p6 O
1 `8 ^" N3 f, C+ ^4 [- dma_addr_t dmaphyssrc1 = 0; q: j. r" C; {
- dma_addr_t dmaphyssrc2 = 0;5 V; X/ w' B0 K0 O n* S. k7 O
- dma_addr_t dmaphysdest1 = 0;- f# A) d" y# O. e8 z
- dma_addr_t dmaphysdest2 = 0;6 o' u( N8 q1 j: b( c" k1 B
- & b% X" r b T, G4 Q/ J( y/ |) l
- char *dmabufsrc1 = NULL;0 D# h1 j% j2 ]2 [$ r; Z
- char *dmabufsrc2 = NULL;
8 t% m$ j( A, D& r - char *dmabufdest1 = NULL;' \2 [" i5 S3 B
- char *dmabufdest2 = NULL;/ Y. Y5 m7 ^+ o5 s9 N
. |& `* @' L/ e F" ?) k& d& I- static int acnt = 512;+ ?( U! v! ^3 Q& j
- static int bcnt = 8;
) o8 P6 H+ ]9 P; c3 ^ - static int ccnt = 8;
+ N' a9 P; H. k - 7 |2 c, x+ n; O% M) l& z
- module_param(acnt, int, S_IRUGO);. A& G5 m9 ?- n, q8 i }0 ?# H
- module_param(bcnt, int, S_IRUGO); w* i$ e* |# v+ C: {- ^
- module_param(ccnt, int, S_IRUGO);
复制代码 7 F5 N7 T4 i% O& W' h
" A1 ]- g9 G2 L( f+ }, d: A: z+ q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) e* ?% \% E( q6 E% narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 r3 v7 C) ^* E0 b* _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
i$ f( w3 A0 Q
9 Z, `% O) Z+ f0 E9 h! o3 X+ d" h. w0 b0 R; ]# M
|
|