|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ _3 l$ ^( P0 f# N- [code]EDMA sample test application* x5 C* T9 H5 a, H# X2 [
- /*
1 I9 ]$ T' x1 F. c. v! g2 U: x+ { - * edma_test.c' M2 p, d, s6 m& I
- *9 d+ \ K1 W% i- B o, Q% K
- * brief EDMA3 Test Application
m; ~% \5 s$ d' m - *
K5 B0 g, e' {) X2 z& |& G - * This file contains EDMA3 Test code.2 e* {9 _( \2 O5 u
- *
( |& a& G+ U3 d) W: r4 n# n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' O6 K% d& n; |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* b) j8 n4 I& h
- * TO CHANGE.! P0 n$ }( A6 J2 o$ t0 l
- *
7 ^; ~2 N$ V! k+ K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 k6 h( P# l# F
- *
9 j T9 T) j: D4 e* j - * This program is free software; you can redistribute it and/or( x/ P3 n; {9 ]5 q B
- * modify it under the terms of the GNU General Public License as) w( @6 `3 F* O- `# Y# k
- * published by the Free Software Foundation version 2.: h, e y/ l5 u9 B2 q
- *9 V) {' i# L. k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. u% _% |4 m, ?, Y8 |: O3 D$ l
- * kind, whether express or implied; without even the implied warranty
0 O, m, a" O% v& X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' t; i3 r+ e) W% ^ - * GNU General Public License for more details.
4 p5 v. @% u' t( j" `. f - */- C6 @- n9 R2 w/ @+ X, t
7 Q: l3 e2 {: S, h- #include <linux/module.h>1 B8 V8 |- Q6 `. h
- #include <linux/init.h>
1 ~, O4 e' p. x) `/ @9 S" S - #include <linux/errno.h>2 T" {5 s; p' j( t1 N+ `- D
- #include <linux/types.h>% e3 V9 L9 H$ M* M7 m; y
- #include <linux/interrupt.h>/ q) H9 M7 q# b/ l ?4 w5 Z
- #include <asm/io.h>
2 r# C7 |& x$ ~7 }! i/ ~ - #include <linux/moduleparam.h>
6 U- l. H; u) y5 G% Y$ h- h! p - #include <linux/sysctl.h>
0 A9 A- I7 Y# Q - #include <linux/mm.h>+ ~$ j; S r' e3 H5 e, a, T& R$ m
- #include <linux/dma-mapping.h>; V9 q9 G3 G' X5 ~. }% y; }0 V
4 V) h k- d Q. E: s" I; v- #include <mach/memory.h>
$ z- \. O, U- G& |& n - #include <mach/hardware.h>
1 S4 K0 W7 s. h* k6 J- ?& `6 { - #include <mach/irqs.h>
1 u+ n8 z& M# P - #include <asm/hardware/edma.h>
. b2 S8 f- H j4 I& Z" z6 C0 M3 U
6 Y+ h A0 v( q9 ]' R7 a/ f3 U0 z- #undef EDMA3_DEBUG3 y* C$ z0 k& m5 O
- /*#define EDMA3_DEBUG*/
" u$ k) Q: P; Q3 i1 Z/ e8 } - , ]/ t" H- f; E7 G. K6 M
- #ifdef EDMA3_DEBUG6 U, ?! r8 o4 Z! C& Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 H; a- [/ e4 z, t; i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); q3 Z' E. s9 v7 S/ I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* }8 C. d% @% U; [/ o - #else
: h" j* w. ~/ F/ q0 T% p - #define DMA_PRINTK( x... )+ ~) E: N' w0 h
- #define DMA_FN_IN5 X3 y( C: N2 G0 S( ~; T4 ^! D
- #define DMA_FN_OUT/ T, d+ H, d/ E, ]5 i( f
- #endif
' K+ \- y3 S8 f9 {
. G( W+ D* [ x! b$ `0 c/ ^8 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ l5 F5 V4 a9 G6 A9 G7 }6 F+ N, } - #define STATIC_SHIFT 3
# z+ m" l" C* j - #define TCINTEN_SHIFT 20
* Y2 o( L$ V5 V - #define ITCINTEN_SHIFT 21" m' A. W+ L1 L& H0 I V. a
- #define TCCHEN_SHIFT 226 h9 [1 K3 @" s4 F% {
- #define ITCCHEN_SHIFT 23
' f/ |; f3 c0 H+ {8 e; T* b, a
4 s6 f, S; e- l$ D: S( o) Y2 q- static volatile int irqraised1 = 0;5 H7 h$ Z: u& ]0 d4 S; ? r
- static volatile int irqraised2 = 0;+ o+ E' ~6 g& H7 e
- ; {% c5 ~+ T, h* f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" }5 V$ G7 d( X! i$ k7 [+ w6 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S2 c6 p# {' {7 z1 ^% J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 G3 ]. F' j" S7 c: c
9 }3 T: @( h9 p0 F4 e. S1 {( i- dma_addr_t dmaphyssrc1 = 0;0 v. u6 q9 F9 J2 j- Z) {7 U
- dma_addr_t dmaphyssrc2 = 0;1 S3 t, C$ S9 X8 t6 ]6 u" q ]9 f
- dma_addr_t dmaphysdest1 = 0;% |# H3 ?7 D* [+ [
- dma_addr_t dmaphysdest2 = 0;8 S j8 C) `& |6 w# d
- ' R! n& A2 I+ J, B8 K
- char *dmabufsrc1 = NULL;
6 X, G% @8 m0 y) J" b - char *dmabufsrc2 = NULL;+ T$ e5 h; d8 B' P/ O4 T8 |
- char *dmabufdest1 = NULL;
% l2 [: V' L9 @' I; q1 g+ T - char *dmabufdest2 = NULL;
V$ n3 b1 k6 n; J& }& c& U
4 D. k4 q3 i1 h* F, T- static int acnt = 512;
& N2 m- G( w0 ?' K4 V* g. ^ - static int bcnt = 8;* e$ N6 u @' h9 L8 @0 ^
- static int ccnt = 8;, n \- z+ n) a7 J3 M z0 @4 ?8 N
- 4 L3 c4 L' U: Z
- module_param(acnt, int, S_IRUGO);
2 {' a! w% Y5 r% p% _' a - module_param(bcnt, int, S_IRUGO); ^/ T- y1 t( R Q
- module_param(ccnt, int, S_IRUGO);
复制代码
. ?) d6 ^' `: G' L/ f. Z
& s# M% j p2 H/ K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, q; J. @ j+ Q5 x! V3 t4 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 \) G$ `/ ~7 @& z7 }+ {! f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K! s: q, N6 }. f
M& n- \2 q; h
) Y2 Q1 T9 x* E |
|