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 $
39 /*****************************************************************************/
42 /*****************************************************************************/
45 * Define the number of async ports per cd1400 uart chip.
47 #define CD1400_PORTS 4
50 * Define the cd1400 uarts internal FIFO sizes.
52 #define CD1400_TXFIFOSIZE 12
53 #define CD1400_RXFIFOSIZE 12
56 * Local RX FIFO thresh hold level. Also define the RTS thresh hold
57 * based on the RX thresh hold.
59 #define FIFO_RXTHRESHOLD 6
60 #define FIFO_RTSTHRESHOLD 7
62 /*****************************************************************************/
65 * Define the cd1400 register addresses. These are all the valid
66 * registers with the cd1400. Some are global, some virtual, some
117 /*****************************************************************************/
120 * Define the set of baud rate clock divisors.
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
128 #define CD1400_NUMCLKS 5
130 /*****************************************************************************/
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!
137 #define PPR_SCALAR 244
139 /*****************************************************************************/
142 * Define values used to set character size options.
144 #define COR1_CHL5 0x00
145 #define COR1_CHL6 0x01
146 #define COR1_CHL7 0x02
147 #define COR1_CHL8 0x03
150 * Define values used to set the number of stop bits.
152 #define COR1_STOP1 0x00
153 #define COR1_STOP15 0x04
154 #define COR1_STOP2 0x08
157 * Define values used to set the parity scheme in use.
159 #define COR1_PARNONE 0x00
160 #define COR1_PARFORCE 0x20
161 #define COR1_PARENB 0x40
162 #define COR1_PARIGNORE 0x10
164 #define COR1_PARODD 0x80
165 #define COR1_PAREVEN 0x00
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
175 #define COR3_SCDRNG 0x80
176 #define COR3_SCD34 0x40
177 #define COR3_FCT 0x20
178 #define COR3_SCD12 0x10
181 * Define the bit values of COR4.
183 #define COR4_BRKINT 0x08
184 #define COR4_IGNBRK 0x18
187 * Define the bit values of COR5.
189 #define COR5_ISTRIP 0x80
191 /*****************************************************************************/
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.
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
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
210 #define MCOR1_DCD 0x80
211 #define MCOR1_CTS 0x40
212 #define MCOR1_RI 0x20
213 #define MCOR1_DSR 0x10
215 #define MCOR2_DCD 0x80
216 #define MCOR2_CTS 0x40
217 #define MCOR2_RI 0x20
218 #define MCOR2_DSR 0x10
220 /*****************************************************************************/
223 * Define the bits used with the service (interrupt) enable register.
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
231 /*****************************************************************************/
234 * Define operational commands for the command register.
236 #define CCR_RESET 0x80
237 #define CCR_CORCHANGE 0x4e
238 #define CCR_SENDCH 0x20
239 #define CCR_CHANCTRL 0x10
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)
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)
251 #define CCR_RESETCHAN (CCR_RESET | 0x00)
252 #define CCR_RESETFULL (CCR_RESET | 0x01)
253 #define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
255 #define CCR_MAXWAIT 10000
257 /*****************************************************************************/
260 * Define the valid acknowledgement types (for hw ack cycle).
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
270 #define SVRR_MDM 0x04
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
284 #define MISR_DCD 0x80
285 #define MISR_CTS 0x40
287 #define MISR_DSR 0x10
289 /*****************************************************************************/
292 * Defines for the CCSR status register.
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
301 /*****************************************************************************/
304 * Define the embedded commands.
307 #define ETC_STARTBREAK 0x81
308 #define ETC_DELAY 0x82
309 #define ETC_STOPBREAK 0x83
311 /*****************************************************************************/