xref: /freebsd/sys/dev/ic/ns16550.h (revision fec27f507c19d3c2f6dd6a545faabf74fcfc4a15)
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) */
442b843bc9SBruce Evans #define	com_thr		com_data /* transmitter holding register (W) */
452b843bc9SBruce Evans #define	com_rhr		com_data /* receiver holding register (R) */
4674814b32SBruce Evans 
4774814b32SBruce Evans #define	com_ier		1	/* interrupt enable register (W) */
4886fe8739SBruce Evans #define	IER_ERXRDY	0x1
4986fe8739SBruce Evans #define	IER_ETXRDY	0x2
5086fe8739SBruce Evans #define	IER_ERLS	0x4
5186fe8739SBruce Evans #define	IER_EMSC	0x8
5286fe8739SBruce Evans 
5374814b32SBruce Evans #define	com_iir		2	/* interrupt identification register (R) */
542b843bc9SBruce Evans #define	com_isr		com_iir	/* interrupt status register (R) */
5586fe8739SBruce Evans #define	IIR_IMASK	0xf
5686fe8739SBruce Evans #define	IIR_RXTOUT	0xc
5786fe8739SBruce Evans #define	IIR_RLS		0x6
5886fe8739SBruce Evans #define	IIR_RXRDY	0x4
5986fe8739SBruce Evans #define	IIR_TXRDY	0x2
6086fe8739SBruce Evans #define	IIR_NOPEND	0x1
6186fe8739SBruce Evans #define	IIR_MLSC	0x0
6286fe8739SBruce Evans #define	IIR_FIFO_MASK	0xc0	/* set if FIFOs are enabled */
6386fe8739SBruce Evans 
642b843bc9SBruce Evans #define	com_lcr		3	/* line control register (R/W) */
652b843bc9SBruce Evans #define	com_lctl	com_lcr
662b843bc9SBruce Evans #define	com_cfcr	com_lcr	/* character format control register (R/W) */
672b843bc9SBruce Evans #define	LCR_DLAB	0x80
682b843bc9SBruce Evans #define	CFCR_DLAB	LCR_DLAB
692b843bc9SBruce Evans #define	LCR_EFR_ENABLE	0xbf	/* magic to enable EFR on 16650 up */
702b843bc9SBruce Evans #define	CFCR_EFR_ENABLE	LCR_EFR_ENABLE
7186fe8739SBruce Evans #define	CFCR_SBREAK	0x40
7286fe8739SBruce Evans #define	CFCR_PZERO	0x30
7386fe8739SBruce Evans #define	CFCR_PONE	0x20
7486fe8739SBruce Evans #define	CFCR_PEVEN	0x10
7586fe8739SBruce Evans #define	CFCR_PODD	0x00
7686fe8739SBruce Evans #define	CFCR_PENAB	0x08
7786fe8739SBruce Evans #define	CFCR_STOPB	0x04
7886fe8739SBruce Evans #define	CFCR_8BITS	0x03
7986fe8739SBruce Evans #define	CFCR_7BITS	0x02
8086fe8739SBruce Evans #define	CFCR_6BITS	0x01
8186fe8739SBruce Evans #define	CFCR_5BITS	0x00
8286fe8739SBruce Evans 
8374814b32SBruce Evans #define	com_mcr		4	/* modem control register (R/W) */
8486fe8739SBruce Evans #define	MCR_PRESCALE	0x80	/* only available on 16650 up */
8586fe8739SBruce Evans #define	MCR_LOOPBACK	0x10
8686fe8739SBruce Evans #define	MCR_IENABLE	0x08
8786fe8739SBruce Evans #define	MCR_DRS		0x04
8886fe8739SBruce Evans #define	MCR_RTS		0x02
8986fe8739SBruce Evans #define	MCR_DTR		0x01
9086fe8739SBruce Evans 
9174814b32SBruce Evans #define	com_lsr		5	/* line status register (R/W) */
9286fe8739SBruce Evans #define	LSR_RCV_FIFO	0x80
9386fe8739SBruce Evans #define	LSR_TSRE	0x40
9486fe8739SBruce Evans #define	LSR_TXRDY	0x20
9586fe8739SBruce Evans #define	LSR_BI		0x10
9686fe8739SBruce Evans #define	LSR_FE		0x08
9786fe8739SBruce Evans #define	LSR_PE		0x04
9886fe8739SBruce Evans #define	LSR_OE		0x02
9986fe8739SBruce Evans #define	LSR_RXRDY	0x01
10086fe8739SBruce Evans #define	LSR_RCV_MASK	0x1f
10186fe8739SBruce Evans 
10274814b32SBruce Evans #define	com_msr		6	/* modem status register (R/W) */
10386fe8739SBruce Evans #define	MSR_DCD		0x80
10486fe8739SBruce Evans #define	MSR_RI		0x40
10586fe8739SBruce Evans #define	MSR_DSR		0x20
10686fe8739SBruce Evans #define	MSR_CTS		0x10
10786fe8739SBruce Evans #define	MSR_DDCD	0x08
10886fe8739SBruce Evans #define	MSR_TERI	0x04
10986fe8739SBruce Evans #define	MSR_DDSR	0x02
11086fe8739SBruce Evans #define	MSR_DCTS	0x01
11186fe8739SBruce Evans 
11274814b32SBruce Evans /* 8250 multiplexed registers #[0-1].  Access enabled by LCR[7]. */
1132b843bc9SBruce Evans #define	com_dll		0	/* divisor latch low (R/W) */
1142b843bc9SBruce Evans #define	com_dlbl	com_dll
1152b843bc9SBruce Evans #define	com_dlm		1	/* divisor latch high (R/W) */
1162b843bc9SBruce Evans #define	com_dlbh	com_dlm
11774814b32SBruce Evans 
11874814b32SBruce Evans /* 16450 register #7.  Not multiplexed. */
11974814b32SBruce Evans #define	com_scr		7	/* scratch register (R/W) */
12074814b32SBruce Evans 
12174814b32SBruce Evans /* 16550 register #2.  Not multiplexed. */
1222b843bc9SBruce Evans #define	com_fcr		2	/* FIFO control register (W) */
1232b843bc9SBruce Evans #define	com_fifo	com_fcr
12474814b32SBruce Evans #define	FIFO_ENABLE	0x01
12574814b32SBruce Evans #define	FIFO_RCV_RST	0x02
12674814b32SBruce Evans #define	FIFO_XMT_RST	0x04
12774814b32SBruce Evans #define	FIFO_DMA_MODE	0x08
12874814b32SBruce Evans #define	FIFO_RX_LOW	0x00
12974814b32SBruce Evans #define	FIFO_RX_MEDL	0x40
13074814b32SBruce Evans #define	FIFO_RX_MEDH	0x80
13174814b32SBruce Evans #define	FIFO_RX_HIGH	0xc0
13274814b32SBruce Evans 
13374814b32SBruce Evans /* 16650 registers #2,[4-7].  Access enabled by LCR_EFR_ENABLE. */
13474814b32SBruce Evans 
1352b843bc9SBruce Evans #define	com_efr		2	/* enhanced features register (R/W) */
136fec27f50SBruce Evans #define	EFR_AUTOCTS	0x80
137fec27f50SBruce Evans #define	EFR_AUTORTS	0x40
13886fe8739SBruce Evans #define	EFR_EFE		0x10	/* enhanced functions enable */
13986fe8739SBruce Evans 
140fec27f50SBruce Evans #define	com_xon1	4	/* XON 1 character (R/W) */
141fec27f50SBruce Evans #define	com_xon2	5	/* XON 2 character (R/W) */
142fec27f50SBruce Evans #define	com_xoff1	6	/* XOFF 1 character (R/W) */
143fec27f50SBruce Evans #define	com_xoff2	7	/* XOFF 2 character (R/W) */
144fec27f50SBruce Evans 
14586fe8739SBruce Evans #ifdef PC98
14686fe8739SBruce Evans /* Hardware extension mode register for RSB-2000/3000. */
14786fe8739SBruce Evans #define	com_emr		com_msr
14886fe8739SBruce Evans #define	EMR_EXBUFF	0x04
14986fe8739SBruce Evans #define	EMR_CTSFLW	0x08
15086fe8739SBruce Evans #define	EMR_DSRFLW	0x10
15186fe8739SBruce Evans #define	EMR_RTSFLW	0x20
15286fe8739SBruce Evans #define	EMR_DTRFLW	0x40
15386fe8739SBruce Evans #define	EMR_EFMODE	0x80
15486fe8739SBruce Evans #endif
155