Lines Matching +full:1 +full:gb
53 #define SW_ID_GP 1
75 { 10, 10, 9, 10, 1, 1 },
76 { 1, 1 },
77 { 10, 10, 6, 7, 1, 1 },
78 { 10, 10, 6, 7, 1, 1 },
79 { 10, 10, 6, 1, 1 },
80 { 10, 7, 7, 1, 1 }};
93 } sw_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-…
164 pending = 1; /* Mark schedule */ in sw_read_packet()
190 * sw_get_bits() and GB() compose bits from the triplet buffer into a __u64.
196 #define GB(pos,num) sw_get_bits(buf, pos, num, sw->bits) macro
206 data |= (__u64)((buf[i] >> tri++) & 1) << bit++; /* Transfer bit */ in sw_get_bits()
233 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */ in sw_init_digital()
254 x ^= x >> 1; in sw_parity()
255 return x & 1; in sw_parity()
267 return -1; in sw_check()
291 if (sw_check(GB(0,64)) || (hat = (GB(6,1) << 3) | GB(60,3)) > 8) in sw_parse()
292 return -1; in sw_parse()
296 input_report_abs(dev, ABS_X, (GB( 3,3) << 7) | GB(16,7)); in sw_parse()
297 input_report_abs(dev, ABS_Y, (GB( 0,3) << 7) | GB(24,7)); in sw_parse()
298 input_report_abs(dev, ABS_RZ, (GB(35,2) << 7) | GB(40,7)); in sw_parse()
299 input_report_abs(dev, ABS_THROTTLE, (GB(32,3) << 7) | GB(48,7)); in sw_parse()
305 input_report_key(dev, sw_btn[SW_ID_3DP][j], !GB(j+8,1)); in sw_parse()
307 input_report_key(dev, BTN_BASE4, !GB(38,1)); in sw_parse()
308 input_report_key(dev, BTN_BASE5, !GB(37,1)); in sw_parse()
318 if (sw_parity(GB(i*15,15))) in sw_parse()
319 return -1; in sw_parse()
321 input_report_abs(sw->dev[i], ABS_X, GB(i*15+3,1) - GB(i*15+2,1)); in sw_parse()
322 input_report_abs(sw->dev[i], ABS_Y, GB(i*15+0,1) - GB(i*15+1,1)); in sw_parse()
325 input_report_key(sw->dev[i], sw_btn[SW_ID_GP][j], !GB(i*15+j+4,1)); in sw_parse()
335 if (!sw_parity(GB(0,48)) || (hat = GB(42,4)) > 8) in sw_parse()
336 return -1; in sw_parse()
339 input_report_abs(dev, ABS_X, GB( 9,10)); in sw_parse()
340 input_report_abs(dev, ABS_Y, GB(19,10)); in sw_parse()
341 input_report_abs(dev, ABS_RZ, GB(36, 6)); in sw_parse()
342 input_report_abs(dev, ABS_THROTTLE, GB(29, 7)); in sw_parse()
348 input_report_key(dev, sw_btn[SW_ID_PP][j], !GB(j,1)); in sw_parse()
356 if (!sw_parity(GB(0,43)) || (hat = GB(28,4)) > 8) in sw_parse()
357 return -1; in sw_parse()
360 input_report_abs(dev, ABS_X, GB( 0,10)); in sw_parse()
361 input_report_abs(dev, ABS_Y, GB(16,10)); in sw_parse()
362 input_report_abs(dev, ABS_THROTTLE, GB(32, 6)); in sw_parse()
368 input_report_key(dev, sw_btn[SW_ID_FSP][j], !GB(j+10,1)); in sw_parse()
370 input_report_key(dev, BTN_TR, !GB(26,1)); in sw_parse()
371 input_report_key(dev, BTN_START, !GB(27,1)); in sw_parse()
372 input_report_key(dev, BTN_MODE, !GB(38,1)); in sw_parse()
373 input_report_key(dev, BTN_SELECT, !GB(39,1)); in sw_parse()
381 if (!sw_parity(GB(0,33))) in sw_parse()
382 return -1; in sw_parse()
385 input_report_abs(dev, ABS_RX, GB( 0,10)); in sw_parse()
386 input_report_abs(dev, ABS_RUDDER, GB(10, 6)); in sw_parse()
387 input_report_abs(dev, ABS_THROTTLE, GB(16, 6)); in sw_parse()
390 input_report_key(dev, sw_btn[SW_ID_FFW][j], !GB(j+22,1)); in sw_parse()
397 return -1; in sw_parse()
415 if (i == 64 && !sw_check(sw_get_bits(buf,0,64,1))) { /* Last init failed, 1 bit mode */ in sw_read()
422 if (i < 66 && GB(0,64) == GB(i*3-66,64)) /* 1 == 3 */ in sw_read()
425 if (i < 66 && GB(0,64) == GB(66,64)) /* 1 == 2 */ in sw_read()
428 if (i < 66 && GB(i*3-132,64) == GB(i*3-66,64)) { /* 2 == 3 */ in sw_read()
461 return -1; /* Not enough, don't reinitialize yet */ in sw_read()
478 return -1; in sw_read()
514 for (i = (((length + 3) >> 2) - 1); i >= 0; i--) in sw_print_packet()
530 pnp[i] = sw_get_bits(buf, 24+8*i, 8, 1); in sw_3dp_id()
533 rev[i] = sw_get_bits(buf, 88+8*i, 8, 1); in sw_3dp_id()
538 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | /* Two 6-bit values */ in sw_3dp_id()
539 sw_get_bits(buf, 16, 6, 1)) / 100, in sw_3dp_id()
540 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | in sw_3dp_id()
541 sw_get_bits(buf, 16, 6, 1)) % 100, in sw_3dp_id()
557 for (i = 1; i < len; i++) in sw_guess_mode()
558 xor |= (buf[i - 1] ^ buf[i]) & 6; in sw_guess_mode()
560 return !!xor * 2 + 1; in sw_guess_mode()
575 unsigned char m = 1; in sw_connect()
601 dbg("Init 1: Mode %d. Length %d.", m , i); in sw_connect()
608 dbg("Init 1b: Length %d.", i); in sw_connect()
619 if (j <= 0) { /* Read ID failed. Happens in 1-bit mode on PP */ in sw_connect()
633 sw->type = -1; in sw_connect()
647 sw->number = 1; in sw_connect()
680 sprintf(comment, " [AC %s]", sw_get_bits(idbuf,38,1,3) ? "off" : "on"); in sw_connect()
698 } while (k && sw->type == -1); in sw_connect()
700 if (sw->type == -1) { in sw_connect()
753 min = bits == 1 ? -1 : 0; in sw_connect()
754 max = (1 << bits) - 1; in sw_connect()
755 fuzz = (bits >> 1) >= 2 ? 1 << ((bits >> 1) - 2) : 0; in sw_connect()
757 0 : 1 << (bits - 5); in sw_connect()