dzreg.h revision 1.2 1 1.2 matt /* $NetBSD: dzreg.h,v 1.2 2003/01/06 21:05:37 matt Exp $ */
2 1.1 ad /*
3 1.1 ad * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
4 1.1 ad *
5 1.1 ad * Redistribution and use in source and binary forms, with or without
6 1.1 ad * modification, are permitted provided that the following conditions
7 1.1 ad * are met:
8 1.1 ad * 1. Redistributions of source code must retain the above copyright
9 1.1 ad * notice, this list of conditions and the following disclaimer.
10 1.1 ad * 2. The name of the author may not be used to endorse or promote products
11 1.1 ad * derived from this software without specific prior written permission
12 1.1 ad *
13 1.1 ad * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 1.1 ad * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 1.1 ad * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 1.1 ad * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 1.1 ad * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 1.1 ad * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 1.1 ad * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 1.1 ad * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 1.1 ad * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 1.1 ad * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 1.1 ad */
24 1.1 ad
25 1.2 matt #ifndef _DEV_DEC_DZREG_H
26 1.2 matt #define _DEV_DEC_DZREG_H
27 1.2 matt
28 1.1 ad union w_b
29 1.1 ad {
30 1.1 ad u_short word;
31 1.1 ad struct {
32 1.1 ad u_char byte_lo;
33 1.1 ad u_char byte_hi;
34 1.1 ad } bytes;
35 1.1 ad };
36 1.1 ad
37 1.1 ad struct DZregs
38 1.1 ad {
39 1.1 ad volatile u_short dz_csr; /* Control/Status Register (R/W) */
40 1.1 ad volatile u_short dz_rbuf; /* Receive Buffer (R only) */
41 1.1 ad #define dz_lpr dz_rbuf /* Line Parameter Register (W only) */
42 1.1 ad volatile union w_b u_tcr; /* Transmit Control Register (R/W) */
43 1.1 ad volatile union w_b u_msr; /* Modem Status Register (R only) */
44 1.1 ad #define u_tdr u_msr /* Transmit Data Register (W only) */
45 1.1 ad };
46 1.1 ad
47 1.1 ad #define dz_tcr u_tcr.bytes.byte_lo /* tx enable bits */
48 1.1 ad #define dz_dtr u_tcr.bytes.byte_hi /* DTR status bits */
49 1.1 ad #define dz_ring u_msr.bytes.byte_lo /* RI status bits */
50 1.1 ad #define dz_dcd u_msr.bytes.byte_hi /* DCD status bits */
51 1.1 ad #define dz_tbuf u_tdr.bytes.byte_lo /* transmit character */
52 1.1 ad #define dz_break u_tdr.bytes.byte_hi /* BREAK set/clr bits */
53 1.1 ad
54 1.1 ad typedef struct DZregs dzregs;
55 1.1 ad
56 1.1 ad #if 0
57 1.1 ad struct dz_regs {
58 1.1 ad volatile unsigned short *dr_csr;
59 1.1 ad volatile unsigned short *dr_rbuf;
60 1.1 ad #define dr_lpr dr_rbuf
61 1.1 ad volatile unsigned char *dr_dtr;
62 1.1 ad volatile unsigned char *dr_break;
63 1.1 ad volatile unsigned char *dr_tbuf;
64 1.1 ad volatile unsigned char *dr_tcr;
65 1.1 ad volatile unsigned short *dr_tcrw;
66 1.1 ad volatile unsigned char *dr_ring;
67 1.1 ad volatile unsigned char *dr_dcd;
68 1.1 ad };
69 1.1 ad #else
70 1.1 ad struct dz_regs {
71 1.1 ad bus_addr_t dr_csr;
72 1.1 ad bus_addr_t dr_rbuf;
73 1.1 ad #define dr_lpr dr_rbuf
74 1.1 ad bus_addr_t dr_dtr;
75 1.1 ad bus_addr_t dr_break;
76 1.1 ad bus_addr_t dr_tbuf;
77 1.1 ad bus_addr_t dr_tcr;
78 1.1 ad bus_addr_t dr_tcrw;
79 1.1 ad bus_addr_t dr_ring;
80 1.1 ad bus_addr_t dr_dcd;
81 1.1 ad };
82 1.1 ad #define DZ_UBA_CSR 0
83 1.1 ad #define DZ_UBA_RBUF 2
84 1.1 ad #define DZ_UBA_DTR 5
85 1.1 ad #define DZ_UBA_BREAK 7
86 1.1 ad #define DZ_UBA_TBUF 6
87 1.1 ad #define DZ_UBA_TCR 4
88 1.1 ad #define DZ_UBA_DCD 7
89 1.1 ad #define DZ_UBA_RING 6
90 1.1 ad
91 1.1 ad #endif
92 1.1 ad
93 1.1 ad /* CSR bits */
94 1.1 ad
95 1.1 ad #define DZ_CSR_TX_READY 0100000 /* Transmitter Ready */
96 1.1 ad #define DZ_CSR_TXIE 0040000 /* Transmitter Interrupt Enable */
97 1.1 ad #define DZ_CSR_SA 0020000 /* Silo Alarm */
98 1.1 ad #define DZ_CSR_SAE 0010000 /* Silo Alarm Enable */
99 1.1 ad #define DZ_CSR_TX_LINE_MASK 0007400 /* Which TX line */
100 1.1 ad
101 1.1 ad #define DZ_CSR_RX_DONE 0000200 /* Receiver Done */
102 1.1 ad #define DZ_CSR_RXIE 0000100 /* Receiver Interrupt Enable */
103 1.1 ad #define DZ_CSR_MSE 0000040 /* Master Scan Enable */
104 1.1 ad #define DZ_CSR_RESET 0000020 /* Clear (reset) Controller */
105 1.1 ad #define DZ_CSR_MAINTENANCE 0000010
106 1.1 ad #define DZ_CSR_UNUSED 0000007
107 1.1 ad
108 1.1 ad /* RBUF bits */
109 1.1 ad
110 1.1 ad #define DZ_RBUF_DATA_VALID 0100000
111 1.1 ad #define DZ_RBUF_OVERRUN_ERR 0040000
112 1.1 ad #define DZ_RBUF_FRAMING_ERR 0020000
113 1.1 ad #define DZ_RBUF_PARITY_ERR 0010000
114 1.1 ad #define DZ_RBUF_RX_LINE_MASK 0007400
115 1.1 ad
116 1.1 ad /* LPR bits */
117 1.1 ad
118 1.1 ad #define DZ_LPR_UNUSED 0160000
119 1.1 ad #define DZ_LPR_RX_ENABLE 0010000
120 1.1 ad
121 1.1 ad #define DZ_LPR_B50 0x0
122 1.1 ad #define DZ_LPR_B75 0x1
123 1.1 ad #define DZ_LPR_B110 0x2
124 1.1 ad #define DZ_LPR_B134 0x3
125 1.1 ad #define DZ_LPR_B150 0x4
126 1.1 ad #define DZ_LPR_B300 0x5
127 1.1 ad #define DZ_LPR_B600 0x6
128 1.1 ad #define DZ_LPR_B1200 0x7
129 1.1 ad #define DZ_LPR_B1800 0x8
130 1.1 ad #define DZ_LPR_B2000 0x9
131 1.1 ad #define DZ_LPR_B2400 0xA
132 1.1 ad #define DZ_LPR_B3600 0xB
133 1.1 ad #define DZ_LPR_B4800 0xC
134 1.1 ad #define DZ_LPR_B7200 0xD
135 1.1 ad #define DZ_LPR_B9600 0xE
136 1.1 ad #define DZ_LPR_B19200 0xF
137 1.1 ad
138 1.1 ad #define DZ_LPR_OPAR 0000200
139 1.1 ad #define DZ_LPR_PARENB 0000100
140 1.1 ad #define DZ_LPR_2_STOP 0000040
141 1.1 ad
142 1.1 ad #define DZ_LPR_5_BIT_CHAR 0000000
143 1.1 ad #define DZ_LPR_6_BIT_CHAR 0000010
144 1.1 ad #define DZ_LPR_7_BIT_CHAR 0000020
145 1.1 ad #define DZ_LPR_8_BIT_CHAR 0000030
146 1.1 ad
147 1.1 ad #define DZ_LPR_CHANNEL_MASK 0000007
148 1.2 matt
149 1.2 matt #endif /* _DEV_DEC_DZREG_H */
150