2 * Copyright 1992 by the University of Guelph
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
10 * University of Guelph makes no representations about the suitability of
11 * this software for any purpose. It is provided "as is"
12 * without express or implied warranty.
14 * $FreeBSD: src/sys/i386/isa/mse.c,v 1.49.2.1 2000/03/20 13:58:47 yokota Exp $
15 * $DragonFly: src/sys/dev/misc/mse/mse.c,v 1.7 2003/08/27 10:35:17 rob Exp $
18 * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
19 * the X386 port, courtesy of
20 * Rick Macklem, rick@snowhite.cis.uoguelph.ca
21 * Caveats: The driver currently uses spltty(), but doesn't use any
22 * generic tty code. It could use splmse() (that only masks off the
23 * bus mouse interrupt, but that would require hacking in i386/isa/icu.s.
24 * (This may be worth the effort, since the Logitech generates 30/60
25 * interrupts/sec continuously while it is open.)
26 * NB: The ATI has NOT been tested yet!
30 * Modification history:
31 * Sep 6, 1994 -- Lars Fredriksen(fredriks@mcs.com)
32 * improved probe based on input from Logitech.
34 * Oct 19, 1992 -- E. Stark (stark@cs.sunysb.edu)
35 * fixes to make it work with Microsoft InPort busmouse
37 * Jan, 1993 -- E. Stark (stark@cs.sunysb.edu)
38 * added patches for new "select" interface
40 * May 4, 1993 -- E. Stark (stark@cs.sunysb.edu)
41 * changed position of some spl()'s in mseread
43 * October 8, 1993 -- E. Stark (stark@cs.sunysb.edu)
44 * limit maximum negative x/y value to -127 to work around XFree problem
45 * that causes spurious button pushes.
48 #include <sys/param.h>
49 #include <sys/systm.h>
51 #include <sys/kernel.h>
54 #include <sys/select.h>
57 #include <machine/bus_pio.h>
58 #include <machine/bus.h>
59 #include <machine/clock.h>
60 #include <machine/mouse.h>
61 #include <machine/resource.h>
64 #include <bus/isa/isavar.h>
66 /* driver configuration flags (config) */
67 #define MSE_CONFIG_ACCEL 0x00f0 /* acceleration factor */
68 #define MSE_CONFIG_FLAGS (MSE_CONFIG_ACCEL)
71 * Software control structure for mouse. The sc_enablemouse(),
72 * sc_disablemouse() and sc_getmouse() routines must be called spl'd().
74 typedef struct mse_softc {
77 struct selinfo sc_selp;
78 struct resource *sc_port;
79 struct resource *sc_intr;
80 bus_space_tag_t sc_iot;
81 bus_space_handle_t sc_ioh;
83 void (*sc_enablemouse) (bus_space_tag_t t,
84 bus_space_handle_t h);
85 void (*sc_disablemouse) (bus_space_tag_t t,
86 bus_space_handle_t h);
87 void (*sc_getmouse) (bus_space_tag_t t,
89 int *dx, int *dy, int *but);
95 u_char sc_bytes[MOUSE_SYS_PACKETSIZE];
96 struct callout_handle sc_callout;
102 mousestatus_t status;
105 static devclass_t mse_devclass;
107 static int mse_probe (device_t dev);
108 static int mse_attach (device_t dev);
109 static int mse_detach (device_t dev);
111 static device_method_t mse_methods[] = {
112 DEVMETHOD(device_probe, mse_probe),
113 DEVMETHOD(device_attach, mse_attach),
114 DEVMETHOD(device_detach, mse_detach),
118 static driver_t mse_driver = {
124 DRIVER_MODULE(mse, isa, mse_driver, mse_devclass, 0, 0);
126 static struct isa_pnp_id mse_ids[] = {
127 { 0x000fd041, "Bus mouse" }, /* PNP0F00 */
128 { 0x020fd041, "InPort mouse" }, /* PNP0F02 */
129 { 0x0d0fd041, "InPort mouse compatible" }, /* PNP0F0D */
130 { 0x110fd041, "Bus mouse compatible" }, /* PNP0F11 */
131 { 0x150fd041, "Logitech bus mouse" }, /* PNP0F15 */
132 { 0x180fd041, "Logitech bus mouse compatible" },/* PNP0F18 */
136 static d_open_t mseopen;
137 static d_close_t mseclose;
138 static d_read_t mseread;
139 static d_ioctl_t mseioctl;
140 static d_poll_t msepoll;
142 #define CDEV_MAJOR 27
143 static struct cdevsw mse_cdevsw = {
145 /* maj */ CDEV_MAJOR,
151 /* close */ mseclose,
154 /* ioctl */ mseioctl,
157 /* strategy */ nostrategy,
162 static void mseintr (void *);
163 static timeout_t msetimeout;
166 #define MSESC_OPEN 0x1
167 #define MSESC_WANT 0x2
169 /* and Mouse Types */
170 #define MSE_NONE 0 /* don't move this! */
171 #define MSE_LOGITECH 0x1
172 #define MSE_ATIINPORT 0x2
173 #define MSE_LOGI_SIG 0xA5
181 #define MSE_UNIT(dev) (minor(dev) >> 1)
182 #define MSE_NBLOCKIO(dev) (minor(dev) & 0x1)
185 * Logitech bus mouse definitions
187 #define MSE_SETUP 0x91 /* What does this mean? */
188 /* The definition for the control port */
191 /* D7 = Mode set flag (1 = active) */
192 /* D6,D5 = Mode selection (port A) */
193 /* 00 = Mode 0 = Basic I/O */
194 /* 01 = Mode 1 = Strobed I/O */
195 /* 10 = Mode 2 = Bi-dir bus */
196 /* D4 = Port A direction (1 = input)*/
197 /* D3 = Port C (upper 4 bits) */
198 /* direction. (1 = input) */
199 /* D2 = Mode selection (port B & C) */
200 /* 0 = Mode 0 = Basic I/O */
201 /* 1 = Mode 1 = Strobed I/O */
202 /* D1 = Port B direction (1 = input)*/
203 /* D0 = Port C (lower 4 bits) */
204 /* direction. (1 = input) */
206 /* So 91 means Basic I/O on all 3 ports,*/
207 /* Port A is an input port, B is an */
208 /* output port, C is split with upper */
209 /* 4 bits being an output port and lower*/
210 /* 4 bits an input port, and enable the */
212 /* Courtesy Intel 8255 databook. Lars */
213 #define MSE_HOLD 0x80
214 #define MSE_RXLOW 0x00
215 #define MSE_RXHIGH 0x20
216 #define MSE_RYLOW 0x40
217 #define MSE_RYHIGH 0x60
218 #define MSE_DISINTR 0x10
219 #define MSE_INTREN 0x00
221 static int mse_probelogi (device_t dev, mse_softc_t *sc);
222 static void mse_disablelogi (bus_space_tag_t t,
223 bus_space_handle_t h);
224 static void mse_getlogi (bus_space_tag_t t,
225 bus_space_handle_t h,
226 int *dx, int *dy, int *but);
227 static void mse_enablelogi (bus_space_tag_t t,
228 bus_space_handle_t h);
231 * ATI Inport mouse definitions
233 #define MSE_INPORT_RESET 0x80
234 #define MSE_INPORT_STATUS 0x00
235 #define MSE_INPORT_DX 0x01
236 #define MSE_INPORT_DY 0x02
237 #define MSE_INPORT_MODE 0x07
238 #define MSE_INPORT_HOLD 0x20
239 #define MSE_INPORT_INTREN 0x09
241 static int mse_probeati (device_t dev, mse_softc_t *sc);
242 static void mse_enableati (bus_space_tag_t t,
243 bus_space_handle_t h);
244 static void mse_disableati (bus_space_tag_t t,
245 bus_space_handle_t h);
246 static void mse_getati (bus_space_tag_t t,
247 bus_space_handle_t h,
248 int *dx, int *dy, int *but);
251 * Table of mouse types.
252 * Keep the Logitech last, since I haven't figured out how to probe it
253 * properly yet. (Someday I'll have the documentation.)
255 static struct mse_types {
256 int m_type; /* Type of bus mouse */
257 int (*m_probe) (device_t dev, mse_softc_t *sc);
258 /* Probe routine to test for it */
259 void (*m_enable) (bus_space_tag_t t, bus_space_handle_t h);
261 void (*m_disable) (bus_space_tag_t t, bus_space_handle_t h);
262 /* Disable interrupts routine */
263 void (*m_get) (bus_space_tag_t t, bus_space_handle_t h,
264 int *dx, int *dy, int *but);
265 /* and get mouse status */
266 mousehw_t m_hw; /* buttons iftype type model hwid */
267 mousemode_t m_mode; /* proto rate res accel level size mask */
270 mse_probeati, mse_enableati, mse_disableati, mse_getati,
271 { 2, MOUSE_IF_INPORT, MOUSE_MOUSE, MOUSE_MODEL_GENERIC, 0, },
272 { MOUSE_PROTO_INPORT, -1, -1, 0, 0, MOUSE_MSC_PACKETSIZE,
273 { MOUSE_MSC_SYNCMASK, MOUSE_MSC_SYNC, }, }, },
275 mse_probelogi, mse_enablelogi, mse_disablelogi, mse_getlogi,
276 { 2, MOUSE_IF_BUS, MOUSE_MOUSE, MOUSE_MODEL_GENERIC, 0, },
277 { MOUSE_PROTO_BUS, -1, -1, 0, 0, MOUSE_MSC_PACKETSIZE,
278 { MOUSE_MSC_SYNCMASK, MOUSE_MSC_SYNC, }, }, },
292 error = ISA_PNP_PROBE(device_get_parent(dev), dev, mse_ids);
296 sc = device_get_softc(dev);
298 sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
299 MSE_IOSIZE, RF_ACTIVE);
300 if (sc->sc_port == NULL)
302 sc->sc_iot = rman_get_bustag(sc->sc_port);
303 sc->sc_ioh = rman_get_bushandle(sc->sc_port);
306 * Check for each mouse type in the table.
309 while (mse_types[i].m_type) {
310 if ((*mse_types[i].m_probe)(dev, sc)) {
311 sc->sc_mousetype = mse_types[i].m_type;
312 sc->sc_enablemouse = mse_types[i].m_enable;
313 sc->sc_disablemouse = mse_types[i].m_disable;
314 sc->sc_getmouse = mse_types[i].m_get;
315 sc->hw = mse_types[i].m_hw;
316 sc->mode = mse_types[i].m_mode;
317 bus_release_resource(dev, SYS_RES_IOPORT, rid,
319 device_set_desc(dev, "Bus/InPort Mouse");
324 bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
337 sc = device_get_softc(dev);
338 unit = device_get_unit(dev);
341 sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
342 MSE_IOSIZE, RF_ACTIVE);
343 if (sc->sc_port == NULL)
345 sc->sc_intr = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
347 if (sc->sc_intr == NULL) {
348 bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
351 sc->sc_iot = rman_get_bustag(sc->sc_port);
352 sc->sc_ioh = rman_get_bushandle(sc->sc_port);
354 if (BUS_SETUP_INTR(device_get_parent(dev), dev, sc->sc_intr,
355 INTR_TYPE_TTY, mseintr, sc, &sc->sc_ih)) {
356 bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
357 bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
361 flags = device_get_flags(dev);
362 sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4;
363 callout_handle_init(&sc->sc_callout);
365 sc->sc_dev = make_dev(&mse_cdevsw, unit << 1, 0, 0, 0600,
367 sc->sc_ndev = make_dev(&mse_cdevsw, (unit<<1)+1, 0, 0, 0600,
380 sc = device_get_softc(dev);
381 if (sc->sc_flags & MSESC_OPEN)
385 BUS_TEARDOWN_INTR(device_get_parent(dev), dev, sc->sc_intr, sc->sc_ih);
386 bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
387 bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
389 destroy_dev(sc->sc_dev);
390 destroy_dev(sc->sc_ndev);
396 * Exclusive open the mouse, initialize it and enable interrupts.
399 mseopen(dev, flags, fmt, td)
408 sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
411 if (sc->sc_mousetype == MSE_NONE)
413 if (sc->sc_flags & MSESC_OPEN)
415 sc->sc_flags |= MSESC_OPEN;
416 sc->sc_obuttons = sc->sc_buttons = MOUSE_MSC_BUTTONS;
417 sc->sc_deltax = sc->sc_deltay = 0;
418 sc->sc_bytesread = sc->mode.packetsize = MOUSE_MSC_PACKETSIZE;
419 sc->sc_watchdog = FALSE;
420 sc->sc_callout = timeout(msetimeout, dev, hz*2);
422 sc->status.flags = 0;
423 sc->status.button = sc->status.obutton = 0;
424 sc->status.dx = sc->status.dy = sc->status.dz = 0;
427 * Initialize mouse interface and enable interrupts.
430 (*sc->sc_enablemouse)(sc->sc_iot, sc->sc_ioh);
436 * mseclose: just turn off mouse innterrupts.
439 mseclose(dev, flags, fmt, td)
445 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
448 untimeout(msetimeout, dev, sc->sc_callout);
449 callout_handle_init(&sc->sc_callout);
451 (*sc->sc_disablemouse)(sc->sc_iot, sc->sc_ioh);
452 sc->sc_flags &= ~MSESC_OPEN;
458 * mseread: return mouse info using the MSC serial protocol, but without
459 * using bytes 4 and 5.
460 * (Yes this is cheesy, but it makes the X386 server happy, so...)
463 mseread(dev, uio, ioflag)
468 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
472 * If there are no protocol bytes to be read, set up a new protocol
475 s = spltty(); /* XXX Should be its own spl, but where is imlXX() */
476 if (sc->sc_bytesread >= sc->mode.packetsize) {
477 while (sc->sc_deltax == 0 && sc->sc_deltay == 0 &&
478 (sc->sc_obuttons ^ sc->sc_buttons) == 0) {
479 if (MSE_NBLOCKIO(dev)) {
483 sc->sc_flags |= MSESC_WANT;
484 error = tsleep((caddr_t)sc, PCATCH, "mseread", 0);
492 * Generate protocol bytes.
493 * For some reason X386 expects 5 bytes but never uses
494 * the fourth or fifth?
496 sc->sc_bytes[0] = sc->mode.syncmask[1]
497 | (sc->sc_buttons & ~sc->mode.syncmask[0]);
498 if (sc->sc_deltax > 127)
500 if (sc->sc_deltax < -127)
501 sc->sc_deltax = -127;
502 sc->sc_deltay = -sc->sc_deltay; /* Otherwise mousey goes wrong way */
503 if (sc->sc_deltay > 127)
505 if (sc->sc_deltay < -127)
506 sc->sc_deltay = -127;
507 sc->sc_bytes[1] = sc->sc_deltax;
508 sc->sc_bytes[2] = sc->sc_deltay;
509 sc->sc_bytes[3] = sc->sc_bytes[4] = 0;
510 sc->sc_bytes[5] = sc->sc_bytes[6] = 0;
511 sc->sc_bytes[7] = MOUSE_SYS_EXTBUTTONS;
512 sc->sc_obuttons = sc->sc_buttons;
513 sc->sc_deltax = sc->sc_deltay = 0;
514 sc->sc_bytesread = 0;
517 xfer = min(uio->uio_resid, sc->mode.packetsize - sc->sc_bytesread);
518 error = uiomove(&sc->sc_bytes[sc->sc_bytesread], xfer, uio);
521 sc->sc_bytesread += xfer;
526 * mseioctl: process ioctl commands.
529 mseioctl(dev, cmd, addr, flag, td)
536 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
537 mousestatus_t status;
543 case MOUSE_GETHWINFO:
545 *(mousehw_t *)addr = sc->hw;
546 if (sc->mode.level == 0)
547 ((mousehw_t *)addr)->model = MOUSE_MODEL_GENERIC;
553 *(mousemode_t *)addr = sc->mode;
554 switch (sc->mode.level) {
558 ((mousemode_t *)addr)->protocol = MOUSE_PROTO_SYSMOUSE;
559 ((mousemode_t *)addr)->syncmask[0] = MOUSE_SYS_SYNCMASK;
560 ((mousemode_t *)addr)->syncmask[1] = MOUSE_SYS_SYNC;
567 switch (((mousemode_t *)addr)->level) {
574 if (((mousemode_t *)addr)->accelfactor < -1)
576 else if (((mousemode_t *)addr)->accelfactor >= 0)
577 sc->mode.accelfactor =
578 ((mousemode_t *)addr)->accelfactor;
579 sc->mode.level = ((mousemode_t *)addr)->level;
580 switch (sc->mode.level) {
582 sc->sc_bytesread = sc->mode.packetsize
583 = MOUSE_MSC_PACKETSIZE;
586 sc->sc_bytesread = sc->mode.packetsize
587 = MOUSE_SYS_PACKETSIZE;
593 *(int *)addr = sc->mode.level;
597 switch (*(int *)addr) {
599 sc->mode.level = *(int *)addr;
600 sc->sc_bytesread = sc->mode.packetsize
601 = MOUSE_MSC_PACKETSIZE;
604 sc->mode.level = *(int *)addr;
605 sc->sc_bytesread = sc->mode.packetsize
606 = MOUSE_SYS_PACKETSIZE;
613 case MOUSE_GETSTATUS:
616 sc->status.flags = 0;
617 sc->status.obutton = sc->status.button;
618 sc->status.button = 0;
623 *(mousestatus_t *)addr = status;
626 case MOUSE_READSTATE:
630 #if (defined(MOUSE_GETVARS))
643 * msepoll: check for mouse input to be processed.
646 msepoll(dev, events, td)
651 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
656 if (events & (POLLIN | POLLRDNORM)) {
657 if (sc->sc_bytesread != sc->mode.packetsize ||
658 sc->sc_deltax != 0 || sc->sc_deltay != 0 ||
659 (sc->sc_obuttons ^ sc->sc_buttons) != 0)
660 revents |= events & (POLLIN | POLLRDNORM);
663 * Since this is an exclusive open device, any previous
664 * proc pointer is trash now, so we can just assign it.
666 selrecord(td, &sc->sc_selp);
674 * msetimeout: watchdog timer routine.
684 sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev));
685 if (sc->sc_watchdog) {
687 printf("mse%d: lost interrupt?\n", MSE_UNIT(dev));
690 sc->sc_watchdog = TRUE;
691 sc->sc_callout = timeout(msetimeout, dev, hz);
695 * mseintr: update mouse status. sc_deltax and sc_deltay are accumulative.
702 * the table to turn MouseSystem button bits (MOUSE_MSC_BUTTON?UP)
703 * into `mousestatus' button bits (MOUSE_BUTTON?DOWN).
705 static int butmap[8] = {
709 MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN,
711 MOUSE_BUTTON1DOWN | MOUSE_BUTTON3DOWN,
712 MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN,
713 MOUSE_BUTTON1DOWN | MOUSE_BUTTON2DOWN | MOUSE_BUTTON3DOWN
715 mse_softc_t *sc = arg;
720 static int mse_intrcnt = 0;
721 if((mse_intrcnt++ % 10000) == 0)
724 if ((sc->sc_flags & MSESC_OPEN) == 0)
727 (*sc->sc_getmouse)(sc->sc_iot, sc->sc_ioh, &dx, &dy, &but);
728 if (sc->mode.accelfactor > 0) {
730 dx = dx * dx / sc->mode.accelfactor;
736 dy = dy * dy / sc->mode.accelfactor;
744 sc->sc_buttons = but;
746 but = butmap[~but & MOUSE_MSC_BUTTONS];
749 sc->status.flags |= ((dx || dy) ? MOUSE_POSCHANGED : 0)
750 | (sc->status.button ^ but);
751 sc->status.button = but;
753 sc->sc_watchdog = FALSE;
756 * If mouse state has changed, wake up anyone wanting to know.
758 if (sc->sc_deltax != 0 || sc->sc_deltay != 0 ||
759 (sc->sc_obuttons ^ sc->sc_buttons) != 0) {
760 if (sc->sc_flags & MSESC_WANT) {
761 sc->sc_flags &= ~MSESC_WANT;
764 selwakeup(&sc->sc_selp);
769 * Routines for the Logitech mouse.
772 * Test for a Logitech bus mouse and return 1 if it is.
773 * (until I know how to use the signature port properly, just disable
774 * interrupts and return 1)
777 mse_probelogi(dev, sc)
784 bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTD, MSE_SETUP);
785 /* set the signature port */
786 bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTB, MSE_LOGI_SIG);
788 DELAY(30000); /* 30 ms delay */
789 sig = bus_space_read_1(sc->sc_iot, sc->sc_ioh, MSE_PORTB) & 0xFF;
790 if (sig == MSE_LOGI_SIG) {
791 bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSE_PORTC,
796 device_printf(dev, "wrong signature %x\n", sig);
802 * Initialize Logitech mouse and enable interrupts.
805 mse_enablelogi(tag, handle)
807 bus_space_handle_t handle;
811 bus_space_write_1(tag, handle, MSE_PORTD, MSE_SETUP);
812 mse_getlogi(tag, handle, &dx, &dy, &but);
816 * Disable interrupts for Logitech mouse.
819 mse_disablelogi(tag, handle)
821 bus_space_handle_t handle;
824 bus_space_write_1(tag, handle, MSE_PORTC, MSE_DISINTR);
828 * Get the current dx, dy and button up/down state.
831 mse_getlogi(tag, handle, dx, dy, but)
833 bus_space_handle_t handle;
840 bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RXLOW);
841 x = bus_space_read_1(tag, handle, MSE_PORTA);
842 *but = (x >> 5) & MOUSE_MSC_BUTTONS;
844 bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RXHIGH);
845 x |= (bus_space_read_1(tag, handle, MSE_PORTA) << 4);
846 bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RYLOW);
847 y = (bus_space_read_1(tag, handle, MSE_PORTA) & 0xf);
848 bus_space_write_1(tag, handle, MSE_PORTC, MSE_HOLD | MSE_RYHIGH);
849 y |= (bus_space_read_1(tag, handle, MSE_PORTA) << 4);
852 bus_space_write_1(tag, handle, MSE_PORTC, MSE_INTREN);
856 * Routines for the ATI Inport bus mouse.
859 * Test for a ATI Inport bus mouse and return 1 if it is.
860 * (do not enable interrupts)
863 mse_probeati(dev, sc)
869 for (i = 0; i < 2; i++)
870 if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, MSE_PORTC) == 0xde)
876 * Initialize ATI Inport mouse and enable interrupts.
879 mse_enableati(tag, handle)
881 bus_space_handle_t handle;
884 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_RESET);
885 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE);
886 bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_INTREN);
890 * Disable interrupts for ATI Inport mouse.
893 mse_disableati(tag, handle)
895 bus_space_handle_t handle;
898 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE);
899 bus_space_write_1(tag, handle, MSE_PORTB, 0);
903 * Get current dx, dy and up/down button state.
906 mse_getati(tag, handle, dx, dy, but)
908 bus_space_handle_t handle;
915 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE);
916 bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_HOLD);
917 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_STATUS);
918 *but = ~bus_space_read_1(tag, handle, MSE_PORTB) & MOUSE_MSC_BUTTONS;
919 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_DX);
920 byte = bus_space_read_1(tag, handle, MSE_PORTB);
922 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_DY);
923 byte = bus_space_read_1(tag, handle, MSE_PORTB);
925 bus_space_write_1(tag, handle, MSE_PORTA, MSE_INPORT_MODE);
926 bus_space_write_1(tag, handle, MSE_PORTB, MSE_INPORT_INTREN);