|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 `: G% @8 Q) T7 W* S- [code]EDMA sample test application) U M6 D8 m e' z, G
- /*7 X0 g6 m! M" T- ]5 K% W
- * edma_test.c" G3 f- g2 X8 p' q" {
- *
* [2 Q7 `- R0 ] - * brief EDMA3 Test Application5 l& P* X2 {- ]- R0 U" O# e
- *
/ p$ [( c0 C2 }# X1 E - * This file contains EDMA3 Test code.
' D: ~4 }8 I: W; Z - *& P# {- c" r ~' v" j" \8 w: Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 \: ~2 A0 q9 {6 m( _7 |9 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 |+ @* ~- J: ?) F
- * TO CHANGE.
7 C/ p1 a l6 t% z2 e+ k3 | - *
" r+ b0 K* Y1 j" p& V* P; w9 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _; Z$ `. `3 p4 H C0 z
- *, c* w) J6 D0 j
- * This program is free software; you can redistribute it and/or; } U0 \8 C: d. w2 Z
- * modify it under the terms of the GNU General Public License as
) Y; N0 Z+ b4 p) o } - * published by the Free Software Foundation version 2.
7 x3 L$ z; D( d+ f% Y - *$ K- J O, p" `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w1 `9 Z( K4 s, u
- * kind, whether express or implied; without even the implied warranty
m1 v: e6 N7 @7 {( R; U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 y/ Z* C# y! v" w, t5 ^ - * GNU General Public License for more details.
. ~- q. N1 y* S7 f1 q6 v+ D6 @5 E - */
3 G& ~, N, L" w& n
; n: H: E0 H; M$ O! X- #include <linux/module.h>+ l* L J" m) | t
- #include <linux/init.h>
! I4 z8 w4 T- ?- U- N( D$ ] - #include <linux/errno.h> h# `) ^/ ]: O9 W
- #include <linux/types.h>
# | W% |6 L6 j" ?) }% I& { - #include <linux/interrupt.h>
1 w' J* l2 v$ V3 ^9 Q - #include <asm/io.h>
. x5 h1 R* d6 {, W; t3 {% _ - #include <linux/moduleparam.h>
' _$ f6 b5 w0 T - #include <linux/sysctl.h>0 ]# a. W3 g/ G7 `
- #include <linux/mm.h>8 `3 {" ?% d" J! j& @$ h
- #include <linux/dma-mapping.h>3 t% ]3 d7 H7 c% J( p/ t
- ; A- Q9 _' i3 E- p* A @) u0 d
- #include <mach/memory.h>
; Z% k9 I9 @6 q/ D* b! e$ r - #include <mach/hardware.h>5 C7 J: g6 }. u8 z( A& B2 ]/ J7 z
- #include <mach/irqs.h>; W# V% P& u. R, H, U) F
- #include <asm/hardware/edma.h>, C+ s: r3 e: T' I# G8 s
- ' r# c- [4 n" k4 ?* w% M
- #undef EDMA3_DEBUG- t* M, h. r- l2 ^; s; U
- /*#define EDMA3_DEBUG*/
1 P/ v Y! d; I - 8 t3 x8 I, J* K, u
- #ifdef EDMA3_DEBUG
: w1 d' t: o6 r( A! H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): E4 C P" e* R V" Q9 i4 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 g0 P, |/ s* w2 h2 R: L8 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' I( y; F0 T" \" P" S2 o$ b4 ` - #else4 k+ Q+ S/ @7 C- b/ i( F, C
- #define DMA_PRINTK( x... )
( [; ?- M4 \- s1 T: }4 r - #define DMA_FN_IN
8 S" f" K7 |3 X a9 T0 { S; e - #define DMA_FN_OUT# U) R1 S. n3 K/ L" }
- #endif# w( A7 X W7 @1 R8 w+ b
- ( ?8 O# T7 J. W& s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): F2 A' G. |& d, v; h; \. ~
- #define STATIC_SHIFT 3# V% `5 y l0 K4 {
- #define TCINTEN_SHIFT 208 o2 X# p% X% ] T! V
- #define ITCINTEN_SHIFT 21
% e. ?8 e) b$ ~2 U! S - #define TCCHEN_SHIFT 221 i4 ?! u, N' P, Y7 M" x' A v$ q" u
- #define ITCCHEN_SHIFT 23- Q" I4 g1 ?0 b$ z
1 n; w8 l1 {' S0 \6 w9 I- static volatile int irqraised1 = 0;
' }: ~9 W' t; d$ P" O - static volatile int irqraised2 = 0;1 X$ W) t. `- [; s
- 4 S" J. l! Y! [4 m6 N; `0 ~0 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) U* K! o5 R6 M6 r0 s* m! G) \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X* S! @- y% ], J3 S, Y9 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B: J% B: R. w; m5 Y
' y& s% `0 i9 L$ k, o( |- dma_addr_t dmaphyssrc1 = 0;
P! p1 S5 p& A - dma_addr_t dmaphyssrc2 = 0;8 [, U3 ^6 F/ N7 b v
- dma_addr_t dmaphysdest1 = 0;
+ y/ e( ?) p0 Y' { - dma_addr_t dmaphysdest2 = 0;9 ^; ~. f! u7 s( z* E+ Y3 S3 q
. k$ c+ Q4 y( g, n- char *dmabufsrc1 = NULL;
; s4 U8 ^2 W- N: J) x - char *dmabufsrc2 = NULL;
) c) N9 h5 ~" M& n) Q* G2 y - char *dmabufdest1 = NULL;1 B/ z) ]- S9 _
- char *dmabufdest2 = NULL;
7 h/ ] H% t& y; M; b3 K, [ - 7 ^/ M/ c; v" J
- static int acnt = 512;
. C+ o4 D0 H, X& @ a4 K - static int bcnt = 8;( J1 n2 ^# p# @
- static int ccnt = 8;: P3 b/ W# @8 _) K5 r8 {1 {
- 0 C6 g+ U2 ?* W- N) X2 Y' k- Y
- module_param(acnt, int, S_IRUGO);
: W6 H$ Z( v s( q8 }+ f- p - module_param(bcnt, int, S_IRUGO);% W: m# O- v K$ k/ f- i. G" z1 u- ^
- module_param(ccnt, int, S_IRUGO);
复制代码 " g9 w9 o W6 Z. A9 E
( _, ^7 ]' H/ \, N2 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ^6 |* H* j x, r- p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) N4 p+ ?/ E* ?% H9 l% _- d( y7 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 {% \( ~9 f3 c# H6 A! {
/ J% C; W- r: j
7 e$ n$ \% Q+ n% n* Y! x) Y- z
|
|