Lines Matching +full:40 +full:- +full:bit

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 1998-2001 Vojtech Pavlik
24 #define GF2K_START 400 /* The time we wait for the first bit [400 us] */
25 #define GF2K_STROBE 40 /* The time we wait for the first bit [40 us] */
42 static char gf2k_length[] = { 40, 40, 40, 40, 40, 40, 40, 40 };
43 … char gf2k_hat_to_axis[][2] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1,…
45 static char *gf2k_names[] = {"", "Genius G-09D", "Genius F-30D", "Genius F-30", "Genius MaxFighter …
46 "Genius F-30-5", "Genius Flight2000 F-23", "Genius F-31"};
93 t--; u = v; in gf2k_read_packet()
123 while ((gameport_read(gameport) & 1) && t) t--; in gf2k_trigger_seq()
134 * Parameter 'pos' is bit number inside packet where to start at, 'num' is number
149 data &= (1 << num) - 1; in gf2k_get_bits()
157 struct input_dev *dev = gf2k->dev; in gf2k_read()
160 for (i = 0; i < 4 && i < gf2k_axes[gf2k->id]; i++) in gf2k_read()
163 for (i = 0; i < 2 && i < gf2k_axes[gf2k->id] - 4; i++) in gf2k_read()
166 t = GB(40,4,0); in gf2k_read()
168 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_read()
173 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_read()
176 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_read()
191 gf2k->reads++; in gf2k_poll()
193 if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id]) in gf2k_poll()
194 gf2k->bads++; in gf2k_poll()
203 gameport_start_polling(gf2k->gameport); in gf2k_open()
211 gameport_stop_polling(gf2k->gameport); in gf2k_close()
228 err = -ENOMEM; in gf2k_connect()
232 gf2k->gameport = gameport; in gf2k_connect()
233 gf2k->dev = input_dev; in gf2k_connect()
250 err = -ENODEV; in gf2k_connect()
254 if (!(gf2k->id = GB(7,2,0) | GB(3,3,2) | GB(0,3,5))) { in gf2k_connect()
255 err = -ENODEV; in gf2k_connect()
260 if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) && in gf2k_connect()
261 (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) { in gf2k_connect()
262 err = -ENODEV; in gf2k_connect()
266 gf2k->id = 6; in gf2k_connect()
269 if (gf2k->id > GF2K_ID_MAX || !gf2k_axes[gf2k->id]) { in gf2k_connect()
271 gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]); in gf2k_connect()
272 err = -ENODEV; in gf2k_connect()
279 snprintf(gf2k->phys, sizeof(gf2k->phys), "%s/input0", gameport->phys); in gf2k_connect()
281 gf2k->length = gf2k_lens[gf2k->id]; in gf2k_connect()
283 input_dev->name = gf2k_names[gf2k->id]; in gf2k_connect()
284 input_dev->phys = gf2k->phys; in gf2k_connect()
285 input_dev->id.bustype = BUS_GAMEPORT; in gf2k_connect()
286 input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS; in gf2k_connect()
287 input_dev->id.product = gf2k->id; in gf2k_connect()
288 input_dev->id.version = 0x0100; in gf2k_connect()
289 input_dev->dev.parent = &gameport->dev; in gf2k_connect()
293 input_dev->open = gf2k_open; in gf2k_connect()
294 input_dev->close = gf2k_close; in gf2k_connect()
296 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in gf2k_connect()
298 for (i = 0; i < gf2k_axes[gf2k->id]; i++) in gf2k_connect()
299 set_bit(gf2k_abs[i], input_dev->absbit); in gf2k_connect()
301 for (i = 0; i < gf2k_hats[gf2k->id]; i++) in gf2k_connect()
302 input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0); in gf2k_connect()
304 for (i = 0; i < gf2k_joys[gf2k->id]; i++) in gf2k_connect()
305 set_bit(gf2k_btn_joy[i], input_dev->keybit); in gf2k_connect()
307 for (i = 0; i < gf2k_pads[gf2k->id]; i++) in gf2k_connect()
308 set_bit(gf2k_btn_pad[i], input_dev->keybit); in gf2k_connect()
310 gf2k_read_packet(gameport, gf2k->length, data); in gf2k_connect()
313 for (i = 0; i < gf2k_axes[gf2k->id]; i++) { in gf2k_connect()
321 32, max - 32, 8, flat); in gf2k_connect()
324 err = input_register_device(gf2k->dev); in gf2k_connect()
341 input_unregister_device(gf2k->dev); in gf2k_disconnect()