|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 M& C! g9 r; k+ K. N% M
- [code]EDMA sample test application" T% d3 G! i8 s$ q# h
- /*2 ^3 u8 _/ I9 n6 c
- * edma_test.c. m6 Y; b e# S- Y
- *0 N4 x9 [0 V" C8 \3 \
- * brief EDMA3 Test Application/ l2 ]7 X6 Z2 F! j3 y6 Q$ w
- *
' K( [2 R( w. d3 a3 Q* c% G - * This file contains EDMA3 Test code.- H3 F/ X/ }8 K. Z( h
- *
) D' i1 b9 M8 o) ^% _5 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE k" z% ], f9 A3 B" D/ w7 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, e, Y) g O4 I' o1 \9 T* X4 Q5 J
- * TO CHANGE.
, [8 C* J/ |3 l, m# a - *
) V/ X6 v& v% s, W; |- m8 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, d* W5 S, }1 I; B; K' B - *
5 s/ m4 P6 H5 _! a. A - * This program is free software; you can redistribute it and/or
0 h& M g6 P. S1 w* c' y3 { - * modify it under the terms of the GNU General Public License as. B0 W' ?% A$ K; f
- * published by the Free Software Foundation version 2.7 P* t9 L2 Q( n7 Q9 p# w; i
- *' |4 T. B ^' E, @# E) ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 }. ]. i" L1 R2 {
- * kind, whether express or implied; without even the implied warranty
& m6 M) L. C& s4 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 d+ ]" n) ?6 l8 N
- * GNU General Public License for more details.5 G3 f8 G N$ m& {3 P- b U
- */# y3 Y# h) r! ?2 m
- 8 N" Q, ~" m f- v
- #include <linux/module.h>
Y1 q4 S+ G' ^; w6 t2 W7 j* G - #include <linux/init.h>) {5 O# [- M+ H5 B+ H3 A
- #include <linux/errno.h>. K, ]4 h, ?$ l! m
- #include <linux/types.h>
( h& g7 P; w6 P$ H. b$ m - #include <linux/interrupt.h>
( L0 n* }$ T+ t - #include <asm/io.h>
) v7 [1 E* k5 w J* K3 A - #include <linux/moduleparam.h>
' |2 |, R8 g4 m! j4 U4 u* N( f7 F - #include <linux/sysctl.h>
* |7 F7 A, { h* a; T" P9 r8 h - #include <linux/mm.h>, _1 g6 V- K/ N
- #include <linux/dma-mapping.h>
) w" N# \1 ^( B - % f2 c9 z9 n" v3 w
- #include <mach/memory.h>: }3 y4 h- }8 h. [) n. O/ d6 P
- #include <mach/hardware.h>
: y% h" {8 b1 ?' ]2 m) a) i6 ] - #include <mach/irqs.h>0 ^) G) k9 c( o2 O0 p* ?
- #include <asm/hardware/edma.h>8 \6 M1 Z. `* t; \# b
4 p0 q" e. s0 ?+ j M. {- #undef EDMA3_DEBUG
6 P g `: {( v4 w% _) g/ q - /*#define EDMA3_DEBUG*/1 q1 c% I, ^; h" E' b7 ^$ C6 @8 ]
- ( B( N) l; e8 {0 R: s8 A1 P0 K6 h
- #ifdef EDMA3_DEBUG
$ N, [3 F+ l3 j7 G( d& j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ }7 A( I9 e8 Q8 I+ o$ {4 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 S; P2 J5 a+ L: e: [# Q$ q5 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( j3 m# U- h0 N7 q7 b - #else0 P0 V; w3 c$ p3 y7 N3 g
- #define DMA_PRINTK( x... )
- t, k2 X* S6 }; X& u, q: J - #define DMA_FN_IN; C7 v" m# M6 Q) k( t
- #define DMA_FN_OUT( d/ W! G; U3 M* C1 n, J* e( K! W9 b
- #endif1 N5 P4 Q# \* ~$ F9 ^ w
- ; i9 e/ x Q5 G6 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 w* e9 E" h }: m6 ]
- #define STATIC_SHIFT 3, {# j3 J4 p4 `8 ^; {5 _
- #define TCINTEN_SHIFT 20' e C5 ]6 M% i" [0 z
- #define ITCINTEN_SHIFT 214 V$ D( \ @& M( D/ D3 @$ g+ d0 ^" z
- #define TCCHEN_SHIFT 22
; B' N- b9 @' F4 i( D - #define ITCCHEN_SHIFT 23
8 y0 o6 r) k* `/ [3 I
! \6 r+ G5 @8 m6 i) X7 _- static volatile int irqraised1 = 0;
, u$ H w+ k$ ~/ ~ - static volatile int irqraised2 = 0;+ B( ^" w0 Q. k% T1 J8 n
! i' ^, }9 z- P2 ^' b9 E7 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ~7 V" g. |' Y, Z5 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, `, f. _1 b7 s; _6 k) W7 ^7 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# Y, c; P% F& K/ G+ N3 R
5 d: O+ B- ?: a/ A1 i5 M$ s- dma_addr_t dmaphyssrc1 = 0;8 p ~6 u9 V/ Q% _2 [5 j% f
- dma_addr_t dmaphyssrc2 = 0;
0 H# N+ T4 i5 x4 l3 D3 a9 \ - dma_addr_t dmaphysdest1 = 0;2 r5 c( [& M& N8 n/ t( x, O
- dma_addr_t dmaphysdest2 = 0;
* z" Z8 T5 @, G' a2 m: I0 G
+ A3 d! `! w# \: M- char *dmabufsrc1 = NULL;
8 j" T7 W6 _$ L7 ^: f& R - char *dmabufsrc2 = NULL;% j) R* B* b* {8 R& G+ m" N
- char *dmabufdest1 = NULL;0 q; |' i4 d2 j0 L! J
- char *dmabufdest2 = NULL; t* @8 y1 G8 P( a1 C( V+ n. u
- 8 @, A+ H, f0 m
- static int acnt = 512;
7 M$ d$ ?6 w( K @5 u. |1 p2 ]1 b - static int bcnt = 8;
& D+ Z5 r0 G B8 J3 p a) C - static int ccnt = 8;8 ~7 g: f6 Q9 ~- u8 l7 d7 P
- # Z% t6 g. o f- Q% e
- module_param(acnt, int, S_IRUGO);
; p3 d0 H+ [; [. x7 z& l - module_param(bcnt, int, S_IRUGO);
- t5 Q0 f! K& Y - module_param(ccnt, int, S_IRUGO);
复制代码 m' |0 L( u( P
?3 V" v9 S) p# R4 `$ i8 L \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \" E# s Z% e7 c/ C5 ~3 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 r. r* y5 O4 U1 Y, C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ?- H4 |+ u" @) w6 v
8 M2 A( w9 F. Y6 Y
* ] d, ]8 r8 p6 T8 K$ j |
|