|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - h# b- {4 }# h' ?$ F3 \
- [code]EDMA sample test application: ?# w$ @3 h& x: w
- /*
1 X' `/ [4 w4 A0 l" I - * edma_test.c( T1 i2 P, X4 c* G2 G
- *
% Z; W& O% |( C8 ~ - * brief EDMA3 Test Application0 U* q8 ~" Z' v8 I) d, V
- ** [* J4 \" t7 O0 x1 u4 U" L0 z
- * This file contains EDMA3 Test code.# D5 M0 h2 ?9 x4 O, x
- *+ g4 w! i$ ]& e! {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- _* o3 z/ ^( v' ^* k* B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 d, D6 {* Z3 N+ T. h1 L: m3 v. |* a* I - * TO CHANGE./ s# V$ V( W4 B2 R- i! v, a
- *& x. _: Z8 F. g) @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! ?0 H5 D5 k: S2 k% B3 Q
- *
4 O0 U( n: |+ P5 T1 N - * This program is free software; you can redistribute it and/or' i; U8 U' B+ Z+ e- S
- * modify it under the terms of the GNU General Public License as% W, [+ L8 v8 ~0 n
- * published by the Free Software Foundation version 2.
+ }' t6 L- g* e% G6 q; C" i/ a - *
0 O& c6 l0 ?# U, r# Z, G. n# s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 j% f6 e+ U% F - * kind, whether express or implied; without even the implied warranty, o, X0 R; @0 a) K# `3 m0 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% i% e! v* h/ G
- * GNU General Public License for more details.- q, f! G! M) W6 ]( w* L
- */
+ h. j8 q: p. ], o1 y2 R - # u& t& l: m3 [( i) Z2 N; }: I
- #include <linux/module.h>. A+ c Y9 c" t0 J/ l2 c& V
- #include <linux/init.h>
( a, W I( |6 ?1 B6 P6 L! L - #include <linux/errno.h>
7 z+ L3 l6 ~5 w" H - #include <linux/types.h>
3 @1 u6 y! q, S/ Y - #include <linux/interrupt.h>
0 u6 L/ f! `/ ] r. ~' H - #include <asm/io.h>
) R+ E' O9 T# o! L - #include <linux/moduleparam.h>; _# A5 e! j, g) ~% X
- #include <linux/sysctl.h>1 a7 R3 m5 j3 _* r- Z% y& h
- #include <linux/mm.h>
/ j, v u! x' R - #include <linux/dma-mapping.h>
" z; X T' A& s5 r) P' r
, R. s0 ]( L3 K& h8 m- #include <mach/memory.h>
' W& U( g$ ?8 a8 W - #include <mach/hardware.h>
6 ~; F, {9 L( |; L3 B( U - #include <mach/irqs.h>3 u/ l. G- ^) Z) w. t
- #include <asm/hardware/edma.h>% J: i7 O) E' p7 K
- $ f5 A+ d1 b: Z' @+ O6 S
- #undef EDMA3_DEBUG
7 _& r3 G8 r9 b; N' K- X - /*#define EDMA3_DEBUG*/
' ~2 s; r- z- k - ) }7 `, {; `6 w# B- V4 J
- #ifdef EDMA3_DEBUG
, j1 s( v4 ^, n P' A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 R. J T. J9 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# ?; O# \8 ]# z7 k7 p# Q4 y1 q: H& \( \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
?1 e1 i- J' q9 F$ r - #else
/ h1 W2 ^5 u: |* ]8 G - #define DMA_PRINTK( x... )- x6 B% C0 V: N- K
- #define DMA_FN_IN V+ x8 Q P( R" c- _2 a
- #define DMA_FN_OUT
/ }/ j: J I* x( [- a - #endif
, {" L5 w" M/ {( `- L" O$ O" e - z" g# U, A/ G$ ]/ J9 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 ~/ [4 J) ^- p2 M' s3 a
- #define STATIC_SHIFT 3
, f; c6 r- B. S0 a+ Y4 n, P/ g - #define TCINTEN_SHIFT 202 ?! n* U2 c; x5 W4 g
- #define ITCINTEN_SHIFT 21
: I3 e4 Y4 Y' b; J - #define TCCHEN_SHIFT 22
" e5 F0 H! i u - #define ITCCHEN_SHIFT 23
' q# E' T1 r4 H9 r& u
4 p8 ], H1 h! \2 |; w. f7 }- static volatile int irqraised1 = 0;) ]9 y# p' ~+ G3 Z: b
- static volatile int irqraised2 = 0;$ {- Y5 X0 N0 A E+ q
* [" D4 J( D$ @ z( o# F7 X0 j; J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u+ c/ g$ B& a* y g% d8 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ f' X+ A' L/ T1 o2 u0 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a7 i, J c0 H3 O
- " z" P, h/ B, T
- dma_addr_t dmaphyssrc1 = 0;$ f! G' E; \4 k5 i9 a: s6 V4 ~
- dma_addr_t dmaphyssrc2 = 0;0 s1 \6 P/ c% P1 c' q7 v" j
- dma_addr_t dmaphysdest1 = 0;
+ U2 G6 ~1 z. L, p+ J" G) x - dma_addr_t dmaphysdest2 = 0;# }! s) q0 t1 L5 ~, N) ?" p
- $ w* j3 v1 ?" O7 D
- char *dmabufsrc1 = NULL;2 f! b- M* k+ x2 Y
- char *dmabufsrc2 = NULL;
5 U- F* I0 K# Q+ G/ w: I - char *dmabufdest1 = NULL;
% M9 m2 H. ^: }' {6 J9 J - char *dmabufdest2 = NULL;
% t7 H: n% X1 {8 i. F# f
% g1 F, q {0 |4 W: ~: K- static int acnt = 512;+ ?7 P7 ^. [0 G3 \4 F, Q8 ^
- static int bcnt = 8;% H3 O. _' D, l) l
- static int ccnt = 8;& x0 B8 ?0 V& H, Q+ c- Z& `
- & i& }& A" @( j( ^, p& `" U
- module_param(acnt, int, S_IRUGO);
# @4 P& j3 z) M/ n5 x/ L - module_param(bcnt, int, S_IRUGO);
1 p* P7 h6 ]7 c8 A# y ~ - module_param(ccnt, int, S_IRUGO);
复制代码
2 e+ I1 d3 N$ u* o s" E1 O( \1 d4 m7 B) F' L Z2 ^. t% y: n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 d+ u8 [7 j, r" e+ F! e( S
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' @3 j! L* e0 \' Y5 g' g3 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% _/ n3 I# P8 C3 D1 S7 h+ _
* y6 J) C/ T: K- T
0 X4 y R6 O+ w: _* w |
|