FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/z8530sc.h
1 /* $NetBSD: z8530sc.h,v 1.19 2003/08/07 16:31:04 agc Exp $ */
2
3 /*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley.
10 *
11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement:
13 * This product includes software developed by the University of
14 * California, Lawrence Berkeley Laboratory.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
39 *
40 * @(#)zsvar.h 8.1 (Berkeley) 6/11/93
41 */
42
43 /*
44 * Copyright (c) 1994 Gordon W. Ross
45 *
46 * This software was developed by the Computer Systems Engineering group
47 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
48 * contributed to Berkeley.
49 *
50 * All advertising materials mentioning features or use of this software
51 * must display the following acknowledgement:
52 * This product includes software developed by the University of
53 * California, Lawrence Berkeley Laboratory.
54 *
55 * Redistribution and use in source and binary forms, with or without
56 * modification, are permitted provided that the following conditions
57 * are met:
58 * 1. Redistributions of source code must retain the above copyright
59 * notice, this list of conditions and the following disclaimer.
60 * 2. Redistributions in binary form must reproduce the above copyright
61 * notice, this list of conditions and the following disclaimer in the
62 * documentation and/or other materials provided with the distribution.
63 * 3. All advertising materials mentioning features or use of this software
64 * must display the following acknowledgement:
65 * This product includes software developed by the University of
66 * California, Berkeley and its contributors.
67 * 4. Neither the name of the University nor the names of its contributors
68 * may be used to endorse or promote products derived from this software
69 * without specific prior written permission.
70 *
71 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
72 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
74 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
75 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
77 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
78 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
80 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
81 * SUCH DAMAGE.
82 *
83 * @(#)zsvar.h 8.1 (Berkeley) 6/11/93
84 */
85
86
87 /*
88 * Function vector - per channel
89 */
90 struct zs_chanstate;
91 struct zsops {
92 void (*zsop_rxint) __P((struct zs_chanstate *));
93 /* receive char available */
94 void (*zsop_stint) __P((struct zs_chanstate *, int));
95 /* external/status */
96 void (*zsop_txint) __P((struct zs_chanstate *));
97 /* xmit buffer empty */
98 void (*zsop_softint) __P((struct zs_chanstate *));
99 /* process software interrupt */
100 };
101
102 extern struct zsops zsops_null;
103
104
105 /*
106 * Software state, per zs channel.
107 */
108 struct zs_chanstate {
109
110 /* Pointers to the device registers. */
111 volatile u_char *cs_reg_csr; /* ctrl, status, and reg. number. */
112 volatile u_char *cs_reg_data; /* data or numbered register */
113
114 int cs_channel; /* sub-unit number */
115 void *cs_private; /* sub-driver data pointer */
116 struct zsops *cs_ops;
117
118 struct simplelock cs_lock; /* per channel lock */
119
120 int cs_brg_clk; /* BAUD Rate Generator clock
121 * (usually PCLK / 16) */
122 int cs_defspeed; /* default baud rate */
123 int cs_defcflag; /* default cflag */
124
125 /*
126 * We must keep a copy of the write registers as they are
127 * mostly write-only and we sometimes need to set and clear
128 * individual bits (e.g., in WR3). Not all of these are
129 * needed but 16 bytes is cheap and this makes the addressing
130 * simpler. Unfortunately, we can only write to some registers
131 * when the chip is not actually transmitting, so whenever
132 * we are expecting a `transmit done' interrupt the preg array
133 * is allowed to `get ahead' of the current values. In a
134 * few places we must change the current value of a register,
135 * rather than (or in addition to) the pending value; for these
136 * cs_creg[] contains the current value.
137 */
138 u_char cs_creg[16]; /* current values */
139 u_char cs_preg[16]; /* pending values */
140 int cs_heldchange; /* change pending (creg != preg) */
141
142 u_char cs_rr0; /* last rr0 processed */
143 u_char cs_rr0_delta; /* rr0 changes at status intr. */
144 u_char cs_rr0_mask; /* rr0 bits that stop output */
145 u_char cs_rr0_dcd; /* which bit to read as DCD */
146 u_char cs_rr0_cts; /* which bit to read as CTS */
147 u_char cs_rr0_pps; /* which bit to use for PPS */
148 /* the above is set only while CRTSCTS is enabled. */
149
150 u_char cs_wr5_dtr; /* which bit to write as DTR */
151 u_char cs_wr5_rts; /* which bit to write as RTS */
152 /* the above is set only while CRTSCTS is enabled. */
153
154 char cs_softreq; /* need soft interrupt call */
155 char cs_spare1; /* (for skippy :) */
156
157 /*
158 * For strange systems that have oddly wired serial ports, we
159 * provide a pointer to the channel state of the port that has
160 * our status lines on it.
161 */
162 struct zs_chanstate *cs_ctl_chan;
163
164 /* power management hooks */
165 int (*enable) __P((struct zs_chanstate *));
166 void (*disable) __P((struct zs_chanstate *));
167 int enabled;
168
169 /* MD code might define a larger variant of this. */
170 };
171
172 struct consdev;
173 struct zsc_attach_args {
174 int channel; /* two serial channels per zsc */
175 int hwflags; /* see definitions below */
176 /* `consdev' is only valid if ZS_HWFLAG_USE_CONSDEV is set */
177 struct consdev *consdev;
178 };
179 /* In case of split console devices, use these: */
180 #define ZS_HWFLAG_CONSOLE_INPUT 1
181 #define ZS_HWFLAG_CONSOLE_OUTPUT 2
182 #define ZS_HWFLAG_CONSOLE \
183 (ZS_HWFLAG_CONSOLE_INPUT | ZS_HWFLAG_CONSOLE_OUTPUT)
184 #define ZS_HWFLAG_NO_DCD 4 /* Ignore the DCD bit */
185 #define ZS_HWFLAG_NO_CTS 8 /* Ignore the CTS bit */
186 #define ZS_HWFLAG_RAW 16 /* advise raw mode */
187 #define ZS_HWFLAG_USE_CONSDEV 32 /* Use console ops from `consdev' */
188 #define ZS_HWFLAG_NORESET 64 /* Don't reset at attach time */
189
190 int zsc_intr_soft __P((void *));
191 int zsc_intr_hard __P((void *));
192
193 void zs_abort __P((struct zs_chanstate *));
194 void zs_break __P((struct zs_chanstate *, int));
195 void zs_iflush __P((struct zs_chanstate *));
196 void zs_loadchannelregs __P((struct zs_chanstate *));
197 int zs_set_speed __P((struct zs_chanstate *, int));
198 int zs_set_modes __P((struct zs_chanstate *, int));
199
200 int zs_check_kgdb __P((struct zs_chanstate *, int));
201
Cache object: eacddd08770995077800562ffa09a65f
|