81cb40505de5134c9b9eecebe7c30ab3532a899d
[openwrt.git] / target / linux / rb532 / files-2.6.24 / include / asm-mips / rc32434 / dma_v.h
1 #ifndef __IDT_DMA_V_H__
2 #define __IDT_DMA_V_H__
3
4 /*******************************************************************************
5  *
6  * Copyright 2002 Integrated Device Technology, Inc.
7  *              All rights reserved.
8  *
9  * DMA register definition.
10  *
11  * File   : $Id: dma.h,v 1.3 2002/06/06 18:34:03 astichte Exp $
12  *
13  * Author : ryan.holmQVist@idt.com
14  * Date   : 20011005
15  * Update :
16  *          $Log: dma.h,v $
17  *          Revision 1.3  2002/06/06 18:34:03  astichte
18  *          Added XXX_PhysicalAddress and XXX_VirtualAddress
19  *      
20  *          Revision 1.2  2002/06/05 18:30:46  astichte
21  *          Removed IDTField
22  *      
23  *          Revision 1.1  2002/05/29 17:33:21  sysarch
24  *          jba File moved from vcode/include/idt/acacia
25  *      
26  *
27  ******************************************************************************/
28 #include  <asm/rc32434/dma.h> 
29 #include  <asm/rc32434/rc32434.h>
30 #define DMA_CHAN_OFFSET  0x14
31 #define IS_DMA_USED(X) (((X) & (DMAD_f_m | DMAD_d_m | DMAD_t_m)) != 0)
32 #define DMA_COUNT(count)   \
33   ((count) & DMAD_count_m)
34
35 #define DMA_HALT_TIMEOUT 500
36
37
38 static inline int rc32434_halt_dma(DMA_Chan_t ch)
39 {
40         int timeout=1;
41         if (local_readl(&ch->dmac) & DMAC_run_m) {
42                 local_writel(0, &ch->dmac); 
43                 for (timeout = DMA_HALT_TIMEOUT; timeout > 0; timeout--) {
44                         if (local_readl(&ch->dmas) & DMAS_h_m) {
45                                 local_writel(0, &ch->dmas);  
46                                 break;
47                         }
48                 }
49         }
50
51         return timeout ? 0 : 1;
52 }
53
54 static inline void rc32434_start_dma(DMA_Chan_t ch, u32 dma_addr)
55 {
56         local_writel(0, &ch->dmandptr); 
57         local_writel(dma_addr, &ch->dmadptr);
58 }
59
60 static inline void rc32434_chain_dma(DMA_Chan_t ch, u32 dma_addr)
61 {
62         local_writel(dma_addr, &ch->dmandptr);
63 }
64
65 #endif  // __IDT_DMA_V_H__
66
67
68
69
70
71
72