|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q2 D2 N$ e4 \( r- [code]EDMA sample test application3 q5 v8 P( n, E' Y- z
- /*% D* r+ N" ]$ Q" ~
- * edma_test.c
& v5 E7 I @# {7 i - *
6 u3 M3 b) y5 `* `6 j( P; S+ s - * brief EDMA3 Test Application
8 Q' H( _; a4 g8 c! S8 F - *7 z; b& i* Y6 X! \0 _# L' @
- * This file contains EDMA3 Test code.
* M6 c5 Y$ R6 q( Z; c - *5 Z/ C# ~7 U% k# j5 G/ N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; \8 x0 b4 v2 }5 f4 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( T* d X) R: w _# Z
- * TO CHANGE.
& |$ ?8 U- ~& V. G - *8 j6 [: s$ |; X6 R4 \4 _5 x3 U, C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 u' K3 T- _5 h, t$ m - *% s$ X; M2 T& I6 d/ v; L8 |5 q# M
- * This program is free software; you can redistribute it and/or4 K; Z& M+ J& K. a4 T
- * modify it under the terms of the GNU General Public License as
0 E$ o' ]7 c8 h( k - * published by the Free Software Foundation version 2.! A( c+ X0 K) G* S8 @1 b6 u% z
- *
7 g) N4 l2 |5 D5 W8 @9 I# F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) p/ M ^- d5 u. k! R9 l! }" A - * kind, whether express or implied; without even the implied warranty# _0 g* C; g2 X1 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! K' z* |9 n W4 q2 H7 v8 i - * GNU General Public License for more details.
: o2 L& [9 _3 y& o: _ - */
! \& @& O7 C, I
+ c( I; B2 ?, g4 n3 ]( |7 f0 }- #include <linux/module.h>( a& u7 h- i% R+ z( X9 C" X3 j
- #include <linux/init.h>
- c1 f6 [( n0 R: z5 ?5 I - #include <linux/errno.h>
) F# L2 y! `- Z - #include <linux/types.h>
8 O. E0 N8 d$ J) N& m' x - #include <linux/interrupt.h>( j$ i8 h0 [5 W6 r
- #include <asm/io.h>% j' V: x. B9 F" c- ]8 n1 e. O
- #include <linux/moduleparam.h>
9 n. C4 a: C8 J' g - #include <linux/sysctl.h>
' I& B W' ~4 w5 F& G$ t - #include <linux/mm.h>+ o L O! k* m; \6 u4 `0 S+ Y
- #include <linux/dma-mapping.h>+ {7 G: s7 h+ G% s* B
; t9 W2 I7 y/ L1 u0 C! }0 y- #include <mach/memory.h># m# L6 z5 O3 W
- #include <mach/hardware.h>
0 i: }1 J: n6 {+ v - #include <mach/irqs.h>
* _9 B z; i' h# p4 I8 e# J9 | - #include <asm/hardware/edma.h>- y. X! Y, H! A1 B
' n2 x6 d/ ?9 X2 Y8 G% H- #undef EDMA3_DEBUG) e( h" x' ~# O1 @0 @, d6 Q3 [
- /*#define EDMA3_DEBUG*/
; H3 T* u% Z# _6 a/ \" e
" _" g; ~- Y9 n# I8 Q: ]# S- #ifdef EDMA3_DEBUG0 j+ j% ^$ N! y6 \) r3 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 R1 Z7 t: m0 B% S' p9 C# b' N$ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 S2 t" u' [& c+ V# R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
@% C/ E5 b/ O% \& D; g: | - #else5 Y- Y6 d! |) k/ }3 _
- #define DMA_PRINTK( x... )2 h4 F" J/ V7 C5 K
- #define DMA_FN_IN% ?8 A! Z- N+ B2 I. i4 D) P. b
- #define DMA_FN_OUT( D% _7 W) s3 @9 G+ y
- #endif
7 i; ~3 D( X' a* U6 L
+ M9 z* p) V0 Y$ P. [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ p# l. O Q* I" u
- #define STATIC_SHIFT 3
, l3 ], _8 n4 h8 c1 I- n - #define TCINTEN_SHIFT 20
! O" m! \1 s i9 G - #define ITCINTEN_SHIFT 21# X) ?) } I- v$ \
- #define TCCHEN_SHIFT 22
) E# I, x6 q* i$ Y1 G - #define ITCCHEN_SHIFT 23
2 K F( \( l! {. e% ? - " u; \. L' h3 Q- a
- static volatile int irqraised1 = 0;+ `. A% w! g% ]6 e
- static volatile int irqraised2 = 0;3 I3 ]9 Q7 x! O7 b6 s
. k& h6 {' O; O0 s4 Z; K; B6 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p7 I! d- F* o: T( {8 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [9 U# B# h0 [) X7 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- j6 F8 l0 I# ~& L - , ]& S0 R4 r% b+ b0 B
- dma_addr_t dmaphyssrc1 = 0;
2 g4 r" U( t. K' g( w - dma_addr_t dmaphyssrc2 = 0;
; Y& B9 x0 w: H3 u9 B - dma_addr_t dmaphysdest1 = 0;$ g1 n, U, C/ J& w/ g
- dma_addr_t dmaphysdest2 = 0;
F: [, `7 |3 ^& c- i; C- b - Q- t" k7 H" S
- char *dmabufsrc1 = NULL;! e; M/ e+ D9 _% m) ]" ~
- char *dmabufsrc2 = NULL;1 k- {$ p' K" g* J2 e
- char *dmabufdest1 = NULL;- d- g8 r4 ~8 G+ y x5 o# p% S% J+ j
- char *dmabufdest2 = NULL;
( l7 I$ E6 c3 a/ ?" N - / e. l- e3 S1 q. X! _
- static int acnt = 512;; A- l! t5 e3 w1 d+ o. q, G
- static int bcnt = 8;9 J1 x. ^; D2 J! G Y. V
- static int ccnt = 8;
3 q& B! Q9 c2 Z/ B! y
0 o- T! S6 Y! P- module_param(acnt, int, S_IRUGO);% r7 Q, B Y: b3 I/ i
- module_param(bcnt, int, S_IRUGO);
1 G- D4 Y9 E/ p R& U - module_param(ccnt, int, S_IRUGO);
复制代码
4 L6 G/ @& O! y5 T& O: W2 ?
1 p+ B% u Q- B5 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# \4 a' N6 _2 L) i4 _ r' H1 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ~7 a* c7 E, |9 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 F9 L" l- x1 b( J P9 }- X- |& O
+ e- O8 P* W0 e$ P& D1 P3 D* u4 q
! s9 a9 E7 q% c, M: {4 f5 V$ {
|
|