ibmpc: Check buffer full and error code FF

This commit is contained in:
tmk 2020-03-02 01:48:11 +09:00
parent 0b1fbeb135
commit 0481aa08e5
2 changed files with 15 additions and 8 deletions

View file

@ -268,8 +268,7 @@ ISR(IBMPC_INT_VECT)
break; break;
case 0b11000000: case 0b11000000:
// XT_Clone-done // XT_Clone-done
recv_data = recv_data<<8; isr_state = isr_state>>8;
recv_data |= (isr_state>>8) & 0xFF;
goto DONE; goto DONE;
break; break;
case 0b10100000: // ^2 case 0b10100000: // ^2
@ -284,8 +283,7 @@ ISR(IBMPC_INT_VECT)
goto NEXT; goto NEXT;
} else { } else {
// no stop bit: XT_IBM-done // no stop bit: XT_IBM-done
recv_data = recv_data<<8; isr_state = isr_state>>8;
recv_data |= (isr_state>>8) & 0xFF;
goto DONE; goto DONE;
} }
} }
@ -294,10 +292,9 @@ ISR(IBMPC_INT_VECT)
case 0b10010000: case 0b10010000:
case 0b01010000: case 0b01010000:
case 0b11010000: case 0b11010000:
// TODO: parity check?
// AT-done // AT-done
recv_data = recv_data<<8; // TODO: parity check?
recv_data |= (isr_state>>6) & 0xFF; isr_state = isr_state>>6;
goto DONE; goto DONE;
break; break;
case 0b01100000: case 0b01100000:
@ -318,7 +315,16 @@ ERROR:
recv_data = 0xFF00; // clear data and scancode of error 0x00 recv_data = 0xFF00; // clear data and scancode of error 0x00
return; return;
DONE: 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 isr_state = 0x8000; // clear to next data
NEXT: NEXT:
return; return;

View file

@ -80,6 +80,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define IBMPC_ERR_TIMEOUT 0x20 #define IBMPC_ERR_TIMEOUT 0x20
#define IBMPC_ERR_FULL 0x40 #define IBMPC_ERR_FULL 0x40
#define IBMPC_ERR_ILLEGAL 0x80 #define IBMPC_ERR_ILLEGAL 0x80
#define IBMPC_ERR_FF 0xFF
#define IBMPC_LED_SCROLL_LOCK 0 #define IBMPC_LED_SCROLL_LOCK 0
#define IBMPC_LED_NUM_LOCK 1 #define IBMPC_LED_NUM_LOCK 1