|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : L! B7 @7 s: }. ^% e
- [code]EDMA sample test application
# s) i, c& U+ H5 R% u/ \1 [ - /*) g: y0 [7 d$ B- X
- * edma_test.c0 W$ j. ]# i) Z$ n
- *
3 i3 B8 w) [( q - * brief EDMA3 Test Application
2 M/ M+ o7 m$ K! z8 N, H/ N$ ^ - *
; ^* O; `9 X$ k) m+ N) u6 g - * This file contains EDMA3 Test code.
' L9 A) P( C5 I - *2 @! z! j! O# V6 V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- ^; E( q: K9 t# ^5 a" T$ ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 v, d6 G# W- c5 b- N, F
- * TO CHANGE.9 f) c* Y8 E' {- ^( T: U8 ~. F( Q2 n
- *% k7 q* G$ b3 ]! p, p3 i- f! ?4 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ m Q1 a( A# y* Y' d) q
- *& U" d6 J; x) q. W. I I
- * This program is free software; you can redistribute it and/or
$ Z6 r: ~; _1 {* a! f8 i% ~; G: ?/ z - * modify it under the terms of the GNU General Public License as- ~" H2 o) l( w* {6 c
- * published by the Free Software Foundation version 2.
. k: U+ r& x5 o - *
5 q, v, o7 {" e( j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 d/ C; g3 r$ D6 l - * kind, whether express or implied; without even the implied warranty! t3 b) c" I5 g: \5 G3 a2 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 j, u1 N9 A. ~3 [) z4 ]
- * GNU General Public License for more details.- A" T7 y- F. f' Q; K' j; X) ?
- */& T; ?# {( ?5 J2 h( p5 m8 J9 I
8 O+ m H* j. z! R4 n. A: ?- #include <linux/module.h>! _2 n0 {# ]* h1 o6 ^3 F6 U$ X* C
- #include <linux/init.h>
% x* A6 k9 H4 f! Z& x! \" Q! Y$ k - #include <linux/errno.h>2 [9 ]9 o3 b0 v3 D4 c9 K
- #include <linux/types.h>( g7 u1 L) @2 l
- #include <linux/interrupt.h>) ?, p2 a2 d- ~6 g$ |8 ^$ h
- #include <asm/io.h>3 r* U6 j2 ^0 N$ X' j3 I
- #include <linux/moduleparam.h>2 C8 p( X7 u8 n' i4 C, U
- #include <linux/sysctl.h>
& g \3 q I) z% B8 n- P - #include <linux/mm.h>
, W$ N, ]% b7 B2 p g, n - #include <linux/dma-mapping.h>
$ G4 j4 A M3 q - 5 J( V! v t& I7 N1 b. W/ q% [
- #include <mach/memory.h>( |8 o8 {- W8 i
- #include <mach/hardware.h>
; ?' I6 ~2 B0 m1 x1 ?0 M# b - #include <mach/irqs.h>
% m: W/ X% _6 p$ f - #include <asm/hardware/edma.h>3 c4 R t$ `8 X% y+ E7 H" c. N
- 9 D: c* ^1 ]7 E) N) f
- #undef EDMA3_DEBUG
) v4 v$ ~/ h3 F2 P* V0 f - /*#define EDMA3_DEBUG*/$ ]6 R+ M. |- s1 G: Q1 V
0 T4 Q9 [5 I/ v3 V% w7 o8 f- #ifdef EDMA3_DEBUG
& Z2 W* y/ ^7 Z+ r+ t0 x! Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. w8 Y/ v; q+ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 k( R7 U9 }; X6 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- H" k; h0 Z/ ?8 _' x, D - #else8 {8 m/ ^! ^9 Q$ a
- #define DMA_PRINTK( x... )
# i# n( M$ U' Q! U - #define DMA_FN_IN
5 d, x: o9 |3 F- `2 f0 k# n6 U/ l( K - #define DMA_FN_OUT
+ Y: E4 \ L g3 ~0 w& M - #endif
4 x7 f7 m" t% S# K0 q9 d$ _# o! \ - - q% A; S! T$ D C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* f, v8 G: d( ` - #define STATIC_SHIFT 31 P- g, {$ {! g' o+ }* B
- #define TCINTEN_SHIFT 20. |) C5 s$ ?0 t
- #define ITCINTEN_SHIFT 21
3 x- @* L' f6 j+ L - #define TCCHEN_SHIFT 227 T+ @, l: N7 V
- #define ITCCHEN_SHIFT 23+ C* ]- C" }& T; H; `
- 0 N' B* @ f0 t8 k( D/ L
- static volatile int irqraised1 = 0;0 W3 C3 S! [+ {2 Z
- static volatile int irqraised2 = 0;
3 S! o$ Z" h* W4 j - , Y, A. ?& h3 h% Q; {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* v# y; E4 b& Q$ M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# D& S5 ]1 ]* V" ?3 U: U6 r5 x# G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, T+ Y9 `" l' w9 A
7 w% w6 s) k, H- dma_addr_t dmaphyssrc1 = 0;2 B( V' }1 z$ v8 l: }; d
- dma_addr_t dmaphyssrc2 = 0;
% ]0 W' h L+ [( v$ s - dma_addr_t dmaphysdest1 = 0;6 `6 |0 L9 M# ^! H/ Y
- dma_addr_t dmaphysdest2 = 0;) }9 e3 ^. B; e: b$ s
1 c' N6 r; Z8 `8 d, H) S& f- char *dmabufsrc1 = NULL;4 \2 ~1 }/ [/ E3 R/ n
- char *dmabufsrc2 = NULL;0 q! G. X; i4 [& I
- char *dmabufdest1 = NULL;
. m& b: K6 C2 ^# ^; U - char *dmabufdest2 = NULL;7 l5 x" a4 F9 ~( _: G
- 1 S1 r* K5 u! l
- static int acnt = 512;/ }5 r( x7 S- s' C+ }9 V
- static int bcnt = 8;/ v% _* ?: h. C8 i
- static int ccnt = 8;+ d# o9 f, ?! b4 v+ P4 @
- ; ]; l2 `7 u: G1 u+ k: O5 P
- module_param(acnt, int, S_IRUGO);
) Y. q3 g( ~: X2 _0 _* J- M x - module_param(bcnt, int, S_IRUGO);
8 N2 P4 E3 Q6 l5 d7 A' C5 u - module_param(ccnt, int, S_IRUGO);
复制代码
% y4 d2 g/ S" R, K( j9 Y6 n8 w# ]( X; O. Q# F8 l. ^: p% f% B5 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" _# Y, h0 b" Q/ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 v- C5 C* {& g, W1 f7 {# X9 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' n H7 o1 j; f" A: M: T/ ^
( g6 S+ b. B% U I. S' D& `( W: P0 Z @: x/ L
|
|