Deleted Added
full compact
mse.c (637) mse.c (798)
1/*
2 * Copyright 1992 by the University of Guelph
3 *
4 * Permission to use, copy and modify this
5 * software and its documentation for any purpose and without
6 * fee is hereby granted, provided that the above copyright
7 * notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting

--- 41 unchanged lines hidden (view full) ---

50#include "kernel.h"
51#include "ioctl.h"
52#include "tty.h"
53#include "uio.h"
54
55#include "i386/isa/isa_device.h"
56#include "i386/isa/icu.h"
57
1/*
2 * Copyright 1992 by the University of Guelph
3 *
4 * Permission to use, copy and modify this
5 * software and its documentation for any purpose and without
6 * fee is hereby granted, provided that the above copyright
7 * notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting

--- 41 unchanged lines hidden (view full) ---

50#include "kernel.h"
51#include "ioctl.h"
52#include "tty.h"
53#include "uio.h"
54
55#include "i386/isa/isa_device.h"
56#include "i386/isa/icu.h"
57
58int mseprobe(), mseattach(), mseintr();
58static int mseprobe(struct isa_device *);
59static int mseattach(struct isa_device *);
60void mseintr(int);
59
60struct isa_driver msedriver = {
61 mseprobe, mseattach, "mse"
62};
63
64/*
65 * Software control structure for mouse. The sc_enablemouse(),
66 * sc_disablemouse() and sc_getmouse() routines must be called spl'd().

--- 74 unchanged lines hidden (view full) ---

141 void (*m_disable)(); /* Disable interrupts routine */
142 void (*m_get)(); /* and get mouse status */
143} mse_types[] = {
144 { MSE_ATIINPORT, mse_probeati, mse_enableati, mse_disableati, mse_getati },
145 { MSE_LOGITECH, mse_probelogi, mse_enablelogi, mse_disablelogi, mse_getlogi },
146 { 0, },
147};
148
61
62struct isa_driver msedriver = {
63 mseprobe, mseattach, "mse"
64};
65
66/*
67 * Software control structure for mouse. The sc_enablemouse(),
68 * sc_disablemouse() and sc_getmouse() routines must be called spl'd().

--- 74 unchanged lines hidden (view full) ---

143 void (*m_disable)(); /* Disable interrupts routine */
144 void (*m_get)(); /* and get mouse status */
145} mse_types[] = {
146 { MSE_ATIINPORT, mse_probeati, mse_enableati, mse_disableati, mse_getati },
147 { MSE_LOGITECH, mse_probelogi, mse_enablelogi, mse_disablelogi, mse_getlogi },
148 { 0, },
149};
150
151int
149mseprobe(idp)
150 register struct isa_device *idp;
151{
152 register struct mse_softc *sc = &mse_sc[idp->id_unit];
153 register int i;
154
155 /*
156 * Check for each mouse type in the table.

--- 7 unchanged lines hidden (view full) ---

164 sc->sc_getmouse = mse_types[i].m_get;
165 return (1);
166 }
167 i++;
168 }
169 return (0);
170}
171
152mseprobe(idp)
153 register struct isa_device *idp;
154{
155 register struct mse_softc *sc = &mse_sc[idp->id_unit];
156 register int i;
157
158 /*
159 * Check for each mouse type in the table.

--- 7 unchanged lines hidden (view full) ---

167 sc->sc_getmouse = mse_types[i].m_get;
168 return (1);
169 }
170 i++;
171 }
172 return (0);
173}
174
175int
172mseattach(idp)
173 struct isa_device *idp;
174{
175 struct mse_softc *sc = &mse_sc[idp->id_unit];
176
177 sc->sc_port = idp->id_iobase;
178 return (1);
179}
180
181/*
182 * Exclusive open the mouse, initialize it and enable interrupts.
183 */
176mseattach(idp)
177 struct isa_device *idp;
178{
179 struct mse_softc *sc = &mse_sc[idp->id_unit];
180
181 sc->sc_port = idp->id_iobase;
182 return (1);
183}
184
185/*
186 * Exclusive open the mouse, initialize it and enable interrupts.
187 */
188int
184mseopen(dev, flag)
185 dev_t dev;
186 int flag;
187{
188 register struct mse_softc *sc;
189 int s;
190
191 if (MSE_UNIT(dev) >= NMSE)

--- 13 unchanged lines hidden (view full) ---

205 (*sc->sc_enablemouse)(sc->sc_port);
206 splx(s);
207 return (0);
208}
209
210/*
211 * mseclose: just turn off mouse innterrupts.
212 */
189mseopen(dev, flag)
190 dev_t dev;
191 int flag;
192{
193 register struct mse_softc *sc;
194 int s;
195
196 if (MSE_UNIT(dev) >= NMSE)

--- 13 unchanged lines hidden (view full) ---

210 (*sc->sc_enablemouse)(sc->sc_port);
211 splx(s);
212 return (0);
213}
214
215/*
216 * mseclose: just turn off mouse innterrupts.
217 */
218int
213mseclose(dev, flag)
219mseclose(dev, flag)
220 dev_t dev;
214 int flag;
215{
216 struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
217 int s;
218
219 s = spltty();
220 (*sc->sc_disablemouse)(sc->sc_port);
221 sc->sc_flags &= ~MSESC_OPEN;
222 splx(s);
223 return(0);
224}
225
226/*
227 * mseread: return mouse info using the MSC serial protocol, but without
228 * using bytes 4 and 5.
229 * (Yes this is cheesy, but it makes the X386 server happy, so...)
230 */
221 int flag;
222{
223 struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
224 int s;
225
226 s = spltty();
227 (*sc->sc_disablemouse)(sc->sc_port);
228 sc->sc_flags &= ~MSESC_OPEN;
229 splx(s);
230 return(0);
231}
232
233/*
234 * mseread: return mouse info using the MSC serial protocol, but without
235 * using bytes 4 and 5.
236 * (Yes this is cheesy, but it makes the X386 server happy, so...)
237 */
238int
231mseread(dev, uio)
232 dev_t dev;
233 struct uio *uio;
234{
235 register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
236 int xfer, s, error;
237
238 /*

--- 44 unchanged lines hidden (view full) ---

283 return (error);
284 sc->sc_bytesread += xfer;
285 return(0);
286}
287
288/*
289 * mseselect: check for mouse input to be processed.
290 */
239mseread(dev, uio)
240 dev_t dev;
241 struct uio *uio;
242{
243 register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
244 int xfer, s, error;
245
246 /*

--- 44 unchanged lines hidden (view full) ---

291 return (error);
292 sc->sc_bytesread += xfer;
293 return(0);
294}
295
296/*
297 * mseselect: check for mouse input to be processed.
298 */
299int
291mseselect(dev, rw, p)
292 dev_t dev;
293 int rw;
294 struct proc *p;
295{
296 register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
297 int s;
298

--- 11 unchanged lines hidden (view full) ---

310 sc->sc_selp = p->p_pid;
311 splx(s);
312 return (0);
313}
314
315/*
316 * mseintr: update mouse status. sc_deltax and sc_deltay are accumulative.
317 */
300mseselect(dev, rw, p)
301 dev_t dev;
302 int rw;
303 struct proc *p;
304{
305 register struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)];
306 int s;
307

--- 11 unchanged lines hidden (view full) ---

319 sc->sc_selp = p->p_pid;
320 splx(s);
321 return (0);
322}
323
324/*
325 * mseintr: update mouse status. sc_deltax and sc_deltay are accumulative.
326 */
327void
318mseintr(unit)
319 int unit;
320{
321 register struct mse_softc *sc = &mse_sc[unit];
322 pid_t p;
323
324#ifdef DEBUG
325 static int mse_intrcnt = 0;

--- 168 unchanged lines hidden ---
328mseintr(unit)
329 int unit;
330{
331 register struct mse_softc *sc = &mse_sc[unit];
332 pid_t p;
333
334#ifdef DEBUG
335 static int mse_intrcnt = 0;

--- 168 unchanged lines hidden ---