Home | History | Annotate | Line # | Download | only in ic
z8530reg.h revision 1.7
      1  1.7      gwr /*	$NetBSD: z8530reg.h,v 1.7 1996/10/23 00:32:31 gwr Exp $ */
      2  1.1  mycroft 
      3  1.1  mycroft /*
      4  1.1  mycroft  * Copyright (c) 1992, 1993
      5  1.1  mycroft  *	The Regents of the University of California.  All rights reserved.
      6  1.1  mycroft  *
      7  1.1  mycroft  * This software was developed by the Computer Systems Engineering group
      8  1.1  mycroft  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9  1.1  mycroft  * contributed to Berkeley.
     10  1.1  mycroft  *
     11  1.1  mycroft  * All advertising materials mentioning features or use of this software
     12  1.1  mycroft  * must display the following acknowledgement:
     13  1.1  mycroft  *	This product includes software developed by the University of
     14  1.1  mycroft  *	California, Lawrence Berkeley Laboratory.
     15  1.1  mycroft  *
     16  1.1  mycroft  * Redistribution and use in source and binary forms, with or without
     17  1.1  mycroft  * modification, are permitted provided that the following conditions
     18  1.1  mycroft  * are met:
     19  1.1  mycroft  * 1. Redistributions of source code must retain the above copyright
     20  1.1  mycroft  *    notice, this list of conditions and the following disclaimer.
     21  1.1  mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     22  1.1  mycroft  *    notice, this list of conditions and the following disclaimer in the
     23  1.1  mycroft  *    documentation and/or other materials provided with the distribution.
     24  1.1  mycroft  * 3. All advertising materials mentioning features or use of this software
     25  1.1  mycroft  *    must display the following acknowledgement:
     26  1.1  mycroft  *	This product includes software developed by the University of
     27  1.1  mycroft  *	California, Berkeley and its contributors.
     28  1.1  mycroft  * 4. Neither the name of the University nor the names of its contributors
     29  1.1  mycroft  *    may be used to endorse or promote products derived from this software
     30  1.1  mycroft  *    without specific prior written permission.
     31  1.1  mycroft  *
     32  1.1  mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33  1.1  mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34  1.1  mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35  1.1  mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36  1.1  mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.1  mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.1  mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.1  mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40  1.1  mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41  1.1  mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42  1.1  mycroft  * SUCH DAMAGE.
     43  1.1  mycroft  *
     44  1.1  mycroft  *	@(#)zsreg.h	8.1 (Berkeley) 6/11/93
     45  1.1  mycroft  */
     46  1.1  mycroft 
     47  1.1  mycroft /*
     48  1.1  mycroft  * Zilog SCC registers, as implemented on the Sun-4c.
     49  1.1  mycroft  *
     50  1.1  mycroft  * Each Z8530 implements two channels (called `a' and `b').
     51  1.1  mycroft  *
     52  1.1  mycroft  * The damnable chip was designed to fit on Z80 I/O ports, and thus
     53  1.1  mycroft  * has everything multiplexed out the wazoo.  We have to select
     54  1.1  mycroft  * a register, then read or write the register, and so on.  Worse,
     55  1.1  mycroft  * the parameter bits are scattered all over the register space.
     56  1.1  mycroft  * This thing is full of `miscellaneous' control registers.
     57  1.1  mycroft  *
     58  1.1  mycroft  * Worse yet, the registers have incompatible functions on read
     59  1.1  mycroft  * and write operations.  We describe the registers below according
     60  1.1  mycroft  * to whether they are `read registers' (RR) or `write registers' (WR).
     61  1.1  mycroft  * As if this were not enough, some of the channel B status bits show
     62  1.1  mycroft  * up in channel A, and vice versa.  The blasted thing shares write
     63  1.1  mycroft  * registers 2 and 9 across both channels, and reads registers 2 and 3
     64  1.1  mycroft  * differently for the two channels.  We can, however, ignore this much
     65  1.1  mycroft  * of the time.
     66  1.6      gwr  *
     67  1.6      gwr  * This file also includes flags for the Z85C30 and Z85230 enhanced scc.
     68  1.6      gwr  * The CMOS 8530 includes extra SDLC functionality, and is used in a
     69  1.6      gwr  * number of Macs (often in the Z85C80, an 85C30 combined w/ a SCSI
     70  1.6      gwr  * controller). -wrs
     71  1.6      gwr  *
     72  1.1  mycroft  * Some of the names in this files were chosen to make the hsis driver
     73  1.1  mycroft  * work unchanged (which means that they will match some in SunOS).
     74  1.1  mycroft  *
     75  1.1  mycroft  * `S.C.' stands for Special Condition, which is any of these:
     76  1.1  mycroft  *	receiver overrun	(aka silo overflow)
     77  1.1  mycroft  *	framing error		(missing stop bit, etc)
     78  1.1  mycroft  *	end of frame		(in synchronous modes)
     79  1.1  mycroft  *	parity error		(when `parity error is S.C.' is set)
     80  1.6      gwr  *
     81  1.1  mycroft  * Registers with only a single `numeric value' get a name.
     82  1.1  mycroft  * Other registers hold bits and are only numbered; the bit
     83  1.1  mycroft  * definitions imply the register number (see below).
     84  1.1  mycroft  *
     85  1.1  mycroft  * We never use the receive and transmit data registers as
     86  1.1  mycroft  * indirects (choosing instead the zc_data register), so they
     87  1.1  mycroft  * are not defined here.
     88  1.1  mycroft  */
     89  1.1  mycroft #define	ZSRR_IVEC	2	/* interrupt vector (channel 0) */
     90  1.1  mycroft #define	ZSRR_IPEND	3	/* interrupt pending (ch. 0 only) */
     91  1.6      gwr #define	ZSRR_TXSYNC	6	/* sync transmit char (monosync mode) */
     92  1.6      gwr #define	ZSRR_RXSYNC	7	/* sync receive char (monosync mode) */
     93  1.6      gwr #define	ZSRR_SYNCLO	6	/* sync low byte (bisync mode) */
     94  1.6      gwr #define	ZSRR_SYNCHI	7	/* sync high byte (bisync mode) */
     95  1.6      gwr #define	ZSRR_SDLC_ADDR	6	/* SDLC address (SDLC mode) */
     96  1.6      gwr #define	ZSRR_SDLC_FLAG	7	/* SDLC flag 0x7E (SDLC mode) */
     97  1.1  mycroft #define	ZSRR_BAUDLO	12	/* baud rate generator (low half) */
     98  1.1  mycroft #define	ZSRR_BAUDHI	13	/* baud rate generator (high half) */
     99  1.6      gwr #define	ZSRR_ENHANCED	14	/* read address of WR7' - yes, it's not 7!*/
    100  1.1  mycroft 
    101  1.1  mycroft #define	ZSWR_IVEC	2	/* interrupt vector (shared) */
    102  1.1  mycroft #define	ZSWR_TXSYNC	6	/* sync transmit char (monosync mode) */
    103  1.1  mycroft #define	ZSWR_RXSYNC	7	/* sync receive char (monosync mode) */
    104  1.1  mycroft #define	ZSWR_SYNCLO	6	/* sync low byte (bisync mode) */
    105  1.1  mycroft #define	ZSWR_SYNCHI	7	/* sync high byte (bisync mode) */
    106  1.1  mycroft #define	ZSWR_SDLC_ADDR	6	/* SDLC address (SDLC mode) */
    107  1.1  mycroft #define	ZSWR_SDLC_FLAG	7	/* SDLC flag 0x7E (SDLC mode) */
    108  1.1  mycroft #define	ZSWR_BAUDLO	12	/* baud rate generator (low half) */
    109  1.1  mycroft #define	ZSWR_BAUDHI	13	/* baud rate generator (high half) */
    110  1.6      gwr #define	ZSWR_ENHANCED	7	/* write address of WR7' */
    111  1.1  mycroft 
    112  1.1  mycroft /*
    113  1.1  mycroft  * Registers 0 through 7 may be written with any one of the 8 command
    114  1.1  mycroft  * modifiers, and/or any one of the 4 reset modifiers, defined below.
    115  1.1  mycroft  * To write registers 8 through 15, however, the command modifier must
    116  1.1  mycroft  * always be `point high'.  Rather than track this bizzareness all over
    117  1.1  mycroft  * the driver, we try to avoid using any modifiers, ever (but they are
    118  1.1  mycroft  * defined here if you want them).
    119  1.1  mycroft  */
    120  1.1  mycroft #define	ZSM_RESET_TXUEOM	0xc0	/* reset xmit underrun / eom latch */
    121  1.1  mycroft #define	ZSM_RESET_TXCRC		0x80	/* reset xmit crc generator */
    122  1.1  mycroft #define	ZSM_RESET_RXCRC		0x40	/* reset recv crc checker */
    123  1.1  mycroft #define	ZSM_NULL		0x00	/* nothing special */
    124  1.1  mycroft 
    125  1.1  mycroft #define	ZSM_RESET_IUS		0x38	/* reset interrupt under service */
    126  1.1  mycroft #define	ZSM_RESET_ERR		0x30	/* reset error cond */
    127  1.1  mycroft #define	ZSM_RESET_TXINT		0x28	/* reset xmit interrupt pending */
    128  1.1  mycroft #define	ZSM_EI_NEXTRXC		0x20	/* enable int. on next rcvd char */
    129  1.1  mycroft #define	ZSM_SEND_ABORT		0x18	/* send abort (SDLC) */
    130  1.1  mycroft #define	ZSM_RESET_STINT		0x10	/* reset external/status interrupt */
    131  1.1  mycroft #define	ZSM_POINTHIGH		0x08	/* `point high' (use r8-r15) */
    132  1.1  mycroft #define	ZSM_NULL		0x00	/* nothing special */
    133  1.1  mycroft 
    134  1.1  mycroft /*
    135  1.1  mycroft  * Commands for Write Register 0 (`Command Register').
    136  1.1  mycroft  * These are just the command modifiers or'ed with register number 0
    137  1.1  mycroft  * (which of course equals the command modifier).
    138  1.1  mycroft  */
    139  1.1  mycroft #define	ZSWR0_RESET_EOM		ZSM_RESET_TXUEOM
    140  1.1  mycroft #define	ZSWR0_RESET_TXCRC	ZSM_RESET_TXCRC
    141  1.1  mycroft #define	ZSWR0_RESET_RXCRC	ZSM_RESET_RXCRC
    142  1.1  mycroft #define	ZSWR0_CLR_INTR		ZSM_RESET_IUS
    143  1.1  mycroft #define	ZSWR0_RESET_ERRORS	ZSM_RESET_ERR
    144  1.1  mycroft #define	ZSWR0_EI_NEXTRXC	ZSM_EI_NEXTRXC
    145  1.1  mycroft #define	ZSWR0_SEND_ABORT	ZSM_SEND_ABORT
    146  1.1  mycroft #define	ZSWR0_RESET_STATUS	ZSM_RESET_STINT
    147  1.1  mycroft #define	ZSWR0_RESET_TXINT	ZSM_RESET_TXINT
    148  1.1  mycroft 
    149  1.1  mycroft /*
    150  1.1  mycroft  * Bits in Write Register 1 (`Transmit/Receive Interrupt and Data
    151  1.1  mycroft  * Transfer Mode Definition').  Note that bits 3 and 4 are taken together
    152  1.1  mycroft  * as a single unit, and bits 5 and 6 are useful only if bit 7 is set.
    153  1.1  mycroft  */
    154  1.1  mycroft #define	ZSWR1_REQ_WAIT		0x80	/* WAIT*-REQ* pin gives WAIT* */
    155  1.1  mycroft #define	ZSWR1_REQ_REQ		0xc0	/* WAIT*-REQ* pin gives REQ* */
    156  1.1  mycroft #define	ZSWR1_REQ_TX		0x00	/* WAIT*-REQ* pin follows xmit buf */
    157  1.1  mycroft #define	ZSWR1_REQ_RX		0x20	/* WAIT*-REQ* pin follows recv buf */
    158  1.1  mycroft 
    159  1.1  mycroft #define	ZSWR1_RIE_NONE		0x00	/* disable rxint entirely */
    160  1.1  mycroft #define	ZSWR1_RIE_FIRST		0x08	/* rxint on first char & on S.C. */
    161  1.1  mycroft #define	ZSWR1_RIE		0x10	/* rxint per char & on S.C. */
    162  1.1  mycroft #define	ZSWR1_RIE_SPECIAL_ONLY	0x18	/* rxint on S.C. only */
    163  1.1  mycroft 
    164  1.1  mycroft #define	ZSWR1_PE_SC		0x04	/* parity error is special condition */
    165  1.1  mycroft #define	ZSWR1_TIE		0x02	/* transmit interrupt enable */
    166  1.1  mycroft #define	ZSWR1_SIE		0x01	/* external/status interrupt enable */
    167  1.1  mycroft 
    168  1.1  mycroft /* HSIS compat */
    169  1.1  mycroft #define	ZSWR1_REQ_ENABLE	(ZSWR1_REQ_WAIT | ZSWR1_REQ_TX)
    170  1.1  mycroft 
    171  1.1  mycroft /*
    172  1.1  mycroft  * Bits in Write Register 3 (`Receive Parameters and Control').
    173  1.1  mycroft  * Bits 7 and 6 are taken as a unit.  Note that the receive bits
    174  1.1  mycroft  * per character ordering is insane.
    175  1.1  mycroft  *
    176  1.1  mycroft  * Here `hardware flow control' means CTS enables the transmitter
    177  1.1  mycroft  * and DCD enables the receiver.  The latter is neither interesting
    178  1.1  mycroft  * nor useful, and gets in our way, making it almost unusable.
    179  1.1  mycroft  */
    180  1.1  mycroft #define	ZSWR3_RX_5		0x00	/* receive 5 bits per char */
    181  1.1  mycroft #define	ZSWR3_RX_7		0x40	/* receive 7 bits per char */
    182  1.1  mycroft #define	ZSWR3_RX_6		0x80	/* receive 6 bits per char */
    183  1.1  mycroft #define	ZSWR3_RX_8		0xc0	/* receive 8 bits per char */
    184  1.7      gwr #define	ZSWR3_RXSIZE		0xc0	/* receive char size mask */
    185  1.1  mycroft 
    186  1.1  mycroft #define	ZSWR3_HFC		0x20	/* hardware flow control */
    187  1.1  mycroft #define	ZSWR3_HUNT		0x10	/* enter hunt mode */
    188  1.1  mycroft #define	ZSWR3_RXCRC_ENABLE	0x08	/* enable recv crc calculation */
    189  1.1  mycroft #define	ZSWR3_ADDR_SEARCH_MODE	0x04	/* address search mode (SDLC only) */
    190  1.1  mycroft #define	ZSWR3_SYNC_LOAD_INH	0x02	/* sync character load inhibit */
    191  1.1  mycroft #define	ZSWR3_RX_ENABLE		0x01	/* receiver enable */
    192  1.1  mycroft 
    193  1.1  mycroft /*
    194  1.1  mycroft  * Bits in Write Register 4 (`Transmit/Receive Miscellaneous Parameters
    195  1.1  mycroft  * and Modes').  Bits 7&6, 5&4, and 3&2 are taken as units.
    196  1.1  mycroft  */
    197  1.1  mycroft #define	ZSWR4_CLK_X1		0x00	/* clock divisor = 1 */
    198  1.1  mycroft #define	ZSWR4_CLK_X16		0x40	/* clock divisor = 16 */
    199  1.1  mycroft #define	ZSWR4_CLK_X32		0x80	/* clock divisor = 32 */
    200  1.1  mycroft #define	ZSWR4_CLK_X64		0xc0	/* clock divisor = 64 */
    201  1.7      gwr #define	ZSWR4_CLK_MASK		0xc0	/* clock divisor mask */
    202  1.1  mycroft 
    203  1.1  mycroft #define	ZSWR4_MONOSYNC		0x00	/* 8 bit sync char (sync only) */
    204  1.1  mycroft #define	ZSWR4_BISYNC		0x10	/* 16 bit sync char (sync only) */
    205  1.7      gwr #define	ZSWR4_SDLC  		0x20	/* SDLC mode */
    206  1.1  mycroft #define	ZSWR4_EXTSYNC		0x30	/* external sync mode */
    207  1.7      gwr #define	ZSWR4_SYNC_MASK		0x30	/* sync mode bit mask */
    208  1.1  mycroft 
    209  1.7      gwr #define	ZSWR4_SYNCMODE		0x00	/* no stop bit (sync mode only) */
    210  1.7      gwr #define	ZSWR4_ONESB 		0x04	/* 1 stop bit */
    211  1.7      gwr #define	ZSWR4_1P5SB 		0x08	/* 1.5 stop bits (clk cannot be 1x) */
    212  1.7      gwr #define	ZSWR4_TWOSB 		0x0c	/* 2 stop bits */
    213  1.7      gwr #define	ZSWR4_SBMASK		0x0c	/* mask of all stop bits */
    214  1.1  mycroft 
    215  1.7      gwr #define	ZSWR4_EVENP 		0x02	/* check for even parity */
    216  1.1  mycroft #define	ZSWR4_PARENB		0x01	/* enable parity checking */
    217  1.7      gwr #define	ZSWR4_PARMASK		0x03	/* mask of all parity bits */
    218  1.1  mycroft 
    219  1.1  mycroft /*
    220  1.1  mycroft  * Bits in Write Register 5 (`Transmit Parameter and Controls').
    221  1.1  mycroft  * Bits 6 and 5 are taken as a unit; the ordering is, as with RX
    222  1.1  mycroft  * bits per char, not sensible.
    223  1.1  mycroft  */
    224  1.1  mycroft #define	ZSWR5_DTR		0x80	/* assert (set to -12V) DTR */
    225  1.1  mycroft 
    226  1.1  mycroft #define	ZSWR5_TX_5		0x00	/* transmit 5 or fewer bits */
    227  1.1  mycroft #define	ZSWR5_TX_7		0x20	/* transmit 7 bits */
    228  1.1  mycroft #define	ZSWR5_TX_6		0x40	/* transmit 6 bits */
    229  1.1  mycroft #define	ZSWR5_TX_8		0x60	/* transmit 8 bits */
    230  1.7      gwr #define	ZSWR5_TXSIZE		0x60	/* transmit char size mask */
    231  1.1  mycroft 
    232  1.1  mycroft #define	ZSWR5_BREAK		0x10	/* send break (continuous 0s) */
    233  1.1  mycroft #define	ZSWR5_TX_ENABLE		0x08	/* enable transmitter */
    234  1.1  mycroft #define	ZSWR5_CRC16		0x04	/* use CRC16 (off => use SDLC) */
    235  1.1  mycroft #define	ZSWR5_RTS		0x02	/* assert RTS */
    236  1.1  mycroft #define	ZSWR5_TXCRC_ENABLE	0x01	/* enable xmit crc calculation */
    237  1.1  mycroft 
    238  1.1  mycroft #ifdef not_done_here
    239  1.1  mycroft /*
    240  1.1  mycroft  * Bits in Write Register 7 when the chip is in SDLC mode.
    241  1.1  mycroft  */
    242  1.1  mycroft #define	ZSWR7_SDLCFLAG		0x7e	/* this value makes SDLC mode work */
    243  1.1  mycroft #endif
    244  1.1  mycroft 
    245  1.1  mycroft /*
    246  1.6      gwr  * Bits in Write Register 7' (ZSWR_ENHANCED above). This register is
    247  1.6      gwr  * only available on the 85230. Dispite the fact it contains flags
    248  1.6      gwr  * and not a single value, the register was named as it is read
    249  1.6      gwr  * via RR14. Weird.
    250  1.6      gwr  */
    251  1.6      gwr 			/*	0x80	unused */
    252  1.6      gwr #define	ZSWR7P_EXTEND_READ	0x40	/* modify read map; make most regs readable */
    253  1.6      gwr #define	ZSWR7P_TX_FIFO		0x20	/* change level for Tx FIFO empty int */
    254  1.6      gwr #define	ZSWR7P_DTR_TIME		0x10	/* modifies deact. speed of /DTR//REQ */
    255  1.6      gwr #define	ZSWR7P_RX_FIFO		0x08	/* Rx FIFO int on 1/2 full? */
    256  1.6      gwr #define	ZSWR7P_RTS_DEACT	0x04	/* automatically deassert RTS */
    257  1.6      gwr #define	ZSWR7P_AUTO_EOM_RESET	0x02	/* automatically reset EMO/Tx Underrun */
    258  1.6      gwr #define	ZSWR7P_AUTO_TX_FLAG	0x01	/* Auto send SDLC flag at transmit start */
    259  1.6      gwr 
    260  1.6      gwr /*
    261  1.1  mycroft  * Bits in Write Register 9 (`Master Interrupt Control').  Bits 7 & 6
    262  1.1  mycroft  * are taken as a unit and indicate the type of reset; 00 means no reset
    263  1.1  mycroft  * (and is not defined here).
    264  1.1  mycroft  */
    265  1.1  mycroft #define	ZSWR9_HARD_RESET	0xc0	/* force hardware reset */
    266  1.1  mycroft #define	ZSWR9_A_RESET		0x80	/* reset channel A (0) */
    267  1.1  mycroft #define	ZSWR9_B_RESET		0x40	/* reset channel B (1) */
    268  1.6      gwr #define	ZSWR9_SOFT_INTAC	0x20	/* Not in NMOS version */
    269  1.1  mycroft 
    270  1.1  mycroft #define	ZSWR9_STATUS_HIGH	0x10	/* status in high bits of intr vec */
    271  1.1  mycroft #define	ZSWR9_MASTER_IE		0x08	/* master interrupt enable */
    272  1.1  mycroft #define	ZSWR9_DLC		0x04	/* disable lower chain */
    273  1.1  mycroft #define	ZSWR9_NO_VECTOR		0x02	/* no vector */
    274  1.1  mycroft #define	ZSWR9_VECTOR_INCL_STAT	0x01	/* vector includes status */
    275  1.1  mycroft 
    276  1.1  mycroft /*
    277  1.1  mycroft  * Bits in Write Register 10 (`Miscellaneous Transmitter/Receiver Control
    278  1.1  mycroft  * Bits').  Bits 6 & 5 are taken as a unit, and some of the bits are
    279  1.1  mycroft  * meaningful only in certain modes.  Bleah.
    280  1.1  mycroft  */
    281  1.1  mycroft #define	ZSWR10_PRESET_ONES	0x80	/* preset CRC to all 1 (else all 0) */
    282  1.1  mycroft 
    283  1.1  mycroft #define	ZSWR10_NRZ		0x00	/* NRZ encoding */
    284  1.1  mycroft #define	ZSWR10_NRZI		0x20	/* NRZI encoding */
    285  1.1  mycroft #define	ZSWR10_FM1		0x40	/* FM1 encoding */
    286  1.1  mycroft #define	ZSWR10_FM0		0x60	/* FM0 encoding */
    287  1.1  mycroft 
    288  1.1  mycroft #define	ZSWR10_GA_ON_POLL	0x10	/* go active on poll (loop mode) */
    289  1.1  mycroft #define	ZSWR10_MARK_IDLE	0x08	/* all 1s (vs flag) when idle (SDLC) */
    290  1.1  mycroft #define	ZSWR10_ABORT_ON_UNDERRUN 0x4	/* abort on xmit underrun (SDLC) */
    291  1.1  mycroft #define	ZSWR10_LOOP_MODE	0x02	/* loop mode (SDLC) */
    292  1.1  mycroft #define	ZSWR10_6_BIT_SYNC	0x01	/* 6 bits per sync char (sync modes) */
    293  1.1  mycroft 
    294  1.1  mycroft /*
    295  1.1  mycroft  * Bits in Write Register 11 (`Clock Mode Control').  Bits 6&5, 4&3, and
    296  1.1  mycroft  * 1&0 are taken as units.  Various bits depend on other bits in complex
    297  1.1  mycroft  * ways; see the Zilog manual.
    298  1.1  mycroft  */
    299  1.1  mycroft #define	ZSWR11_XTAL		0x80	/* have xtal between RTxC* and SYNC* */
    300  1.1  mycroft 					/* (else have TTL oscil. on RTxC*) */
    301  1.6      gwr #define	ZSWR11_RXCLK_RTXC	0x00	/* recv clock taken from RTxC* pin */
    302  1.1  mycroft #define	ZSWR11_RXCLK_TRXC	0x20	/* recv clock taken from TRxC* pin */
    303  1.1  mycroft #define	ZSWR11_RXCLK_BAUD	0x40	/* recv clock taken from BRG */
    304  1.1  mycroft #define	ZSWR11_RXCLK_DPLL	0x60	/* recv clock taken from DPLL */
    305  1.1  mycroft 
    306  1.6      gwr #define	ZSWR11_TXCLK_RTXC	0x00	/* xmit clock taken from RTxC* pin */
    307  1.6      gwr #define	ZSWR11_TXCLK_TRXC	0x08	/* xmit clock taken from TRxC* pin */
    308  1.1  mycroft #define	ZSWR11_TXCLK_BAUD	0x10	/* xmit clock taken from BRG */
    309  1.1  mycroft #define	ZSWR11_TXCLK_DPLL	0x18	/* xmit clock taken from DPLL */
    310  1.1  mycroft 
    311  1.1  mycroft #define	ZSWR11_TRXC_OUT_ENA	0x04	/* TRxC* pin will be an output */
    312  1.1  mycroft 					/* (unless it is being used above) */
    313  1.1  mycroft #define	ZSWR11_TRXC_XTAL	0x00	/* TRxC output from xtal oscillator */
    314  1.1  mycroft #define	ZSWR11_TRXC_XMIT	0x01	/* TRxC output from xmit clock */
    315  1.1  mycroft #define	ZSWR11_TRXC_BAUD	0x02	/* TRxC output from BRG */
    316  1.1  mycroft #define	ZSWR11_TRXC_DPLL	0x03	/* TRxC output from DPLL */
    317  1.1  mycroft 
    318  1.1  mycroft /*
    319  1.1  mycroft  * Formula for Write Registers 12 and 13 (`Lower Byte of Baud Rate
    320  1.1  mycroft  * Generator Time Constant' and `Upper Byte of ...').  Inputs:
    321  1.1  mycroft  *
    322  1.1  mycroft  *	f	BRG input clock frequency (in Hz) AFTER division
    323  1.1  mycroft  *		by 1, 16, 32, or 64 (per clock divisor in WR4)
    324  1.1  mycroft  *	bps	desired rate in bits per second (9600, etc)
    325  1.1  mycroft  *
    326  1.1  mycroft  * We want
    327  1.1  mycroft  *
    328  1.1  mycroft  *	  f
    329  1.1  mycroft  *	----- + 0.5 - 2
    330  1.1  mycroft  *	2 bps
    331  1.1  mycroft  *
    332  1.1  mycroft  * rounded down to an integer.  This can be computed entirely
    333  1.1  mycroft  * in integer arithemtic as:
    334  1.1  mycroft  *
    335  1.1  mycroft  *	f + bps
    336  1.1  mycroft  *	------- - 2
    337  1.1  mycroft  *	 2 bps
    338  1.1  mycroft  */
    339  1.1  mycroft #define	BPS_TO_TCONST(f, bps)	((((f) + (bps)) / (2 * (bps))) - 2)
    340  1.1  mycroft 
    341  1.1  mycroft /* inverse of above: given a BRG Time Constant, return Bits Per Second */
    342  1.1  mycroft #define	TCONST_TO_BPS(f, tc)	((f) / 2 / ((tc) + 2))
    343  1.1  mycroft 
    344  1.1  mycroft /*
    345  1.1  mycroft  * Bits in Write Register 14 (`Miscellaneous Control Bits').
    346  1.1  mycroft  * Bits 7 through 5 are taken as a unit and make up a `DPLL command'.
    347  1.1  mycroft  */
    348  1.1  mycroft #define	ZSWR14_DPLL_NOOP	0x00	/* leave DPLL alone */
    349  1.1  mycroft #define	ZSWR14_DPLL_SEARCH	0x20	/* enter search mode */
    350  1.1  mycroft #define	ZSWR14_DPLL_RESET_CM	0x40	/* reset `clock missing' in RR10 */
    351  1.1  mycroft #define	ZSWR14_DPLL_DISABLE	0x60	/* disable DPLL (continuous search) */
    352  1.1  mycroft #define	ZSWR14_DPLL_SRC_BAUD	0x80	/* set DPLL src = BRG */
    353  1.1  mycroft #define	ZSWR14_DPLL_SRC_RTXC	0xa0	/* set DPLL src = RTxC* or xtal osc */
    354  1.1  mycroft #define	ZSWR14_DPLL_FM		0xc0	/* operate in FM mode */
    355  1.1  mycroft #define	ZSWR14_DPLL_NRZI	0xe0	/* operate in NRZI mode */
    356  1.1  mycroft 
    357  1.1  mycroft #define	ZSWR14_LOCAL_LOOPBACK	0x10	/* set local loopback mode */
    358  1.1  mycroft #define	ZSWR14_AUTO_ECHO	0x08	/* set auto echo mode */
    359  1.3   briggs #define	ZSWR14_DTR_REQ		0x04	/* DTR* / REQ* pin gives REQ* */
    360  1.1  mycroft #define	ZSWR14_BAUD_FROM_PCLK	0x02	/* BRG clock taken from PCLK */
    361  1.1  mycroft 					/* (else from RTxC* pin or xtal osc) */
    362  1.1  mycroft #define	ZSWR14_BAUD_ENA		0x01	/* enable BRG countdown */
    363  1.1  mycroft 
    364  1.1  mycroft /*
    365  1.1  mycroft  * Bits in Write Register 15 (`External/Status Interrupt Control').
    366  1.1  mycroft  * Most of these cause status interrupts whenever the corresponding
    367  1.1  mycroft  * bit or pin changes state (i.e., any rising or falling edge).
    368  1.6      gwr  *
    369  1.6      gwr  * NOTE: ZSWR15_SDLC_FIFO & ZSWR15_ENABLE_ENHANCED should not be
    370  1.6      gwr  * set on an NMOS 8530. Also, ZSWR15_ENABLE_ENHANCED is only
    371  1.6      gwr  * available on the 85230.
    372  1.1  mycroft  */
    373  1.1  mycroft #define	ZSWR15_BREAK_IE		0x80	/* enable break/abort status int */
    374  1.1  mycroft #define	ZSWR15_TXUEOM_IE	0x40	/* enable TX underrun/EOM status int */
    375  1.1  mycroft #define	ZSWR15_CTS_IE		0x20	/* enable CTS* pin status int */
    376  1.1  mycroft #define	ZSWR15_SYNCHUNT_IE	0x10	/* enable SYNC* pin/hunt status int */
    377  1.1  mycroft #define	ZSWR15_DCD_IE		0x08	/* enable DCD* pin status int */
    378  1.6      gwr #define	ZSWR15_SDLC_FIFO	0x04	/* enable SDLC FIFO enhancements */
    379  1.1  mycroft #define	ZSWR15_ZERO_COUNT_IE	0x02	/* enable BRG-counter = 0 status int */
    380  1.6      gwr #define	ZSWR15_ENABLE_ENHANCED	0x01	/* enable writing WR7' at reg 7 */
    381  1.1  mycroft 
    382  1.1  mycroft /*
    383  1.1  mycroft  * Bits in Read Register 0 (`Transmit/Receive Buffer Status and External
    384  1.1  mycroft  * Status').
    385  1.1  mycroft  */
    386  1.1  mycroft #define	ZSRR0_BREAK		0x80	/* break/abort detected */
    387  1.1  mycroft #define	ZSRR0_TXUNDER		0x40	/* transmit underrun/EOM (sync) */
    388  1.1  mycroft #define	ZSRR0_CTS		0x20	/* clear to send */
    389  1.1  mycroft #define	ZSRR0_SYNC_HUNT		0x10	/* sync/hunt (sync mode) */
    390  1.1  mycroft #define	ZSRR0_DCD		0x08	/* data carrier detect */
    391  1.1  mycroft #define	ZSRR0_TX_READY		0x04	/* transmit buffer empty */
    392  1.1  mycroft #define	ZSRR0_ZERO_COUNT	0x02	/* zero count in baud clock */
    393  1.1  mycroft #define	ZSRR0_RX_READY		0x01	/* received character ready */
    394  1.1  mycroft 
    395  1.1  mycroft /*
    396  1.1  mycroft  * Bits in Read Register 1 (the Zilog book does not name this one).
    397  1.1  mycroft  */
    398  1.1  mycroft #define	ZSRR1_EOF		0x80	/* end of frame (SDLC mode) */
    399  1.1  mycroft #define	ZSRR1_FE		0x40	/* CRC/framing error */
    400  1.1  mycroft #define	ZSRR1_DO		0x20	/* data (receiver) overrun */
    401  1.1  mycroft #define	ZSRR1_PE		0x10	/* parity error */
    402  1.1  mycroft #define	ZSRR1_RC0		0x08	/* residue code 0 (SDLC mode) */
    403  1.1  mycroft #define	ZSRR1_RC1		0x04	/* residue code 1 (SDLC mode) */
    404  1.1  mycroft #define	ZSRR1_RC2		0x02	/* residue code 2 (SDLC mode) */
    405  1.1  mycroft #define	ZSRR1_ALL_SENT		0x01	/* all chars out of xmitter (async) */
    406  1.1  mycroft 
    407  1.1  mycroft /*
    408  1.1  mycroft  * Read Register 2 in B channel contains status bits if VECTOR_INCL_STAT
    409  1.1  mycroft  * is set.
    410  1.1  mycroft  */
    411  1.1  mycroft 
    412  1.1  mycroft /*
    413  1.1  mycroft  * Bits in Read Register 3 (`Interrupt Pending').  Only channel A
    414  1.1  mycroft  * has an RR3.
    415  1.1  mycroft  */
    416  1.1  mycroft 			/*	0x80	   unused, returned as 0 */
    417  1.1  mycroft 			/*	0x40	   unused, returned as 0 */
    418  1.1  mycroft #define	ZSRR3_IP_A_RX		0x20	/* channel A recv int pending */
    419  1.1  mycroft #define	ZSRR3_IP_A_TX		0x10	/* channel A xmit int pending */
    420  1.1  mycroft #define	ZSRR3_IP_A_STAT		0x08	/* channel A status int pending */
    421  1.1  mycroft #define	ZSRR3_IP_B_RX		0x04	/* channel B recv int pending */
    422  1.1  mycroft #define	ZSRR3_IP_B_TX		0x02	/* channel B xmit int pending */
    423  1.1  mycroft #define	ZSRR3_IP_B_STAT		0x01	/* channel B status int pending */
    424  1.1  mycroft 
    425  1.1  mycroft /*
    426  1.1  mycroft  * Bits in Read Register 10 (`contains some miscellaneous status bits').
    427  1.1  mycroft  */
    428  1.1  mycroft #define	ZSRR10_1_CLOCK_MISSING	0x80	/* 1 clock edge missing (FM mode) */
    429  1.1  mycroft #define	ZSRR10_2_CLOCKS_MISSING	0x40	/* 2 clock edges missing (FM mode) */
    430  1.1  mycroft 			/*	0x20	   unused */
    431  1.1  mycroft #define	ZSRR10_LOOP_SENDING	0x10	/* xmitter controls loop (SDLC loop) */
    432  1.1  mycroft 			/*	0x08	   unused */
    433  1.1  mycroft 			/*	0x04	   unused */
    434  1.1  mycroft #define	ZSRR10_ON_LOOP		0x02	/* SCC is on loop (SDLC/X.21 modes) */
    435  1.1  mycroft 
    436  1.1  mycroft /*
    437  1.1  mycroft  * Bits in Read Register 15.  This register is one of the few that
    438  1.1  mycroft  * simply reads back the corresponding Write Register.
    439  1.1  mycroft  */
    440  1.1  mycroft #define	ZSRR15_BREAK_IE		0x80	/* break/abort status int enable */
    441  1.1  mycroft #define	ZSRR15_TXUEOM_IE	0x40	/* TX underrun/EOM status int enable */
    442  1.1  mycroft #define	ZSRR15_CTS_IE		0x20	/* CTS* pin status int enable */
    443  1.1  mycroft #define	ZSRR15_SYNCHUNT_IE	0x10	/* SYNC* pin/hunt status int enable */
    444  1.1  mycroft #define	ZSRR15_DCD_IE		0x08	/* DCD* pin status int enable */
    445  1.1  mycroft 			/*	0x04	   unused, returned as zero */
    446  1.1  mycroft #define	ZSRR15_ZERO_COUNT_IE	0x02	/* BRG-counter = 0 status int enable */
    447  1.1  mycroft 			/*	0x01	   unused, returned as zero */
    448