ns16550.h revision 120116
14Srgrimes/*- 24Srgrimes * Copyright (c) 1991 The Regents of the University of California. 34Srgrimes * All rights reserved. 44Srgrimes * 54Srgrimes * Redistribution and use in source and binary forms, with or without 64Srgrimes * modification, are permitted provided that the following conditions 74Srgrimes * are met: 84Srgrimes * 1. Redistributions of source code must retain the above copyright 94Srgrimes * notice, this list of conditions and the following disclaimer. 104Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 114Srgrimes * notice, this list of conditions and the following disclaimer in the 124Srgrimes * documentation and/or other materials provided with the distribution. 134Srgrimes * 3. All advertising materials mentioning features or use of this software 144Srgrimes * must display the following acknowledgement: 154Srgrimes * This product includes software developed by the University of 164Srgrimes * California, Berkeley and its contributors. 174Srgrimes * 4. Neither the name of the University nor the names of its contributors 184Srgrimes * may be used to endorse or promote products derived from this software 194Srgrimes * without specific prior written permission. 204Srgrimes * 214Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 224Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 234Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 244Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 254Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 264Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 274Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 284Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 294Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 304Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 314Srgrimes * SUCH DAMAGE. 324Srgrimes * 33619Srgrimes * from: @(#)ns16550.h 7.1 (Berkeley) 5/9/91 3450477Speter * $FreeBSD: head/sys/dev/ic/ns16550.h 120116 2003-09-16 08:08:08Z bde $ 354Srgrimes */ 364Srgrimes 374Srgrimes/* 384Srgrimes * NS16550 UART registers 394Srgrimes */ 404Srgrimes#define com_data 0 /* data register (R/W) */ 414Srgrimes#define com_dlbl 0 /* divisor latch low (W) */ 424Srgrimes#define com_dlbh 1 /* divisor latch high (W) */ 434Srgrimes#define com_ier 1 /* interrupt enable (W) */ 444Srgrimes#define com_iir 2 /* interrupt identification (R) */ 454Srgrimes#define com_fifo 2 /* FIFO control (W) */ 464Srgrimes#define com_lctl 3 /* line control register (R/W) */ 474Srgrimes#define com_cfcr 3 /* line control register (R/W) */ 484Srgrimes#define com_mcr 4 /* modem control register (R/W) */ 494Srgrimes#define com_lsr 5 /* line status register (R/W) */ 504Srgrimes#define com_msr 6 /* modem status register (R/W) */ 51103795Sphk#define com_scr 7 /* scratch register for 16450 up (R/W) */ 52120116Sbde 53120116Sbde/* interrupt enable register */ 54120116Sbde#define IER_ERXRDY 0x1 55120116Sbde#define IER_ETXRDY 0x2 56120116Sbde#define IER_ERLS 0x4 57120116Sbde#define IER_EMSC 0x8 58120116Sbde 59120116Sbde/* interrupt identification register */ 60120116Sbde#define IIR_IMASK 0xf 61120116Sbde#define IIR_RXTOUT 0xc 62120116Sbde#define IIR_RLS 0x6 63120116Sbde#define IIR_RXRDY 0x4 64120116Sbde#define IIR_TXRDY 0x2 65120116Sbde#define IIR_NOPEND 0x1 66120116Sbde#define IIR_MLSC 0x0 67120116Sbde#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ 68120116Sbde 69120116Sbde/* fifo control register */ 70120116Sbde#define FIFO_ENABLE 0x01 71120116Sbde#define FIFO_RCV_RST 0x02 72120116Sbde#define FIFO_XMT_RST 0x04 73120116Sbde#define FIFO_DMA_MODE 0x08 74120116Sbde#define FIFO_RX_LOW 0x00 75120116Sbde#define FIFO_RX_MEDL 0x40 76120116Sbde#define FIFO_RX_MEDH 0x80 77120116Sbde#define FIFO_RX_HIGH 0xc0 78120116Sbde 79120116Sbde/* character format control register (aka line control register) */ 80120116Sbde#define CFCR_DLAB 0x80 81120116Sbde#define CFCR_SBREAK 0x40 82120116Sbde#define CFCR_PZERO 0x30 83120116Sbde#define CFCR_PONE 0x20 84120116Sbde#define CFCR_PEVEN 0x10 85120116Sbde#define CFCR_PODD 0x00 86120116Sbde#define CFCR_PENAB 0x08 87120116Sbde#define CFCR_STOPB 0x04 88120116Sbde#define CFCR_8BITS 0x03 89120116Sbde#define CFCR_7BITS 0x02 90120116Sbde#define CFCR_6BITS 0x01 91120116Sbde#define CFCR_5BITS 0x00 92120116Sbde#define CFCR_EFR_ENABLE 0xbf /* magic to enable EFR on 16650 up */ 93120116Sbde 94120116Sbde/* modem control register */ 95120116Sbde#define MCR_PRESCALE 0x80 /* only available on 16650 up */ 96120116Sbde#define MCR_LOOPBACK 0x10 97120116Sbde#define MCR_IENABLE 0x08 98120116Sbde#define MCR_DRS 0x04 99120116Sbde#define MCR_RTS 0x02 100120116Sbde#define MCR_DTR 0x01 101120116Sbde 102120116Sbde/* line status register */ 103120116Sbde#define LSR_RCV_FIFO 0x80 104120116Sbde#define LSR_TSRE 0x40 105120116Sbde#define LSR_TXRDY 0x20 106120116Sbde#define LSR_BI 0x10 107120116Sbde#define LSR_FE 0x08 108120116Sbde#define LSR_PE 0x04 109120116Sbde#define LSR_OE 0x02 110120116Sbde#define LSR_RXRDY 0x01 111120116Sbde#define LSR_RCV_MASK 0x1f 112120116Sbde 113120116Sbde/* modem status register */ 114120116Sbde#define MSR_DCD 0x80 115120116Sbde#define MSR_RI 0x40 116120116Sbde#define MSR_DSR 0x20 117120116Sbde#define MSR_CTS 0x10 118120116Sbde#define MSR_DDCD 0x08 119120116Sbde#define MSR_TERI 0x04 120120116Sbde#define MSR_DDSR 0x02 121120116Sbde#define MSR_DCTS 0x01 122120116Sbde 123120116Sbde/* enhanced feature register (only available on 16650 up) */ 124120116Sbde#define com_efr com_fifo 125120116Sbde#define EFR_EFE 0x10 /* enhanced functions enable */ 126120116Sbde 127120116Sbde#ifdef PC98 128120116Sbde/* Hardware extension mode register for RSB-2000/3000. */ 129120116Sbde#define com_emr com_msr 130120116Sbde#define EMR_EXBUFF 0x04 131120116Sbde#define EMR_CTSFLW 0x08 132120116Sbde#define EMR_DSRFLW 0x10 133120116Sbde#define EMR_RTSFLW 0x20 134120116Sbde#define EMR_DTRFLW 0x40 135120116Sbde#define EMR_EFMODE 0x80 136120116Sbde#endif 137