|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x6 l1 ]6 _3 b) g, K1 a/ S7 s
- [code]EDMA sample test application- X2 v$ I* |& u) M
- /*( d6 M0 |) D6 v/ z
- * edma_test.c# ^& Q7 V. E; o" n7 k7 [6 p1 }
- *% P3 U* N! w4 K. W
- * brief EDMA3 Test Application5 r6 z m5 [4 o; u: C* [
- *8 C+ G! ?5 h3 `: _" C6 ] H
- * This file contains EDMA3 Test code.+ P; {# Z- I' n& W
- *
% R/ l s; T8 l# Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 E2 c3 c- Z1 O8 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 N9 D" r5 t! e0 _! U
- * TO CHANGE.
+ }, |% F" |1 ~ - *- z( J% A4 Q2 \9 ~) s' }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Y4 `0 Q% x- a4 ` - */ l! f% L9 w6 Q4 ~' [8 j
- * This program is free software; you can redistribute it and/or
+ u% S+ p! S* S6 F( S2 T2 | - * modify it under the terms of the GNU General Public License as
" a" R5 G$ U, X& ]2 ^7 ~- s - * published by the Free Software Foundation version 2.
3 o* z, ]2 y' u3 e' } - *
! U' K' s$ L( i# ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 {$ R" W4 O( P8 n7 G' [ - * kind, whether express or implied; without even the implied warranty8 S8 h. |! S( A' j( w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* T' p D& k: x' m - * GNU General Public License for more details.7 M% L& T- ]% I, G3 F
- */+ z/ d/ Q0 J4 a- N
- 8 @, F8 w$ P1 }: o
- #include <linux/module.h>
( B$ Q# s! B+ q! R2 `0 \& S) m - #include <linux/init.h>
/ `; Z/ A' D: Y2 ^2 Q - #include <linux/errno.h>
4 k: @. C/ t% F - #include <linux/types.h>/ [1 A9 [$ g+ J) H/ p1 D: M/ w
- #include <linux/interrupt.h>
; u0 c! }6 i( f! C, T, T - #include <asm/io.h>9 B) W3 n; u! V0 o7 l7 l
- #include <linux/moduleparam.h>
& ]0 }0 t& U, [! l( y( b - #include <linux/sysctl.h>
" R% }; @ l9 z; f2 v" U - #include <linux/mm.h>
- m4 d- h. a1 ~0 h/ w/ L - #include <linux/dma-mapping.h>' t1 T( X: ^ u. o& u; Y, y0 ~
1 e3 A+ `: h. W# Z- r7 ]/ A- #include <mach/memory.h>
# \& S( H2 i4 n$ }" t) x! [ - #include <mach/hardware.h># x: R- n" [7 z. v9 D% b- A
- #include <mach/irqs.h>
B: y% a% ], H2 D$ v6 H( }9 U8 H/ O - #include <asm/hardware/edma.h>
6 A3 h# Y6 [) ?" _1 `6 y1 p
% W; r9 P- B7 D% h% H- #undef EDMA3_DEBUG+ T" W9 C' ^, I; f7 @9 ^9 [' o
- /*#define EDMA3_DEBUG*/' d3 G1 Y% a! [; R6 Z$ U
- 5 u: W6 v: N* y* x! Z
- #ifdef EDMA3_DEBUG: b; O# v+ _* X. ^/ V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ^$ L( ?6 [6 U( [5 h1 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ Q$ n+ y, L8 b) S4 J9 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ Q3 s. [, T3 |, y - #else. V/ a6 C7 m6 `3 e% ?3 f
- #define DMA_PRINTK( x... )
! V! }6 ~4 @ m3 H5 p& q - #define DMA_FN_IN$ R; t' Y8 o% B, O
- #define DMA_FN_OUT$ R7 ~. {8 q" J+ V; P+ v
- #endif/ D' ?9 N4 ^" N8 B; V
- ( o3 y5 r4 ^5 M5 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# j* d$ n+ @: v8 K% B! X
- #define STATIC_SHIFT 3
+ T2 z2 `/ `, V! Y) [; }7 b6 p - #define TCINTEN_SHIFT 20
! ~" h: H* i" ]+ n: Z0 q: x3 s+ z - #define ITCINTEN_SHIFT 21# U1 W" f1 @- C/ L% W
- #define TCCHEN_SHIFT 22) T" L9 F# _6 y. \: L2 n
- #define ITCCHEN_SHIFT 23
1 x: F1 E \7 d7 q
2 z1 {& F' _6 p! I& p& s$ d4 D- static volatile int irqraised1 = 0;3 e- E7 B% ^! X
- static volatile int irqraised2 = 0;
& N" l% Y m$ W! T2 D5 S$ c
7 R B' x9 h4 t7 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s& I( b0 Y7 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 b( G( p" o5 x+ p$ B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l! C% w$ {" [' f
Q( B& P2 Q( o- dma_addr_t dmaphyssrc1 = 0;
, e& J6 i! r4 e' \+ z" s+ g) h - dma_addr_t dmaphyssrc2 = 0;$ n% k' J* f& F! x5 k3 h
- dma_addr_t dmaphysdest1 = 0;% T7 q6 N9 q0 D! B" F U( U
- dma_addr_t dmaphysdest2 = 0;
; {' g; {4 H; T+ {: w% {% R
G6 c+ I) p: T, N/ H5 d S5 E- char *dmabufsrc1 = NULL;3 n8 S2 X) E8 ]5 r! a+ I
- char *dmabufsrc2 = NULL;
. U& m: L% x1 x) [; s( F; x6 N4 M - char *dmabufdest1 = NULL;: d! e0 q+ C/ V
- char *dmabufdest2 = NULL;7 t# b0 P. e* `! j
- ' ~; Q4 a7 \/ \% n
- static int acnt = 512;) |% L1 G" x5 s
- static int bcnt = 8;
5 j- `, p/ X/ R* k X - static int ccnt = 8;" z$ A( n% |; Q
* k. Y) q# a# l0 T, `7 n# ^3 h- module_param(acnt, int, S_IRUGO);8 y) ] ]3 B+ J" j2 j
- module_param(bcnt, int, S_IRUGO);
4 @) E4 C# m) O1 n+ n6 A - module_param(ccnt, int, S_IRUGO);
复制代码 5 I, B" w0 N7 f1 K) z/ O& x
6 C2 l0 g" m% V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ S F4 Q5 H1 E0 W4 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 y) p" Z( m% X) g" s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ }* ^+ a( E* G. E/ k: _ h* k; Q) t2 ?& l: {
) k+ {5 A3 c1 h; d
|
|