mse.c (82618) | mse.c (83366) |
---|---|
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 9 * documentation. 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. 13 * | 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 9 * documentation. 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. 13 * |
14 * $FreeBSD: head/sys/dev/mse/mse.c 82618 2001-08-31 02:14:34Z msmith $ | 14 * $FreeBSD: head/sys/dev/mse/mse.c 83366 2001-09-12 08:38:13Z julian $ |
15 */ 16/* 17 * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and 18 * the X386 port, courtesy of 19 * Rick Macklem, rick@snowhite.cis.uoguelph.ca 20 * Caveats: The driver currently uses spltty(), but doesn't use any 21 * generic tty code. It could use splmse() (that only masks off the 22 * bus mouse interrupt, but that would require hacking in i386/isa/icu.s. --- 366 unchanged lines hidden (view full) --- 389 390 return 0; 391} 392 393/* 394 * Exclusive open the mouse, initialize it and enable interrupts. 395 */ 396static int | 15 */ 16/* 17 * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and 18 * the X386 port, courtesy of 19 * Rick Macklem, rick@snowhite.cis.uoguelph.ca 20 * Caveats: The driver currently uses spltty(), but doesn't use any 21 * generic tty code. It could use splmse() (that only masks off the 22 * bus mouse interrupt, but that would require hacking in i386/isa/icu.s. --- 366 unchanged lines hidden (view full) --- 389 390 return 0; 391} 392 393/* 394 * Exclusive open the mouse, initialize it and enable interrupts. 395 */ 396static int |
397mseopen(dev, flags, fmt, p) | 397mseopen(dev, flags, fmt, td) |
398 dev_t dev; 399 int flags; 400 int fmt; | 398 dev_t dev; 399 int flags; 400 int fmt; |
401 struct proc *p; | 401 struct thread *td; |
402{ 403 mse_softc_t *sc; 404 int s; 405 406 sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 407 if (sc == NULL) 408 return (ENXIO); 409 if (sc->sc_mousetype == MSE_NONE) --- 19 unchanged lines hidden (view full) --- 429 splx(s); 430 return (0); 431} 432 433/* 434 * mseclose: just turn off mouse innterrupts. 435 */ 436static int | 402{ 403 mse_softc_t *sc; 404 int s; 405 406 sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 407 if (sc == NULL) 408 return (ENXIO); 409 if (sc->sc_mousetype == MSE_NONE) --- 19 unchanged lines hidden (view full) --- 429 splx(s); 430 return (0); 431} 432 433/* 434 * mseclose: just turn off mouse innterrupts. 435 */ 436static int |
437mseclose(dev, flags, fmt, p) | 437mseclose(dev, flags, fmt, td) |
438 dev_t dev; 439 int flags; 440 int fmt; | 438 dev_t dev; 439 int flags; 440 int fmt; |
441 struct proc *p; | 441 struct thread *td; |
442{ 443 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 444 int s; 445 446 untimeout(msetimeout, dev, sc->sc_callout); 447 callout_handle_init(&sc->sc_callout); 448 s = spltty(); 449 (*sc->sc_disablemouse)(sc->sc_iot, sc->sc_ioh); --- 70 unchanged lines hidden (view full) --- 520 sc->sc_bytesread += xfer; 521 return(0); 522} 523 524/* 525 * mseioctl: process ioctl commands. 526 */ 527static int | 442{ 443 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 444 int s; 445 446 untimeout(msetimeout, dev, sc->sc_callout); 447 callout_handle_init(&sc->sc_callout); 448 s = spltty(); 449 (*sc->sc_disablemouse)(sc->sc_iot, sc->sc_ioh); --- 70 unchanged lines hidden (view full) --- 520 sc->sc_bytesread += xfer; 521 return(0); 522} 523 524/* 525 * mseioctl: process ioctl commands. 526 */ 527static int |
528mseioctl(dev, cmd, addr, flag, p) | 528mseioctl(dev, cmd, addr, flag, td) |
529 dev_t dev; 530 u_long cmd; 531 caddr_t addr; 532 int flag; | 529 dev_t dev; 530 u_long cmd; 531 caddr_t addr; 532 int flag; |
533 struct proc *p; | 533 struct thread *td; |
534{ 535 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 536 mousestatus_t status; 537 int err = 0; 538 int s; 539 540 switch (cmd) { 541 --- 95 unchanged lines hidden (view full) --- 637 } 638 return (err); 639} 640 641/* 642 * msepoll: check for mouse input to be processed. 643 */ 644static int | 534{ 535 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 536 mousestatus_t status; 537 int err = 0; 538 int s; 539 540 switch (cmd) { 541 --- 95 unchanged lines hidden (view full) --- 637 } 638 return (err); 639} 640 641/* 642 * msepoll: check for mouse input to be processed. 643 */ 644static int |
645msepoll(dev, events, p) | 645msepoll(dev, events, td) |
646 dev_t dev; 647 int events; | 646 dev_t dev; 647 int events; |
648 struct proc *p; | 648 struct thread *td; |
649{ 650 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 651 int s; 652 int revents = 0; 653 654 s = spltty(); 655 if (events & (POLLIN | POLLRDNORM)) { 656 if (sc->sc_bytesread != sc->mode.packetsize || 657 sc->sc_deltax != 0 || sc->sc_deltay != 0 || 658 (sc->sc_obuttons ^ sc->sc_buttons) != 0) 659 revents |= events & (POLLIN | POLLRDNORM); 660 else { 661 /* 662 * Since this is an exclusive open device, any previous 663 * proc pointer is trash now, so we can just assign it. 664 */ | 649{ 650 mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); 651 int s; 652 int revents = 0; 653 654 s = spltty(); 655 if (events & (POLLIN | POLLRDNORM)) { 656 if (sc->sc_bytesread != sc->mode.packetsize || 657 sc->sc_deltax != 0 || sc->sc_deltay != 0 || 658 (sc->sc_obuttons ^ sc->sc_buttons) != 0) 659 revents |= events & (POLLIN | POLLRDNORM); 660 else { 661 /* 662 * Since this is an exclusive open device, any previous 663 * proc pointer is trash now, so we can just assign it. 664 */ |
665 selrecord(p, &sc->sc_selp); | 665 selrecord(td, &sc->sc_selp); |
666 } 667 } 668 splx(s); 669 return (revents); 670} 671 672/* 673 * msetimeout: watchdog timer routine. --- 253 unchanged lines hidden --- | 666 } 667 } 668 splx(s); 669 return (revents); 670} 671 672/* 673 * msetimeout: watchdog timer routine. --- 253 unchanged lines hidden --- |