rambo.h revision 1.5.58.1       1  1.5.58.1     yamt /*	$NetBSD: rambo.h,v 1.5.58.1 2008/05/16 02:22:52 yamt 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  *
     18       1.1      wdk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     19       1.1      wdk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     20       1.1      wdk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     21       1.1      wdk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     22       1.1      wdk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     23       1.1      wdk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     24       1.1      wdk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     25       1.1      wdk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     26       1.1      wdk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     27       1.1      wdk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     28       1.1      wdk  * POSSIBILITY OF SUCH DAMAGE.
     29       1.1      wdk  */
     30       1.1      wdk 
     31       1.1      wdk /*
     32       1.1      wdk  *  RAMBO DMA controller/timer asic used on the Mips 3230 (Pizazz)
     33       1.1      wdk  */
     34       1.1      wdk 
     35       1.1      wdk #ifndef _MACHINE_RAMBO_H
     36       1.1      wdk #define _MACHINE_RAMBO_H 1
     37       1.1      wdk 
     38       1.1      wdk /* Register laytout of a single RAMBO DMA channel */
     39       1.1      wdk struct	rambo_ch {
     40       1.1      wdk 	u_long	dma_laddr;	/* DMA load address reg	32b R/W */
     41       1.1      wdk 	u_long  __0[63];
     42       1.1      wdk 	u_long  dma_diag;	/* DMA Diagnostic reg	32b R   */
     43       1.1      wdk 	u_long	__1[63];
     44       1.1      wdk 	u_short __2;
     45       1.1      wdk 	u_short	dma_fifo;	/* FIFO Buffer 16 bits	16b R/W */
     46       1.1      wdk 	u_long	__3[63];
     47       1.1      wdk 	u_long	dma_mode;	/* DMA Mode Register	32b R/W */
     48       1.1      wdk 	u_long	__4[63];
     49       1.1      wdk 	u_short __5;
     50       1.1      wdk 	u_short	dma_block;	/* DMA Block Count	16b R/W */
     51       1.1      wdk 	u_long	__6[63];
     52       1.1      wdk 	u_long	dma_caddr;	/* DMA Current Address	32b R   */
     53       1.1      wdk 	u_long	__7[63];
     54       1.1      wdk };
     55       1.1      wdk 
     56       1.1      wdk #define RAMBO_LADDR	0x0000
     57       1.1      wdk #define RAMBO_DIAG	0x0100
     58       1.1      wdk #define	RAMBO_FIFO	0x0202
     59       1.1      wdk #define	RAMBO_MODE	0x0300
     60       1.1      wdk #define	RAMBO_BLKCNT	0x0402
     61       1.1      wdk #define	RAMBO_CADDR	0x0500
     62       1.1      wdk 
     63       1.1      wdk /* DMA mode register (dma_mode) (R/W) */
     64       1.1      wdk 
     65       1.1      wdk #define	RB_CLRFIFO	0x80000000 /* Clear DMA FIFO */
     66       1.1      wdk #define	RB_DMA_ENABLE	0x40000000 /* Enable DMA Transfer */
     67       1.1      wdk #define	RB_AUTORELOAD	0x20000000 /* Auto restart DMA */
     68       1.1      wdk #define	RB_INT_ENABLE  	0X10000000 /* INterrupt on terminal count */
     69       1.1      wdk 
     70       1.1      wdk #define RB_DMA_WR	0x08000000 /* Xfer into memory */
     71       1.1      wdk #define RB_DMA_RD	0x00000000 /* Xfer from memory */
     72       1.1      wdk 
     73       1.1      wdk #define	RB_CLRERROR	0x04000000 /* Clear DMA Error register */
     74       1.1      wdk 
     75       1.1      wdk /* status bits of mode register (R) */
     76       1.1      wdk 
     77       1.1      wdk #define	RB_FIFO_FULL	0x00000800 /* FIFO Buffer is full */
     78       1.1      wdk #define	RB_FIFO_EMPTY	0x00000400 /* FIFO Buffer is empty */
     79       1.4      wiz #define	RB_DMA_ERROR	0x00000200 /* Error has occurred */
     80       1.1      wdk #define	RB_INTR_PEND	0x00000100 /* Interrupt is pending */
     81       1.1      wdk 
     82       1.1      wdk #define	RB_CNT_MASK	0x000000ff /* half-words left in FIFO */
     83       1.1      wdk 
     84       1.1      wdk /* Offsets to other registers in the RAMBO asic */
     85       1.1      wdk #define	RB_TCOUNT	0x0c00
     86       1.1      wdk #define	RB_TBREAK	0x0d00
     87       1.1      wdk #define RB_ERRREG	0x0e00
     88       1.1      wdk #define	RB_CTLREG	0x0f00
     89       1.1      wdk 
     90       1.1      wdk /* Hardware Register */
     91       1.1      wdk 
     92       1.1      wdk #define	RB_BUZZ0	0x00	/* 1524 Hz */
     93       1.1      wdk #define	RB_BUZZ1	0x10	/* 762 Hz */
     94       1.1      wdk #define	RB_BUZZ2	0x20	/* 381 Hz */
     95       1.1      wdk #define	RB_BUZZ3	0x30	/* 190 Hz */
     96       1.1      wdk #define	RB_BUZZOFF	0x08	/* Buzzer Enable - Active Low  */
     97       1.1      wdk #define	RB_PARITY_EN	0x04	/* Enable Parity - Active High */
     98       1.1      wdk #define	RB_CLR_PAR	0x02	/* Clear SysParErr - Active High */
     99       1.1      wdk #define	RB_CLR_IOERR	0x01	/* Clear ErrIntB - Active Low */
    100       1.1      wdk 
    101       1.1      wdk #define	RB_BLK_SHIFT	6
    102       1.1      wdk #define	RB_BLK_CNT	32	/* half-word byte count */
    103       1.1      wdk #define	RB_BLK_MASK	0x3f	/* Alignment mask */
    104       1.1      wdk #define	RB_BLK_SIZE	64	/* Bytes in a DMA Block */
    105       1.1      wdk 
    106       1.1      wdk /* DMA cannot cross 512k boundry (2^19 == 512k) */
    107       1.1      wdk #define RB_BSIZE	19
    108       1.1      wdk #define RB_BMASK	((1<<RB_BSIZE)-1)
    109       1.1      wdk #define	RB_BOUNDRY	(1<<RB_BSIZE)
    110       1.1      wdk 
    111       1.2      wdk /* Rambo cycle counter is fed by 25MHz clock then divided by 4 */
    112       1.5  gdamore #define	RB_FREQUENCY		625000L
    113       1.5  gdamore #define	HZ_TO_TICKS(hz)		(RB_FREQUENCY/(hz))
    114       1.3      wdk #define TICKS_TO_USECS(t)	(((t)*4)/25)
    115       1.1      wdk #endif
    116