Lines Matching +full:1 +full:gb
56 #define SW_ID_GP 1
78 { 10, 10, 9, 10, 1, 1 },
79 { 1, 1 },
80 { 10, 10, 6, 7, 1, 1 },
81 { 10, 10, 6, 7, 1, 1 },
82 { 10, 10, 6, 1, 1 },
83 { 10, 7, 7, 1, 1 }};
96 } sw_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-…
167 pending = 1; /* Mark schedule */ in sw_read_packet()
193 * sw_get_bits() and GB() compose bits from the triplet buffer into a __u64.
199 #define GB(pos,num) sw_get_bits(buf, pos, num, sw->bits) macro
209 data |= (__u64)((buf[i] >> tri++) & 1) << bit++; /* Transfer bit */ in sw_get_bits()
236 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */ in sw_init_digital()
257 x ^= x >> 1; in sw_parity()
258 return x & 1; in sw_parity()
270 return -1; in sw_check()
294 if (sw_check(GB(0,64)) || (hat = (GB(6,1) << 3) | GB(60,3)) > 8) in sw_parse()
295 return -1; in sw_parse()
299 input_report_abs(dev, ABS_X, (GB( 3,3) << 7) | GB(16,7)); in sw_parse()
300 input_report_abs(dev, ABS_Y, (GB( 0,3) << 7) | GB(24,7)); in sw_parse()
301 input_report_abs(dev, ABS_RZ, (GB(35,2) << 7) | GB(40,7)); in sw_parse()
302 input_report_abs(dev, ABS_THROTTLE, (GB(32,3) << 7) | GB(48,7)); in sw_parse()
308 input_report_key(dev, sw_btn[SW_ID_3DP][j], !GB(j+8,1)); in sw_parse()
310 input_report_key(dev, BTN_BASE4, !GB(38,1)); in sw_parse()
311 input_report_key(dev, BTN_BASE5, !GB(37,1)); in sw_parse()
321 if (sw_parity(GB(i*15,15))) in sw_parse()
322 return -1; in sw_parse()
324 input_report_abs(sw->dev[i], ABS_X, GB(i*15+3,1) - GB(i*15+2,1)); in sw_parse()
325 input_report_abs(sw->dev[i], ABS_Y, GB(i*15+0,1) - GB(i*15+1,1)); in sw_parse()
328 input_report_key(sw->dev[i], sw_btn[SW_ID_GP][j], !GB(i*15+j+4,1)); in sw_parse()
338 if (!sw_parity(GB(0,48)) || (hat = GB(42,4)) > 8) in sw_parse()
339 return -1; in sw_parse()
342 input_report_abs(dev, ABS_X, GB( 9,10)); in sw_parse()
343 input_report_abs(dev, ABS_Y, GB(19,10)); in sw_parse()
344 input_report_abs(dev, ABS_RZ, GB(36, 6)); in sw_parse()
345 input_report_abs(dev, ABS_THROTTLE, GB(29, 7)); in sw_parse()
351 input_report_key(dev, sw_btn[SW_ID_PP][j], !GB(j,1)); in sw_parse()
359 if (!sw_parity(GB(0,43)) || (hat = GB(28,4)) > 8) in sw_parse()
360 return -1; in sw_parse()
363 input_report_abs(dev, ABS_X, GB( 0,10)); in sw_parse()
364 input_report_abs(dev, ABS_Y, GB(16,10)); in sw_parse()
365 input_report_abs(dev, ABS_THROTTLE, GB(32, 6)); in sw_parse()
371 input_report_key(dev, sw_btn[SW_ID_FSP][j], !GB(j+10,1)); in sw_parse()
373 input_report_key(dev, BTN_TR, !GB(26,1)); in sw_parse()
374 input_report_key(dev, BTN_START, !GB(27,1)); in sw_parse()
375 input_report_key(dev, BTN_MODE, !GB(38,1)); in sw_parse()
376 input_report_key(dev, BTN_SELECT, !GB(39,1)); in sw_parse()
384 if (!sw_parity(GB(0,33))) in sw_parse()
385 return -1; in sw_parse()
388 input_report_abs(dev, ABS_RX, GB( 0,10)); in sw_parse()
389 input_report_abs(dev, ABS_RUDDER, GB(10, 6)); in sw_parse()
390 input_report_abs(dev, ABS_THROTTLE, GB(16, 6)); in sw_parse()
393 input_report_key(dev, sw_btn[SW_ID_FFW][j], !GB(j+22,1)); in sw_parse()
400 return -1; in sw_parse()
418 if (i == 64 && !sw_check(sw_get_bits(buf,0,64,1))) { /* Last init failed, 1 bit mode */ in sw_read()
425 if (i < 66 && GB(0,64) == GB(i*3-66,64)) /* 1 == 3 */ in sw_read()
428 if (i < 66 && GB(0,64) == GB(66,64)) /* 1 == 2 */ in sw_read()
431 if (i < 66 && GB(i*3-132,64) == GB(i*3-66,64)) { /* 2 == 3 */ in sw_read()
464 return -1; /* Not enough, don't reinitialize yet */ in sw_read()
481 return -1; in sw_read()
517 for (i = (((length + 3) >> 2) - 1); i >= 0; i--) in sw_print_packet()
533 pnp[i] = sw_get_bits(buf, 24+8*i, 8, 1); in sw_3dp_id()
536 rev[i] = sw_get_bits(buf, 88+8*i, 8, 1); in sw_3dp_id()
541 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | /* Two 6-bit values */ in sw_3dp_id()
542 sw_get_bits(buf, 16, 6, 1)) / 100, in sw_3dp_id()
543 (int) ((sw_get_bits(buf, 8, 6, 1) << 6) | in sw_3dp_id()
544 sw_get_bits(buf, 16, 6, 1)) % 100, in sw_3dp_id()
560 for (i = 1; i < len; i++) in sw_guess_mode()
561 xor |= (buf[i - 1] ^ buf[i]) & 6; in sw_guess_mode()
563 return !!xor * 2 + 1; in sw_guess_mode()
578 unsigned char m = 1; in sw_connect()
604 dbg("Init 1: Mode %d. Length %d.", m , i); in sw_connect()
611 dbg("Init 1b: Length %d.", i); in sw_connect()
622 if (j <= 0) { /* Read ID failed. Happens in 1-bit mode on PP */ in sw_connect()
636 sw->type = -1; in sw_connect()
650 sw->number = 1; in sw_connect()
682 sprintf(comment, " [AC %s]", sw_get_bits(idbuf,38,1,3) ? "off" : "on"); in sw_connect()
700 } while (k && sw->type == -1); in sw_connect()
702 if (sw->type == -1) { in sw_connect()
755 min = bits == 1 ? -1 : 0; in sw_connect()
756 max = (1 << bits) - 1; in sw_connect()
757 fuzz = (bits >> 1) >= 2 ? 1 << ((bits >> 1) - 2) : 0; in sw_connect()
759 0 : 1 << (bits - 5); in sw_connect()