|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 k+ ?, U" t3 v( ]/ g; b k- [code]EDMA sample test application' k, E- u8 q( V3 \
- /*
9 H: s. U, J( i8 K% A - * edma_test.c
7 q3 O! v! C [* Y+ N - *+ b; D2 n$ Q. J8 V s2 Q# [ G
- * brief EDMA3 Test Application. L, Y1 o( v! b8 B' _1 u3 z
- *' w# ?- B3 s% d j9 ~; K
- * This file contains EDMA3 Test code.$ K5 i q6 U* I# |+ W8 C0 `6 ?
- *( Z" N' r. N3 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ k* p8 X, `9 p" y1 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 ]6 u- z i5 \1 V - * TO CHANGE.) @9 A0 C1 H; O
- *" h. M( a( h; ]1 x& h) C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l5 S$ n, |; ^2 j
- *
8 D1 h. ?* O* r! T - * This program is free software; you can redistribute it and/or" |5 J7 n( D- m, a
- * modify it under the terms of the GNU General Public License as
2 E. f0 d7 e4 D& u - * published by the Free Software Foundation version 2.) ~/ C5 Z2 Z6 t
- *. u5 P- W; I, i; Q" U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o8 z1 w* n: u. X' l8 `
- * kind, whether express or implied; without even the implied warranty* [0 x" \6 V9 q* q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( C5 ]) J* }$ H3 {+ D- a
- * GNU General Public License for more details.$ V/ d1 t0 I% d: T% @
- */9 F U: B% m# x% ?
+ ]. m, F; I8 q+ U, i5 y- #include <linux/module.h>
9 c5 H. }* {- f/ ?8 ]. R - #include <linux/init.h>2 }3 z" C1 i( J0 H6 U
- #include <linux/errno.h>' X9 U+ Z' u0 J
- #include <linux/types.h>
7 q) _; h5 d& y9 M - #include <linux/interrupt.h>' t) i. w. i1 J. w3 O6 z
- #include <asm/io.h>7 L: s0 c# L* A6 O z0 L, X
- #include <linux/moduleparam.h>& D" p1 T1 s8 o2 e5 e) \
- #include <linux/sysctl.h>
/ g' B& G( T+ a( m6 _' v' c - #include <linux/mm.h>& M L& G" r/ `: j
- #include <linux/dma-mapping.h>: z6 W2 [0 j8 S4 E) j- C
- |/ ?" N) D. q/ I' ?7 h
- #include <mach/memory.h>
: B; C) E9 O5 `2 F( } - #include <mach/hardware.h>
: g' M/ D+ c' a - #include <mach/irqs.h>& _ j/ m2 ~# d: B' ^" H' t% f
- #include <asm/hardware/edma.h>
2 l$ X) ~% ? j+ ^+ T2 y( g9 X) W
/ E* u& a6 ^5 M E/ j) \0 r- #undef EDMA3_DEBUG
2 y X! o$ U; I. D1 \/ U5 Z* V - /*#define EDMA3_DEBUG*/ e3 T7 R$ y* N+ o2 ~4 V
- ) e. h) Y8 \; T' `6 G" T" X
- #ifdef EDMA3_DEBUG1 {0 m+ ?$ l, Y; d% p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). l( |7 r; w2 X, s( W/ ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* X% d5 u5 a3 ^6 F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! p; x! w3 `8 `5 @# ~1 e9 s - #else. H7 p8 X$ ^" X
- #define DMA_PRINTK( x... )
! E. O0 i/ Y- d8 X8 g/ S - #define DMA_FN_IN
5 P( z9 h2 x3 `+ z5 |2 K y - #define DMA_FN_OUT
) T" R. U O, K. D - #endif
1 a$ K& r8 {' F0 v4 H2 P
% j# c+ C8 X: B6 f% l/ B. ~2 W( j9 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( ~% N6 A( J! d7 }; n$ Z - #define STATIC_SHIFT 3 ? F2 R& X: i1 U
- #define TCINTEN_SHIFT 20
' b7 [3 Z4 v. r2 W/ b. n A" i& W - #define ITCINTEN_SHIFT 21
1 |1 s+ K" O- t4 U8 N4 @0 `/ a3 Z - #define TCCHEN_SHIFT 22: R3 y, ]5 z1 s; s- a
- #define ITCCHEN_SHIFT 23$ `7 n/ ^; Z. L- `( g% d
- 7 O- D/ E9 a) P, y6 |
- static volatile int irqraised1 = 0;2 C1 N$ g6 n2 S% G% C3 X5 j
- static volatile int irqraised2 = 0;
& R& }4 |. n* P2 \5 Z& P" u/ n f& q
$ [* g# w3 \( u: I; n# F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m( C6 w. A/ u0 D% L9 z, W- z { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, i2 `8 }. K5 i2 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l+ P2 s! ~ R# q) [
- ; i; U2 G6 A/ U0 M/ } ~5 S0 h1 o& N8 G
- dma_addr_t dmaphyssrc1 = 0;* T6 m9 K5 W, U$ W2 z& @: [. w3 O
- dma_addr_t dmaphyssrc2 = 0;2 A+ ?. G! T6 m
- dma_addr_t dmaphysdest1 = 0;
! F; O! W; T/ v/ L4 ^ - dma_addr_t dmaphysdest2 = 0;
2 j S/ m; v9 g0 @& J8 x - % J" c; }$ `% F8 M9 F
- char *dmabufsrc1 = NULL;- z% A$ [, ] P. Z
- char *dmabufsrc2 = NULL;: i2 L* u$ u9 L( R
- char *dmabufdest1 = NULL;* @* e) F% p( P6 f
- char *dmabufdest2 = NULL;& L+ M: k h0 h0 H3 s6 m! H2 \1 z: U k
$ `- \$ d& X% \% O. o- static int acnt = 512;
! K0 p( g; R7 j/ {6 s( ] - static int bcnt = 8;
# H7 G; \& Y4 J: k/ K' E! T7 D - static int ccnt = 8;
7 V2 S* ~, g. A - ' {$ t. p3 Q* n' q; Y
- module_param(acnt, int, S_IRUGO);6 I8 D1 a9 f0 J! l, W+ t& ?$ y3 N
- module_param(bcnt, int, S_IRUGO);2 ]$ l' _* X; ]- c/ B) h
- module_param(ccnt, int, S_IRUGO);
复制代码 $ H' J5 T( ^: y# L/ v/ ]
( C8 @" O7 {) L; k+ Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 {. E5 G1 C( z8 O" B, p5 ]' ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 w8 m1 g2 y0 v4 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }# \: Q, _" ~% T2 @6 o
* N8 R! e. p& Y+ u7 S# k" D* [( p( v9 O! u" F5 S: U0 K
|
|