|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~0 U" g' K- V1 g* e
- [code]EDMA sample test application$ G% u3 v- X R0 Z6 m- S" B
- /*% J; z) g2 ], [4 |/ i/ a6 Z
- * edma_test.c% e0 J* g- E7 _2 U
- ** E4 g8 D) a X7 Y- G6 P# ]
- * brief EDMA3 Test Application
F7 q* C5 x0 p; Q" J - *
% @/ B, t% y' z7 _1 m - * This file contains EDMA3 Test code.
# F; I R+ @; ] - *8 h; N! ]* h6 s7 M( v' b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* G& y# x" F( K. c) m9 ~( F( t' x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! |. L$ \0 G }: C6 c
- * TO CHANGE.4 Z0 |% H& j- q
- *2 S: ~+ S3 b: f. o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ?3 b- j$ Z3 C
- *0 Q( k3 Y m, H& W& h
- * This program is free software; you can redistribute it and/or3 V( K* V7 W. n2 R: g; k8 {0 J8 t4 D
- * modify it under the terms of the GNU General Public License as" U6 c# ~& ]; N
- * published by the Free Software Foundation version 2.
; c3 V! m- c$ I ] - *
! a$ @# D( S0 v. ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s, d6 l. K6 A3 e" d# [7 Z2 N8 g
- * kind, whether express or implied; without even the implied warranty
" M$ m8 ]" N1 ]7 e0 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. k* C" s0 W6 K
- * GNU General Public License for more details.
' l: {" s5 p7 h) I* q* y - */ M1 [" g# C) D4 c) Y- ^( a
: R, g U% w: b2 [- #include <linux/module.h>
; ?6 I4 |) L. u! u8 F4 k5 Y- t - #include <linux/init.h>( ?( N* }0 t/ g; D+ e) ?# ?- Z0 I. x
- #include <linux/errno.h># L2 N9 e+ i. _7 Z) n
- #include <linux/types.h>0 x2 t# u8 f. y) D6 J
- #include <linux/interrupt.h>
8 W: m3 c( d! _7 z- S7 O s - #include <asm/io.h>6 j6 i9 [# j9 V; x- y
- #include <linux/moduleparam.h>2 V. v, r0 L. }
- #include <linux/sysctl.h>& ^/ a1 H8 F4 R! Q& @ G! r
- #include <linux/mm.h>
# w7 R5 Z8 V8 A4 |1 b - #include <linux/dma-mapping.h>
* O1 w+ u/ A- T3 S
% n& z2 _2 |4 G* b( b x- #include <mach/memory.h>
& S. p. z8 H" t8 } - #include <mach/hardware.h>( W7 w* {% A2 e; S" j+ S2 Q( [
- #include <mach/irqs.h>
8 k s6 a5 m w9 s. h/ ?* V& w; y3 U* M - #include <asm/hardware/edma.h>0 J1 D% C- ?+ W8 M F1 O
- 4 X6 P s; l' |
- #undef EDMA3_DEBUG+ f C0 G/ W9 @: D% j' t6 F
- /*#define EDMA3_DEBUG*/
3 C4 c! `2 F6 G8 Z8 X4 o
' d1 j9 Q: Y8 O P$ U- #ifdef EDMA3_DEBUG
2 d- K+ y% a8 ]4 g1 |9 b X! |8 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Y8 Z4 `: M, I6 E' Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 K! E$ J3 A, C Z; E `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ^. J& L# r5 N3 ?
- #else
{" q, |. X2 X0 G4 u - #define DMA_PRINTK( x... )
3 N) W' N }& |/ o - #define DMA_FN_IN
4 a: V; W: k. ]* D7 e4 O' @ - #define DMA_FN_OUT1 M5 Q. {( W. {! V- a8 j' G, \
- #endif6 p/ I" p: l3 }3 L8 p5 s' N% P
3 n( a$ B! b; J0 d3 m1 |' ]9 r* z. u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) A ~1 h3 q0 E6 p6 M5 X9 i - #define STATIC_SHIFT 3
( O2 A/ F6 k/ i2 ]: o1 q! K* v - #define TCINTEN_SHIFT 207 {% H; `8 [( Z* p# n
- #define ITCINTEN_SHIFT 21
7 q* b3 v) l8 ? - #define TCCHEN_SHIFT 22
' B2 w' F5 v7 G# m% E% f* U - #define ITCCHEN_SHIFT 23+ R% s' {: T0 L) {5 ^
5 n# j {* s2 ~/ i2 X- static volatile int irqraised1 = 0;
8 n y* P, u3 Q7 ^$ ~" F - static volatile int irqraised2 = 0;
( C5 y; D0 T! W3 ^
5 K I, N, j9 Q( J. C$ u4 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* S* q- y4 N! u3 N4 j+ @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D9 S2 u$ C: [ e# J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 q3 V: C4 q# E( W: H0 `9 ] Y - . C$ @3 R( E1 p; {" v
- dma_addr_t dmaphyssrc1 = 0;# [2 ^3 ^( C# ]5 [
- dma_addr_t dmaphyssrc2 = 0;# u8 p( L/ n3 O6 l9 Q& Y
- dma_addr_t dmaphysdest1 = 0;) n6 L* K/ \, D; P
- dma_addr_t dmaphysdest2 = 0;
: D. [, c% T1 c' l1 U. Z( `5 Q - ; r/ g6 l) B F# A
- char *dmabufsrc1 = NULL;
9 h T! r' l, n1 }' d3 h - char *dmabufsrc2 = NULL;; b! s- g8 v% ?- x& z0 T0 t, h3 |) d
- char *dmabufdest1 = NULL;
/ K- g: ^$ L3 d2 c( y - char *dmabufdest2 = NULL;* d( x( l# D6 f$ F/ {: I
- 2 h8 |8 P6 d4 N8 i0 `
- static int acnt = 512;( _' e& J$ o2 z& c( I! E* N1 e
- static int bcnt = 8;% @4 f1 m+ O( }- E
- static int ccnt = 8;
$ g( Y+ {/ u1 V' S3 ]9 u - " s n/ I9 M& Y+ q) O* C& Z6 e7 ]
- module_param(acnt, int, S_IRUGO);
% ~( `' b' T6 h( X - module_param(bcnt, int, S_IRUGO);. c& B1 U* K" j J4 p4 B
- module_param(ccnt, int, S_IRUGO);
复制代码 3 T" c3 o* h. Q
9 h- l1 R$ ^. m" `/ X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R( h& }5 U; U. A# X+ e5 G Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 a* e: z! {( M% r& s8 H, Y% j: E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
]( t7 h1 n: S% F6 y* i. h- K* ?! q" q& e
4 O# d7 {/ G Z, c0 p% z# }
|
|