|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / @) G: O6 a; m% Y( {8 d
- [code]EDMA sample test application
* F/ N0 M* G- t* x) V& b0 C - /*1 }9 E0 e$ ]; [7 ]) o3 i4 W
- * edma_test.c
' d7 i$ a$ a7 K8 ]" Y7 A# x - *
( ?; T' W O! o+ M0 C4 { - * brief EDMA3 Test Application! T) ? p9 V% R& y3 ^0 u1 o
- *
+ `$ \/ X5 Y2 l$ `) N9 v+ r' B - * This file contains EDMA3 Test code.
8 ^4 B, F# ?8 t: ~# |: P2 X& V - *
: O; l9 R/ U/ F4 i3 N" \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; D% u( t+ p+ d. H+ A+ I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% z& U' u# j( Q* h! R' p - * TO CHANGE.
$ u$ X( _! [. y - *! j; A5 `. V+ `5 s6 K3 j2 D# Q' E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 W: ~* @% `( k$ ]: y( K - ** P0 ?/ E* |% M- v/ b8 i
- * This program is free software; you can redistribute it and/or* [ H$ N9 S6 r% p+ i- ^
- * modify it under the terms of the GNU General Public License as
9 v0 W- a: H; a5 O8 | - * published by the Free Software Foundation version 2.+ G# l" c( G6 Z
- *4 ]7 k6 [% h4 |) g1 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 l, b+ P; i6 v5 Z6 u - * kind, whether express or implied; without even the implied warranty* W D6 L+ {1 O3 G0 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- z& A" C) s6 Y. L d - * GNU General Public License for more details.& k" B( _" T0 [
- */
^' K2 t' S' g0 c u - " Y3 l+ d8 M8 }' P8 d
- #include <linux/module.h>
: ^+ o5 E. ^; U/ t( } - #include <linux/init.h>
- j/ N5 u& M" p, {4 r% U - #include <linux/errno.h>
; ?' Q8 X2 a* A0 S: e - #include <linux/types.h>, J/ s7 G2 v* i; ?
- #include <linux/interrupt.h>/ h0 I9 R5 Z" v" [5 B; _! ^, j9 P
- #include <asm/io.h>
4 |' [+ d4 {1 o7 `2 X, }$ W - #include <linux/moduleparam.h>
; v0 J% D2 p7 V @! Q6 J - #include <linux/sysctl.h>
t# L" T6 A7 O; R. | - #include <linux/mm.h>4 |% v% c; A4 R5 y
- #include <linux/dma-mapping.h>
9 z8 p* L9 O! O* Q4 Y. v
+ B4 I( }" z) o8 C3 b2 |: v- #include <mach/memory.h>2 i8 s* [ I+ i3 }) h- k2 Q& F
- #include <mach/hardware.h>" X0 W+ o& D$ Y, `2 \
- #include <mach/irqs.h># @1 Y! Z' X2 u C; m- K9 P' X
- #include <asm/hardware/edma.h>
6 @- ~1 ]1 @/ K1 i( i
' a3 I' t0 ^4 _- G& |: L- #undef EDMA3_DEBUG
) Q8 Q# V$ f( ?, F - /*#define EDMA3_DEBUG*/3 Y( `$ A/ r3 F8 d$ l2 M9 F0 i
& [5 h, r$ x5 ^7 d& L' C/ j- #ifdef EDMA3_DEBUG
% a. u, E( H A( d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 r# G4 ^$ }2 B8 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ [4 y- x0 G# U) Q) v2 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Y" X4 ~9 n3 [! l2 J
- #else5 Z, m2 y8 x$ Y& X9 s1 g
- #define DMA_PRINTK( x... )
$ X/ f7 p1 A2 \3 B1 W1 d - #define DMA_FN_IN
6 Y4 [) t5 |/ U: C, i - #define DMA_FN_OUT
t+ m. }( E8 M0 D2 A; } - #endif
- L6 e7 R( W% q; l+ | - / s) C# \; i8 c$ {; i$ x+ ], m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 D1 x7 m' e2 ^4 i! A1 H - #define STATIC_SHIFT 3
5 |) a: p, w+ \ t& s# ?$ m! M5 L - #define TCINTEN_SHIFT 20$ E9 i. n* l$ _2 Z; x
- #define ITCINTEN_SHIFT 21
V! h3 J# x$ ]6 ^# \ - #define TCCHEN_SHIFT 22- B! U& V$ L+ a3 ~
- #define ITCCHEN_SHIFT 23* h$ X) D) a! E( B! M, p0 H1 X% Y
- 4 _' X0 W+ Z. ~2 @( ^( [" _
- static volatile int irqraised1 = 0;$ {1 [& w1 a- K
- static volatile int irqraised2 = 0;5 s, @1 w' s) X3 q4 i; [
/ u" P3 Y0 [4 J$ _0 V, m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 }, d3 P9 t8 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 u6 e$ i' ?, `6 S4 D% \, R; q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- [2 C5 N; B3 R" L( B; t
9 o- }3 p* e; ^- dma_addr_t dmaphyssrc1 = 0;
. G) k0 q6 B' n7 e4 j - dma_addr_t dmaphyssrc2 = 0;
- i3 L, s- o+ u" w% U6 V - dma_addr_t dmaphysdest1 = 0;% z% x. r, H$ c; T
- dma_addr_t dmaphysdest2 = 0;
7 m3 h0 p" C5 i' L# u6 D - 9 s& N$ n5 v! i* y
- char *dmabufsrc1 = NULL;
: E" a Z5 J) k! A) E" ? - char *dmabufsrc2 = NULL;
# J0 u. O+ ]/ R+ o4 N: U( {1 }4 @ - char *dmabufdest1 = NULL;
; B B4 S2 ]5 l# n - char *dmabufdest2 = NULL;
2 Z, f# T, u- f- q - / i5 q( r$ Z& w4 K2 R2 V
- static int acnt = 512;
1 M# b. o3 u j' \6 M - static int bcnt = 8;
. b& y) I5 R" h. c, t6 _ - static int ccnt = 8;
8 z2 u e+ @. I0 E: H
- j* ^1 U$ Y. d% r4 I5 ]& s8 @- K p3 j- module_param(acnt, int, S_IRUGO);3 d2 t8 C4 ?, K
- module_param(bcnt, int, S_IRUGO);
/ J5 r: X8 u O. x& C4 g0 O) J' U - module_param(ccnt, int, S_IRUGO);
复制代码
9 [8 g8 D1 S. W2 a# w, F$ @
; L g" h4 m- x0 U2 j& A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 y: Z+ D A3 A- K2 h rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, _* N4 }0 R. B5 Y; Q$ Z) O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! q! @$ |8 b- z, l6 V% h7 @- ?' ^$ d; _) w$ A [0 ~
% y9 M' `6 _3 n. l$ s2 m
|
|