i8251.h revision 77962
177962Snyan/*-
277962Snyan * Copyright (c) 1991 The Regents of the University of California.
377962Snyan * All rights reserved.
477962Snyan *
577962Snyan * Redistribution and use in source and binary forms, with or without
677962Snyan * modification, are permitted provided that the following conditions
777962Snyan * are met:
877962Snyan * 1. Redistributions of source code must retain the above copyright
977962Snyan *    notice, this list of conditions and the following disclaimer.
1077962Snyan * 2. Redistributions in binary form must reproduce the above copyright
1177962Snyan *    notice, this list of conditions and the following disclaimer in the
1277962Snyan *    documentation and/or other materials provided with the distribution.
1377962Snyan * 3. All advertising materials mentioning features or use of this software
1477962Snyan *    must display the following acknowledgement:
1577962Snyan *	This product includes software developed by the University of
1677962Snyan *	California, Berkeley and its contributors.
1777962Snyan * 4. Neither the name of the University nor the names of its contributors
1877962Snyan *    may be used to endorse or promote products derived from this software
1977962Snyan *    without specific prior written permission.
2077962Snyan *
2177962Snyan * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2277962Snyan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2377962Snyan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2477962Snyan * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2577962Snyan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2677962Snyan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2777962Snyan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2877962Snyan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2977962Snyan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3077962Snyan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3177962Snyan * SUCH DAMAGE.
3277962Snyan *
3377962Snyan * $FreeBSD: head/sys/dev/ic/i8251.h 77962 2001-06-10 04:28:39Z nyan $
3477962Snyan */
3577962Snyan
3677962Snyan/*
3777962Snyan * modified for PC9801 by M.Ishii
3877962Snyan *			Kyoto University Microcomputer Club (KMC)
3977962Snyan */
4077962Snyan
4177962Snyan/*
4277962Snyan * modified for 8251(FIFO) by Seigo TANIMURA <tanimura@FreeBSD.org>
4377962Snyan */
4477962Snyan
4577962Snyan/* define command and status code */
4677962Snyan#define	CMD8251_TxEN	0x01	/* transmit enable */
4777962Snyan#define	CMD8251_DTR	0x02	/* assert DTR */
4877962Snyan#define	CMD8251_RxEN	0x04	/* receive enable */
4977962Snyan#define	CMD8251_SBRK	0x08	/* send break */
5077962Snyan#define	CMD8251_ER	0x10	/* error reset */
5177962Snyan#define	CMD8251_RTS	0x20	/* assert RTS */
5277962Snyan#define	CMD8251_RESET	0x40	/* internal reset */
5377962Snyan#define	CMD8251_EH	0x80	/* enter hunt mode (only synchronous mode)*/
5477962Snyan
5577962Snyan#define	STS8251_TxRDY	0x01	/* transmit READY */
5677962Snyan#define	STS8251_RxRDY	0x02	/* data exists in receive buffer */
5777962Snyan#define	STS8251_TxEMP	0x04	/* transmit buffer EMPTY */
5877962Snyan#define	STS8251_PE	0x08	/* perity error */
5977962Snyan#define	STS8251_OE	0x10	/* overrun error */
6077962Snyan#define	STS8251_FE	0x20	/* framing error */
6177962Snyan#define	STS8251_BD_SD	0x40	/* break detect (async) / sync detect (sync) */
6277962Snyan#define	STS8251_DSR	0x80	/* DSR is asserted */
6377962Snyan
6477962Snyan#define	STS8251F_TxEMP	0x01	/* transmit buffer EMPTY */
6577962Snyan#define	STS8251F_TxRDY	0x02	/* transmit READY */
6677962Snyan#define	STS8251F_RxRDY	0x04	/* data exists in receive buffer */
6777962Snyan#define	STS8251F_OE	0x10	/* overrun error */
6877962Snyan#define	STS8251F_PE	0x20	/* perity error */
6977962Snyan#define	STS8251F_BD_SD	0x80	/* break detect (async) / sync detect (sync) */
7077962Snyan
7177962Snyan#define	INTR8251F_DTCT	0x60	/* FIFO detection mask */
7277962Snyan#define	INTR8251F_INTRV	0x0e	/* interrupt event */
7377962Snyan#define	INTR8251F_TO	0x0c	/* receive timeout */
7477962Snyan#define	INTR8251F_LSTS	0x06	/* line status */
7577962Snyan#define	INTR8251F_RxRDY	0x04	/* receive READY */
7677962Snyan#define	INTR8251F_TxRDY	0x02	/* transmit READY */
7777962Snyan#define	INTR8251F_ISEV	0x01	/* event occured */
7877962Snyan#define	INTR8251F_MSTS	0x00	/* modem status */
7977962Snyan
8077962Snyan#define	CTRL8251F_ENABLE	0x01	/* enable FIFO */
8177962Snyan#define	CTRL8251F_RCV_RST	0x02	/* reset receive FIFO */
8277962Snyan#define	CTRL8251F_XMT_RST	0x04	/* reset transmit FIFO */
8377962Snyan
8477962Snyan#define	MOD8251_5BITS	0x00
8577962Snyan#define	MOD8251_6BITS	0x04
8677962Snyan#define	MOD8251_7BITS	0x08
8777962Snyan#define	MOD8251_8BITS	0x0c
8877962Snyan#define MOD8251_PDISAB	0x00	/* parity disable */
8977962Snyan#define	MOD8251_PODD	0x10	/* parity odd */
9077962Snyan#define	MOD8251_PEVEN	0x30	/* parity even */
9177962Snyan#define	MOD8251_STOP1	0x40	/* stop bit len = 1bit */
9277962Snyan#define	MOD8251_STOP2	0xc0	/* stop bit len = 2bit */
9377962Snyan#define	MOD8251_CLKX16	0x02	/* x16 */
9477962Snyan#define	MOD8251_CLKX1	0x01	/* x1 */
9577962Snyan
9677962Snyan#define	CICSCD_CD	0x20	/* CD */
9777962Snyan#define	CICSCD_CS	0x40	/* CS */
9877962Snyan#define	CICSCD_CI	0x80	/* CI */
9977962Snyan
10077962Snyan#define	CICSCDF_CS	0x10	/* CS */
10177962Snyan#define	CICSCDF_DR	0x20	/* DR */
10277962Snyan#define	CICSCDF_CI	0x40	/* CI */
10377962Snyan#define	CICSCDF_CD	0x80	/* CD */
10477962Snyan
10577962Snyan/* interrupt mask control */
10677962Snyan#define	IEN_Rx		0x01
10777962Snyan#define	IEN_TxEMP	0x02
10877962Snyan#define	IEN_Tx		0x04
109