|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% @+ d) q; J |. c' `, j/ z- [code]EDMA sample test application
% a9 W! T; u8 i0 b- X" T - /*9 d. J( t. a: ` p5 }5 {) y
- * edma_test.c3 U$ k& d! s( S
- *
3 @3 [& U4 [" u" g - * brief EDMA3 Test Application
. ^+ E) L7 f. R5 _+ f - *
) I, Z: \; k- i+ A, z - * This file contains EDMA3 Test code.
9 b2 u; m* U1 B' j - *
4 U, G$ f0 w$ X7 `& F5 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 e5 J: F* P0 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G {$ k2 ~) B1 T* w' p" e2 [
- * TO CHANGE.& B/ z P. Z- J0 i2 O0 W
- *" h8 Q3 P$ B, D4 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! @- G; u8 [8 i a3 Q+ n% ?
- *6 m# Y% I- H/ j7 o9 s
- * This program is free software; you can redistribute it and/or7 B0 a( U: k' d+ d, U
- * modify it under the terms of the GNU General Public License as
$ y+ |: `) R6 D9 b9 v- P - * published by the Free Software Foundation version 2.! I" B" l5 M+ z2 j
- *9 R* U- C m/ G( H/ t9 o. V1 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 i# j+ G+ M! C% Q - * kind, whether express or implied; without even the implied warranty [4 x G* Z' a. Q7 Q2 \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 Z& {+ Z8 ~. k( w7 u8 I' j" N
- * GNU General Public License for more details.6 p/ |8 B8 L6 M( Y% P: [
- */
/ z' ~* f( ]# G, h) Z
" ]: j. Z' R9 X- #include <linux/module.h>
4 p5 d; {9 M& N! K - #include <linux/init.h>
/ F- J) R& }& } - #include <linux/errno.h>
$ A. |3 `: P% Y! Y$ Q7 |, w - #include <linux/types.h>1 k" h( u0 ~/ U- N a
- #include <linux/interrupt.h>
4 S9 L# b6 a9 \! w. N# W - #include <asm/io.h>* t, u( @$ A0 u( j6 q: L0 y4 W
- #include <linux/moduleparam.h>/ k) g* k* W! |2 c7 q2 r
- #include <linux/sysctl.h>2 f# v3 H- a8 U ^* K
- #include <linux/mm.h>- P0 a! r4 I5 C( }9 l
- #include <linux/dma-mapping.h>
& N! @! m% L5 x6 j/ t' u - 0 `, l: T7 U8 |1 G$ ~1 u' V
- #include <mach/memory.h>
/ q* n3 [+ T0 ~0 F# h - #include <mach/hardware.h>
. o$ m( b3 j1 K8 g5 g0 C; I - #include <mach/irqs.h>- ~/ y, e/ ~- x9 g* `0 f
- #include <asm/hardware/edma.h>
: R" N' q7 s- ~ - 0 G5 p7 x' ~+ m, O0 }7 V8 Y
- #undef EDMA3_DEBUG7 R9 T! b. D9 T0 W
- /*#define EDMA3_DEBUG*/6 S; f( q0 E" {1 ]
- % k- Q$ C+ ]* ]: E8 a
- #ifdef EDMA3_DEBUG
' C! w. F5 G3 \& G& A0 F P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! ]4 b" W" m$ f7 M+ o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 o5 w3 |" d& N2 V; T9 w! v+ L4 i; [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f/ x) U. V2 M& H5 x
- #else( e! U: o4 i: r
- #define DMA_PRINTK( x... )
( c1 {, |7 d# R3 U a: E - #define DMA_FN_IN- {2 z6 n d ~; [# r
- #define DMA_FN_OUT7 V* c5 r/ d& G8 ?
- #endif. K) y( ?- ^! n* Q
- / L, a. V J6 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 p$ ~5 _! Z# r0 O4 X t - #define STATIC_SHIFT 3
' b9 q, w6 y& Z8 s7 ]8 ?5 ~1 V5 x% T - #define TCINTEN_SHIFT 20, h+ O. @: E# }: j! S+ y0 U8 Z: E
- #define ITCINTEN_SHIFT 21' G- {. V2 N" v
- #define TCCHEN_SHIFT 22
# l S% h, Q6 n1 C5 B0 t t - #define ITCCHEN_SHIFT 23
4 _9 ^/ e2 _/ b, z8 ]1 ~" ], | - $ m- D/ K; ~, O6 x5 r9 D9 V# K2 ~
- static volatile int irqraised1 = 0;2 I2 A3 J. ]! t
- static volatile int irqraised2 = 0;
5 X& P- L/ s6 O* ~6 _ - # |4 X5 T8 x7 O( Z" S- u" o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 T& }" z/ Y2 `- o6 z. [5 t+ J; g ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S" E& I/ f! n4 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n& k4 w2 ^0 l. E4 W2 b1 ]2 I
5 h9 Q8 X" r2 e5 I- dma_addr_t dmaphyssrc1 = 0;" a, V4 M( \4 s8 D. `
- dma_addr_t dmaphyssrc2 = 0;; ^) |/ t: H/ Q4 y5 L3 c" E N
- dma_addr_t dmaphysdest1 = 0;
) h5 X) T" v4 C* S/ t2 ? - dma_addr_t dmaphysdest2 = 0;) h9 N1 J" n, M" Q- o
& H0 G9 D7 w4 F3 B* @) A s* `/ ~" \- char *dmabufsrc1 = NULL;& a9 l$ R# V/ Q5 |" ~
- char *dmabufsrc2 = NULL;% l( s% E; H) z% g- O" l1 f- W
- char *dmabufdest1 = NULL;
0 y: i% ?& t1 g; L9 Q - char *dmabufdest2 = NULL;
+ }( M3 h8 e* g& E - * @6 x- e0 H; j$ t7 t/ e
- static int acnt = 512;
% e* |$ k m/ u - static int bcnt = 8;
0 w+ V8 Q7 P K t - static int ccnt = 8;9 s' R: m. j3 `( c% n, s) g
- , V/ R% G( E f ]5 [
- module_param(acnt, int, S_IRUGO);) c: p/ z+ [1 C7 [ ?% N
- module_param(bcnt, int, S_IRUGO);9 k1 c% ?+ w+ K+ D
- module_param(ccnt, int, S_IRUGO);
复制代码 8 g+ ~4 ?! ?1 |1 P: q R( @1 R
0 v( k5 i3 j. r2 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 g( n% a8 d) E7 B, V8 `; a0 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* q& Z8 Q. j9 |( o5 P" g/ u1 [" p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 M3 t0 p; h/ g5 }9 c
, ?$ g3 d4 {+ [9 }* P; p c/ i7 W' K, m) [- ?- i8 ?: d" C
|
|