|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 j6 T5 K$ [2 m8 q" j$ f- [code]EDMA sample test application
+ x% L) E- v9 j( N: s# l4 N - /*6 {5 x) }3 ~' w& E2 H1 T
- * edma_test.c
' b/ ], D* x9 \) b( n - *
3 B1 y1 {3 e. ^9 ` - * brief EDMA3 Test Application( M; I W! S8 \6 d: Y2 [: ~ Y
- *, Q. x- l+ Y- L
- * This file contains EDMA3 Test code.
* f" x1 r9 V! ~6 S3 H& `0 L1 a - *) h7 q. i8 V; P0 _* x. ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- u* f/ I" u( }2 C1 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" {8 T0 U# S6 s, g% l9 L - * TO CHANGE.6 K$ ~ t& e( z
- *
) A G' B& [( [7 H6 z- Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* j9 w* _5 r4 T) o0 o - *7 D0 u$ c! l: N
- * This program is free software; you can redistribute it and/or& D2 E/ Y1 p- }# A$ H9 {
- * modify it under the terms of the GNU General Public License as
3 X4 q+ x' \) m* r0 ? - * published by the Free Software Foundation version 2.2 }- n7 x; T* o8 P
- *9 G. c- ~2 O6 i5 c( Y, n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ [( O" d* C3 h6 [# R, t. x - * kind, whether express or implied; without even the implied warranty
+ o6 \$ ~& v6 B1 w! y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# t/ S( D6 Z3 A% x: R - * GNU General Public License for more details.6 q' H: y/ V3 B: |; X9 P+ N' L0 z
- */7 E- z6 ?- j! W0 D, B
- ; Z* ?' n: s& E" a Q
- #include <linux/module.h>
8 d2 P$ ^6 `% | - #include <linux/init.h>
: ^6 h+ ~' m |9 t1 F3 p - #include <linux/errno.h># f+ R: Z$ }* o8 \' L9 }
- #include <linux/types.h>
' j' s2 P c: k: f - #include <linux/interrupt.h>8 s2 ]( _( m: {& O* e6 r
- #include <asm/io.h>
: q1 n+ T! f. l - #include <linux/moduleparam.h>
4 u& I+ f" m6 I - #include <linux/sysctl.h>2 Q& g- ?: k1 I1 H& }: }8 @! ?& ]
- #include <linux/mm.h>
' d8 D5 X! X0 w' ~$ k4 w" D - #include <linux/dma-mapping.h>
h/ ]4 ?4 I$ y
/ p6 M3 W3 R( g. L- #include <mach/memory.h>3 \* q0 Z6 W( M! D6 E0 |
- #include <mach/hardware.h>
0 T- k% L) C' s - #include <mach/irqs.h>9 A9 \3 y+ w2 v5 `
- #include <asm/hardware/edma.h>; P9 k- M' s) ?1 r$ B) ^
- ( Q8 X& C+ Q- H4 M" v
- #undef EDMA3_DEBUG
& |; p$ `4 ?+ n- M& I - /*#define EDMA3_DEBUG*/
% K0 }) J* |) Q6 w# i7 E) {6 u. Q0 x - 9 Z. G1 C: G& A1 Y1 ]# V
- #ifdef EDMA3_DEBUG
, s4 S. K- ?( g3 h7 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
V V+ ^4 f: L( C3 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& T' K) a( q C9 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( M( p: Z2 ]9 P' C ` - #else
- ]4 z4 f9 u1 J! S% N% s1 { - #define DMA_PRINTK( x... )
9 O; Q( l+ M9 G, O2 k# h - #define DMA_FN_IN. |) l) B/ s5 ^7 @
- #define DMA_FN_OUT6 R* W" V2 o; I* r* A+ p
- #endif
4 Q E- f3 N8 U- P. Y6 `- x - " y V5 d" A. c5 C, w$ J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: B q9 G' l8 h* n# d - #define STATIC_SHIFT 3
6 l) A0 ` U/ k# s4 j6 u. }9 h- Z - #define TCINTEN_SHIFT 20
4 r9 m, v2 K# _" a; ~- x - #define ITCINTEN_SHIFT 21
( y7 o# l. w2 P. R' j w: u' k - #define TCCHEN_SHIFT 22
) Y( M* v. n: y" R - #define ITCCHEN_SHIFT 23. {/ d+ _/ C0 d N, I
/ B! L, y" V7 A6 \( ~- static volatile int irqraised1 = 0;) d7 ?% q' v$ q0 _2 f
- static volatile int irqraised2 = 0;
" D$ |2 W8 g- u% j. E) [
. D- _( Q, R3 b# ?1 Z8 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" o* g& T6 N/ ~ V0 \* o; L0 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \) S: R8 z$ b) A! t6 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( }9 g, @" u2 z- @$ }8 | - - w( K. p2 `! J. N. p1 B9 a1 v
- dma_addr_t dmaphyssrc1 = 0;9 m/ ?& V( i/ \* @- e% M1 z% @0 Y
- dma_addr_t dmaphyssrc2 = 0; l; _+ H. M; c" V) j% ^
- dma_addr_t dmaphysdest1 = 0;
f3 q* t- p6 U - dma_addr_t dmaphysdest2 = 0;9 G- G- V5 T$ S
! k4 i! |' T: l1 p6 O- char *dmabufsrc1 = NULL;% F9 {# R' c ]
- char *dmabufsrc2 = NULL;- f; }2 t& A6 H1 G* z% r! {
- char *dmabufdest1 = NULL;
9 P- u6 Y! ~" ] - char *dmabufdest2 = NULL;* f2 F3 m; b% C- U) T
- 8 u4 P5 w4 d) k1 B2 u
- static int acnt = 512;5 J5 U* n1 ^1 @3 d
- static int bcnt = 8;6 S0 Y1 J/ g+ ?( T4 B
- static int ccnt = 8;
" d" r( G; @3 H7 X) l. l - 1 Z. j; R0 f( q( y9 M/ D
- module_param(acnt, int, S_IRUGO);
7 p, D& W2 }; u& D - module_param(bcnt, int, S_IRUGO);
; o5 V% o$ v9 ?+ G$ z c - module_param(ccnt, int, S_IRUGO);
复制代码 $ B' ^; j8 s, }' o$ {8 R
( ^' `8 W" R" o+ L& ^$ w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ X' I8 @" u' [& @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 T1 f6 d* ^$ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; |/ s* a) _- M4 Z, P5 |$ P1 h0 F: S8 Z2 D
! c/ x% u% L3 I6 A4 a) Z8 Y$ D |
|