ns16550.h revision 194600
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 * 4. Neither the name of the University nor the names of its contributors 144Srgrimes * may be used to endorse or promote products derived from this software 154Srgrimes * without specific prior written permission. 164Srgrimes * 174Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 184Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 194Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 204Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 214Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 224Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 234Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 244Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 254Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 264Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 274Srgrimes * SUCH DAMAGE. 284Srgrimes * 29619Srgrimes * from: @(#)ns16550.h 7.1 (Berkeley) 5/9/91 3050477Speter * $FreeBSD: head/sys/dev/ic/ns16550.h 194600 2009-06-21 19:17:22Z sam $ 314Srgrimes */ 324Srgrimes 334Srgrimes/* 34120119Sbde * NS8250... UART registers. 354Srgrimes */ 36120119Sbde 37120119Sbde/* 8250 registers #[0-6]. */ 38120119Sbde 394Srgrimes#define com_data 0 /* data register (R/W) */ 40137948Smarcel#define REG_DATA com_data 41120116Sbde 42120119Sbde#define com_ier 1 /* interrupt enable register (W) */ 43137948Smarcel#define REG_IER com_ier 44120116Sbde#define IER_ERXRDY 0x1 45120116Sbde#define IER_ETXRDY 0x2 46120116Sbde#define IER_ERLS 0x4 47120116Sbde#define IER_EMSC 0x8 48120116Sbde 49194600Ssam#define IER_BITS "\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC" 50194600Ssam 51120119Sbde#define com_iir 2 /* interrupt identification register (R) */ 52137948Smarcel#define REG_IIR com_iir 53120116Sbde#define IIR_IMASK 0xf 54120116Sbde#define IIR_RXTOUT 0xc 55120116Sbde#define IIR_RLS 0x6 56120116Sbde#define IIR_RXRDY 0x4 57120116Sbde#define IIR_TXRDY 0x2 58120116Sbde#define IIR_NOPEND 0x1 59120116Sbde#define IIR_MLSC 0x0 60120116Sbde#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ 61120116Sbde 62194600Ssam#define IIR_BITS "\20\1NOPEND\2TXRDY\3RXRDY" 63194600Ssam 64120122Sbde#define com_lcr 3 /* line control register (R/W) */ 65120122Sbde#define com_cfcr com_lcr /* character format control register (R/W) */ 66137948Smarcel#define REG_LCR com_lcr 67120122Sbde#define LCR_DLAB 0x80 68120122Sbde#define CFCR_DLAB LCR_DLAB 69120122Sbde#define LCR_EFR_ENABLE 0xbf /* magic to enable EFR on 16650 up */ 70120122Sbde#define CFCR_EFR_ENABLE LCR_EFR_ENABLE 71137948Smarcel#define LCR_SBREAK 0x40 72137948Smarcel#define CFCR_SBREAK LCR_SBREAK 73137948Smarcel#define LCR_PZERO 0x30 74137948Smarcel#define CFCR_PZERO LCR_PZERO 75137948Smarcel#define LCR_PONE 0x20 76137948Smarcel#define CFCR_PONE LCR_PONE 77137948Smarcel#define LCR_PEVEN 0x10 78137948Smarcel#define CFCR_PEVEN LCR_PEVEN 79137948Smarcel#define LCR_PODD 0x00 80137948Smarcel#define CFCR_PODD LCR_PODD 81137948Smarcel#define LCR_PENAB 0x08 82137948Smarcel#define CFCR_PENAB LCR_PENAB 83137948Smarcel#define LCR_STOPB 0x04 84137948Smarcel#define CFCR_STOPB LCR_STOPB 85137948Smarcel#define LCR_8BITS 0x03 86137948Smarcel#define CFCR_8BITS LCR_8BITS 87137948Smarcel#define LCR_7BITS 0x02 88137948Smarcel#define CFCR_7BITS LCR_7BITS 89137948Smarcel#define LCR_6BITS 0x01 90137948Smarcel#define CFCR_6BITS LCR_6BITS 91137948Smarcel#define LCR_5BITS 0x00 92137948Smarcel#define CFCR_5BITS LCR_5BITS 93120116Sbde 94120119Sbde#define com_mcr 4 /* modem control register (R/W) */ 95137948Smarcel#define REG_MCR com_mcr 96120119Sbde#define MCR_PRESCALE 0x80 /* only available on 16650 up */ 97120116Sbde#define MCR_LOOPBACK 0x10 98137948Smarcel#define MCR_IE 0x08 99137948Smarcel#define MCR_IENABLE MCR_IE 100120116Sbde#define MCR_DRS 0x04 101120116Sbde#define MCR_RTS 0x02 102120116Sbde#define MCR_DTR 0x01 103120116Sbde 104194600Ssam#define MCR_BITS "\20\1DTR\2RTS\3DRS\4IE\5LOOPBACK\10PRESCALE" 105194600Ssam 106120119Sbde#define com_lsr 5 /* line status register (R/W) */ 107137948Smarcel#define REG_LSR com_lsr 108120116Sbde#define LSR_RCV_FIFO 0x80 109137948Smarcel#define LSR_TEMT 0x40 110137948Smarcel#define LSR_TSRE LSR_TEMT 111137948Smarcel#define LSR_THRE 0x20 112137948Smarcel#define LSR_TXRDY LSR_THRE 113120116Sbde#define LSR_BI 0x10 114120116Sbde#define LSR_FE 0x08 115120116Sbde#define LSR_PE 0x04 116120116Sbde#define LSR_OE 0x02 117120116Sbde#define LSR_RXRDY 0x01 118120116Sbde#define LSR_RCV_MASK 0x1f 119120116Sbde 120194600Ssam#define LSR_BITS "\20\1RXRDY\2OE\3PE\4FE\5BI\6THRE\7TEMT\10RCV_FIFO" 121194600Ssam 122120119Sbde#define com_msr 6 /* modem status register (R/W) */ 123137948Smarcel#define REG_MSR com_msr 124120116Sbde#define MSR_DCD 0x80 125120116Sbde#define MSR_RI 0x40 126120116Sbde#define MSR_DSR 0x20 127120116Sbde#define MSR_CTS 0x10 128120116Sbde#define MSR_DDCD 0x08 129120116Sbde#define MSR_TERI 0x04 130120116Sbde#define MSR_DDSR 0x02 131120116Sbde#define MSR_DCTS 0x01 132120116Sbde 133194600Ssam#define MSR_BITS "\20\1DCTS\2DDSR\3TERI\4DDCD\5CTS\6DSR\7RI\10DCD" 134194600Ssam 135120119Sbde/* 8250 multiplexed registers #[0-1]. Access enabled by LCR[7]. */ 136120122Sbde#define com_dll 0 /* divisor latch low (R/W) */ 137120122Sbde#define com_dlbl com_dll 138120122Sbde#define com_dlm 1 /* divisor latch high (R/W) */ 139120122Sbde#define com_dlbh com_dlm 140158844Sbenno#define REG_DLL com_dll 141158844Sbenno#define REG_DLH com_dlm 142120116Sbde 143120119Sbde/* 16450 register #7. Not multiplexed. */ 144120119Sbde#define com_scr 7 /* scratch register (R/W) */ 145120119Sbde 146120119Sbde/* 16550 register #2. Not multiplexed. */ 147120122Sbde#define com_fcr 2 /* FIFO control register (W) */ 148120122Sbde#define com_fifo com_fcr 149137948Smarcel#define REG_FCR com_fcr 150137948Smarcel#define FCR_ENABLE 0x01 151137948Smarcel#define FIFO_ENABLE FCR_ENABLE 152137948Smarcel#define FCR_RCV_RST 0x02 153137948Smarcel#define FIFO_RCV_RST FCR_RCV_RST 154137948Smarcel#define FCR_XMT_RST 0x04 155137948Smarcel#define FIFO_XMT_RST FCR_XMT_RST 156137948Smarcel#define FCR_DMA 0x08 157137948Smarcel#define FIFO_DMA_MODE FCR_DMA 158137948Smarcel#define FCR_RX_LOW 0x00 159137948Smarcel#define FIFO_RX_LOW FCR_RX_LOW 160137948Smarcel#define FCR_RX_MEDL 0x40 161137948Smarcel#define FIFO_RX_MEDL FCR_RX_MEDL 162137948Smarcel#define FCR_RX_MEDH 0x80 163137948Smarcel#define FIFO_RX_MEDH FCR_RX_MEDH 164137948Smarcel#define FCR_RX_HIGH 0xc0 165137948Smarcel#define FIFO_RX_HIGH FCR_RX_HIGH 166120119Sbde 167194600Ssam#define FCR_BITS "\20\1ENABLE\2RCV_RST\3XMT_RST\4DMA" 168194600Ssam 169120119Sbde/* 16650 registers #2,[4-7]. Access enabled by LCR_EFR_ENABLE. */ 170120119Sbde 171120122Sbde#define com_efr 2 /* enhanced features register (R/W) */ 172137948Smarcel#define REG_EFR com_efr 173137948Smarcel#define EFR_CTS 0x80 174137948Smarcel#define EFR_AUTOCTS EFR_CTS 175137948Smarcel#define EFR_RTS 0x40 176137948Smarcel#define EFR_AUTORTS EFR_RTS 177120119Sbde#define EFR_EFE 0x10 /* enhanced functions enable */ 178120119Sbde 179120123Sbde#define com_xon1 4 /* XON 1 character (R/W) */ 180120123Sbde#define com_xon2 5 /* XON 2 character (R/W) */ 181120123Sbde#define com_xoff1 6 /* XOFF 1 character (R/W) */ 182120123Sbde#define com_xoff2 7 /* XOFF 2 character (R/W) */ 183120123Sbde 184120124Sbde/* 16950 register #1. Access enabled by ACR[7]. Also requires !LCR[7]. */ 185120124Sbde#define com_asr 1 /* additional status register (R[0-7]/W[0-1]) */ 186120124Sbde 187120124Sbde/* 16950 register #3. R/W access enabled by ACR[7]. */ 188120124Sbde#define com_rfl 3 /* receiver fifo level (R) */ 189120124Sbde 190120124Sbde/* 191120124Sbde * 16950 register #4. Access enabled by ACR[7]. Also requires 192120124Sbde * !LCR_EFR_ENABLE. 193120124Sbde */ 194120124Sbde#define com_tfl 4 /* transmitter fifo level (R) */ 195120124Sbde 196120124Sbde/* 197120124Sbde * 16950 register #5. Accessible if !LCR_EFR_ENABLE. Read access also 198120124Sbde * requires ACR[6]. 199120124Sbde */ 200120124Sbde#define com_icr 5 /* index control register (R/W) */ 201120124Sbde 202120124Sbde/* 203120124Sbde * 16950 register #7. It is the same as com_scr except it has a different 204120124Sbde * abbreviation in the manufacturer's data sheet and it also serves as an 205120124Sbde * index into the Indexed Control register set. 206120124Sbde */ 207120124Sbde#define com_spr com_scr /* scratch pad (and index) register (R/W) */ 208137948Smarcel#define REG_SPR com_scr 209120124Sbde 210120124Sbde/* 211120124Sbde * 16950 indexed control registers #[0-0x13]. Access is via index in SPR, 212120124Sbde * data in ICR (if ICR is accessible). 213120124Sbde */ 214120124Sbde 215120124Sbde#define com_acr 0 /* additional control register (R/W) */ 216120124Sbde#define ACR_ASE 0x80 /* ASR/RFL/TFL enable */ 217120124Sbde#define ACR_ICRE 0x40 /* ICR enable */ 218120124Sbde#define ACR_TLE 0x20 /* TTL/RTL enable */ 219120124Sbde 220120124Sbde#define com_cpr 1 /* clock prescaler register (R/W) */ 221120124Sbde#define com_tcr 2 /* times clock register (R/W) */ 222120124Sbde#define com_ttl 4 /* transmitter trigger level (R/W) */ 223120124Sbde#define com_rtl 5 /* receiver trigger level (R/W) */ 224120124Sbde/* ... */ 225120124Sbde 226120116Sbde/* Hardware extension mode register for RSB-2000/3000. */ 227120116Sbde#define com_emr com_msr 228120116Sbde#define EMR_EXBUFF 0x04 229120116Sbde#define EMR_CTSFLW 0x08 230120116Sbde#define EMR_DSRFLW 0x10 231120116Sbde#define EMR_RTSFLW 0x20 232120116Sbde#define EMR_DTRFLW 0x40 233120116Sbde#define EMR_EFMODE 0x80 234