|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ i1 X! i; L4 L, D: r- [code]EDMA sample test application
! y. T* j+ l/ T i0 O ~* N - /*
# a" Y+ @: ?6 |) ?4 E5 p" W - * edma_test.c& V1 ] _3 @- U |' D
- *, u7 k6 t$ |# b8 a' M
- * brief EDMA3 Test Application0 q* _. ?& t1 B3 w
- *
! u! ~% [6 }- X1 `, V - * This file contains EDMA3 Test code.
- q" \, q& n4 M, S/ @! I - *6 b) |! ^- @; A) U8 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 ]8 j) s7 r1 X4 H" _4 A" d! Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J, ~% g4 _( q7 ]3 l; q) z* \
- * TO CHANGE.1 A5 q4 q6 f/ h/ [/ c9 d
- *
8 M4 Q/ z" ^. b/ J+ c0 ^2 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ D% S2 X1 R, k: t/ H - *) Q; W+ n* Z/ m6 Z) q, f- D
- * This program is free software; you can redistribute it and/or9 t/ b% z$ k% {4 M
- * modify it under the terms of the GNU General Public License as
. y/ I1 j# D% C9 ^1 W& A. q - * published by the Free Software Foundation version 2.; S( f D+ Z: T; X
- *
3 k- S j, Q5 N! [( ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 A, h1 R* M- J& m! l4 j/ r2 j2 n - * kind, whether express or implied; without even the implied warranty
! j$ |. V( ~4 v9 F6 ~( p1 ~& b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the y: P8 J$ j; a
- * GNU General Public License for more details.6 O4 o; A) w5 H; S$ o
- */1 v) g1 W/ k$ ?- L/ |3 t
- / |5 W# A9 Y) L
- #include <linux/module.h>
7 Y, u3 {9 O, h) N - #include <linux/init.h>) ]% d+ b& {8 R( D) m! n$ l1 | M) S
- #include <linux/errno.h>
, }. \: k/ G$ j. ~% A - #include <linux/types.h>0 I2 J) i: A5 D0 q& i% H2 C
- #include <linux/interrupt.h>
/ ?" g z, U# W/ e( P7 O3 ~' b - #include <asm/io.h>; N% _% x& J/ `% o. e) U
- #include <linux/moduleparam.h>3 c7 i* a* z( P3 \
- #include <linux/sysctl.h>& A8 ~: a9 s. e2 `
- #include <linux/mm.h>
1 f R8 h) e$ b9 e$ ], R - #include <linux/dma-mapping.h>/ J6 @' I/ j& A4 ^/ m
( \ j6 M& v: l( x G& ^, H- #include <mach/memory.h>( X# [1 Y( L" v. a: c. t @! k8 K
- #include <mach/hardware.h>: H0 f, Q6 u' Q. s6 k
- #include <mach/irqs.h>6 x1 c$ x! z/ w( B# M* A; i" c
- #include <asm/hardware/edma.h>4 b& @# d3 [$ X% U0 B% \* c, e
7 Q! Y% x1 f1 l% W6 G' m0 h6 M- #undef EDMA3_DEBUG
+ l6 M- n" Y) m; w: x e9 W: D - /*#define EDMA3_DEBUG*/ W% m8 @/ G! ]. B" [8 A
- 0 u. ]& u. n* P9 s% [/ {7 c% e
- #ifdef EDMA3_DEBUG8 M0 d# V7 j5 O( |6 w1 p. n, y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). G$ |: ^( Q, h8 h( _8 {2 m% V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 y8 r' S, w& x0 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 |, V; V3 A! v; n3 A
- #else* O: \: J5 t6 W
- #define DMA_PRINTK( x... )
8 `+ U" b7 P( y4 V( k1 p$ z+ m: J - #define DMA_FN_IN
; p" ~4 C0 @' b& n5 ] - #define DMA_FN_OUT6 }2 P Y: j( z8 R8 L6 k+ C7 q
- #endif S. K9 P% i2 O9 ?
$ q$ T' J9 P9 z" {$ Z9 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' a B; g6 g% `7 E7 W
- #define STATIC_SHIFT 3* R! |& F: h( i$ G
- #define TCINTEN_SHIFT 20
' @. B) S# ~. b" R$ w% @" i3 } - #define ITCINTEN_SHIFT 214 S' {1 r$ j7 k# C
- #define TCCHEN_SHIFT 22
* C- G' h9 z8 i9 a; J8 n: _ - #define ITCCHEN_SHIFT 23
7 Y" F& |# \1 ?# ]* l& L2 n
9 g5 u; c) e+ x3 t: ?- static volatile int irqraised1 = 0;" p9 {" H5 r4 [4 a2 n4 g4 n
- static volatile int irqraised2 = 0;5 G) a/ N" r8 |
- & v# e6 e: }9 f& L, k, H: w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ~3 b, H) u. v4 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 N" d1 F$ h' N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 j2 k. g5 Z4 a' L0 n4 V
+ ?" M( \( N% G: m- dma_addr_t dmaphyssrc1 = 0;7 y' _. X& C* h1 @
- dma_addr_t dmaphyssrc2 = 0;
5 H! u9 R3 G7 L, |4 e0 a" H7 ` - dma_addr_t dmaphysdest1 = 0;1 z* ]$ U# d1 {) u# H h3 O: D
- dma_addr_t dmaphysdest2 = 0;
, ]6 n( I0 ?, ^! b- o, c0 ~
Y- j) y1 Y7 ~6 d3 N* f8 c- char *dmabufsrc1 = NULL;
5 }5 p2 ]0 m6 r0 U' a - char *dmabufsrc2 = NULL;: v9 j5 l2 [; [
- char *dmabufdest1 = NULL;
0 \1 k3 J" o( y. y; g/ Z - char *dmabufdest2 = NULL; N8 K" F$ q2 C/ Y' U
- n' n o) [9 X, `! g
- static int acnt = 512;
5 M% ^8 D$ A5 `9 C6 T - static int bcnt = 8;
- ^5 ]+ Q0 U1 I. f7 { - static int ccnt = 8;
- X3 h& |7 R! Z1 @ - . `7 B, y a3 ~) M9 b
- module_param(acnt, int, S_IRUGO);4 ^, f7 S0 U8 g$ |' _
- module_param(bcnt, int, S_IRUGO);
4 m/ |7 C, w( {( ^& i& G5 f - module_param(ccnt, int, S_IRUGO);
复制代码 5 t; ^; D5 Q& M' d% }+ n
9 W) @" C" a" i1 X5 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 {" _; \7 }& y, ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [- @/ `+ a3 T5 W5 N; ]' M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C3 x2 I! S: @5 I9 j
" v. Z( _* T0 D4 n" r2 ^; Z
) f/ V8 u4 {' \+ r5 E8 c0 ] |
|