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