|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 d& X; j- f5 ^ G4 ], y2 {- [code]EDMA sample test application; R; L; S& ]) f6 Z3 N h
- /*
0 @; H# T. S8 t1 m" W6 N - * edma_test.c
7 W7 s2 Q7 {. B - *
4 v. f$ S- v1 v - * brief EDMA3 Test Application8 Z8 B3 B. R9 t0 j
- *" ?0 M) D' T& y& @
- * This file contains EDMA3 Test code.- ` Z" Q8 q, V7 p: `8 a
- *
: A y5 P H4 x( Z- y7 u. e" l& S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* H& i& Q& q* l- S; b2 j2 B. {, C6 r ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 d9 y5 s' B2 q* g2 ~
- * TO CHANGE.0 ^ e$ V6 R+ E& @
- *, z- B; [9 P$ C) l: `: a' E6 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" \+ `7 B5 p! q6 v
- *4 z2 R: v2 H$ s, m4 W% `
- * This program is free software; you can redistribute it and/or
7 `3 H9 x% N+ ~5 n1 C3 y( j - * modify it under the terms of the GNU General Public License as
$ D& z# w1 x' _ - * published by the Free Software Foundation version 2.% ]6 A# u0 s% E6 W/ I
- *7 n( R0 d$ x/ B5 D4 Y% I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 |- `* y8 V) B4 `+ T2 X$ I/ n - * kind, whether express or implied; without even the implied warranty
1 k8 [0 x# q: u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& a0 I0 V( h: q: O: {( W - * GNU General Public License for more details.: E: C2 I O6 a; r0 u5 t
- */8 z8 Q% L6 p9 Z! D; d
4 P# b- X5 h5 Q7 o" U- #include <linux/module.h>2 s& h3 _# B' O
- #include <linux/init.h>; \+ y9 d* G- e J
- #include <linux/errno.h>
# I- c) ?1 w1 k& x- a - #include <linux/types.h>
: }" j q% A. |1 ~8 ^+ k - #include <linux/interrupt.h>
" I1 \, \3 X+ W - #include <asm/io.h>
$ X3 y. Y& f: F% H4 I& B* [ - #include <linux/moduleparam.h>
# x# k& d. h0 f0 ^4 X - #include <linux/sysctl.h>
% }4 @4 D' I5 D" U' N4 L" Q - #include <linux/mm.h>
/ G5 n! o6 t9 F! L, ?* Y0 ? - #include <linux/dma-mapping.h>" q! Y; l. h$ P/ D% |" X
- . I& }4 d/ e) W* W9 q S
- #include <mach/memory.h>
; e4 X$ m! a+ N" _$ x' p - #include <mach/hardware.h>
- f6 f7 j2 M0 u, a, o8 ~ - #include <mach/irqs.h>
7 {# m" }9 y$ R& z& a# W - #include <asm/hardware/edma.h>
! M+ y' o6 w0 z
; q" |/ T- v9 G, o; o7 C- #undef EDMA3_DEBUG# K% l, a3 V2 A% W
- /*#define EDMA3_DEBUG*/+ Z3 }9 s* v' V- i: ~; {
- 3 S) z7 t9 ?, m4 l$ i) L' L+ i e
- #ifdef EDMA3_DEBUG
/ r) n/ W& t8 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# r3 T+ p$ K I" Q* r, g/ L. ]) E1 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 T0 i: g* c7 Z, X4 m2 M$ Q- F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ?8 a( b! z/ D4 m+ x
- #else1 k7 g8 ?$ z+ A$ Q! q: Y) e9 D/ F7 v
- #define DMA_PRINTK( x... )- r/ ?- r& F: [5 C
- #define DMA_FN_IN
" l9 P! V. Q4 a" K$ u - #define DMA_FN_OUT Q& Y3 N# l. O0 {" m& S
- #endif
; h1 I# ~1 z+ ]+ r" P0 s6 i9 t
. p. M0 V" h# ^$ ~6 V& J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. v' p, O" i1 e. \/ s: m" L! A - #define STATIC_SHIFT 3% O& X ?2 S! w+ e0 W1 O
- #define TCINTEN_SHIFT 20
( c( Q) ~( `5 K - #define ITCINTEN_SHIFT 218 H* P; H& ^5 U
- #define TCCHEN_SHIFT 22
% c; b! i' }& L8 C _( Z - #define ITCCHEN_SHIFT 237 x" c F ^1 K( Z$ c) {$ }
# M! h5 _6 B- J" z' p. A% h& X- static volatile int irqraised1 = 0;
* u- P* p1 Q0 k& A* b - static volatile int irqraised2 = 0;
/ @' L: q% ^! J( b0 c8 D1 l1 E3 D8 w - ' A) C5 o+ e1 D8 t% X* ?/ B9 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }* j' F L/ Q9 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J1 ^2 M% g: ~3 r$ h( ?* P2 _9 Q$ [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |( [( n- x- @$ J5 r
- ) t6 t( n5 Z8 }; t$ |5 \) G2 A
- dma_addr_t dmaphyssrc1 = 0;4 l( Q9 _' p$ ^. ]+ S
- dma_addr_t dmaphyssrc2 = 0;
3 Z3 S; B. R; M/ z: x% [1 Y - dma_addr_t dmaphysdest1 = 0;' L4 j5 ~5 Z; T5 v5 _+ l9 A9 o, n
- dma_addr_t dmaphysdest2 = 0;
* y* y8 [; Z3 w( p - ( b9 t. ?1 X9 H+ q! S6 B g
- char *dmabufsrc1 = NULL;# t/ b) F( A) V1 N5 e
- char *dmabufsrc2 = NULL;) {8 S1 Y* O! g* n$ Q$ Z1 s
- char *dmabufdest1 = NULL;
" f3 c7 z( x, R* R2 a# L5 | - char *dmabufdest2 = NULL;
2 f( z0 N1 z: |9 G+ d1 ~, w
: Q* ^2 @+ A6 g _9 n, y1 S' I8 t- static int acnt = 512;7 c8 S/ j- ~3 d) S+ ^
- static int bcnt = 8;
5 ~. e, a+ l: |+ Y9 ]# c" m - static int ccnt = 8;0 a' S" A' t1 G6 x& e" z
& p |5 T8 U5 X$ [9 n- module_param(acnt, int, S_IRUGO);4 Y9 ~) }4 Y, ~1 C
- module_param(bcnt, int, S_IRUGO);4 R: [" Y4 T) [* g- z- h' k
- module_param(ccnt, int, S_IRUGO);
复制代码
* p) U9 y$ k d# x7 e5 B7 X
" f9 M+ W+ M9 m! l$ f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( v3 W& f, W5 k) N1 G# L6 {4 u6 qarm-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 b( M1 V: ?$ p' @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. m ? ^8 R4 t3 n/ ~2 a" I2 N! @
+ y# ?8 L E% w \9 @- k
. }7 ]- U+ O" f: U |
|