|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ N3 Y7 v% a& K2 B
- [code]EDMA sample test application* B3 g" b: ?& C E1 y" ~
- /*! X @, a4 M) F5 m4 Z, Q0 }
- * edma_test.c
3 Q: I& n2 n9 V' e( M( f - *
5 F" ?. ?+ S3 E2 l - * brief EDMA3 Test Application2 s; u# V. C5 e: V: E& T4 M3 E, T) p% v
- *
; ?# |+ A3 R) t3 h4 H- R/ U - * This file contains EDMA3 Test code.6 j, X' T# K4 k' T
- *6 S* {6 M$ u8 q, E6 [" w( c& s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% k; B) B* F! l3 K( f0 `7 I( [6 Y1 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 y* J8 o# l; [7 c$ D - * TO CHANGE.
. \5 k, P: D3 o" X7 _6 f - *! l6 I' X9 |/ ?' ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& c3 c# g0 t0 t) ?( ^$ p - *7 O& X7 j. o, P' J2 p
- * This program is free software; you can redistribute it and/or! f7 m: r/ q& P9 D
- * modify it under the terms of the GNU General Public License as5 T1 @/ n' N8 I o4 e
- * published by the Free Software Foundation version 2.
9 l- g( {- \0 s; ^* n, V* b# A - *( [" x: b7 M) N6 s. \ c; v, r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* m8 @: X0 g W. A - * kind, whether express or implied; without even the implied warranty
4 a4 H' W4 I$ t$ h- g h6 G( S" R' w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( b) T5 Y5 u8 ] - * GNU General Public License for more details.' e" D7 s) S( f" C
- */
# C# x/ g0 r' k1 |0 E1 f - / C" L/ J% C, G/ x
- #include <linux/module.h>" ]: F/ u5 X8 _9 O0 j: Z$ A5 z" ~
- #include <linux/init.h>
# L# Z2 t9 G$ D+ q - #include <linux/errno.h>
0 q ~- Q2 ~' p - #include <linux/types.h>
# t2 H1 [, p& I" a m - #include <linux/interrupt.h>
, {% s: s, W2 W - #include <asm/io.h>" c; r6 a2 s8 U$ y* _
- #include <linux/moduleparam.h>1 p% M. R: v6 N
- #include <linux/sysctl.h>% i* m2 o! L, o. o, a
- #include <linux/mm.h>
- @) Q& H* n5 D - #include <linux/dma-mapping.h>: E, e$ G6 `0 V
+ a: W/ r! x/ }3 E- #include <mach/memory.h>+ u: `0 V9 |" `: u6 t2 u. L0 a4 O4 x
- #include <mach/hardware.h> |& ^6 P) R* H: \
- #include <mach/irqs.h>$ z5 w0 ~7 J, e3 V. L
- #include <asm/hardware/edma.h>0 g. z3 i, Q: ~* H) b/ T* ?
$ z& |- |, b1 [- H- #undef EDMA3_DEBUG5 L% y) _, u# V* c4 r; y: m4 n( q
- /*#define EDMA3_DEBUG*/, ^9 p: b- Q, Q t" D$ S
- 7 G8 I! p0 `. P2 A1 W
- #ifdef EDMA3_DEBUG$ H, R. _: b4 L m& c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 i1 ?; c; i& h" b% }% d1 g* }# x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( ~0 ]4 J9 e) T$ Y9 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% d3 K, o9 ]0 T - #else
$ E" [/ P% P0 X/ G# F - #define DMA_PRINTK( x... )& X* `9 ~2 K% T/ a, U3 y
- #define DMA_FN_IN. W5 y. d, a0 n: m, j7 }
- #define DMA_FN_OUT
% k# m# M; X0 O - #endif
" ]% ~3 P2 O5 H0 s# Z; d9 s - 5 R% o0 L v- U, q: i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- m# w; u- e3 P' G - #define STATIC_SHIFT 38 k& ^! J. X+ }* |) i
- #define TCINTEN_SHIFT 20
' l2 C& e5 u( S( W E - #define ITCINTEN_SHIFT 21# p- Z: {5 H9 ^" S8 D
- #define TCCHEN_SHIFT 22
# k, l; T/ \. X3 V% A - #define ITCCHEN_SHIFT 23
+ ~) R( Z) G* N+ q
3 O0 R; w5 t5 m$ t, O1 ?- static volatile int irqraised1 = 0;8 m$ W8 `" z' g, ]# G7 | d
- static volatile int irqraised2 = 0;
$ s. A% `, _/ a4 |7 c* M
$ n( r% G+ o' ^. F* Z; A( p. K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L$ F: e- }) O3 ^/ b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% {0 t8 j( v y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! r/ x _: s& N- l0 W; ?
/ n9 T ^; ~( u! P3 M- dma_addr_t dmaphyssrc1 = 0;$ E, Q$ z/ _2 ]+ L$ j
- dma_addr_t dmaphyssrc2 = 0;/ s" g0 C$ v$ N8 P6 W
- dma_addr_t dmaphysdest1 = 0;; v6 I% ^; S+ u
- dma_addr_t dmaphysdest2 = 0;
3 `0 o6 B; X0 P9 W! x& a
& a7 z' J+ `9 W4 {8 S9 @- X& Q- char *dmabufsrc1 = NULL;# Y7 Q: ^5 P2 z$ C
- char *dmabufsrc2 = NULL;* k) A1 n" r$ T
- char *dmabufdest1 = NULL;. F4 k4 [" p# }% b9 }; l
- char *dmabufdest2 = NULL;
5 k0 C5 w- Z4 |6 s+ Z* N
2 A7 R v& `& y9 R) E- static int acnt = 512;
* Y# y5 Y+ n: \# A. U% {. N - static int bcnt = 8; T7 M, |! q% C. E
- static int ccnt = 8; m2 X: Q, T9 d
! y" O3 U; A% v9 Q Z# ^- module_param(acnt, int, S_IRUGO);
, y( n4 K$ h1 R0 _6 I3 R - module_param(bcnt, int, S_IRUGO);2 f" v. _& C c( {9 W. K
- module_param(ccnt, int, S_IRUGO);
复制代码 / u" A8 X6 f( v% i( I6 a% h
* i+ ^/ ^# a& K/ x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 F0 h1 a. A* U) Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 o( h& X( j+ s! [" V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- X$ c0 w& U4 j$ P
3 i' v5 [. x0 ?! Z4 u8 W
; M. `2 L. i) Y |
|