Deleted Added
full compact
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);
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
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
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
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
219mseclose(dev, flag)
220 dev_t dev;
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
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
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
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 ---