epcomreg.h revision 1.4 1 1.4 skrll /* $NetBSD: epcomreg.h,v 1.4 2021/11/21 08:25:26 skrll Exp $ */
2 1.1 joff
3 1.1 joff /*
4 1.1 joff * Copyright (c) 2004 Jesse Off
5 1.1 joff *
6 1.1 joff * Redistribution and use in source and binary forms, with or without
7 1.1 joff * modification, are permitted provided that the following conditions
8 1.1 joff * are met:
9 1.1 joff * 1. Redistributions of source code must retain the above copyright
10 1.1 joff * notice, this list of conditions and the following disclaimer.
11 1.1 joff * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 joff * notice, this list of conditions and the following disclaimer in the
13 1.1 joff * documentation and/or other materials provided with the distribution.
14 1.1 joff *
15 1.1 joff * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA AND CONTRIBUTORS ``AS IS''
16 1.1 joff * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.1 joff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.4 skrll * ARE DISCLAIMED. IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS
19 1.1 joff * HEAD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20 1.1 joff * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1 joff * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1 joff * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1 joff * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1 joff * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 1.1 joff * THE POSSIBILITY OF SUCH DAMAGE.
26 1.1 joff */
27 1.1 joff
28 1.1 joff #ifndef _EPCOMREG_H_
29 1.1 joff #define _EPCOMREG_H_
30 1.1 joff
31 1.1 joff #define EPCOM_FREQ 7372800
32 1.1 joff #define EPCOMSPEED2BRD(b) ((EPCOM_FREQ / (16 * (b))) - 1)
33 1.1 joff
34 1.1 joff
35 1.1 joff /* UART Data Register */
36 1.1 joff #define EPCOM_Data 0x00000000UL
37 1.1 joff
38 1.1 joff /* UART Receive Status/Error Clear Register */
39 1.1 joff #define EPCOM_RXSts 0x00000004UL
40 1.1 joff #define RXSts_FE 0x01
41 1.1 joff #define RXSts_PE 0x02
42 1.1 joff #define RXSts_BE 0x04
43 1.1 joff #define RXSts_OE 0x08
44 1.1 joff
45 1.1 joff /* UART Line Control Register High */
46 1.1 joff #define EPCOM_LinCtrlHigh 0x00000008UL
47 1.1 joff #define LinCtrlHigh_BRK 0x01
48 1.1 joff #define LinCtrlHigh_PEN 0x02
49 1.1 joff #define LinCtrlHigh_EPS 0x04
50 1.1 joff #define LinCtrlHigh_STP2 0x08
51 1.1 joff #define LinCtrlHigh_FEN 0x10
52 1.1 joff #define LinCtrlHigh_WLEN 0x60
53 1.1 joff
54 1.1 joff /* UART Line Control Register Middle */
55 1.1 joff #define EPCOM_LinCtrlMid 0x0000000cUL
56 1.1 joff
57 1.1 joff /* UART Line Control Register Low */
58 1.1 joff #define EPCOM_LinCtrlLow 0x00000010UL
59 1.1 joff
60 1.1 joff /* UART control register */
61 1.1 joff #define EPCOM_Ctrl 0x00000014UL
62 1.1 joff #define Ctrl_UARTE 0x01 /* UART Enable */
63 1.1 joff #define Ctrl_MSIE 0x08 /* Modem Status Interrupt Enable */
64 1.1 joff #define Ctrl_RIE 0x10 /* Receive Interrupt Enable */
65 1.1 joff #define Ctrl_TIE 0x20 /* Transmit Interrupt Enable */
66 1.1 joff #define Ctrl_RTIE 0x40 /* Receive Timeout Enable */
67 1.1 joff #define Ctrl_LBE 0x80 /* Loopback Enable */
68 1.1 joff
69 1.1 joff /* UART Flag register */
70 1.1 joff #define EPCOM_Flag 0x00000018UL
71 1.1 joff #define Flag_CTS 0x01 /* Clear To Send status */
72 1.1 joff #define Flag_DSR 0x02 /* Data Set Ready status */
73 1.1 joff #define Flag_DCD 0x04 /* Data Carrier Detect status */
74 1.1 joff #define Flag_BUSY 0x08 /* UART Busy */
75 1.1 joff #define Flag_RXFE 0x10 /* Receive FIFO Empty */
76 1.1 joff #define Flag_TXFF 0x20 /* Transmit FIFO Full */
77 1.1 joff #define Flag_RXFF 0x40 /* Receive FIFO Full */
78 1.1 joff #define Flag_TXFE 0x80 /* Transmit FIFO Empty */
79 1.1 joff
80 1.1 joff /* UART Interrupt Identification and Interrupt Clear Register */
81 1.1 joff #define EPCOM_IntIDIntClr 0x0000001cUL
82 1.1 joff #define IntIDIntClr_MIS 0x01 /* Modem Interrupt Status */
83 1.1 joff #define IntIDIntClr_RIS 0x01 /* Receive Interrupt Status */
84 1.1 joff #define IntIDIntClr_TIS 0x01 /* Transmit Interrupt Status */
85 1.1 joff #define IntIDIntClr_RTIS 0x01 /* Receive Timeout Interrupt Status */
86 1.1 joff
87 1.1 joff /* UART Modem Control Register */
88 1.1 joff #define EPCOM_ModemCtrl 0x00000100UL
89 1.1 joff #define ModemCtrl_DTR 0x01 /* DTR output signal */
90 1.1 joff #define ModemCtrl_RTS 0x02 /* RTS output signal */
91 1.1 joff
92 1.1 joff /* UART Modem Status Register */
93 1.1 joff #define EPCOM_ModemSts 0x00000104UL
94 1.1 joff #define ModemSts_DCTS 0x01 /* Delta CTS */
95 1.1 joff #define ModemSts_DDSR 0x02 /* Delta DSR */
96 1.1 joff #define ModemSts_TERI 0x04 /* Trailing Edge Ring Indicator */
97 1.1 joff #define ModemSts_DDCD 0x08 /* Delta DCD */
98 1.1 joff #define ModemSts_CTS 0x10 /* Inverse CTSn input pin */
99 1.1 joff #define ModemSts_DSR 0x20 /* Inverse of the DSRn pin */
100 1.1 joff #define ModemSts_RI 0x40 /* Inverse of RI input pin */
101 1.1 joff #define ModemSts_DCD 0x80 /* Inverse of DCDn input pin */
102 1.1 joff
103 1.1 joff #endif /* _EPCOMREG_H_ */
104