|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " H! ]# _- b: F5 E. ^# E4 K
- [code]EDMA sample test application7 l6 `4 ]* K: y+ x
- /*
0 b. [7 o4 S4 W1 {' z0 R3 p" _ - * edma_test.c
$ v" e' A$ ^9 }1 X - *
. Y. {2 c# d- c- p( f9 q4 e. h - * brief EDMA3 Test Application; i& d" B' ~' O# j5 n
- *
4 z- p; I4 @2 X! h, L0 j# u- Y Z - * This file contains EDMA3 Test code.$ a) |4 ?5 F5 x; T/ I+ `( F9 O% [
- *9 @( _$ c- A3 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 N7 t# x0 P2 s8 t& X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# S' Q' L* R# ~ g+ S1 J* K - * TO CHANGE.& D) u) Q" _$ A x O3 I3 C9 [
- *
& x. a( @$ p4 M* F- Q: Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
L- s7 G8 {8 l+ N o! X } - *
5 |+ v0 T" _1 y - * This program is free software; you can redistribute it and/or) d- q7 Y z: c
- * modify it under the terms of the GNU General Public License as
+ c6 Y5 G' @% R1 p- a! d% ^" ] - * published by the Free Software Foundation version 2.- W' F+ {# I6 @
- *
+ l9 X2 A1 u4 b% Z5 X2 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! T/ K% U8 Z$ h( L }% h - * kind, whether express or implied; without even the implied warranty
# R/ x6 X5 R+ H H& w5 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, [! @& F* K3 x- |7 Q8 N; J; I - * GNU General Public License for more details.# [' a+ c* V3 d& x; H5 x0 g. O. Y+ m
- */
) G9 e! e! w- P
5 y' c/ }0 O6 t0 d- #include <linux/module.h>
+ y. ~ n6 M( E: c- s- i; H( @- l - #include <linux/init.h>+ T* L* v' E& d
- #include <linux/errno.h>
/ C# I4 R, F, @. A6 P/ |1 z - #include <linux/types.h>
" @" V+ v; `$ c- C8 g, N/ O' Q - #include <linux/interrupt.h>, C+ f3 A" }9 C/ g1 m( D, |* ^% d
- #include <asm/io.h>( r8 w' @. |4 B: }
- #include <linux/moduleparam.h>
9 c6 G7 u# P8 _3 i7 d3 S R5 R - #include <linux/sysctl.h>
4 q# }% R; b V% j - #include <linux/mm.h>; }/ P& C% O4 c. |8 u F
- #include <linux/dma-mapping.h>" r- V. i- {0 X, f8 S# B! M
- + ~' y1 S/ R5 O# @# R
- #include <mach/memory.h>
3 ?5 C1 H; Z* Y! F" _' i8 M - #include <mach/hardware.h>. o$ o+ U& Z- I3 G- H
- #include <mach/irqs.h>
0 Q$ m+ F. y' E- Y: F8 p A/ { - #include <asm/hardware/edma.h>) t9 O& a0 m8 C, q9 F
- % h. t; Z: O. i: b- `
- #undef EDMA3_DEBUG `+ Y& V& k4 h0 g
- /*#define EDMA3_DEBUG*// p' t9 v: f1 M4 m! x0 I
- h) [$ i( f! w3 v( Y
- #ifdef EDMA3_DEBUG
! e* p3 o% A- W- r1 V- i/ f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 o% O% W2 a( ?" {$ x& o( A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), A& Q* L$ {# f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p! j4 v& v: ^( k! C
- #else* E. W/ V+ B; _' h9 M5 J
- #define DMA_PRINTK( x... )
7 [* s0 l6 Q3 a - #define DMA_FN_IN, f# W# z. ?0 C: `: ]
- #define DMA_FN_OUT
# w7 s- A5 u' N2 F: Z1 o3 P - #endif
8 z, F1 z. b% d - * X- k6 c+ D4 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; s' j* T7 D/ a% q3 m - #define STATIC_SHIFT 3* t, x" H$ F( q: {! I
- #define TCINTEN_SHIFT 20
, l q7 s: H" _2 ~! ?+ M @8 N - #define ITCINTEN_SHIFT 213 q. h1 t! K/ C7 R; O3 I
- #define TCCHEN_SHIFT 22
% Y! {- j; j( @ - #define ITCCHEN_SHIFT 23+ B1 v3 l8 ^ z" k
8 q+ N7 q: I8 R, w( n7 W6 n- static volatile int irqraised1 = 0; f6 V3 ^8 s. ]
- static volatile int irqraised2 = 0;
4 y" J# C0 H( D8 k2 b. s: P+ d - / d4 e, t9 D1 J: f/ B9 x9 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& R5 l! Y+ P0 U- ?7 e/ t4 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^4 ]5 p6 y3 L7 z' G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @0 Q; z& f+ q$ b5 C6 n$ Z+ N; X
- - L# E* x* j o6 u- G- Y
- dma_addr_t dmaphyssrc1 = 0;0 a, b6 S9 _8 }. @) m
- dma_addr_t dmaphyssrc2 = 0;
2 F+ p+ @9 p8 R( M* M - dma_addr_t dmaphysdest1 = 0;$ B9 e( t9 {" O# T, m7 g
- dma_addr_t dmaphysdest2 = 0;1 o* ?7 w$ H( p6 D3 X$ l
) |& g7 n2 U, T5 P2 Q; ?- char *dmabufsrc1 = NULL;! u0 n4 r& o8 ^+ K$ ]
- char *dmabufsrc2 = NULL;
% W: C$ b* o$ ^1 U1 I2 [7 j - char *dmabufdest1 = NULL;
4 z8 Q* y- }5 U3 M# h1 Q' r - char *dmabufdest2 = NULL;9 G) R7 s. Z) j
, N/ ?# x% X' m0 g( q- static int acnt = 512;! a1 X" t* B5 K
- static int bcnt = 8;2 Y+ m* l4 U0 W
- static int ccnt = 8;: P% v W& Q4 X' N2 }: D! ]! G2 J
- ' o$ [2 S) ]6 b- W$ k$ e% I, C) @4 C, Y2 m
- module_param(acnt, int, S_IRUGO);3 d% m8 a, V- U7 ]5 b1 i
- module_param(bcnt, int, S_IRUGO);# y+ y. ]8 y, k, ?
- module_param(ccnt, int, S_IRUGO);
复制代码 / v0 ]7 B& y* J
3 V' d1 {, U# S' C, F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 j& M t. D: y; T; B, Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! I, g0 i U. u' N$ Z T7 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- B, h+ U$ {6 ~* W' p
5 ^2 T# Y- t7 L ?
% k2 o( j( t4 ?! O5 n# y |
|