|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& x& V. Q- Y# M+ [2 } W! U/ m; b- Z; b2 n- [code]EDMA sample test application
7 a6 M- \5 U w# O. z - /*
6 z4 P1 `- p' Y9 d) R F - * edma_test.c
0 Q0 s/ I1 v/ ]. G8 @0 O% ~8 L - *
6 O/ a" X6 r6 d% g% I( z3 U - * brief EDMA3 Test Application& d/ x, W8 v& \+ a
- *& N1 c( d6 J6 O( j# m) I
- * This file contains EDMA3 Test code.
- g* F* Y8 ]( s - *
M4 Z8 f' q \0 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' T; T) ^( I: h( `7 g* [# _7 |7 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ P8 T6 R* g* j5 Y4 H
- * TO CHANGE.# d4 u9 t" v! e+ }* o9 F, {" C A
- *3 ` x+ M7 A, e- \, d ?, T& j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 o9 ]; D. O& ?( M
- *
5 Z) R* G$ \# k - * This program is free software; you can redistribute it and/or
0 G# }" c7 {5 a' e- a1 r K - * modify it under the terms of the GNU General Public License as7 J3 H1 j" R, m9 o5 F e
- * published by the Free Software Foundation version 2.
6 H9 h% J5 ~+ Q9 B" M- l - ** P8 ^+ u, O h! J7 m7 |$ `9 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; Z- `3 r4 \0 E1 [ - * kind, whether express or implied; without even the implied warranty
, g$ w9 S: q0 \% G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ K: X g5 u3 x( R8 v - * GNU General Public License for more details.
P6 D' J& B- X# j% V - */2 h$ j0 ~# g# h5 H
- ' u( e" G9 V, T
- #include <linux/module.h>
7 v, g y3 Z9 u- A$ K- u) R - #include <linux/init.h>
% i- R5 X. s9 G" P" Q; [; \ - #include <linux/errno.h>4 s/ C. S3 j( t, m' v
- #include <linux/types.h>: D! O+ I& T6 H q: F+ U9 E: f' i
- #include <linux/interrupt.h>, K; f! Z3 ]9 D9 w. x
- #include <asm/io.h>" M% b f0 O# a; c. q
- #include <linux/moduleparam.h>2 O- e9 D6 I$ E3 R
- #include <linux/sysctl.h>6 j# U5 q) {0 { @* w( Y# z
- #include <linux/mm.h>
# h7 i0 u" w7 L4 m3 a, L- C; I* O8 z - #include <linux/dma-mapping.h>
% a# k4 ]2 v6 e* n% E& H
2 V9 H$ ~6 p, a8 ~3 m% ?- #include <mach/memory.h>! d! h7 E* L( o1 n5 |8 o% ?
- #include <mach/hardware.h>$ t- _1 F+ V5 N
- #include <mach/irqs.h>
! C5 G+ n9 ]7 x6 I* s - #include <asm/hardware/edma.h>+ [7 k- R" x* B% p6 P% K8 R
4 R) j4 K5 `/ R- i8 L8 `- #undef EDMA3_DEBUG
$ _/ K' G) h' u1 R) w% I2 w5 }! E - /*#define EDMA3_DEBUG*/+ o* Y: v0 z# G- D k5 \
8 X" j7 Q/ z# \. b! x! u! c- #ifdef EDMA3_DEBUG
* F9 ~9 X2 L F+ _4 u" z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) c! u* M3 T: p6 |# T! |# s2 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 j; k$ u) w' N$ k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); m- L9 h% ]4 h7 r
- #else
4 c9 F% H5 Z+ O - #define DMA_PRINTK( x... )1 D1 A4 L! Q/ c1 ]+ P
- #define DMA_FN_IN
: b: H5 `2 t* m& g8 \9 W - #define DMA_FN_OUT
, t4 g m: ]7 `" q4 n2 R8 ^ - #endif3 n- b* C: b4 |& a* N5 O
- ' k9 s2 I1 W. a' r% J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# t+ q$ G4 f" i" F - #define STATIC_SHIFT 3
" u$ G% Y: E6 p' k) f, M# g - #define TCINTEN_SHIFT 205 v( N0 x' y. z
- #define ITCINTEN_SHIFT 21# t- |2 \ G4 V, c
- #define TCCHEN_SHIFT 22
1 v* |1 ^. z' ?" G+ P) X! w+ j- W - #define ITCCHEN_SHIFT 23; w6 ^+ v7 X; |9 `
- ( t. Q% o, j$ R
- static volatile int irqraised1 = 0;$ ~/ H2 j6 t( x; m2 ?1 l
- static volatile int irqraised2 = 0;
* ~- W; {* z) i - 0 g. ?7 [( |- H6 v% }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n( z, C( i- D: ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ @9 E* t8 S n6 G; S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' e" z: _# T8 ]
- 5 N/ B& T. X! G
- dma_addr_t dmaphyssrc1 = 0;
) @3 D( m2 f+ s& Z1 O3 n - dma_addr_t dmaphyssrc2 = 0; _( J1 O6 Q/ s1 G
- dma_addr_t dmaphysdest1 = 0;% g9 I e0 k; q$ m( q
- dma_addr_t dmaphysdest2 = 0;
' I1 ^! }& q( ~5 Y; D3 l* R; K
4 g& m% O1 f8 P, U+ H0 \9 n- char *dmabufsrc1 = NULL;9 h1 Y$ ~0 V1 { H! A+ K
- char *dmabufsrc2 = NULL;) ~" d& [6 N* B1 D
- char *dmabufdest1 = NULL;4 c1 O' v2 G# w( |& z2 {
- char *dmabufdest2 = NULL;
% l: [) m7 Y& o, K - " e! D% {. \! C5 K4 p9 q
- static int acnt = 512;- ~- `2 m C a6 O3 D5 ?4 ~
- static int bcnt = 8;3 o- c. w: ]4 |1 h
- static int ccnt = 8;" M5 R+ z1 r, g2 ]* _ s
) {% X7 x; K2 D- A1 R7 H. a) z$ O6 L- module_param(acnt, int, S_IRUGO);
" e' E$ {) ^5 X0 h4 w - module_param(bcnt, int, S_IRUGO);4 K$ J0 k+ y+ |
- module_param(ccnt, int, S_IRUGO);
复制代码
* t, ^/ d! e' b- \( w8 Z e2 U- t. U' }( I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 h0 K, G# ^2 b- Garm-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$ [2 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 ] C2 R0 S: D% F( c- n) o4 d/ @, O4 Q6 w3 T, Z7 ]5 j
1 X6 U% _, G5 q# X }
|
|