|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 k1 \. ?$ \) @2 Z7 }2 v
- [code]EDMA sample test application y3 X% J8 S) L2 X
- /*
9 I' a2 Y$ m) c- G - * edma_test.c* Q- t& W8 b# v, |& S& n! A1 K
- *
% ]/ @% t# J, }* q& e. ?$ C4 V - * brief EDMA3 Test Application1 W. n6 i% ~- H. i g
- *
6 l Z% b% f( w3 y9 p - * This file contains EDMA3 Test code.
$ \" ^, O4 M+ K" P/ y p% C - *$ d0 i0 Y4 U s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 G3 D% @' t' f" x' t6 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 y. X- ?3 I' P- C( c - * TO CHANGE.: x f2 D" G. x8 |
- *. U" X: q, y4 w8 z# u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. h6 q* t) `; Q# \% D Z6 I
- *
9 Y% b# H/ c" D) ~ - * This program is free software; you can redistribute it and/or
6 n4 J2 i5 W: N& I - * modify it under the terms of the GNU General Public License as
6 J: N: I+ U$ Y; F8 ^( L8 K* R - * published by the Free Software Foundation version 2.
$ P. p0 N3 M( m; k - *3 R# D8 m$ s5 x2 p) |1 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 Q% i* R; F+ \$ [" { - * kind, whether express or implied; without even the implied warranty
& T0 b: P. L- A$ C1 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' X" X; N, z5 j
- * GNU General Public License for more details.
9 y- T, V q* Y/ B( E - */
" U" t2 S6 G9 S1 y+ P. H$ v
N' Z6 t5 t" z- \- #include <linux/module.h> r+ |' E2 w! Q& q' n y0 h
- #include <linux/init.h>
) A; h4 D& t( p- L( h - #include <linux/errno.h>+ B! Z7 U- J; ~
- #include <linux/types.h>* X" l2 m. f' B% I; w
- #include <linux/interrupt.h>
9 R& w. s# S1 u) h! L2 [* ?/ K - #include <asm/io.h>
- ^5 k: g& n0 q! D+ V& I" Q4 x7 k - #include <linux/moduleparam.h>: X5 |- V+ l0 C, E+ P. P! C
- #include <linux/sysctl.h>- ]( C6 J+ S) ~2 ~
- #include <linux/mm.h>
+ g- v) K+ a, P4 x - #include <linux/dma-mapping.h>4 |( D2 a! j+ p: a1 X& A
- 3 x( i" q$ O. L. {5 L6 {
- #include <mach/memory.h>
$ R1 H& A! r; f3 Q) I1 b( W9 S$ s& Q - #include <mach/hardware.h>5 `$ Q" ~; c% m0 p
- #include <mach/irqs.h> j# M3 q# }% r2 C8 H% W. j, ]5 v- p
- #include <asm/hardware/edma.h>! r/ {! y1 o# T- ^
- 0 o( B; y3 W5 L+ ?9 A8 Z1 n( N
- #undef EDMA3_DEBUG6 l( ^% p6 ~* @
- /*#define EDMA3_DEBUG*/
9 J* v: G1 d+ ~$ r9 C4 [
0 t, [' F. b0 {- #ifdef EDMA3_DEBUG
6 E6 z1 [2 ~/ m# t1 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 D9 l8 ~$ S( I: \: h H8 i U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ?! ?/ s ~, W& l' x& Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) \2 I, h1 R+ [2 R8 W" { - #else" O2 s; U2 P$ q2 m+ C: j
- #define DMA_PRINTK( x... )
* m! ~: N$ S K - #define DMA_FN_IN G q9 {6 V* W, S1 z2 g# I' E
- #define DMA_FN_OUT
7 s8 l: q& ^( P+ f! B" X - #endif* Q+ f2 B" X6 P$ R% Q
- % J& w9 n& m* D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). c( E7 r f- F' o: W
- #define STATIC_SHIFT 3, q" y; T. D( }' t" q
- #define TCINTEN_SHIFT 20$ \" B6 b/ r6 W
- #define ITCINTEN_SHIFT 21! P5 X, W1 C$ @' j! h& z
- #define TCCHEN_SHIFT 222 A% x, e4 o( g5 h0 g5 _% W( q
- #define ITCCHEN_SHIFT 23. S6 f: _9 j. H! m& B) z2 B7 ?
+ h+ O+ P3 }" `4 m& G, t3 _- static volatile int irqraised1 = 0;
0 i5 A% o: Y9 J4 g4 S3 }; f$ F7 D - static volatile int irqraised2 = 0;8 w5 a' o$ h8 _& C
4 h) s' Y4 |8 v5 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; J! D1 G M, D! m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 g3 j. r6 O w( x Y6 V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 u# Y' x- d7 v. v - / p! H( U& w1 X: }2 ?! ]+ \
- dma_addr_t dmaphyssrc1 = 0;" m/ v/ D/ P; G6 l7 N
- dma_addr_t dmaphyssrc2 = 0;
3 m/ S. X1 s& n& D( a9 C - dma_addr_t dmaphysdest1 = 0;
& K7 g% `1 S# o8 W. e2 R - dma_addr_t dmaphysdest2 = 0;) N8 J# X+ E C+ g
0 E9 ~ P' {0 ~" W+ i8 {& ]- char *dmabufsrc1 = NULL;3 | M% W5 k$ l4 x# h
- char *dmabufsrc2 = NULL;$ z1 ^ B- x0 }- L# X' j
- char *dmabufdest1 = NULL;
i' ^/ q5 a( E3 F - char *dmabufdest2 = NULL;
4 }* r! o2 d, s ^- b- _0 P
& U* \2 S+ Q. B0 }, b- static int acnt = 512;7 |3 I3 }7 [# v/ h1 j
- static int bcnt = 8;
3 x# e' h$ E0 O3 T: Y( a. _) S5 l - static int ccnt = 8;: u+ s8 C4 M ?8 J
- 7 v, }( G* a+ ^
- module_param(acnt, int, S_IRUGO);
3 p6 o) d* o5 W/ k: Q6 S! K- Q+ R - module_param(bcnt, int, S_IRUGO);- [5 U5 j$ B; e& O: c+ N1 C
- module_param(ccnt, int, S_IRUGO);
复制代码
# l2 q$ D& h- g p8 M$ a/ A1 ^. b( _9 p! \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 D; \( ~: V1 }' Z& harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) g" E% e+ D7 L) k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ p3 ~; J& @' W d1 X1 ^# M1 B
/ f0 F( j; q( H6 e! E0 ~9 ?. p: Y8 {2 _' f0 @% N
|
|