|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k/ Y' s7 T9 r7 ^- [code]EDMA sample test application) o3 z4 b! H9 J: W. G
- /*6 {+ I2 e9 ~8 s! g* ~. U, O
- * edma_test.c
& Y" z/ i4 i# l k8 ]: X* B3 Q' Z6 w - *
+ G' D; x( a- }, K6 S/ ] - * brief EDMA3 Test Application9 K8 f& N* B' ]; r5 I5 Q$ {2 y9 l- l
- *
8 j! x w3 F# _0 j - * This file contains EDMA3 Test code.# A, J7 Z& \! N# B+ H5 l
- * p8 }( Z, H' d. P& _, g/ J# F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
_+ c3 d& i2 C9 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ m3 T- y3 R. F4 E: f0 A - * TO CHANGE.
3 R2 c/ ]7 F! v y; M) g' H/ g - *& H5 {* E+ ]" |& b' r" C8 s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 e3 ]/ {7 |6 x; u
- *5 V" S6 n& O0 V2 V% n' s7 ]
- * This program is free software; you can redistribute it and/or& v$ i( w+ o0 E O) k0 ]- e
- * modify it under the terms of the GNU General Public License as% B/ Q- E6 ]# S7 h4 W: k# x* D' `
- * published by the Free Software Foundation version 2.
4 L, z" O8 a3 X4 F - *
( `; H2 D- I @( P( ?; N/ [; S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' t- l; A) u6 L. Q( ~ u7 `) O0 O
- * kind, whether express or implied; without even the implied warranty
# e0 F% {* g1 p/ O+ l6 ^- ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 a; G7 S! r( Z - * GNU General Public License for more details.
' S* x8 A4 q# r. @ - */
$ p6 E L; Q+ o! `# [& o - 8 a/ ~# l0 w9 O c* t" q
- #include <linux/module.h>6 y# i( Q! _0 r; \, y( S' C/ @
- #include <linux/init.h>
" V3 W. E! P2 r" v6 l3 g+ @ - #include <linux/errno.h>1 {7 r, L$ g2 Q! K; N/ o
- #include <linux/types.h>
4 j8 i) s+ z; S) M& u - #include <linux/interrupt.h>
% l$ l: q, U3 W( Z" ]: y& X - #include <asm/io.h>
% T# h; M0 z9 T: u3 t5 u1 w - #include <linux/moduleparam.h>
4 g, n, v7 M: E) m h - #include <linux/sysctl.h>/ t9 s, }: d" ]# o I2 B' |7 S' e s
- #include <linux/mm.h>$ b- u0 U6 t) n# U- E4 T
- #include <linux/dma-mapping.h>
0 m% e. R5 L1 e6 {6 m
$ {) Q& ~# ?" _& B" g; _/ X. a- #include <mach/memory.h>
0 {: c8 c' z: x- I3 S$ W - #include <mach/hardware.h>
& {2 v$ r9 P- P( N/ I - #include <mach/irqs.h>
1 B2 ^8 Q# S, E2 m4 K( t - #include <asm/hardware/edma.h>
9 z" a6 o0 _+ Q I4 K+ c$ K
, }& w# C9 q& z) H; F) {& b- #undef EDMA3_DEBUG
( O2 {& m; i+ Y6 q$ K/ U' g - /*#define EDMA3_DEBUG*/2 X Y; p9 ?. O3 s* r1 h0 j
3 }" K* k/ v' w% d- #ifdef EDMA3_DEBUG
) {* U( a, [# ~4 o% B; n6 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 m5 V) L2 o5 j" y- n( I0 w9 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, l+ D& d' ^! `1 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 x/ |. t% b F; b: ]+ J1 Z
- #else" z- Z$ [$ K8 [* |& o$ D
- #define DMA_PRINTK( x... )
7 n/ y/ C9 A/ g+ W* C) p4 a( n0 ` - #define DMA_FN_IN
n" P- K7 p( } - #define DMA_FN_OUT m/ c2 R* D. E
- #endif0 a% M [! C+ d) G1 _, Q
- 8 u) f, j2 S/ Z+ {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) `+ B6 h4 x$ n - #define STATIC_SHIFT 3# Q9 x* {5 `& W1 r# Y
- #define TCINTEN_SHIFT 20* `7 n! i$ q$ }* U
- #define ITCINTEN_SHIFT 21
, x1 R9 n7 G! y: @" V5 [ - #define TCCHEN_SHIFT 223 E" z' H. M" k* o5 j4 L, k# @
- #define ITCCHEN_SHIFT 23
3 Q' B5 B) ?% X) c2 P# [' h4 N - 6 j; x6 t" V. e6 B; o
- static volatile int irqraised1 = 0;$ g% T& C* n& u( w% P- ?/ h& w
- static volatile int irqraised2 = 0;7 p g2 Y) X# P) [& p, I/ W- k
7 b8 K, @! K/ h7 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 V9 `( I8 i% C Q. z+ \) q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, @: Q0 y' m% ?( V$ E- T% a3 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ u! p4 I' u* F( P
3 {+ k: C; n0 n, Y( [( Z( L- dma_addr_t dmaphyssrc1 = 0;6 b8 G$ j. X/ N
- dma_addr_t dmaphyssrc2 = 0;
5 C2 d" i6 O7 y4 n" `" A( h+ g E - dma_addr_t dmaphysdest1 = 0;4 i1 t. X' \# Q2 k1 Q8 v, c
- dma_addr_t dmaphysdest2 = 0;
9 }$ g& n7 }' E8 ?; u6 g7 e - 5 x8 M; T0 D1 k, F; v
- char *dmabufsrc1 = NULL;, @/ Y! Y) Z' i) t+ W
- char *dmabufsrc2 = NULL;
" \& o$ _ [! g) i. G9 \9 a. ~ - char *dmabufdest1 = NULL;& G( |" N, G. P( x, E! k5 I
- char *dmabufdest2 = NULL;
: t% p0 F7 i q5 w. d- t6 t - 3 J$ R; T3 E. T
- static int acnt = 512;
) d4 h# ~% y. y* G - static int bcnt = 8;
" p, v1 i. @/ U7 j - static int ccnt = 8;
5 V, d2 ?4 O4 ^- h& |
, m/ u$ L) @. C7 l+ Y4 y A- V0 M! Y- module_param(acnt, int, S_IRUGO);: ]- s- l$ }2 v* s: b3 u% p* Y
- module_param(bcnt, int, S_IRUGO);5 w j% x; W6 a+ m
- module_param(ccnt, int, S_IRUGO);
复制代码
1 {! ^/ i5 s3 ]1 p
2 m4 ] z9 m( [% m) G8 R; v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 w$ E* [7 Q: a$ k, varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 g1 w; l( Y; h) {8 e: u' r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) J; [3 N; L& H0 c
9 q# b' X! f- A, p
0 Z8 a7 O! g- m |
|