|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# r2 y- V5 C* [9 x5 Y- [code]EDMA sample test application
. b) `1 ]% m$ `' w# _ - /*! O) q- D. x7 ?- h( g9 x
- * edma_test.c4 y* E8 S$ V% x8 `) r% ?* \" n
- *& t1 }# S" j( x* ?; i
- * brief EDMA3 Test Application
k6 Z- r% W7 e" b6 v) d U - *
" A. s( A# f- c - * This file contains EDMA3 Test code.
/ a: a7 S$ t$ X) E$ ^- n3 s - *, I) n; q5 r7 V# I( ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Y" b8 f+ v5 A+ Q# C" u4 K+ E+ ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" v7 k8 [ ]* i/ j' o, o6 g
- * TO CHANGE.* \+ X% d. k/ b* Y2 G- z1 Q
- *
! D/ J, s( h" X6 R" Y+ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^% R8 S. r x; j) z
- *. M7 }/ N$ w+ p% h9 M' g2 K0 V
- * This program is free software; you can redistribute it and/or: I, K0 \, _, U& W- Z. g) E7 o B
- * modify it under the terms of the GNU General Public License as
! A! ^/ S& T: C5 N J; g - * published by the Free Software Foundation version 2.+ g, Q$ E$ E) {+ Q- m; M, t, x- ^
- *
# Q% l# @8 h5 d9 r3 z% L/ s8 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ]( Z5 ]0 ]: ~8 O8 a8 j2 M9 P - * kind, whether express or implied; without even the implied warranty
$ j( o5 P# R1 i. d' A. U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& s/ ?+ ?6 E* X! S - * GNU General Public License for more details.8 R: L1 }* y* h! M7 `0 k4 w0 y' V1 h' F
- */
4 f v5 D9 a0 b
( o2 I8 D$ x$ [4 I- #include <linux/module.h>
0 H( r5 d+ L5 s; v - #include <linux/init.h>8 |, b' j3 X; ^6 E
- #include <linux/errno.h>
- C& n$ k- o% n: Y - #include <linux/types.h>& l' [. q k* K: b2 L6 s: {$ v
- #include <linux/interrupt.h>3 ]# [" s1 a+ k1 O( V' u0 q
- #include <asm/io.h>/ @; H0 b5 G J
- #include <linux/moduleparam.h>
L, I \; U! O& A! H- }6 ^ - #include <linux/sysctl.h>5 `# u) \5 l0 c) S
- #include <linux/mm.h>
; E% l% ?: N, M8 b# W( B+ W - #include <linux/dma-mapping.h>
: {; k( ~# @1 D6 z& N: [3 o- [ - 2 ?% V6 k3 Z: d4 V# @
- #include <mach/memory.h>
; Q4 S+ I; I* D' a+ m - #include <mach/hardware.h>
& V1 `, G, r. @8 a - #include <mach/irqs.h>
0 v! I9 ?2 H8 d4 v: t - #include <asm/hardware/edma.h>
- C2 S/ K) p% X( G - 8 y: s! p( x0 i* R C
- #undef EDMA3_DEBUG
: ~; v, e! o9 @. R/ P t2 t - /*#define EDMA3_DEBUG*/& r# n( J8 Z3 y" L" l. g/ i/ a4 s% W: b% b
- 8 g% k8 h6 _4 h$ s3 [
- #ifdef EDMA3_DEBUG7 t: _: z& @& ]5 D& `9 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?3 t0 L( H. o/ f' M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* X1 P) q/ j' W9 B6 ^- C) H6 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 P! l" p" P+ Q5 Z# K - #else
1 u6 t% A/ {$ l6 V - #define DMA_PRINTK( x... )8 Y' @! |, Z( q# M- }5 D
- #define DMA_FN_IN
; _: h( H6 v# ~! w ]; v - #define DMA_FN_OUT
( |2 a6 P- s( s- [+ I - #endif! M: D3 z/ ]! k* ^ Z9 V* j2 n1 }
& t$ u+ R% M+ F1 P7 q& B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 l" h: e0 A G- t. g1 }+ z: T" [ - #define STATIC_SHIFT 3
+ \. V: V5 U } z+ {1 e: c, { - #define TCINTEN_SHIFT 20
+ O! j0 j3 w* ~ - #define ITCINTEN_SHIFT 21, ], I- X: K/ i
- #define TCCHEN_SHIFT 223 X" `5 K* v) A$ ~$ c$ ]
- #define ITCCHEN_SHIFT 232 V4 X3 j7 d* K( u8 }9 `
' \2 S% ^7 b- L6 y2 o! ]5 |- static volatile int irqraised1 = 0;& A+ T1 g; Q( U$ c! K, r6 {
- static volatile int irqraised2 = 0;% I) h$ k6 B7 O2 I1 X
/ r% R% R4 z I" \8 O+ i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s- q3 H# K" r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ `/ J& P- A \ d" t8 O2 N- F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& T! d( @/ \( T. o - $ f% S/ y8 H0 q* |% \
- dma_addr_t dmaphyssrc1 = 0;
) p& k% g y5 @ F7 T* o1 a - dma_addr_t dmaphyssrc2 = 0;
) _& c! s: ~# T" Y9 P9 \ - dma_addr_t dmaphysdest1 = 0;
; p. k8 R" @7 V, c/ J) n+ U' i - dma_addr_t dmaphysdest2 = 0;
6 \# ]! y6 K9 X9 S - ; z% b+ Z8 r% @. H0 v
- char *dmabufsrc1 = NULL;
1 s& f* A5 t1 o0 C# q Z - char *dmabufsrc2 = NULL;
q) V* @: G4 k* N- e2 C - char *dmabufdest1 = NULL;
: U6 L: ?1 t0 G - char *dmabufdest2 = NULL;. K# ~$ i# B1 {( l3 p F y
- 2 \! G. y( C! M
- static int acnt = 512;
, l* Z) g$ j7 ?0 u" Z+ G1 X, y" B - static int bcnt = 8;
4 G) ]! ]% i0 R7 v0 v1 B, _ - static int ccnt = 8;4 a9 S$ F1 ^( ?5 Y- [2 Z$ l! U
: T3 u7 J+ Z+ d& Y: O4 P' V- module_param(acnt, int, S_IRUGO);0 K" y: {6 d; U8 d: w6 p) }) N4 n
- module_param(bcnt, int, S_IRUGO);
. }0 e% R, C' d; F# ?- Z - module_param(ccnt, int, S_IRUGO);
复制代码
5 P9 ` S$ F$ V& O. v2 t% X6 z1 k: v- N) |' ]; E! ^( d& E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& s* a, I* y* u
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 R; O3 E8 {. z" Y1 Z9 b; l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( f1 V, _ g, F1 m
2 \- p0 X3 w( I3 E8 R$ u z- e$ M9 ~+ k2 V
|
|