Home | History | Annotate | Line # | Download | only in obio
rambo.h revision 1.4.4.2
      1  1.4.4.2  wiz /*	$NetBSD: rambo.h,v 1.4.4.2 2001/09/16 16:34:34 wiz Exp $	*/
      2  1.4.4.2  wiz /*-
      3  1.4.4.2  wiz  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      4  1.4.4.2  wiz  * All rights reserved.
      5  1.4.4.2  wiz  *
      6  1.4.4.2  wiz  * This code is derived from software contributed to The NetBSD Foundation
      7  1.4.4.2  wiz  * by Wayne Knowles
      8  1.4.4.2  wiz  *
      9  1.4.4.2  wiz  * Redistribution and use in source and binary forms, with or without
     10  1.4.4.2  wiz  * modification, are permitted provided that the following conditions
     11  1.4.4.2  wiz  * are met:
     12  1.4.4.2  wiz  * 1. Redistributions of source code must retain the above copyright
     13  1.4.4.2  wiz  *    notice, this list of conditions and the following disclaimer.
     14  1.4.4.2  wiz  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.4.4.2  wiz  *    notice, this list of conditions and the following disclaimer in the
     16  1.4.4.2  wiz  *    documentation and/or other materials provided with the distribution.
     17  1.4.4.2  wiz  * 3. All advertising materials mentioning features or use of this software
     18  1.4.4.2  wiz  *    must display the following acknowledgement:
     19  1.4.4.2  wiz  *        This product includes software developed by the NetBSD
     20  1.4.4.2  wiz  *        Foundation, Inc. and its contributors.
     21  1.4.4.2  wiz  * 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.4.4.2  wiz  *    contributors may be used to endorse or promote products derived
     23  1.4.4.2  wiz  *    from this software without specific prior written permission.
     24  1.4.4.2  wiz  *
     25  1.4.4.2  wiz  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.4.4.2  wiz  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.4.4.2  wiz  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.4.4.2  wiz  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.4.4.2  wiz  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.4.4.2  wiz  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.4.4.2  wiz  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.4.4.2  wiz  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.4.4.2  wiz  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.4.4.2  wiz  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.4.4.2  wiz  * POSSIBILITY OF SUCH DAMAGE.
     36  1.4.4.2  wiz  */
     37  1.4.4.2  wiz 
     38  1.4.4.2  wiz /*
     39  1.4.4.2  wiz  *  RAMBO DMA controller/timer asic used on the Mips 3230 (Pizazz)
     40  1.4.4.2  wiz  */
     41  1.4.4.2  wiz 
     42  1.4.4.2  wiz #ifndef _MACHINE_RAMBO_H
     43  1.4.4.2  wiz #define _MACHINE_RAMBO_H 1
     44  1.4.4.2  wiz 
     45  1.4.4.2  wiz /* Register laytout of a single RAMBO DMA channel */
     46  1.4.4.2  wiz struct	rambo_ch {
     47  1.4.4.2  wiz 	u_long	dma_laddr;	/* DMA load address reg	32b R/W */
     48  1.4.4.2  wiz 	u_long  __0[63];
     49  1.4.4.2  wiz 	u_long  dma_diag;	/* DMA Diagnostic reg	32b R   */
     50  1.4.4.2  wiz 	u_long	__1[63];
     51  1.4.4.2  wiz 	u_short __2;
     52  1.4.4.2  wiz 	u_short	dma_fifo;	/* FIFO Buffer 16 bits	16b R/W */
     53  1.4.4.2  wiz 	u_long	__3[63];
     54  1.4.4.2  wiz 	u_long	dma_mode;	/* DMA Mode Register	32b R/W */
     55  1.4.4.2  wiz 	u_long	__4[63];
     56  1.4.4.2  wiz 	u_short __5;
     57  1.4.4.2  wiz 	u_short	dma_block;	/* DMA Block Count	16b R/W */
     58  1.4.4.2  wiz 	u_long	__6[63];
     59  1.4.4.2  wiz 	u_long	dma_caddr;	/* DMA Current Address	32b R   */
     60  1.4.4.2  wiz 	u_long	__7[63];
     61  1.4.4.2  wiz };
     62  1.4.4.2  wiz 
     63  1.4.4.2  wiz #define RAMBO_LADDR	0x0000
     64  1.4.4.2  wiz #define RAMBO_DIAG	0x0100
     65  1.4.4.2  wiz #define	RAMBO_FIFO	0x0202
     66  1.4.4.2  wiz #define	RAMBO_MODE	0x0300
     67  1.4.4.2  wiz #define	RAMBO_BLKCNT	0x0402
     68  1.4.4.2  wiz #define	RAMBO_CADDR	0x0500
     69  1.4.4.2  wiz 
     70  1.4.4.2  wiz /* DMA mode register (dma_mode) (R/W) */
     71  1.4.4.2  wiz 
     72  1.4.4.2  wiz #define	RB_CLRFIFO	0x80000000 /* Clear DMA FIFO */
     73  1.4.4.2  wiz #define	RB_DMA_ENABLE	0x40000000 /* Enable DMA Transfer */
     74  1.4.4.2  wiz #define	RB_AUTORELOAD	0x20000000 /* Auto restart DMA */
     75  1.4.4.2  wiz #define	RB_INT_ENABLE  	0X10000000 /* INterrupt on terminal count */
     76  1.4.4.2  wiz 
     77  1.4.4.2  wiz #define RB_DMA_WR	0x08000000 /* Xfer into memory */
     78  1.4.4.2  wiz #define RB_DMA_RD	0x00000000 /* Xfer from memory */
     79  1.4.4.2  wiz 
     80  1.4.4.2  wiz #define	RB_CLRERROR	0x04000000 /* Clear DMA Error register */
     81  1.4.4.2  wiz 
     82  1.4.4.2  wiz /* status bits of mode register (R) */
     83  1.4.4.2  wiz 
     84  1.4.4.2  wiz #define	RB_FIFO_FULL	0x00000800 /* FIFO Buffer is full */
     85  1.4.4.2  wiz #define	RB_FIFO_EMPTY	0x00000400 /* FIFO Buffer is empty */
     86  1.4.4.2  wiz #define	RB_DMA_ERROR	0x00000200 /* Error has occurred */
     87  1.4.4.2  wiz #define	RB_INTR_PEND	0x00000100 /* Interrupt is pending */
     88  1.4.4.2  wiz 
     89  1.4.4.2  wiz #define	RB_CNT_MASK	0x000000ff /* half-words left in FIFO */
     90  1.4.4.2  wiz 
     91  1.4.4.2  wiz /* Offsets to other registers in the RAMBO asic */
     92  1.4.4.2  wiz #define	RB_TCOUNT	0x0c00
     93  1.4.4.2  wiz #define	RB_TBREAK	0x0d00
     94  1.4.4.2  wiz #define RB_ERRREG	0x0e00
     95  1.4.4.2  wiz #define	RB_CTLREG	0x0f00
     96  1.4.4.2  wiz 
     97  1.4.4.2  wiz /* Hardware Register */
     98  1.4.4.2  wiz 
     99  1.4.4.2  wiz #define	RB_BUZZ0	0x00	/* 1524 Hz */
    100  1.4.4.2  wiz #define	RB_BUZZ1	0x10	/* 762 Hz */
    101  1.4.4.2  wiz #define	RB_BUZZ2	0x20	/* 381 Hz */
    102  1.4.4.2  wiz #define	RB_BUZZ3	0x30	/* 190 Hz */
    103  1.4.4.2  wiz #define	RB_BUZZOFF	0x08	/* Buzzer Enable - Active Low  */
    104  1.4.4.2  wiz #define	RB_PARITY_EN	0x04	/* Enable Parity - Active High */
    105  1.4.4.2  wiz #define	RB_CLR_PAR	0x02	/* Clear SysParErr - Active High */
    106  1.4.4.2  wiz #define	RB_CLR_IOERR	0x01	/* Clear ErrIntB - Active Low */
    107  1.4.4.2  wiz 
    108  1.4.4.2  wiz #define	RB_BLK_SHIFT	6
    109  1.4.4.2  wiz #define	RB_BLK_CNT	32	/* half-word byte count */
    110  1.4.4.2  wiz #define	RB_BLK_MASK	0x3f	/* Alignment mask */
    111  1.4.4.2  wiz #define	RB_BLK_SIZE	64	/* Bytes in a DMA Block */
    112  1.4.4.2  wiz 
    113  1.4.4.2  wiz /* DMA cannot cross 512k boundry (2^19 == 512k) */
    114  1.4.4.2  wiz #define RB_BSIZE	19
    115  1.4.4.2  wiz #define RB_BMASK	((1<<RB_BSIZE)-1)
    116  1.4.4.2  wiz #define	RB_BOUNDRY	(1<<RB_BSIZE)
    117  1.4.4.2  wiz 
    118  1.4.4.2  wiz /* Rambo cycle counter is fed by 25MHz clock then divided by 4 */
    119  1.4.4.2  wiz #define	HZ_TO_TICKS(hz)		(6250000L/(hz))
    120  1.4.4.2  wiz #define TICKS_TO_USECS(t)	(((t)*4)/25)
    121  1.4.4.2  wiz #endif
    122