|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ B/ N. ~1 ~8 N+ d' j2 e$ [! |# t; k8 y
- [code]EDMA sample test application. S4 w0 A/ k" H3 {, g/ s
- /*$ ?4 b& m5 l3 }5 y
- * edma_test.c
8 `( F' I) X i4 l3 J - *: L8 M, j' g! }) I8 @
- * brief EDMA3 Test Application
5 A7 _3 C4 ~) \; }4 F! i; ~ - *% H- E }9 P& ^( o& H# t f3 t( A0 _
- * This file contains EDMA3 Test code.8 c' n* x& b, [$ ?/ K1 I
- *
+ v9 l) R- P7 I; \2 k* q% ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Z n5 [. H4 k, s p8 d, g; _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% b+ p; Q- z% B) m* |
- * TO CHANGE.
+ A0 H7 c, i! S- k' Z( H8 _ - *
2 C1 c$ P) ?* B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( t) z! A$ p, x) c
- *
) g r2 u6 F4 }2 X7 @ - * This program is free software; you can redistribute it and/or0 X+ F3 z& d" Q3 C
- * modify it under the terms of the GNU General Public License as; x# r9 [4 I) w* K% n
- * published by the Free Software Foundation version 2.* M# p: h/ {6 n
- *5 x/ p' ?1 e, `! Z0 c: ~0 X9 g$ d$ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ _; a' E, ?% s% ~9 i ` - * kind, whether express or implied; without even the implied warranty
8 }0 N1 X2 q+ [ X- O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 [; P+ p6 N6 w7 @; E% l9 a# a
- * GNU General Public License for more details.
4 n# p4 s. @& @# V" U) m: U - */
: t0 @9 E3 L% ~& W: L
! F- Y6 H6 R, K/ Q% g+ e- #include <linux/module.h>
- T& ?3 i8 ]; ?& G A4 ^0 C5 U# W - #include <linux/init.h>0 A9 ^! \7 j$ ?) D4 [( w! o
- #include <linux/errno.h>6 `+ l+ [4 p# ?8 y% A8 n
- #include <linux/types.h>
4 A m; U% o2 B8 `8 x2 T - #include <linux/interrupt.h>" K! @0 N3 ^6 Z* b Z; R" y
- #include <asm/io.h>( U5 P3 }+ x2 K
- #include <linux/moduleparam.h>/ Z1 T6 u2 ^/ g& X0 H$ p) F% g2 U
- #include <linux/sysctl.h>3 ^8 r4 I6 t" M! V8 l) S
- #include <linux/mm.h>
6 e! z: N* e) p* l6 F. T - #include <linux/dma-mapping.h>
# n5 B. `, c/ m8 ]6 Y" d+ K
G& I" R0 }' j9 B- #include <mach/memory.h>& ?# Q" |: x' k4 `( X: R
- #include <mach/hardware.h>( c' \- J _ Q
- #include <mach/irqs.h>* \" |/ P" _% n
- #include <asm/hardware/edma.h>
8 p# |. i0 u8 H+ U& _# g: q
0 b- h9 A- q* r" O: W' s( Q8 |- #undef EDMA3_DEBUG& o+ G' h2 W. f: I% n
- /*#define EDMA3_DEBUG*/) t6 [6 a! `9 n* F7 ?1 H
, B$ e# `; z7 v) J- #ifdef EDMA3_DEBUG
8 [8 O$ E, C* k% W- L+ M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& \$ y* t! }7 G* \' }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 y. Q. |- J2 a+ M5 F( Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, R. j" G3 x A - #else
2 x/ w; v/ z/ p1 T8 c' A5 |: L - #define DMA_PRINTK( x... )3 I3 X# `. }9 R* R! ]7 i
- #define DMA_FN_IN; m4 l" I) @. M- q# x
- #define DMA_FN_OUT* G2 ^. F& h% Y
- #endif, C6 Q0 o5 F1 F' H |8 E8 K# U' M6 v/ \! w
, e- w" W7 c* C3 z. r- B$ ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; k0 b9 w: l; [% V - #define STATIC_SHIFT 31 X8 N+ w1 r8 R8 J1 {! p8 s
- #define TCINTEN_SHIFT 20
) v4 }% a! X: C% Z* x" ~7 ^% d - #define ITCINTEN_SHIFT 21
& \) p+ @. } I/ X/ r - #define TCCHEN_SHIFT 221 D' V9 c( J, S# P" `8 L+ ]
- #define ITCCHEN_SHIFT 23
0 i9 }' @: ^' u" }
; _8 [/ u9 o3 B( X0 x+ {- static volatile int irqraised1 = 0;
+ x* b7 S# M' t - static volatile int irqraised2 = 0;
: E$ d8 q0 K! F2 C7 t* B, O - . Y+ N& ~5 k( Q7 T0 B- }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Q7 u# T8 K P8 W" d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B! |6 r7 z; | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 N2 } t+ C6 f. m2 G3 B
1 a/ G: B6 F" o7 z- dma_addr_t dmaphyssrc1 = 0;
V+ z) \- A) I - dma_addr_t dmaphyssrc2 = 0;
9 u R# F/ f- o: S - dma_addr_t dmaphysdest1 = 0;3 p3 ~7 `! c7 `
- dma_addr_t dmaphysdest2 = 0;
6 a9 o3 h6 K# R _7 a
, Z2 a3 a0 v5 \9 l- char *dmabufsrc1 = NULL;4 ^9 ~& [( w$ T+ i4 c2 b
- char *dmabufsrc2 = NULL;
! |, o. H( T' _# C; D2 g - char *dmabufdest1 = NULL; ^9 [( _1 l% O1 W! w/ @7 o+ Q1 \
- char *dmabufdest2 = NULL;% r# _6 e$ [6 U0 N; U! |
- * T4 I/ V3 \8 F2 N
- static int acnt = 512;1 ]- ~8 _6 O9 G7 C- N
- static int bcnt = 8;
( h7 m5 i; s* Y$ q3 k - static int ccnt = 8;
" u* F a h9 y' P% P- l! ?
0 p. a- e7 f; Z5 N+ @$ g* ^ r- module_param(acnt, int, S_IRUGO);. b r2 ^) J8 z& \
- module_param(bcnt, int, S_IRUGO);
( Y0 A7 p( l O& ~) R- l# ?: { - module_param(ccnt, int, S_IRUGO);
复制代码
5 J/ T) V0 M' j m& [- V7 V& k& G! x& f( V1 H0 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 R' p! G2 @% Y8 K+ t/ o0 H0 X, sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) P' d1 x$ H" H- {6 K! o* W4 x$ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X( d0 C9 i( T7 U
- D: f7 |3 A- @. R
: j# q) S* }' V$ b8 u, A' S6 t; m
|
|