Merge from vendor branch NTPD:
[dragonfly.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  * $DragonFly: src/sys/dev/serial/ic_layer/i8251.h,v 1.2 2003/06/17 04:28:27 dillon Exp $
35  */
36
37 /*
38  * modified for PC9801 by M.Ishii 
39  *                      Kyoto University Microcomputer Club (KMC)
40  */
41
42 /*
43  * modified for 8251(FIFO) by Seigo TANIMURA <tanimura@FreeBSD.org>
44  */
45
46 /* define command and status code */
47 #define CMD8251_TxEN    0x01    /* transmit enable */
48 #define CMD8251_DTR     0x02    /* assert DTR */
49 #define CMD8251_RxEN    0x04    /* receive enable */
50 #define CMD8251_SBRK    0x08    /* send break */
51 #define CMD8251_ER      0x10    /* error reset */
52 #define CMD8251_RTS     0x20    /* assert RTS */
53 #define CMD8251_RESET   0x40    /* internal reset */
54 #define CMD8251_EH      0x80    /* enter hunt mode (only synchronous mode)*/
55
56 #define STS8251_TxRDY   0x01    /* transmit READY */
57 #define STS8251_RxRDY   0x02    /* data exists in receive buffer */
58 #define STS8251_TxEMP   0x04    /* transmit buffer EMPTY */
59 #define STS8251_PE      0x08    /* perity error */
60 #define STS8251_OE      0x10    /* overrun error */
61 #define STS8251_FE      0x20    /* framing error */
62 #define STS8251_BD_SD   0x40    /* break detect (async) / sync detect (sync) */
63 #define STS8251_DSR     0x80    /* DSR is asserted */
64
65 #define STS8251F_TxEMP  0x01    /* transmit buffer EMPTY */
66 #define STS8251F_TxRDY  0x02    /* transmit READY */
67 #define STS8251F_RxRDY  0x04    /* data exists in receive buffer */
68 #define STS8251F_OE     0x10    /* overrun error */
69 #define STS8251F_PE     0x20    /* perity error */
70 #define STS8251F_BD_SD  0x80    /* break detect (async) / sync detect (sync) */
71
72 #define INTR8251F_DTCT  0x60    /* FIFO detection mask */
73 #define INTR8251F_INTRV 0x0e    /* interrupt event */
74 #define INTR8251F_TO    0x0c    /* receive timeout */
75 #define INTR8251F_LSTS  0x06    /* line status */
76 #define INTR8251F_RxRDY 0x04    /* receive READY */
77 #define INTR8251F_TxRDY 0x02    /* transmit READY */
78 #define INTR8251F_ISEV  0x01    /* event occured */
79 #define INTR8251F_MSTS  0x00    /* modem status */
80
81 #define CTRL8251F_ENABLE        0x01    /* enable FIFO */
82 #define CTRL8251F_RCV_RST       0x02    /* reset receive FIFO */
83 #define CTRL8251F_XMT_RST       0x04    /* reset transmit FIFO */
84
85 #define MOD8251_5BITS   0x00
86 #define MOD8251_6BITS   0x04
87 #define MOD8251_7BITS   0x08
88 #define MOD8251_8BITS   0x0c
89 #define MOD8251_PDISAB  0x00    /* parity disable */
90 #define MOD8251_PODD    0x10    /* parity odd */
91 #define MOD8251_PEVEN   0x30    /* parity even */
92 #define MOD8251_STOP1   0x40    /* stop bit len = 1bit */
93 #define MOD8251_STOP2   0xc0    /* stop bit len = 2bit */
94 #define MOD8251_CLKX16  0x02    /* x16 */
95 #define MOD8251_CLKX1   0x01    /* x1 */
96
97 #define CICSCD_CD       0x20    /* CD */
98 #define CICSCD_CS       0x40    /* CS */
99 #define CICSCD_CI       0x80    /* CI */
100
101 #define CICSCDF_CS      0x10    /* CS */
102 #define CICSCDF_DR      0x20    /* DR */
103 #define CICSCDF_CI      0x40    /* CI */
104 #define CICSCDF_CD      0x80    /* CD */
105
106 /* interrupt mask control */
107 #define IEN_Rx          0x01
108 #define IEN_TxEMP       0x02
109 #define IEN_Tx          0x04