Initial import from FreeBSD RELENG_4:
[games.git] / sys / dev / serial / ic_layer / i8251.h
1 /*-
2  * Copyright (c) 1991 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *      This product includes software developed by the University of
16  *      California, Berkeley and its contributors.
17  * 4. Neither the name of the University nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * $FreeBSD: src/sys/dev/ic/i8251.h,v 1.1.2.1 2002/02/03 14:52:02 nyan Exp $
34  */
35
36 /*
37  * modified for PC9801 by M.Ishii 
38  *                      Kyoto University Microcomputer Club (KMC)
39  */
40
41 /*
42  * modified for 8251(FIFO) by Seigo TANIMURA <tanimura@FreeBSD.org>
43  */
44
45 /* define command and status code */
46 #define CMD8251_TxEN    0x01    /* transmit enable */
47 #define CMD8251_DTR     0x02    /* assert DTR */
48 #define CMD8251_RxEN    0x04    /* receive enable */
49 #define CMD8251_SBRK    0x08    /* send break */
50 #define CMD8251_ER      0x10    /* error reset */
51 #define CMD8251_RTS     0x20    /* assert RTS */
52 #define CMD8251_RESET   0x40    /* internal reset */
53 #define CMD8251_EH      0x80    /* enter hunt mode (only synchronous mode)*/
54
55 #define STS8251_TxRDY   0x01    /* transmit READY */
56 #define STS8251_RxRDY   0x02    /* data exists in receive buffer */
57 #define STS8251_TxEMP   0x04    /* transmit buffer EMPTY */
58 #define STS8251_PE      0x08    /* perity error */
59 #define STS8251_OE      0x10    /* overrun error */
60 #define STS8251_FE      0x20    /* framing error */
61 #define STS8251_BD_SD   0x40    /* break detect (async) / sync detect (sync) */
62 #define STS8251_DSR     0x80    /* DSR is asserted */
63
64 #define STS8251F_TxEMP  0x01    /* transmit buffer EMPTY */
65 #define STS8251F_TxRDY  0x02    /* transmit READY */
66 #define STS8251F_RxRDY  0x04    /* data exists in receive buffer */
67 #define STS8251F_OE     0x10    /* overrun error */
68 #define STS8251F_PE     0x20    /* perity error */
69 #define STS8251F_BD_SD  0x80    /* break detect (async) / sync detect (sync) */
70
71 #define INTR8251F_DTCT  0x60    /* FIFO detection mask */
72 #define INTR8251F_INTRV 0x0e    /* interrupt event */
73 #define INTR8251F_TO    0x0c    /* receive timeout */
74 #define INTR8251F_LSTS  0x06    /* line status */
75 #define INTR8251F_RxRDY 0x04    /* receive READY */
76 #define INTR8251F_TxRDY 0x02    /* transmit READY */
77 #define INTR8251F_ISEV  0x01    /* event occured */
78 #define INTR8251F_MSTS  0x00    /* modem status */
79
80 #define CTRL8251F_ENABLE        0x01    /* enable FIFO */
81 #define CTRL8251F_RCV_RST       0x02    /* reset receive FIFO */
82 #define CTRL8251F_XMT_RST       0x04    /* reset transmit FIFO */
83
84 #define MOD8251_5BITS   0x00
85 #define MOD8251_6BITS   0x04
86 #define MOD8251_7BITS   0x08
87 #define MOD8251_8BITS   0x0c
88 #define MOD8251_PDISAB  0x00    /* parity disable */
89 #define MOD8251_PODD    0x10    /* parity odd */
90 #define MOD8251_PEVEN   0x30    /* parity even */
91 #define MOD8251_STOP1   0x40    /* stop bit len = 1bit */
92 #define MOD8251_STOP2   0xc0    /* stop bit len = 2bit */
93 #define MOD8251_CLKX16  0x02    /* x16 */
94 #define MOD8251_CLKX1   0x01    /* x1 */
95
96 #define CICSCD_CD       0x20    /* CD */
97 #define CICSCD_CS       0x40    /* CS */
98 #define CICSCD_CI       0x80    /* CI */
99
100 #define CICSCDF_CS      0x10    /* CS */
101 #define CICSCDF_DR      0x20    /* DR */
102 #define CICSCDF_CI      0x40    /* CI */
103 #define CICSCDF_CD      0x80    /* CD */
104
105 /* interrupt mask control */
106 #define IEN_Rx          0x01
107 #define IEN_TxEMP       0x02
108 #define IEN_Tx          0x04