|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) @( }' C) Y& |! T3 L6 W4 e3 X
- [code]EDMA sample test application5 l7 d% T" f, ]4 O) L6 |8 S+ ^
- /*/ b0 A+ s8 y) I8 x9 _
- * edma_test.c
1 Y2 Z+ `! R, f$ O: W( Z8 x - *$ |1 h! ]5 V% m
- * brief EDMA3 Test Application
& S1 H: a( L4 U# C# C9 u1 V' D5 m - *- z$ F4 X# `1 ^3 i
- * This file contains EDMA3 Test code.1 {) L9 Q9 c+ {
- *
$ A+ N" s3 l+ G1 u |) N9 q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ u( Q5 E9 I) a2 ] N- T" E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?) b% ~* F( g/ f8 o, N
- * TO CHANGE.0 a* m, J: m$ i: O) v
- *+ O1 s$ p* g% ^) ^1 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 h6 r" z: Q* C6 e; _7 I
- * n5 ^) X0 D. z* ]* f( c" s
- * This program is free software; you can redistribute it and/or- h' O- E9 ~' d7 F! l. t+ T
- * modify it under the terms of the GNU General Public License as( w$ E+ n. Q3 Z N( U
- * published by the Free Software Foundation version 2.
! l% h v/ [% T# \' p. w: Z - *
3 Z& p3 I5 _$ Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
I8 E+ e; w. M8 S* _9 ~ - * kind, whether express or implied; without even the implied warranty/ B+ ?2 Y8 b& u8 _$ \8 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) f+ @. T, m5 H0 x$ d
- * GNU General Public License for more details.
4 [- m0 t* Q& K6 F$ r - */
$ f6 v- _; U( D1 q0 S
7 K& y" M) `5 A0 x9 D- #include <linux/module.h>
; R5 l' v! p P. U. e( [ - #include <linux/init.h> D4 t; @8 I8 E3 N* g. }: Q
- #include <linux/errno.h>
, }/ f6 r& y& b4 I" K9 v' }' M# s: N - #include <linux/types.h>
0 ]. V6 p5 [2 r! z - #include <linux/interrupt.h>! e3 N6 b* k/ ^- M7 a
- #include <asm/io.h>
- H+ R/ h6 i4 U2 l' @5 a. `3 f+ t# Z - #include <linux/moduleparam.h>; Z) o; Y0 i) [" b7 ]1 V+ H
- #include <linux/sysctl.h>: G. V: @2 v% G5 i+ O& d1 ~
- #include <linux/mm.h>8 M. C0 A( T5 Q
- #include <linux/dma-mapping.h>6 C# ~9 x1 k. v' k
, x& s+ q# c* T( z( q1 C" c- #include <mach/memory.h>% w8 x, ~$ X; G, e2 y c: a
- #include <mach/hardware.h>
' l, M8 B! Z" Z. X v6 y: F - #include <mach/irqs.h>1 N& D# X9 p1 Y! `6 b& B
- #include <asm/hardware/edma.h>$ t2 `% S8 ~, B+ z
- ! C/ Z8 k# ]' h8 K; n
- #undef EDMA3_DEBUG
$ ^" w) I4 H7 L* ], y Z - /*#define EDMA3_DEBUG*/
7 M% N, H* }0 [+ O. k. a8 R! x
% m: n& j2 T# |9 P: e' \* \- #ifdef EDMA3_DEBUG
3 P/ s) R; J( O/ k3 d7 {5 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I U) b9 r9 [5 ` n4 P! n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' c# f3 G/ P9 z2 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ x$ K( `( z; Y7 j- e
- #else4 z7 m/ h! a" F9 R& [( `
- #define DMA_PRINTK( x... ) k: w/ X" c- w3 X2 P: J- I) t% S5 n+ y
- #define DMA_FN_IN1 V. o" ]; C$ D/ }3 s# v5 B, S: l
- #define DMA_FN_OUT8 n* j! L) F- @9 u7 o$ Z _
- #endif
- h: H* b# _7 b0 {2 @ - 6 [/ P2 f2 M. o; i/ S+ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 m+ c$ k, f. P9 l - #define STATIC_SHIFT 3: s" G( S+ R$ O& ? u7 n
- #define TCINTEN_SHIFT 208 Q/ Z, H6 q5 u4 R: J! @3 R3 X; d
- #define ITCINTEN_SHIFT 21
5 B8 ?- _! ]4 F5 Q$ K& Z! t - #define TCCHEN_SHIFT 22- b5 d) J9 O8 ^$ Z5 t' r5 m
- #define ITCCHEN_SHIFT 235 Q7 }+ w) D: p7 N' F, H+ v
- / w$ N1 y2 s) F
- static volatile int irqraised1 = 0;
: C2 M J/ y% M. l - static volatile int irqraised2 = 0;
- @$ f# H1 _) Y4 e/ { - 5 t; \) c/ w& u( `# R2 Y9 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }' A. M: S+ Q& I* V- g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- _7 e8 ]0 D& N4 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( `$ _& X9 C) Z4 v6 W
- % f1 B8 I; S) z. T# {9 |/ w2 G
- dma_addr_t dmaphyssrc1 = 0;
( T1 v8 r3 X! j$ t, j! y) R - dma_addr_t dmaphyssrc2 = 0;# Y- B# c$ | q" D' o
- dma_addr_t dmaphysdest1 = 0;
! X, ?/ n- e2 ] - dma_addr_t dmaphysdest2 = 0;0 B% @5 a: R1 W$ Q9 x% o5 O3 B
! Y% S1 Z# K) l, K5 q- char *dmabufsrc1 = NULL;( M7 e% a1 F) v' o
- char *dmabufsrc2 = NULL;
5 N2 a7 {. B3 B0 z8 a; N - char *dmabufdest1 = NULL;
) Y" l1 w4 g2 M v% }, H; I% N - char *dmabufdest2 = NULL;# S Q9 @# ~2 a6 R
% z1 C) I' W: t& U3 V4 ?) d- static int acnt = 512;- U/ [- I2 a: L7 G. E1 e
- static int bcnt = 8;; X8 d; h/ C \: F! k" T& g
- static int ccnt = 8;! T; g6 l; |, O e r2 w4 @+ ~
- ) c$ X3 T! l% V3 F
- module_param(acnt, int, S_IRUGO);2 v" C+ ]) X! Q
- module_param(bcnt, int, S_IRUGO);* i% H1 \! c6 }! e T/ f7 C
- module_param(ccnt, int, S_IRUGO);
复制代码 8 m8 [ S5 \7 T/ C1 W
: U! ~2 F4 p* V2 Z3 l+ Q: w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 \; L3 p, P8 x. ~/ S2 F( Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ~; k( o( o, y. Y0 o+ o2 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ l# B3 z8 f# Y, q* ~! W7 R
/ W% K/ Z% `0 |! e5 N# k5 s% N. {; u' Z: U/ o7 ^
|
|