|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 y" ~$ W! G8 Y6 U! ^ s$ q
- [code]EDMA sample test application
# u7 H0 ]9 L- x# _) R - /*
+ V& S# g* L2 R: G - * edma_test.c
- s" [! R; u9 F1 d$ t - *
* ?3 J* v6 L$ f - * brief EDMA3 Test Application- j @5 M$ O5 c/ A
- *
) s m p# G& d8 h - * This file contains EDMA3 Test code.; _- \7 Y; _! p1 h$ W
- *0 @6 Q, P- r. v5 c$ y( R! w0 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 U: j, ~' _ `5 n! ?' u( \. @! K1 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* p5 ?" R& q: B0 _- Y8 B - * TO CHANGE.
, b2 k& W# u0 |! ~# F - *
0 \8 j N( d6 C' |. v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 _+ |. S( X3 G& ?# ?
- *
# Z' L, `" }0 Y9 x9 z/ A+ k - * This program is free software; you can redistribute it and/or
2 @- o' T3 s) ~/ f- m - * modify it under the terms of the GNU General Public License as
" M$ s( S/ \5 W, H0 k, s - * published by the Free Software Foundation version 2.
- c2 s" \/ x' x( V- K! p - *& a! S: M' E' u% r' E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 i3 x! p" `( z - * kind, whether express or implied; without even the implied warranty
: V, ^" m( Q p( {2 H0 ~: a! l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* g& N3 S6 B; z2 T
- * GNU General Public License for more details.1 Z/ ~3 t5 t z) Q0 m
- */
& c) Y- c. Y5 N' e- d N - ! d2 _* |8 C4 p, P1 n3 c! }3 O
- #include <linux/module.h>% _8 O& t9 t- P \5 ]
- #include <linux/init.h>
w; U. l! a9 U L - #include <linux/errno.h>1 T) T& J: J5 m6 }3 e
- #include <linux/types.h>" L: [- d; C7 K8 F! }9 P7 J0 q
- #include <linux/interrupt.h>8 E O* v2 d) F7 R' _; p. `- a0 a
- #include <asm/io.h>
6 |6 y: E7 ]6 _+ |' |/ I |* k" i4 F - #include <linux/moduleparam.h>5 Q0 s' Y$ @, C |- O" A3 l
- #include <linux/sysctl.h>& }0 B( \5 U3 v9 y+ g
- #include <linux/mm.h>
2 l+ l8 S0 _ D; T5 H - #include <linux/dma-mapping.h>
3 ~. x. U, t" x" t0 ~# d& X - ; S$ [: @( Z6 X0 c2 [' v
- #include <mach/memory.h>* @9 Z/ i+ }7 m- X/ R
- #include <mach/hardware.h>1 z! S8 r3 n3 a4 K, b9 L2 O
- #include <mach/irqs.h>) c6 f, ~- C) f" w
- #include <asm/hardware/edma.h>/ T+ P4 a% s5 k: s3 s B
- 8 X* g9 X5 v3 S" m/ B6 F
- #undef EDMA3_DEBUG; r! B S+ j) B* R2 m& X5 W5 M
- /*#define EDMA3_DEBUG*/
$ h. M& I9 H5 R0 B
% [2 X: n# t7 [" g( q- #ifdef EDMA3_DEBUG6 J( m L; S! Y4 i: @7 ^( x4 p- [3 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ @) r% G& W2 H1 p) z, Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# g/ w% I4 g2 ^& C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( V# w6 x/ M7 H% A - #else( m1 o0 {# T/ a' i) y/ c) j9 O
- #define DMA_PRINTK( x... )
( L6 T8 Y, H" l( q - #define DMA_FN_IN$ ~( K6 x& P' P- T! L
- #define DMA_FN_OUT
0 G1 f5 Y/ ?/ _- c Q; R - #endif
( Q" {. N7 N' C8 i' o
( `9 o* v* S$ W" u* P4 c' W* C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 J8 ~& |$ b6 V, { - #define STATIC_SHIFT 3! O9 ?: h" k/ e1 w6 B r0 q3 S
- #define TCINTEN_SHIFT 20
0 k6 _- X$ d* ?! m - #define ITCINTEN_SHIFT 21$ }' f `# M N: v
- #define TCCHEN_SHIFT 22 J% @8 C3 P. q7 z8 a8 [$ O2 V, v
- #define ITCCHEN_SHIFT 23# {4 ?3 y7 J4 A0 K z+ T/ G
- 1 ?- i# @0 M7 h% v& A/ x
- static volatile int irqraised1 = 0;
: }- C \1 T) D6 E - static volatile int irqraised2 = 0;
% f- s' p7 j6 |' @( v. ]; k5 d e9 ] - 0 g, [+ _* h+ |2 X- E5 u8 l* Z4 T+ @: G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ x F" v5 J/ F) b" A* s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \* A# t/ K! D. x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s9 p1 w7 D7 r0 _- K
; Q% D! Z# Z$ n1 l- dma_addr_t dmaphyssrc1 = 0;7 s e' i, P" h; y
- dma_addr_t dmaphyssrc2 = 0;
& c9 p$ |# m- @9 {$ U; i( n# X - dma_addr_t dmaphysdest1 = 0; I3 v6 Y8 K8 l- ^. }' J- K& h
- dma_addr_t dmaphysdest2 = 0;
2 ~4 t" a1 } U' u - ! S p T3 n1 H
- char *dmabufsrc1 = NULL;
7 S1 R( ]# D3 x- c8 }4 I - char *dmabufsrc2 = NULL;
% m$ ?0 Y8 r8 z1 n# r% o - char *dmabufdest1 = NULL;( N7 @5 l6 v$ E
- char *dmabufdest2 = NULL;
; W, g2 R9 g3 i4 a3 \ - 5 t/ W* t6 B# O' k: A% y% ^4 C
- static int acnt = 512;7 z8 M: i6 s2 D+ A! f% v
- static int bcnt = 8;: U+ s% G) f4 J- n. p# G
- static int ccnt = 8;4 ~, {& {$ K9 z4 {0 V6 x( W8 y
- ; f' C' H1 W/ Z5 R( l( b j% A0 E
- module_param(acnt, int, S_IRUGO);8 G* W3 E+ N- ?5 D
- module_param(bcnt, int, S_IRUGO);
3 p$ i$ Q5 _' ^- e) P$ J - module_param(ccnt, int, S_IRUGO);
复制代码
2 p0 ]4 A* X x: w* D9 d! u( `
1 x6 N& M6 _: y3 f$ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- O( l \$ t1 l# ?1 A- x- x; |" |+ Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; M8 J* J4 L8 ~1 S* E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& z$ Z! @1 X; x+ _# l! ?5 X8 S9 S/ N/ J5 ]9 {# D+ N0 A; ^
; H$ D7 r, O8 d) _3 C. L
|
|