|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 R: L h/ A# k1 t/ K$ a, g
- [code]EDMA sample test application
: o6 @. O1 d7 H+ p% n0 c9 y - /*/ z% b. W* s* Y# X$ m) Q, I
- * edma_test.c3 N7 m1 D! g1 A# y5 i
- *
# I8 @9 l0 C5 h - * brief EDMA3 Test Application' e" x! w" J- Q. x) f
- *! p) Z9 _2 y" W
- * This file contains EDMA3 Test code.
) B) @, b3 n- T) O! k - *
" H" s2 K; d9 Z x- g+ Q, O0 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 |# S' l) w- S: s/ d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Q% B8 ^/ w: Z" `9 H9 A- V0 M
- * TO CHANGE.
* M0 c' |$ o; c6 v6 A - *
% G& T' z: x4 \* B) _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ~7 j7 y7 `" n9 }% e - *
J0 Q2 @" C( r6 \, ^) ^! E! W2 }- |/ K - * This program is free software; you can redistribute it and/or
4 ?) j. J2 s3 y. E - * modify it under the terms of the GNU General Public License as7 i- @- W. Q! \/ q
- * published by the Free Software Foundation version 2./ l. H4 X% z' U# ?0 Z
- *
* L$ L: S N8 {5 \0 ^! A ~6 i2 ?7 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 E8 d- G$ l# G) c, T( ]) x - * kind, whether express or implied; without even the implied warranty$ z8 I2 A. b! f, W$ R7 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( s2 I9 G0 N* q# f - * GNU General Public License for more details.2 o3 s' W$ D# L4 {( [# ], b! N
- */% X0 [6 W& J+ p) M0 |+ x0 k7 o
, e2 _ I9 f' A7 {; Q- #include <linux/module.h>
# i8 l/ ]; L& p* x+ P4 h - #include <linux/init.h># e0 l8 h* M% O0 n! s8 m2 Z
- #include <linux/errno.h>! L- O$ T Z2 y; w* t
- #include <linux/types.h>$ E c9 O% d$ }1 y4 m
- #include <linux/interrupt.h>- Q# y% x$ E3 D6 v+ t2 k
- #include <asm/io.h>0 s2 n3 F: S2 p0 N' T, p. y, @
- #include <linux/moduleparam.h>
* f' T& L2 b1 d1 w. O5 } V8 _ - #include <linux/sysctl.h>+ h( X9 c5 U1 H, `' F! O. F- [, r6 k
- #include <linux/mm.h>
. g! E9 P/ x8 E: }' ~$ @ - #include <linux/dma-mapping.h>
4 u/ ?$ E1 P7 P. q/ J d - 6 G" V' \/ i1 `2 }6 P) l& k' o
- #include <mach/memory.h>/ J* @4 o6 I* @. n/ I
- #include <mach/hardware.h>; ^& v+ {, Z5 H4 d5 w- P
- #include <mach/irqs.h>7 i# h4 @& s% o+ f! u4 Q: ]$ M
- #include <asm/hardware/edma.h>
+ U3 a" |4 P. R+ S5 Z' k
5 T% [' y% S$ v" U- #undef EDMA3_DEBUG
& z$ @$ n; c" `/ K; F - /*#define EDMA3_DEBUG*/
# S% q0 e+ f/ K `- E) g - & a! m$ h( d# \) q X
- #ifdef EDMA3_DEBUG; Q# B/ \1 Y7 b5 [4 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 M2 I# E7 z) m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 Q e, \9 ^) T* }5 [- N$ q# L' y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 I3 P6 D/ ^0 _1 W0 B - #else9 q: T! v- {; M" F5 F
- #define DMA_PRINTK( x... )
% o" d9 p' y' }3 c4 n$ _: r - #define DMA_FN_IN
# x$ U2 J; f/ g# a1 H D - #define DMA_FN_OUT
6 Z+ p; v2 I7 d2 t) o( d - #endif( G( N8 Z5 n3 \7 y0 q8 m% f$ C
- + o: }" C! {1 }" o- U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 x* z. _& U y5 w
- #define STATIC_SHIFT 3
2 }+ h. Z! W; N Z' ]) z1 ~ - #define TCINTEN_SHIFT 20. o7 z/ p, j, ` e6 K% h2 W2 b
- #define ITCINTEN_SHIFT 21) R n7 m p6 Q- x
- #define TCCHEN_SHIFT 22. q) ~' s; ~* S, l* G* s' I- T9 A: U
- #define ITCCHEN_SHIFT 23' O* v1 ^" v5 m0 m; ?: t* V
! c- H/ j; D5 s$ h/ q3 q- static volatile int irqraised1 = 0;' \) t: B; ^" O4 D8 C9 b, A
- static volatile int irqraised2 = 0;
, Y% c, z$ H# M - ~( ^0 z, L0 f2 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {; @1 ~* @( O0 T3 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E5 Z* \* c: e8 a: X% W. x+ y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 y$ e; o7 f- ^6 W+ d& ]0 g& C9 C
- 5 H3 N6 D( j5 ^; e3 b4 U
- dma_addr_t dmaphyssrc1 = 0;
% {! N2 I/ |+ G) Q+ a. O8 p - dma_addr_t dmaphyssrc2 = 0;- a: Z7 n2 J7 O3 }3 @; }7 S: h
- dma_addr_t dmaphysdest1 = 0; _1 p1 C6 d* M' U) m) m: S
- dma_addr_t dmaphysdest2 = 0;
5 @+ ~1 N- B1 U+ i" G* \
7 g" u+ F' `* s# e. s- char *dmabufsrc1 = NULL;
# Q+ P5 t, m/ H) t% o6 m0 [$ c - char *dmabufsrc2 = NULL;8 b" r9 O$ h: m: d6 V3 p: f7 `! W2 w
- char *dmabufdest1 = NULL;
: B8 Z" y# U' f7 x - char *dmabufdest2 = NULL;$ [) y' `8 E6 r, \1 i! b C
( D; k; J3 M' M* S' R7 \8 a- static int acnt = 512;
' `/ F' @/ j- u6 f0 m0 I - static int bcnt = 8;5 Y* X* Y) _' c( F9 l% @9 x
- static int ccnt = 8;
& P$ b: N7 U V1 \2 F - 4 @( ^3 T2 P* N% K5 U, q
- module_param(acnt, int, S_IRUGO);* m! O) w! d8 S5 s$ J" J+ }
- module_param(bcnt, int, S_IRUGO);
0 E- }5 q# i5 k' R# `1 e - module_param(ccnt, int, S_IRUGO);
复制代码
( a5 }/ [& U( A" g7 _
) [+ u6 a" w/ d+ w2 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. a* _0 O8 A; H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A# l6 ^% M' W7 ?6 G, |! j) u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. c3 {7 P5 m/ J3 Z7 a2 w. ?
3 \ k9 w. l0 |! W! g+ d8 m0 }" s. F- [+ r: f$ R
|
|