break;
case 0b11000000:
// XT_Clone-done
- recv_data = recv_data<<8;
- recv_data |= (isr_state>>8) & 0xFF;
+ isr_state = isr_state>>8;
goto DONE;
break;
case 0b10100000: // ^2
goto NEXT;
} else {
// no stop bit: XT_IBM-done
- recv_data = recv_data<<8;
- recv_data |= (isr_state>>8) & 0xFF;
+ isr_state = isr_state>>8;
goto DONE;
}
}
case 0b10010000:
case 0b01010000:
case 0b11010000:
- // TODO: parity check?
// AT-done
- recv_data = recv_data<<8;
- recv_data |= (isr_state>>6) & 0xFF;
+ // TODO: parity check?
+ isr_state = isr_state>>6;
goto DONE;
break;
case 0b01100000:
recv_data = 0xFF00; // clear data and scancode of error 0x00
return;
DONE:
- // TODO: process error code: 0x00(AT), 0xFF(XT) in particular
+ if ((isr_state & 0x00FF) == 0x00FF) {
+ // receive error code 0xFF
+ ibmpc_error = IBMPC_ERR_FF;
+ }
+ if ((recv_data & 0xFF00) != 0xFF00) {
+ // buffer full and overwritten
+ ibmpc_error = IBMPC_ERR_FULL;
+ }
+ recv_data = recv_data<<8;
+ recv_data |= isr_state & 0xFF;
isr_state = 0x8000; // clear to next data
NEXT:
return;
#define IBMPC_ERR_TIMEOUT 0x20
#define IBMPC_ERR_FULL 0x40
#define IBMPC_ERR_ILLEGAL 0x80
+#define IBMPC_ERR_FF 0xFF
#define IBMPC_LED_SCROLL_LOCK 0
#define IBMPC_LED_NUM_LOCK 1