xref: /freebsd/sys/dev/ic/ns16550.h (revision 74814b322ab9fb83584a8f2a15635f99036dde1a)
15b81b6b3SRodney W. Grimes /*-
25b81b6b3SRodney W. Grimes  * Copyright (c) 1991 The Regents of the University of California.
35b81b6b3SRodney W. Grimes  * All rights reserved.
45b81b6b3SRodney W. Grimes  *
55b81b6b3SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
65b81b6b3SRodney W. Grimes  * modification, are permitted provided that the following conditions
75b81b6b3SRodney W. Grimes  * are met:
85b81b6b3SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
95b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
105b81b6b3SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
115b81b6b3SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
125b81b6b3SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
135b81b6b3SRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
145b81b6b3SRodney W. Grimes  *    must display the following acknowledgement:
155b81b6b3SRodney W. Grimes  *	This product includes software developed by the University of
165b81b6b3SRodney W. Grimes  *	California, Berkeley and its contributors.
175b81b6b3SRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
185b81b6b3SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
195b81b6b3SRodney W. Grimes  *    without specific prior written permission.
205b81b6b3SRodney W. Grimes  *
215b81b6b3SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
225b81b6b3SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
235b81b6b3SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
245b81b6b3SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
255b81b6b3SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
265b81b6b3SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
275b81b6b3SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
285b81b6b3SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
295b81b6b3SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
305b81b6b3SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
315b81b6b3SRodney W. Grimes  * SUCH DAMAGE.
325b81b6b3SRodney W. Grimes  *
336f78ca60SRodney W. Grimes  *	from: @(#)ns16550.h	7.1 (Berkeley) 5/9/91
34c3aac50fSPeter Wemm  * $FreeBSD$
355b81b6b3SRodney W. Grimes  */
365b81b6b3SRodney W. Grimes 
375b81b6b3SRodney W. Grimes /*
3874814b32SBruce Evans  * NS8250... UART registers.
395b81b6b3SRodney W. Grimes  */
4086fe8739SBruce Evans 
4174814b32SBruce Evans /* 8250 registers #[0-6]. */
4274814b32SBruce Evans 
4374814b32SBruce Evans #define	com_data	0	/* data register (R/W) */
4474814b32SBruce Evans 
4574814b32SBruce Evans #define	com_ier		1	/* interrupt enable register (W) */
4686fe8739SBruce Evans #define	IER_ERXRDY	0x1
4786fe8739SBruce Evans #define	IER_ETXRDY	0x2
4886fe8739SBruce Evans #define	IER_ERLS	0x4
4986fe8739SBruce Evans #define	IER_EMSC	0x8
5086fe8739SBruce Evans 
5174814b32SBruce Evans #define	com_iir		2	/* interrupt identification register (R) */
5286fe8739SBruce Evans #define	IIR_IMASK	0xf
5386fe8739SBruce Evans #define	IIR_RXTOUT	0xc
5486fe8739SBruce Evans #define	IIR_RLS		0x6
5586fe8739SBruce Evans #define	IIR_RXRDY	0x4
5686fe8739SBruce Evans #define	IIR_TXRDY	0x2
5786fe8739SBruce Evans #define	IIR_NOPEND	0x1
5886fe8739SBruce Evans #define	IIR_MLSC	0x0
5986fe8739SBruce Evans #define	IIR_FIFO_MASK	0xc0	/* set if FIFOs are enabled */
6086fe8739SBruce Evans 
6174814b32SBruce Evans #define	com_lctl	3	/* line control register (R/W) */
6274814b32SBruce Evans #define	com_cfcr	3	/* character format control register (R/W) */
6386fe8739SBruce Evans #define	CFCR_DLAB	0x80
6486fe8739SBruce Evans #define	CFCR_SBREAK	0x40
6586fe8739SBruce Evans #define	CFCR_PZERO	0x30
6686fe8739SBruce Evans #define	CFCR_PONE	0x20
6786fe8739SBruce Evans #define	CFCR_PEVEN	0x10
6886fe8739SBruce Evans #define	CFCR_PODD	0x00
6986fe8739SBruce Evans #define	CFCR_PENAB	0x08
7086fe8739SBruce Evans #define	CFCR_STOPB	0x04
7186fe8739SBruce Evans #define	CFCR_8BITS	0x03
7286fe8739SBruce Evans #define	CFCR_7BITS	0x02
7386fe8739SBruce Evans #define	CFCR_6BITS	0x01
7486fe8739SBruce Evans #define	CFCR_5BITS	0x00
7586fe8739SBruce Evans #define	CFCR_EFR_ENABLE	0xbf	/* magic to enable EFR on 16650 up */
7686fe8739SBruce Evans 
7774814b32SBruce Evans #define	com_mcr		4	/* modem control register (R/W) */
7886fe8739SBruce Evans #define	MCR_PRESCALE	0x80	/* only available on 16650 up */
7986fe8739SBruce Evans #define	MCR_LOOPBACK	0x10
8086fe8739SBruce Evans #define	MCR_IENABLE	0x08
8186fe8739SBruce Evans #define	MCR_DRS		0x04
8286fe8739SBruce Evans #define	MCR_RTS		0x02
8386fe8739SBruce Evans #define	MCR_DTR		0x01
8486fe8739SBruce Evans 
8574814b32SBruce Evans #define	com_lsr		5	/* line status register (R/W) */
8686fe8739SBruce Evans #define	LSR_RCV_FIFO	0x80
8786fe8739SBruce Evans #define	LSR_TSRE	0x40
8886fe8739SBruce Evans #define	LSR_TXRDY	0x20
8986fe8739SBruce Evans #define	LSR_BI		0x10
9086fe8739SBruce Evans #define	LSR_FE		0x08
9186fe8739SBruce Evans #define	LSR_PE		0x04
9286fe8739SBruce Evans #define	LSR_OE		0x02
9386fe8739SBruce Evans #define	LSR_RXRDY	0x01
9486fe8739SBruce Evans #define	LSR_RCV_MASK	0x1f
9586fe8739SBruce Evans 
9674814b32SBruce Evans #define	com_msr		6	/* modem status register (R/W) */
9786fe8739SBruce Evans #define	MSR_DCD		0x80
9886fe8739SBruce Evans #define	MSR_RI		0x40
9986fe8739SBruce Evans #define	MSR_DSR		0x20
10086fe8739SBruce Evans #define	MSR_CTS		0x10
10186fe8739SBruce Evans #define	MSR_DDCD	0x08
10286fe8739SBruce Evans #define	MSR_TERI	0x04
10386fe8739SBruce Evans #define	MSR_DDSR	0x02
10486fe8739SBruce Evans #define	MSR_DCTS	0x01
10586fe8739SBruce Evans 
10674814b32SBruce Evans /* 8250 multiplexed registers #[0-1].  Access enabled by LCR[7]. */
10774814b32SBruce Evans #define	com_dlbl	0	/* divisor latch low (W) */
10874814b32SBruce Evans #define	com_dlbh	1	/* divisor latch high (W) */
10974814b32SBruce Evans 
11074814b32SBruce Evans /* 16450 register #7.  Not multiplexed. */
11174814b32SBruce Evans #define	com_scr		7	/* scratch register (R/W) */
11274814b32SBruce Evans 
11374814b32SBruce Evans /* 16550 register #2.  Not multiplexed. */
11474814b32SBruce Evans #define	com_fifo	2	/* FIFO control register (W) */
11574814b32SBruce Evans #define	FIFO_ENABLE	0x01
11674814b32SBruce Evans #define	FIFO_RCV_RST	0x02
11774814b32SBruce Evans #define	FIFO_XMT_RST	0x04
11874814b32SBruce Evans #define	FIFO_DMA_MODE	0x08
11974814b32SBruce Evans #define	FIFO_RX_LOW	0x00
12074814b32SBruce Evans #define	FIFO_RX_MEDL	0x40
12174814b32SBruce Evans #define	FIFO_RX_MEDH	0x80
12274814b32SBruce Evans #define	FIFO_RX_HIGH	0xc0
12374814b32SBruce Evans 
12474814b32SBruce Evans /* 16650 registers #2,[4-7].  Access enabled by LCR_EFR_ENABLE. */
12574814b32SBruce Evans 
12674814b32SBruce Evans #define	com_efr		com_fifo /* enhanced feature register (R/W) */
12786fe8739SBruce Evans #define	EFR_EFE		0x10	/* enhanced functions enable */
12886fe8739SBruce Evans 
12986fe8739SBruce Evans #ifdef PC98
13086fe8739SBruce Evans /* Hardware extension mode register for RSB-2000/3000. */
13186fe8739SBruce Evans #define	com_emr		com_msr
13286fe8739SBruce Evans #define	EMR_EXBUFF	0x04
13386fe8739SBruce Evans #define	EMR_CTSFLW	0x08
13486fe8739SBruce Evans #define	EMR_DSRFLW	0x10
13586fe8739SBruce Evans #define	EMR_RTSFLW	0x20
13686fe8739SBruce Evans #define	EMR_DTRFLW	0x40
13786fe8739SBruce Evans #define	EMR_EFMODE	0x80
13886fe8739SBruce Evans #endif
139