|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 y- a, d) O- w$ w# V o0 v4 B- [code]EDMA sample test application
5 j, B' e# t% ]' \4 d% @8 } - /*% l/ D, b+ B. P; [
- * edma_test.c
5 q0 e1 t0 r7 \4 X4 B/ d - *& c, U( _+ }% T T/ V j
- * brief EDMA3 Test Application
1 m8 v" Q" j9 N1 |4 v3 l2 D - *. k8 K7 Y5 U! C: t! T
- * This file contains EDMA3 Test code.# n j% Z5 c. R4 d; U) Q
- *
' m! r) f; e, N/ k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 T i( i) {; f6 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- @; k. ?$ M- \. t! h" V+ b
- * TO CHANGE.: o8 ]2 J1 n' W7 l
- *5 H; T( a& T4 z- C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 F1 ~2 w5 H+ z: `5 H
- *. |- A* I6 L, p* |7 `
- * This program is free software; you can redistribute it and/or
2 F$ j8 f Y! l( L- o - * modify it under the terms of the GNU General Public License as- A9 V3 j. X$ o
- * published by the Free Software Foundation version 2.2 [0 i* X5 z, g: `- ~
- *
8 t6 P4 d$ r) @, ~: Y# { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 e- W* n; K& F8 ~9 x
- * kind, whether express or implied; without even the implied warranty* o3 g; }! y; H% m9 Q7 M& ~$ M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! O1 ?4 J; z9 p/ w1 S
- * GNU General Public License for more details.
" g5 `% _2 O. m - */! b9 K0 _& ?7 L( S/ m
' Z) O: d5 V; N. v- #include <linux/module.h>* J$ \6 G: q! k. e
- #include <linux/init.h>7 A# M' |4 B! H# U1 N. u
- #include <linux/errno.h>% c) r. p4 A6 @" ?5 u" e6 s
- #include <linux/types.h>7 ?- U- F) o3 j( I/ j) h% h
- #include <linux/interrupt.h>/ W6 r' l/ ]) k1 k8 T$ j: c
- #include <asm/io.h>) Y4 { b0 Z& |* O
- #include <linux/moduleparam.h>. k8 T: y( G, ^4 k" F
- #include <linux/sysctl.h>
J$ y# X( `7 n/ z6 E+ v$ n - #include <linux/mm.h>+ v* L) M- U+ T0 r$ P
- #include <linux/dma-mapping.h>, Q' i$ }: N" | _' J$ F( _* H8 M
$ Q- c. O" _0 o0 \- #include <mach/memory.h>
, w( L8 P. s3 l% t% h E! o - #include <mach/hardware.h>* o( t! f4 t- l" P) l5 O4 r0 p
- #include <mach/irqs.h>
5 E1 m) l# l; k n0 g# F - #include <asm/hardware/edma.h>/ u! r, D# x5 b' k- u
% g1 k) n! H. E% G6 N- #undef EDMA3_DEBUG
8 e0 E8 X- T% H# H+ V8 d - /*#define EDMA3_DEBUG*/
. d, g+ S# o8 t. h4 i+ y' _9 Z. H
! R1 B: ^& P( {0 K* Y- #ifdef EDMA3_DEBUG5 ^+ `0 q7 G4 U( g- N% C9 E$ `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 M- E" \+ f( _+ z8 G i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 l7 U, v6 E1 R7 u- x9 [1 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ~7 S l9 F! i4 N+ @
- #else
5 l. t( [& `2 s5 @5 n( J - #define DMA_PRINTK( x... )
+ B# ?- c0 C; | - #define DMA_FN_IN6 z6 T9 F5 d1 ~- P- d/ \ f
- #define DMA_FN_OUT/ U7 X! U( {' b0 N# g
- #endif
& }- H$ Z" n. g - ; ^: Z- _* j; N( q5 [- L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 M* Q: ?% {( @5 @; P5 J- q9 Q1 j - #define STATIC_SHIFT 3
4 R' h3 e4 [# m) P3 M1 f - #define TCINTEN_SHIFT 20' ]6 G+ k* Y$ s6 l* J8 T( d
- #define ITCINTEN_SHIFT 21
4 Z- N: [ Y f8 l6 _6 [* M - #define TCCHEN_SHIFT 22
2 x/ S: O/ S& x% \ - #define ITCCHEN_SHIFT 23
9 ~- {) c# I$ T, [$ M5 { - ' Q6 p# q8 C3 }0 g5 ? A
- static volatile int irqraised1 = 0;# t" S0 E! T4 X
- static volatile int irqraised2 = 0;. a8 `" w" Q/ E" G" @( T
; H, i$ {* |3 U* G9 C+ F: q# C$ z9 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) I; C% j p2 z! |- l; f ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N$ ]9 }7 w( f, e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q) M( e) {+ J$ O1 ?4 x/ t
$ U. f% A* U2 C. m- dma_addr_t dmaphyssrc1 = 0;- s N# ~$ ^8 U3 I& `
- dma_addr_t dmaphyssrc2 = 0;" N( j1 n( Y( t
- dma_addr_t dmaphysdest1 = 0;) S! g8 a6 z, N) m
- dma_addr_t dmaphysdest2 = 0;
# }! m3 U: b0 |' C* O - # U) m* s6 ]! l6 j
- char *dmabufsrc1 = NULL;6 J. G( y0 I; p# D$ m
- char *dmabufsrc2 = NULL;
" h) F7 G+ O. v. w% H `) J - char *dmabufdest1 = NULL;
% e9 ], U4 N2 A, M - char *dmabufdest2 = NULL;
. g5 k& j1 ^. G* u7 t q4 f - . X& t, u( o6 G( C! {
- static int acnt = 512;' ^* r) z; W- Q. I( i5 B
- static int bcnt = 8;. S4 v, t' }: S }, z
- static int ccnt = 8;/ d& X a' I8 X
4 A$ S7 R: Y6 {( Z1 C: t: Z) m. u- module_param(acnt, int, S_IRUGO);" b# f# \( z9 S7 s |- [4 f/ a
- module_param(bcnt, int, S_IRUGO);/ M M' g0 ]- x6 T' Q- Q, _
- module_param(ccnt, int, S_IRUGO);
复制代码 8 q; z( O' i3 ^$ C' y) l
- _, R( S- z' c# C1 M, G6 g: T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 ^9 e+ ^( e$ o) f9 A" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& T' z4 n4 T0 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V; d: O, l: K8 [& ^1 m$ Q
/ P4 C/ B1 j3 w. e$ x& ]$ ~
- S) S4 o2 |% V; R5 \ |
|