|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ], E* Z" W. U7 h
- [code]EDMA sample test application) O" l1 ^: K- `* q8 z' D# s
- /*
2 r, d- P1 R; s' P0 A - * edma_test.c2 R& C+ H7 k; c' m0 o
- *
9 \( F' X' Y' E - * brief EDMA3 Test Application& {; S9 _* K4 Z5 I- y1 V
- *
, P7 K* j! J9 y - * This file contains EDMA3 Test code.6 ~9 n1 w! g4 }3 X
- *0 [/ k! U7 b5 `6 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 ~( ]. k& P& X, V/ y# ^3 J; M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! J9 z2 q: q7 e. ?8 j
- * TO CHANGE.
. Q' ]/ E; z8 X0 b - *: c. K6 g2 l$ l7 u8 q- f0 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. J# z+ b4 ^ L8 x6 d9 V! w) ~2 E
- *
. e- O q" a* w. x! ?3 a% c - * This program is free software; you can redistribute it and/or
1 t0 C$ F$ ]$ m( P' T2 s0 l8 H+ {# [ - * modify it under the terms of the GNU General Public License as
' `& X) I' @4 L0 [ - * published by the Free Software Foundation version 2." S% A9 }) H- j# \/ f
- *
+ C m+ d& W: S# n# W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: D2 B L+ q1 y- o
- * kind, whether express or implied; without even the implied warranty9 {5 F$ ]5 i2 A7 t9 o$ d# n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; C4 l$ C# k( [2 G0 s" P
- * GNU General Public License for more details.
; o, `/ Z0 Z J1 T - */
: E6 H B3 c! d/ ~
( H5 m; i6 z5 ?" h- #include <linux/module.h># i$ k3 r% M: v; C6 c4 Z4 H
- #include <linux/init.h>
0 C/ [4 M \) Z/ z) e( ^+ X - #include <linux/errno.h>9 J6 C+ H9 l/ m6 p
- #include <linux/types.h>
/ W* s+ X7 H. B4 O - #include <linux/interrupt.h>
4 z6 Z, z: e* d4 l6 W/ R( | - #include <asm/io.h>
. w- i$ N# q/ C5 R# G& G( a9 g - #include <linux/moduleparam.h>
# l r8 l4 v6 m1 l1 i - #include <linux/sysctl.h>7 W6 w6 O1 W( I2 _6 e5 ]
- #include <linux/mm.h>
3 G# j" P: ?3 L' ? - #include <linux/dma-mapping.h>2 V' ~7 G, k+ `4 i; i6 z d: y
9 w) U" V2 y1 G0 v( _0 w- #include <mach/memory.h>
4 s5 n0 D. q: g- M H% P - #include <mach/hardware.h>
& F; u# i8 H) d4 u - #include <mach/irqs.h>
8 Z# m3 t2 ?- n9 J - #include <asm/hardware/edma.h>
, i5 i7 f9 `# E2 n, K% e
5 A7 r4 P9 i$ z3 `/ B+ r$ p3 |% s- #undef EDMA3_DEBUG
: V1 S+ Y$ ?8 E0 X' ^ - /*#define EDMA3_DEBUG*/3 q/ h4 X2 i4 c
, K1 ^9 O- r6 d' P: B1 U- #ifdef EDMA3_DEBUG; Q1 @6 w5 A$ C. C4 L4 Q) v5 Z5 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 o. r8 x9 Q8 N% m$ F0 L7 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: u* e8 a" r! x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( f4 O8 O: @1 x: {, [ - #else; m5 Z" p2 d% l
- #define DMA_PRINTK( x... )
# g8 O4 Q0 G# l8 Z( _3 K - #define DMA_FN_IN2 }% [8 h2 J5 u% Z& e S
- #define DMA_FN_OUT# L9 O( A, B7 P( ^3 z6 T
- #endif
+ P: S. a+ T! d6 \& y
2 N3 ?& O" s: N2 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ ^$ c3 Q8 I; m! |5 L - #define STATIC_SHIFT 3
8 G1 T7 b- g6 a/ j5 K - #define TCINTEN_SHIFT 208 i1 d: y0 ^6 r0 L t2 g: Z0 a
- #define ITCINTEN_SHIFT 21/ h/ K8 W: W4 l
- #define TCCHEN_SHIFT 22
3 O! r |4 F. s - #define ITCCHEN_SHIFT 23' v) f! n2 Z+ q, `. n+ e5 @" u
$ ^( Q& R1 F- C+ W. t3 A( l- static volatile int irqraised1 = 0;% g' |, a/ [0 t
- static volatile int irqraised2 = 0;
7 N ?" p2 i! j! d
; Y* {8 y" u3 P8 \! f9 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! P7 z" ~/ @ H* v" B/ u. Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. a5 d5 P9 R2 D7 y( }$ q! O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: X$ O) j: ?" a d2 x& s - 1 @# s# Q u# g( a; \! J& ~9 R( J
- dma_addr_t dmaphyssrc1 = 0;0 f" U& P; L' l
- dma_addr_t dmaphyssrc2 = 0;
$ {# {$ e* t, u/ I* ]0 I' E - dma_addr_t dmaphysdest1 = 0;
$ ^; @3 r: e$ }* n( D+ P* p - dma_addr_t dmaphysdest2 = 0;
7 ~/ X/ Z# w" k) j: m; u( @' i9 x
4 ^6 v9 N* D2 d; r- char *dmabufsrc1 = NULL;. b$ W2 n; \5 ?% A6 g% a
- char *dmabufsrc2 = NULL;, P% C* @" h( U+ A2 t _% k. z9 i% G2 O
- char *dmabufdest1 = NULL;
6 ?$ z5 ?/ n2 _6 x, m+ N - char *dmabufdest2 = NULL;
. V' v8 T x% p8 X1 j. Y2 A - ) ` V5 G- M7 N2 i d' p
- static int acnt = 512;
/ _9 U, q' \: Y: G& Q - static int bcnt = 8;4 B. ~* P4 b; A1 {# Q z
- static int ccnt = 8;
) u# m. `2 Q/ N1 N( C - 8 i4 t3 W* ~; d' o
- module_param(acnt, int, S_IRUGO);
1 g# A# i) A4 @3 b: E8 [ - module_param(bcnt, int, S_IRUGO);
) K" F2 s4 ~1 [5 E3 R5 d P - module_param(ccnt, int, S_IRUGO);
复制代码 ( H7 p- X2 t' Y; E( n, G% Z+ `- r
9 f9 X% s% k W6 a7 q* l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ o* _' n. g' n, D! B0 L) Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 i& l6 D: b8 K8 h+ e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 t# Y( P$ R1 G
4 M3 @& m. F0 f. ?2 T. y& ?
/ d( C2 \* W9 e |
|