1 /*****************************************************************************/
2
3 /*
4 * cd1400.h -- cd1400 UART hardware info.
5 *
6 * Copyright (c) 1995 Greg Ungerer (gerg@stallion.oz.au).
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Greg Ungerer.
20 * 4. Neither the name of the author nor the names of any co-contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * $FreeBSD: releng/5.0/sys/i386/isa/ic/scd1400.h 50477 1999-08-28 01:08:13Z peter $
37 */
38
39 /*****************************************************************************/
40 #ifndef _CD1400_H
41 #define _CD1400_H
42 /*****************************************************************************/
43
44 /*
45 * Define the number of async ports per cd1400 uart chip.
46 */
47 #define CD1400_PORTS 4
48
49 /*
50 * Define the cd1400 uarts internal FIFO sizes.
51 */
52 #define CD1400_TXFIFOSIZE 12
53 #define CD1400_RXFIFOSIZE 12
54
55 /*
56 * Local RX FIFO thresh hold level. Also define the RTS thresh hold
57 * based on the RX thresh hold.
58 */
59 #define FIFO_RXTHRESHOLD 6
60 #define FIFO_RTSTHRESHOLD 7
61
62 /*****************************************************************************/
63
64 /*
65 * Define the cd1400 register addresses. These are all the valid
66 * registers with the cd1400. Some are global, some virtual, some
67 * per port.
68 */
69 #define GFRCR 0x40
70 #define CAR 0x68
71 #define GCR 0x4b
72 #define SVRR 0x67
73 #define RICR 0x44
74 #define TICR 0x45
75 #define MICR 0x46
76 #define RIR 0x6b
77 #define TIR 0x6a
78 #define MIR 0x69
79 #define PPR 0x7e
80
81 #define RIVR 0x43
82 #define TIVR 0x42
83 #define MIVR 0x41
84 #define TDR 0x63
85 #define RDSR 0x62
86 #define MISR 0x4c
87 #define EOSRR 0x60
88
89 #define LIVR 0x18
90 #define CCR 0x05
91 #define SRER 0x06
92 #define COR1 0x08
93 #define COR2 0x09
94 #define COR3 0x0a
95 #define COR4 0x1e
96 #define COR5 0x1f
97 #define CCSR 0x0b
98 #define RDCR 0x0e
99 #define SCHR1 0x1a
100 #define SCHR2 0x1b
101 #define SCHR3 0x1c
102 #define SCHR4 0x1d
103 #define SCRL 0x22
104 #define SCRH 0x23
105 #define LNC 0x24
106 #define MCOR1 0x15
107 #define MCOR2 0x16
108 #define RTPR 0x21
109 #define MSVR1 0x6c
110 #define MSVR2 0x6d
111 #define PSVR 0x6f
112 #define RBPR 0x78
113 #define RCOR 0x7c
114 #define TBPR 0x72
115 #define TCOR 0x76
116
117 /*****************************************************************************/
118
119 /*
120 * Define the set of baud rate clock divisors.
121 */
122 #define CD1400_CLK0 8
123 #define CD1400_CLK1 32
124 #define CD1400_CLK2 128
125 #define CD1400_CLK3 512
126 #define CD1400_CLK4 2048
127
128 #define CD1400_NUMCLKS 5
129
130 /*****************************************************************************/
131
132 /*
133 * Define the clock pre-scalar value to be a 5 ms clock. This should be
134 * OK for now. It would probably be better to make it 10 ms, but we
135 * can't fit that divisor into 8 bits!
136 */
137 #define PPR_SCALAR 244
138
139 /*****************************************************************************/
140
141 /*
142 * Define values used to set character size options.
143 */
144 #define COR1_CHL5 0x00
145 #define COR1_CHL6 0x01
146 #define COR1_CHL7 0x02
147 #define COR1_CHL8 0x03
148
149 /*
150 * Define values used to set the number of stop bits.
151 */
152 #define COR1_STOP1 0x00
153 #define COR1_STOP15 0x04
154 #define COR1_STOP2 0x08
155
156 /*
157 * Define values used to set the parity scheme in use.
158 */
159 #define COR1_PARNONE 0x00
160 #define COR1_PARFORCE 0x20
161 #define COR1_PARENB 0x40
162 #define COR1_PARIGNORE 0x10
163
164 #define COR1_PARODD 0x80
165 #define COR1_PAREVEN 0x00
166
167 #define COR2_IXM 0x80
168 #define COR2_TXIBE 0x40
169 #define COR2_ETC 0x20
170 #define COR2_LLM 0x10
171 #define COR2_RLM 0x08
172 #define COR2_RTSAO 0x04
173 #define COR2_CTSAE 0x02
174
175 #define COR3_SCDRNG 0x80
176 #define COR3_SCD34 0x40
177 #define COR3_FCT 0x20
178 #define COR3_SCD12 0x10
179
180 /*
181 * Define the bit values of COR4.
182 */
183 #define COR4_BRKINT 0x08
184 #define COR4_IGNBRK 0x18
185
186 /*
187 * Define the bit values of COR5.
188 */
189 #define COR5_ISTRIP 0x80
190
191 /*****************************************************************************/
192
193 /*
194 * Define the modem control register values.
195 * Note that the actual hardware is a little different to the conventional
196 * pin names on the cd1400.
197 */
198 #define MSVR1_DTR 0x01
199 #define MSVR1_DSR 0x10
200 #define MSVR1_RI 0x20
201 #define MSVR1_CTS 0x40
202 #define MSVR1_DCD 0x80
203
204 #define MSVR2_RTS 0x02
205 #define MSVR2_DSR 0x10
206 #define MSVR2_RI 0x20
207 #define MSVR2_CTS 0x40
208 #define MSVR2_DCD 0x80
209
210 #define MCOR1_DCD 0x80
211 #define MCOR1_CTS 0x40
212 #define MCOR1_RI 0x20
213 #define MCOR1_DSR 0x10
214
215 #define MCOR2_DCD 0x80
216 #define MCOR2_CTS 0x40
217 #define MCOR2_RI 0x20
218 #define MCOR2_DSR 0x10
219
220 /*****************************************************************************/
221
222 /*
223 * Define the bits used with the service (interrupt) enable register.
224 */
225 #define SRER_NNDT 0x01
226 #define SRER_TXEMPTY 0x02
227 #define SRER_TXDATA 0x04
228 #define SRER_RXDATA 0x10
229 #define SRER_MODEM 0x80
230
231 /*****************************************************************************/
232
233 /*
234 * Define operational commands for the command register.
235 */
236 #define CCR_RESET 0x80
237 #define CCR_CORCHANGE 0x4e
238 #define CCR_SENDCH 0x20
239 #define CCR_CHANCTRL 0x10
240
241 #define CCR_TXENABLE (CCR_CHANCTRL | 0x08)
242 #define CCR_TXDISABLE (CCR_CHANCTRL | 0x04)
243 #define CCR_RXENABLE (CCR_CHANCTRL | 0x02)
244 #define CCR_RXDISABLE (CCR_CHANCTRL | 0x01)
245
246 #define CCR_SENDSCHR1 (CCR_SENDCH | 0x01)
247 #define CCR_SENDSCHR2 (CCR_SENDCH | 0x02)
248 #define CCR_SENDSCHR3 (CCR_SENDCH | 0x03)
249 #define CCR_SENDSCHR4 (CCR_SENDCH | 0x04)
250
251 #define CCR_RESETCHAN (CCR_RESET | 0x00)
252 #define CCR_RESETFULL (CCR_RESET | 0x01)
253 #define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
254
255 #define CCR_MAXWAIT 10000
256
257 /*****************************************************************************/
258
259 /*
260 * Define the valid acknowledgement types (for hw ack cycle).
261 */
262 #define ACK_TYPMASK 0x07
263 #define ACK_TYPTX 0x02
264 #define ACK_TYPMDM 0x01
265 #define ACK_TYPRXGOOD 0x03
266 #define ACK_TYPRXBAD 0x07
267
268 #define SVRR_RX 0x01
269 #define SVRR_TX 0x02
270 #define SVRR_MDM 0x04
271
272 #define ST_OVERRUN 0x01
273 #define ST_FRAMING 0x02
274 #define ST_PARITY 0x04
275 #define ST_BREAK 0x08
276 #define ST_SCHAR1 0x10
277 #define ST_SCHAR2 0x20
278 #define ST_SCHAR3 0x30
279 #define ST_SCHAR4 0x40
280 #define ST_RANGE 0x70
281 #define ST_SCHARMASK 0x70
282 #define ST_TIMEOUT 0x80
283
284 #define MISR_DCD 0x80
285 #define MISR_CTS 0x40
286 #define MISR_RI 0x20
287 #define MISR_DSR 0x10
288
289 /*****************************************************************************/
290
291 /*
292 * Defines for the CCSR status register.
293 */
294 #define CCSR_RXENABLED 0x80
295 #define CCSR_RXFLOWON 0x40
296 #define CCSR_RXFLOWOFF 0x20
297 #define CCSR_TXENABLED 0x08
298 #define CCSR_TXFLOWON 0x04
299 #define CCSR_TXFLOWOFF 0x02
300
301 /*****************************************************************************/
302
303 /*
304 * Define the embedded commands.
305 */
306 #define ETC_CMD 0x00
307 #define ETC_STARTBREAK 0x81
308 #define ETC_DELAY 0x82
309 #define ETC_STOPBREAK 0x83
310
311 /*****************************************************************************/
312 #endif
Cache object: 3bd05fb59c21935143ead64c67460b0b
|