|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n5 ~2 ~+ y4 V V, X6 x+ m- [code]EDMA sample test application
) W. n1 J5 a8 n5 L2 i( a0 |* K - /*
1 e/ O6 v# k, u, Y; P, J - * edma_test.c8 w# r+ B" K7 I7 I5 ]
- *
" n9 F" C5 `7 L5 _ - * brief EDMA3 Test Application2 J; u' |( I% J# y
- *
6 {/ q) q. o3 I, ? - * This file contains EDMA3 Test code.
7 s/ }8 I: O9 m. b( ?" [7 ` - *
! ?+ h/ G& M' S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ~$ L; u4 `8 p9 J4 @; A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 P9 T4 p4 @, A, _' z2 O; R! u9 r - * TO CHANGE.
% h8 `+ ?2 H# ]' M) u8 i7 t - *4 U, R( x" P5 l& V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ n) j' K& U) I" g& B - *, K, X% c# g2 o7 e
- * This program is free software; you can redistribute it and/or" }/ I& X0 a$ H
- * modify it under the terms of the GNU General Public License as
; x/ [* z2 ^- i% e - * published by the Free Software Foundation version 2.
+ O' S6 M- l* A9 q/ L - *' _. a4 T8 F# @5 B% G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {7 @% C9 c) E1 J; L$ o
- * kind, whether express or implied; without even the implied warranty( K4 T: S# s- d7 U7 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ x+ k! J3 I% |! Z
- * GNU General Public License for more details.
# G" R) ~ J0 D# Y - */
0 K" Y, J5 \1 F2 C; ~
" ?9 K* a, w' R. W- #include <linux/module.h>
& k8 e3 y9 g% P4 ]6 k5 @. k - #include <linux/init.h>
: P; X/ C" q) W! x5 A - #include <linux/errno.h>: K2 t8 M+ i4 i1 ]$ Q
- #include <linux/types.h>0 W0 o, a" a- f4 t* M a
- #include <linux/interrupt.h>2 ^ `& B! v+ } Z& ^# `- F
- #include <asm/io.h>
' p: U6 z0 z: C; W k; ] - #include <linux/moduleparam.h>
- C5 v; R& u# ~3 x% P2 k - #include <linux/sysctl.h>. n* A4 {- m! n& ^* S6 i5 i
- #include <linux/mm.h>
$ R n6 R; V* ^, }- k - #include <linux/dma-mapping.h>
, p2 N: c: v) ~; X# u; m" V5 ^
( z0 C, v( S, _4 V, M8 E- #include <mach/memory.h>
% N/ j& \6 Z; J8 ^: @ - #include <mach/hardware.h>
4 h3 s) \4 E; G3 j6 a - #include <mach/irqs.h>8 T) X1 o" ]! u7 @6 M1 p
- #include <asm/hardware/edma.h>* [- f2 b4 [/ U, X4 I, p
+ }* f% ?8 C& E$ ^' g- #undef EDMA3_DEBUG
. d6 G- G) ?/ w6 O* r - /*#define EDMA3_DEBUG*/) x' `5 R: d0 g/ j; }* l
" W$ F1 {! h6 i( ~- #ifdef EDMA3_DEBUG, h$ t9 y2 W; _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 L; x P! N4 u( @' ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' h% t% u6 v8 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ m: o0 t0 R& x- I0 f, _9 q) ?
- #else
, x% @" y+ I! G* E' X% \9 P - #define DMA_PRINTK( x... )
8 N" `6 w$ f3 S- v4 {, V - #define DMA_FN_IN$ R9 L8 o. q8 Y _1 t; x
- #define DMA_FN_OUT8 H% M& ^# v9 w4 s; t6 p0 ?$ |
- #endif+ [$ G' V4 p, k9 v4 I R2 V
0 P) f5 g9 j B6 r' Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) c. h" ~' G/ u6 F1 y. V: z - #define STATIC_SHIFT 3+ c' U; G9 |/ R: u
- #define TCINTEN_SHIFT 20
' w0 U$ x8 N# T2 j; V - #define ITCINTEN_SHIFT 214 a, U v7 K8 g0 f9 e8 ?1 x0 ]
- #define TCCHEN_SHIFT 22
# O* l' m* L% R' D - #define ITCCHEN_SHIFT 237 b! E$ l$ h1 y3 e3 Y
- 5 x: M/ R: l: n: m' z. h
- static volatile int irqraised1 = 0;5 h7 K7 P0 K- V, k# O5 d+ f- L
- static volatile int irqraised2 = 0;
3 w2 L3 b8 v$ ]1 h- f
+ ^ a7 r' y" o: t! P$ _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ m7 T1 F/ l; ?2 H6 Y- Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ]4 Z/ h& J' O& ]# o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [+ {5 g$ N. D; K$ T Q
- 5 p0 d1 a, U/ n! c, W0 h0 P4 ^$ N
- dma_addr_t dmaphyssrc1 = 0;
$ [7 E7 j5 y) M5 w( M! Z3 M9 s - dma_addr_t dmaphyssrc2 = 0;
6 j8 H8 @8 m" P- F1 o7 U& ^ - dma_addr_t dmaphysdest1 = 0;
. r7 L- X/ ~8 _ g9 Y8 M - dma_addr_t dmaphysdest2 = 0;( Y8 @5 ?; C& u- B! C. d
- 1 g9 n, t$ h8 F1 | T4 A+ }$ p
- char *dmabufsrc1 = NULL;* I1 c! |2 V8 V! e- M
- char *dmabufsrc2 = NULL;/ s- T8 Q, q- y2 F; b1 W: K
- char *dmabufdest1 = NULL;% v8 b M3 m' j& Y% K6 h* D
- char *dmabufdest2 = NULL;8 o# @& i5 e* C+ r, \' A
: N5 @" j: }9 @) I# H- static int acnt = 512;
[" G# r O. Z: k9 t3 U - static int bcnt = 8;$ F9 v5 \/ X+ w8 W
- static int ccnt = 8;( u2 K" ^+ { b4 \3 z( {
- Q/ I) d8 Z& |0 G6 W$ ?- module_param(acnt, int, S_IRUGO);1 B- H2 j# m+ t1 c! ]( U0 V2 _( Q
- module_param(bcnt, int, S_IRUGO);. W% T4 ?- V. l5 ^1 r/ o# S
- module_param(ccnt, int, S_IRUGO);
复制代码 ; U$ N' S2 U0 B. v4 D
* }( c8 c J) _, \3 _3 M3 ? R9 \. A- b$ R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I: }5 V( U+ a$ c) I4 _, ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* {1 ], `( { T! x7 }, c( |1 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! N& F) g) t$ F' @$ L' N( d/ m) X7 \2 Y, @; Z+ ]$ [
# U% \5 f% g5 U |
|