|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 R/ h) O$ J' f' ~: q/ x
- [code]EDMA sample test application1 H# E# C* p4 W
- /*
2 {5 G c3 D& ~1 @ - * edma_test.c9 q5 W+ K7 |$ A2 I4 Z/ u9 d
- *: ? K( W" s( d; H0 E
- * brief EDMA3 Test Application
$ e/ i1 L2 I# o, D* q! X( t$ f' J - *
; @ u8 H* q0 ]8 {3 Y1 ]8 Z. b' F) z, [ - * This file contains EDMA3 Test code.
( I, j6 r) ~9 w; ^ - *
& G5 Y7 j$ w6 b/ X" G- C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 x& N1 H, s( Y5 @' {$ ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, f) G3 ^. [6 r, W1 H8 w$ V
- * TO CHANGE.' P: _0 ^ x: b* j
- *
3 _5 {) f$ \! x3 L( ~" N- |) K M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 q) M, c1 T6 ~, N& [( m- b - *
" e8 m: n2 v7 y - * This program is free software; you can redistribute it and/or9 v+ _( Q! e2 F" R+ y: L7 i
- * modify it under the terms of the GNU General Public License as" K \; }. y) M* G _9 h8 c
- * published by the Free Software Foundation version 2.
0 v# Y9 s3 E/ ?% h2 Z, l, a0 k/ A - *
1 U, k4 Q" j4 p. s9 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, \1 c9 t. L' Q0 d. X) g& j3 h4 f - * kind, whether express or implied; without even the implied warranty" q9 i6 Y, v9 c/ q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* _2 i; y4 v$ }& H* d( h% B
- * GNU General Public License for more details., s% \. C! Q1 z
- */# P; W" E i! M& L( V( X3 s: E4 I
- ) A+ G/ d( [; ]7 n7 j. Z' J
- #include <linux/module.h>
) ^: I) Z5 M! P. }* m - #include <linux/init.h>5 e" v! j! x2 x+ } f* t+ M
- #include <linux/errno.h>+ r2 O. K6 r% Z6 W/ l2 l! _/ M
- #include <linux/types.h>6 c/ @, H; W" v- u+ Q
- #include <linux/interrupt.h>* r) |( Z' f) O( ?8 O
- #include <asm/io.h>
3 U% f6 Z$ O3 M) } - #include <linux/moduleparam.h>4 M/ S4 G. W% A8 d! b
- #include <linux/sysctl.h>
3 Z! x- q. m) t0 l" M' a' ?$ p - #include <linux/mm.h>* V5 o5 W3 L( c" h/ Z+ t
- #include <linux/dma-mapping.h>
' Z( `, E% K0 v* ^
0 l1 }- t+ D+ }& K9 l- #include <mach/memory.h>
6 G1 e* s# i7 M3 Y - #include <mach/hardware.h>, E" z0 U6 H3 h0 M1 Z! n, ]
- #include <mach/irqs.h>
+ O$ Q3 R" L) j5 W: R - #include <asm/hardware/edma.h>; h" }8 x. C! d3 S$ d
- ! K% M& D6 z0 V8 A# ~ _' @
- #undef EDMA3_DEBUG4 w* K4 X6 F& K- k
- /*#define EDMA3_DEBUG*/9 m1 g% D& J7 p, f. d9 y
- 7 h, X" x8 E. w+ E0 _/ r& w
- #ifdef EDMA3_DEBUG
# W( n/ F8 K. G6 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 T" L. V2 m/ m9 U9 D( m9 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @6 }5 l6 E# o f5 l( R6 b' `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 f' e4 `5 A3 \4 l0 j$ D% h6 Z6 k' D
- #else
! `# u; }( \" a& Q% S5 X6 L4 s$ k% z S - #define DMA_PRINTK( x... )
( O1 T8 t( N" o - #define DMA_FN_IN4 V {: L' ?8 w/ v4 `, c
- #define DMA_FN_OUT' Q* y; T+ e/ [
- #endif7 ~. \8 n, ]% Y* O2 c
- . R& ]) x4 O9 ]5 u2 i, v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! v/ \) A; k7 f* I
- #define STATIC_SHIFT 3: s7 B2 L: P) _; t
- #define TCINTEN_SHIFT 20
) q" Z2 U! {0 z& c% Q6 `; w - #define ITCINTEN_SHIFT 21
6 C3 x$ M! }; N' { o; z - #define TCCHEN_SHIFT 22+ L4 @* ?+ S( C" \( V7 E& S
- #define ITCCHEN_SHIFT 23
! B+ Q" |$ g& A2 s/ F - 0 k: N c4 Z0 c) _& s1 R# K! }! \
- static volatile int irqraised1 = 0;
2 @: e6 }" h$ Y( V0 |6 `8 ] - static volatile int irqraised2 = 0; W, e$ p8 Q' x1 q4 R: g. \$ c; e
0 [/ C' p% O/ Q: f/ U5 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[- G! G1 w. A1 x3 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `: _2 u8 p- i/ W6 T" ]" x- ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; O" d9 S: I- [& `% { - 7 U/ @9 V7 H' C, |# t8 t# o/ |
- dma_addr_t dmaphyssrc1 = 0;8 y1 p3 x! U( q& |1 f, w
- dma_addr_t dmaphyssrc2 = 0;
R0 p8 ~5 D; ?' I$ p0 F - dma_addr_t dmaphysdest1 = 0;
) T! ^5 c& _& e2 t - dma_addr_t dmaphysdest2 = 0;
) d8 v4 V9 ]- _2 p! w0 X0 c) D" y
& Z1 G3 j' \) k6 @- char *dmabufsrc1 = NULL;
' S$ y* N8 e% H& ?- Q# k0 {' S7 L - char *dmabufsrc2 = NULL;
) V% b9 q1 o' c - char *dmabufdest1 = NULL;
% r, z+ N- W* ` ~ - char *dmabufdest2 = NULL;
3 V6 f0 ^, ^8 B+ {. Z
& y& U9 X3 c2 E5 q5 {0 B. D- static int acnt = 512;) c1 b# B9 F+ v3 r, U/ P
- static int bcnt = 8;/ b1 h5 _; W9 r! I0 v
- static int ccnt = 8;
3 K/ P& ?% S: ?2 }3 e+ N$ P( c
# t# x" o. d0 e$ c# ~6 `& b- module_param(acnt, int, S_IRUGO);
& p; c, N! i( [& H2 y$ i& y6 Y - module_param(bcnt, int, S_IRUGO);& { x# e) D1 J
- module_param(ccnt, int, S_IRUGO);
复制代码
( M: h% ]1 o2 [5 X+ h5 [# t, n% U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 t% C& }' P/ J2 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 q3 w5 p/ H- _# C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N! K; e6 s" z* ]1 X& [8 c
# U' v( a$ ~5 _$ Z" c
! s K( D% F1 o5 J8 z |
|