1 /*****************************************************************************/
4 * cd1400.h -- cd1400 UART hardware info.
6 * Copyright (c) 1995 Greg Ungerer (gerg@stallion.oz.au).
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
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
36 * $FreeBSD: src/sys/i386/isa/ic/scd1400.h,v 1.5 1999/08/28 00:45:15 peter Exp $
37 * $DragonFly: src/sys/platform/pc32/isa/ic/scd1400.h,v 1.2 2003/06/17 04:28:37 dillon Exp $
40 /*****************************************************************************/
43 /*****************************************************************************/
46 * Define the number of async ports per cd1400 uart chip.
48 #define CD1400_PORTS 4
51 * Define the cd1400 uarts internal FIFO sizes.
53 #define CD1400_TXFIFOSIZE 12
54 #define CD1400_RXFIFOSIZE 12
57 * Local RX FIFO thresh hold level. Also define the RTS thresh hold
58 * based on the RX thresh hold.
60 #define FIFO_RXTHRESHOLD 6
61 #define FIFO_RTSTHRESHOLD 7
63 /*****************************************************************************/
66 * Define the cd1400 register addresses. These are all the valid
67 * registers with the cd1400. Some are global, some virtual, some
118 /*****************************************************************************/
121 * Define the set of baud rate clock divisors.
123 #define CD1400_CLK0 8
124 #define CD1400_CLK1 32
125 #define CD1400_CLK2 128
126 #define CD1400_CLK3 512
127 #define CD1400_CLK4 2048
129 #define CD1400_NUMCLKS 5
131 /*****************************************************************************/
134 * Define the clock pre-scalar value to be a 5 ms clock. This should be
135 * OK for now. It would probably be better to make it 10 ms, but we
136 * can't fit that divisor into 8 bits!
138 #define PPR_SCALAR 244
140 /*****************************************************************************/
143 * Define values used to set character size options.
145 #define COR1_CHL5 0x00
146 #define COR1_CHL6 0x01
147 #define COR1_CHL7 0x02
148 #define COR1_CHL8 0x03
151 * Define values used to set the number of stop bits.
153 #define COR1_STOP1 0x00
154 #define COR1_STOP15 0x04
155 #define COR1_STOP2 0x08
158 * Define values used to set the parity scheme in use.
160 #define COR1_PARNONE 0x00
161 #define COR1_PARFORCE 0x20
162 #define COR1_PARENB 0x40
163 #define COR1_PARIGNORE 0x10
165 #define COR1_PARODD 0x80
166 #define COR1_PAREVEN 0x00
168 #define COR2_IXM 0x80
169 #define COR2_TXIBE 0x40
170 #define COR2_ETC 0x20
171 #define COR2_LLM 0x10
172 #define COR2_RLM 0x08
173 #define COR2_RTSAO 0x04
174 #define COR2_CTSAE 0x02
176 #define COR3_SCDRNG 0x80
177 #define COR3_SCD34 0x40
178 #define COR3_FCT 0x20
179 #define COR3_SCD12 0x10
182 * Define the bit values of COR4.
184 #define COR4_BRKINT 0x08
185 #define COR4_IGNBRK 0x18
188 * Define the bit values of COR5.
190 #define COR5_ISTRIP 0x80
192 /*****************************************************************************/
195 * Define the modem control register values.
196 * Note that the actual hardware is a little different to the conventional
197 * pin names on the cd1400.
199 #define MSVR1_DTR 0x01
200 #define MSVR1_DSR 0x10
201 #define MSVR1_RI 0x20
202 #define MSVR1_CTS 0x40
203 #define MSVR1_DCD 0x80
205 #define MSVR2_RTS 0x02
206 #define MSVR2_DSR 0x10
207 #define MSVR2_RI 0x20
208 #define MSVR2_CTS 0x40
209 #define MSVR2_DCD 0x80
211 #define MCOR1_DCD 0x80
212 #define MCOR1_CTS 0x40
213 #define MCOR1_RI 0x20
214 #define MCOR1_DSR 0x10
216 #define MCOR2_DCD 0x80
217 #define MCOR2_CTS 0x40
218 #define MCOR2_RI 0x20
219 #define MCOR2_DSR 0x10
221 /*****************************************************************************/
224 * Define the bits used with the service (interrupt) enable register.
226 #define SRER_NNDT 0x01
227 #define SRER_TXEMPTY 0x02
228 #define SRER_TXDATA 0x04
229 #define SRER_RXDATA 0x10
230 #define SRER_MODEM 0x80
232 /*****************************************************************************/
235 * Define operational commands for the command register.
237 #define CCR_RESET 0x80
238 #define CCR_CORCHANGE 0x4e
239 #define CCR_SENDCH 0x20
240 #define CCR_CHANCTRL 0x10
242 #define CCR_TXENABLE (CCR_CHANCTRL | 0x08)
243 #define CCR_TXDISABLE (CCR_CHANCTRL | 0x04)
244 #define CCR_RXENABLE (CCR_CHANCTRL | 0x02)
245 #define CCR_RXDISABLE (CCR_CHANCTRL | 0x01)
247 #define CCR_SENDSCHR1 (CCR_SENDCH | 0x01)
248 #define CCR_SENDSCHR2 (CCR_SENDCH | 0x02)
249 #define CCR_SENDSCHR3 (CCR_SENDCH | 0x03)
250 #define CCR_SENDSCHR4 (CCR_SENDCH | 0x04)
252 #define CCR_RESETCHAN (CCR_RESET | 0x00)
253 #define CCR_RESETFULL (CCR_RESET | 0x01)
254 #define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
256 #define CCR_MAXWAIT 10000
258 /*****************************************************************************/
261 * Define the valid acknowledgement types (for hw ack cycle).
263 #define ACK_TYPMASK 0x07
264 #define ACK_TYPTX 0x02
265 #define ACK_TYPMDM 0x01
266 #define ACK_TYPRXGOOD 0x03
267 #define ACK_TYPRXBAD 0x07
271 #define SVRR_MDM 0x04
273 #define ST_OVERRUN 0x01
274 #define ST_FRAMING 0x02
275 #define ST_PARITY 0x04
276 #define ST_BREAK 0x08
277 #define ST_SCHAR1 0x10
278 #define ST_SCHAR2 0x20
279 #define ST_SCHAR3 0x30
280 #define ST_SCHAR4 0x40
281 #define ST_RANGE 0x70
282 #define ST_SCHARMASK 0x70
283 #define ST_TIMEOUT 0x80
285 #define MISR_DCD 0x80
286 #define MISR_CTS 0x40
288 #define MISR_DSR 0x10
290 /*****************************************************************************/
293 * Defines for the CCSR status register.
295 #define CCSR_RXENABLED 0x80
296 #define CCSR_RXFLOWON 0x40
297 #define CCSR_RXFLOWOFF 0x20
298 #define CCSR_TXENABLED 0x08
299 #define CCSR_TXFLOWON 0x04
300 #define CCSR_TXFLOWOFF 0x02
302 /*****************************************************************************/
305 * Define the embedded commands.
308 #define ETC_STARTBREAK 0x81
309 #define ETC_DELAY 0x82
310 #define ETC_STOPBREAK 0x83
312 /*****************************************************************************/