|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O) `# L Y3 b8 B/ _5 e+ O- [code]EDMA sample test application
2 D8 t' i6 M+ B8 ?' o' V - /*
' h$ O1 i! N' A7 |& b - * edma_test.c; L1 t/ @6 }4 w
- *
, ]0 [- L! I! D: z# \. u - * brief EDMA3 Test Application
3 b1 d9 Y m$ Z) d' a - *
2 m% ?9 v1 k3 X& N7 B8 _7 k2 Z - * This file contains EDMA3 Test code.
: R$ l; o2 I4 M( O9 g: d - *6 _* Q* S, F$ K: E+ Z. b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# v/ N$ F0 I' l. ?( |" H8 D7 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 B2 |& \; c1 P4 C" ?9 a1 l - * TO CHANGE.
0 N! H% G0 X7 B - *
5 X6 M/ |3 Y8 `* i, N5 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. Z/ k: b- X% \; L; T - *
, k& Z9 F$ a' `7 |6 V1 h - * This program is free software; you can redistribute it and/or4 k* ^) }& D2 w- ]$ O
- * modify it under the terms of the GNU General Public License as
3 z/ G* J# v( T, h6 ~ - * published by the Free Software Foundation version 2.
) h) D6 G; ]' H% s4 {0 w p8 c - *
7 H5 l8 ?; \, ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 p7 h& d% M( c3 K/ P* ?, J" \
- * kind, whether express or implied; without even the implied warranty
% H6 C9 G* l: g2 I+ X) K; S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 u( k4 u9 G" P0 E$ C+ F - * GNU General Public License for more details.
6 `3 S3 Z0 V8 t! S, r* Q( a/ Q - */
% E7 \( i% z" H
3 _$ I) u6 B0 }* f( A- #include <linux/module.h>" w% [& U! I: U& | P) m, ~+ _
- #include <linux/init.h>$ o% f; f+ n- @ G, X
- #include <linux/errno.h>4 g) n4 [$ y: o$ L) ?
- #include <linux/types.h>
" ?7 m2 F$ ~* D5 h& }' S - #include <linux/interrupt.h>2 T2 f1 @1 \" b) e* _% v+ S1 K6 K
- #include <asm/io.h>
' z2 }" |" c F8 ~+ F( W7 G - #include <linux/moduleparam.h># v- p. Y" S, G& w! R1 r( ]
- #include <linux/sysctl.h>4 e/ L) u) s& r; {
- #include <linux/mm.h>
U" u8 L9 T% d4 D; q8 i& O - #include <linux/dma-mapping.h>
. F+ z3 `4 g* B8 i% G
+ A T$ |1 r& a- [, {6 y- #include <mach/memory.h>
. e& H3 y3 B, Y8 o - #include <mach/hardware.h>
+ w" l: U) a) r$ k2 h) c' P - #include <mach/irqs.h>
! w, a* p8 E1 o* G- p5 n4 ] - #include <asm/hardware/edma.h>
/ X5 h' w* i6 u; i! {$ Q
" W+ j$ c$ d* i# g: f4 ^- #undef EDMA3_DEBUG6 a# A( R3 t2 o; z$ k: [5 H5 `
- /*#define EDMA3_DEBUG*/
) o/ \( W, Y) B9 M% E - * l+ t! i7 h1 }7 \
- #ifdef EDMA3_DEBUG
. l- t! A8 ~- ~) |9 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ W9 \$ H/ M, ], O7 t/ |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 r9 K, {2 o% i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 `$ A; F' s* A8 {5 P* g - #else7 S) X/ N5 z+ T+ |% t C
- #define DMA_PRINTK( x... )
8 n) M7 o( z5 Z' V5 `1 q - #define DMA_FN_IN
; h1 b$ C; }3 F3 _4 J9 c4 [- I0 d - #define DMA_FN_OUT
) G7 H- r; \! u( L, x - #endif
" T4 ]- y5 Z) U1 L) n o
9 y: [" w' F6 Z8 \7 H/ R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! y/ |! y2 A$ P - #define STATIC_SHIFT 3) H- t# n1 w: L6 I, e: h4 L
- #define TCINTEN_SHIFT 203 K% i1 f- [% ]+ _8 d
- #define ITCINTEN_SHIFT 21. D8 C# F! W C* j6 u6 P1 h
- #define TCCHEN_SHIFT 22
- ]6 X9 v0 i; E z: t - #define ITCCHEN_SHIFT 23
5 t4 l9 [& F7 @& p% \! { - / M8 {. x7 P4 e/ s, j9 \& o
- static volatile int irqraised1 = 0;
2 L s8 e! X Z& n# a" u" C - static volatile int irqraised2 = 0;
/ R D4 N: t# _) U* n7 K' P
# v6 |. b& [' ^; s; F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W+ \, G1 V$ J8 }7 d" x6 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 v8 l- B& u6 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% }8 R+ v3 S4 T8 s b5 f
- * z: ?, C: c) |7 _
- dma_addr_t dmaphyssrc1 = 0;
) K' o0 P- `: ?% J0 l4 T - dma_addr_t dmaphyssrc2 = 0;& Z/ Y' _+ y5 D& l: E, A
- dma_addr_t dmaphysdest1 = 0;; V% e* H( O7 U
- dma_addr_t dmaphysdest2 = 0;$ z9 F- ^; ]: b3 U" R- s; B' _, H7 e9 E
3 @0 @9 ~( q6 w3 v( Z" A- char *dmabufsrc1 = NULL;' E, ]! m$ x( w- ]1 a0 g$ Z
- char *dmabufsrc2 = NULL;* G- x0 i" i) L
- char *dmabufdest1 = NULL;
5 z0 h6 J7 O2 X8 z( _ - char *dmabufdest2 = NULL;4 ?5 Z* P, |( l6 A
- 4 g* i+ O) W y
- static int acnt = 512;
% {: h( t: p. I$ T! D1 n - static int bcnt = 8;
4 g8 k/ c6 f" L; P4 |9 {6 X - static int ccnt = 8;
& r% u9 V; H- ]: U
; N# e6 o$ S! t5 L- module_param(acnt, int, S_IRUGO);6 F+ s* @2 d: _& }
- module_param(bcnt, int, S_IRUGO);
% J# a/ {/ t) ?& f+ V" j - module_param(ccnt, int, S_IRUGO);
复制代码
" Y( T: L# I: H/ Y
! v* H; ~. f1 U) S+ a$ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 O" S$ y7 \9 a" ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 T3 C7 M: N, L9 K0 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' ?# {* x k7 G: E
* A5 G1 j- W% i' `$ |# e& g
) p$ p( ?1 b3 V9 K0 {7 c' H! G8 F |
|