|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 S6 g* K) A. G( o
- [code]EDMA sample test application7 k, l+ ^6 @0 o$ ~# R+ m
- /*2 Q. n8 d- P I4 [" }/ S
- * edma_test.c( K3 q7 W/ D2 E# H% [ S6 \1 s/ e% O
- *( m, s4 A+ p' c6 w# ^
- * brief EDMA3 Test Application
9 p/ c9 q; J- @. _& a - *
' Z) s, E1 K) J: x# w - * This file contains EDMA3 Test code.' b$ ^4 \( b u% f6 k e
- *
5 g [' m, k. _$ N8 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) I5 d: x5 l; ? B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! S; i" e t' k5 K+ f6 @: v - * TO CHANGE.
# S3 W" U7 B( j- c9 `# [ - *, ?$ J; l9 C' N) D" D0 k: f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 H& _7 e- I! c d* X4 P - *( r, k; p$ _, n
- * This program is free software; you can redistribute it and/or
; K8 m- M3 H% z: a* j' ] - * modify it under the terms of the GNU General Public License as
0 t; d; _& e' H" K7 A2 c: o. U - * published by the Free Software Foundation version 2.9 O! E0 r. X% p' \8 x9 ^/ R+ }
- *
; m/ q/ ]* J, \7 }1 K! H; U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 `1 | R5 e+ q3 o1 W$ T* O3 @ - * kind, whether express or implied; without even the implied warranty4 B4 m, u" `2 x% P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 J+ X0 X. R1 E2 n6 U
- * GNU General Public License for more details./ U9 u; D# Q1 s/ |
- */
, S4 P5 j( q5 E+ x4 q
6 {+ q5 L4 y. U) @( s8 W- #include <linux/module.h>+ g$ y$ `$ ^# {4 e3 \1 k. A1 _
- #include <linux/init.h>1 n& N5 C7 E, k1 J: S, S
- #include <linux/errno.h>
, A# P( v2 V; d& F, p0 L6 h - #include <linux/types.h>0 A1 L% m, j( ~0 s; i. I- N
- #include <linux/interrupt.h>
! C, K* m4 c, f8 e. A - #include <asm/io.h>+ \7 K! s& {% j$ \6 U% G+ S" i# B# K
- #include <linux/moduleparam.h>! R2 |' ], ^4 ?: }" U- o, g
- #include <linux/sysctl.h>
7 ^8 `& ^* P0 R0 Q) \7 p. y - #include <linux/mm.h>
' e, k' {; r3 ]# e, R! g - #include <linux/dma-mapping.h>6 M& v2 u6 d: j' Y K" G
/ H$ W% i/ [, d n6 E& L- #include <mach/memory.h>+ F- W! C. E6 ?6 s3 I, p) \ Y
- #include <mach/hardware.h>/ S# t V. j" Y Z- D' o- Q
- #include <mach/irqs.h>
9 ^1 F( e) E( B' {$ T - #include <asm/hardware/edma.h>
1 y p- _7 C' e, P) j - 5 o/ E9 O+ A9 p" t1 j
- #undef EDMA3_DEBUG
' V8 K; R# F$ [! D) P4 Q q - /*#define EDMA3_DEBUG*/+ J: M' I5 K! G+ c P$ N% ^' F
/ {+ e1 }% e8 D( r- #ifdef EDMA3_DEBUG. B) [9 Y, K9 |! w/ K% J9 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^" }! c% M" p$ l, Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 o) i |6 @! j1 ?; Z# }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |8 y6 y8 h! m+ x9 k7 z& H' J
- #else* p' B. J! k" N; i5 {
- #define DMA_PRINTK( x... )
8 c. N# @4 T5 I - #define DMA_FN_IN
+ `9 T* Q$ y9 P - #define DMA_FN_OUT/ X/ |* {3 f" D& s# s+ |- C" i
- #endif- w: L( B; w6 k5 Y+ q0 a
+ |( [2 G& c. W- #define MAX_DMA_TRANSFER_IN_BYTES (32768): Y8 N7 T. e+ x/ L. S
- #define STATIC_SHIFT 3
+ `) K# r' u E# H% J5 a( F% Q - #define TCINTEN_SHIFT 20" @, s6 j+ @2 S/ X4 C0 q
- #define ITCINTEN_SHIFT 21
/ {. ^% A9 ]# I- i - #define TCCHEN_SHIFT 22
0 l O8 W+ U- H6 W$ t a: c- q - #define ITCCHEN_SHIFT 23
' ^# _8 |$ i6 j4 `- Q) A9 _
3 r8 ? h- P5 J0 M; \2 @) O, D$ q- static volatile int irqraised1 = 0;$ m% _* w7 U y. Q4 W
- static volatile int irqraised2 = 0;* t$ ~& q- p" p4 G$ n$ X7 f
$ d c1 _/ k7 ~8 w" N. c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Q+ A: e, s# O# j3 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 R9 s y7 e. P1 E( C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. `1 S* ]6 |. c8 y3 Q1 W! C/ u - $ G4 u5 a; _+ T
- dma_addr_t dmaphyssrc1 = 0;& ~2 }' w+ Y N6 H q0 ^
- dma_addr_t dmaphyssrc2 = 0;
5 z- L1 \0 a: G5 N0 M - dma_addr_t dmaphysdest1 = 0;# _7 _( f- J) I, A4 l2 [
- dma_addr_t dmaphysdest2 = 0;: ?; d; z7 ?( {7 |9 w6 n. ` A
+ |. M0 J" F% p8 Y' L3 J" C# t- char *dmabufsrc1 = NULL;1 \# N i7 W' l5 T% P
- char *dmabufsrc2 = NULL;
; e( E* X1 g% [# V3 f - char *dmabufdest1 = NULL;
- S7 |. Z. L5 [' B6 l7 @/ ^* b- L - char *dmabufdest2 = NULL;
' @# _. ]7 r$ w# C0 E# p+ p
5 a+ s' x5 \" P9 E# S7 q e- static int acnt = 512;% z0 P$ v H0 A$ J7 w1 r
- static int bcnt = 8;
' i5 I! p9 ?& j8 ? - static int ccnt = 8;
8 h- m1 u) d" c" F7 U3 Z) T3 G7 f- _ - ' N+ _4 e4 Z. v1 ]; c& b9 v
- module_param(acnt, int, S_IRUGO);& Z" m2 l4 ?6 W; @0 ^( T+ w1 m# u
- module_param(bcnt, int, S_IRUGO);& N/ W# K" b4 D; h$ i& r+ O+ ]8 Q% g
- module_param(ccnt, int, S_IRUGO);
复制代码
; S, a1 K* ~' ~& p+ `1 ]3 E) @4 g9 V1 ^7 B7 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D, \' }7 _" P5 g/ j9 P2 ^; C6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, N5 w7 y6 O# w% ~5 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 F. {: N: ^3 y( h# R3 \
8 T1 J. M* s9 h" u9 Q5 A0 k9 T _1 `+ M8 ^9 |1 D2 J
|
|