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