Lines Matching defs:gameport

15 #include <linux/gameport.h>
97 struct gameport *gameport;
117 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id)
124 timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID packet */
125 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */
126 start = gameport_time(gameport, SW_START);
127 strobe = gameport_time(gameport, SW_STROBE);
134 gameport_trigger(gameport); /* Trigger */
135 v = gameport_read(gameport);
140 v = gameport_read(gameport);
153 v = gameport_read(gameport);
169 gameport_trigger(gameport); /* Trigger */
222 static void sw_init_digital(struct gameport *gameport)
232 gameport_trigger(gameport); /* Trigger */
233 t = gameport_time(gameport, SW_TIMEOUT * 1000);
234 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */
238 gameport_trigger(gameport); /* Last trigger */
412 i = sw_read_packet(sw->gameport, buf, sw->length, 0);
418 " - going to reinitialize.\n", sw->gameport->phys);
444 " - enabling optimization again.\n", sw->gameport->phys);
457 " - disabling optimization.\n", sw->gameport->phys);
465 " - reinitializing joystick.\n", sw->gameport->phys);
469 sw_init_digital(sw->gameport);
473 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */
475 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */
482 static void sw_poll(struct gameport *gameport)
484 struct sw *sw = gameport_get_drvdata(gameport);
495 gameport_start_polling(sw->gameport);
503 gameport_stop_polling(sw->gameport);
568 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
589 sw->gameport = gameport;
591 gameport_set_drvdata(gameport, sw);
593 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW);
598 gameport->phys, gameport->io, gameport->speed);
600 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */
605 sw_init_digital(gameport); /* Switch to digital */
607 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
616 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */
622 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */
630 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */
641 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */
649 sw->gameport = gameport;
703 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys);
715 gameport_set_poll_handler(gameport, sw_poll);
716 gameport_set_poll_interval(gameport, 20);
727 "%s/input%d", gameport->phys, i);
741 input_dev->dev.parent = &gameport->dev;
782 fail2: gameport_close(gameport);
783 fail1: gameport_set_drvdata(gameport, NULL);
788 static void sw_disconnect(struct gameport *gameport)
790 struct sw *sw = gameport_get_drvdata(gameport);
795 gameport_close(gameport);
796 gameport_set_drvdata(gameport, NULL);