ibmpc: Inhibit device while buffer is full
This commit is contained in:
parent
22b6e87f37
commit
d13ce4d06f
1 changed files with 16 additions and 3 deletions
|
|
@ -203,8 +203,8 @@ int16_t ibmpc_host_recv(void)
|
||||||
ret = 0xFF;
|
ret = 0xFF;
|
||||||
break;
|
break;
|
||||||
case IBMPC_ERR_FULL:
|
case IBMPC_ERR_FULL:
|
||||||
// buffer full
|
// buffer overflow
|
||||||
dprintf("!FULL! ");
|
dprintf("!OVF! ");
|
||||||
ret = 0xFF;
|
ret = 0xFF;
|
||||||
break;
|
break;
|
||||||
case 0xFF:
|
case 0xFF:
|
||||||
|
|
@ -226,6 +226,12 @@ int16_t ibmpc_host_recv(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable ISR if recv_data is not full
|
||||||
|
if ((recv_data | 0x00FF) == 0xFFFF) {
|
||||||
|
ibmpc_host_isr_clear();
|
||||||
|
IBMPC_INT_ON();
|
||||||
|
idle();
|
||||||
|
}
|
||||||
//dprintf("i%04X ", ibmpc_isr_debug); ibmpc_isr_debug = 0;
|
//dprintf("i%04X ", ibmpc_isr_debug); ibmpc_isr_debug = 0;
|
||||||
dprintf("r%02X ", ret);
|
dprintf("r%02X ", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -412,7 +418,7 @@ DONE:
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
if (HI8(recv_data) != 0xFF && LO8(recv_data) != 0xFF) {
|
if (HI8(recv_data) != 0xFF && LO8(recv_data) != 0xFF) {
|
||||||
// buffer full
|
// buffer overflow
|
||||||
ibmpc_error = IBMPC_ERR_FULL;
|
ibmpc_error = IBMPC_ERR_FULL;
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -420,6 +426,13 @@ DONE:
|
||||||
recv_data = recv_data<<8;
|
recv_data = recv_data<<8;
|
||||||
recv_data |= isr_state & 0xFF;
|
recv_data |= isr_state & 0xFF;
|
||||||
CLEAR:
|
CLEAR:
|
||||||
|
// Disable ISR if recv_data is full
|
||||||
|
if ((recv_data | 0x00FF) != 0xFFFF) {
|
||||||
|
IBMPC_INT_OFF();
|
||||||
|
// inhibit: clock_lo
|
||||||
|
IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
|
||||||
|
IBMPC_CLOCK_DDR |= (1<<IBMPC_CLOCK_BIT);
|
||||||
|
}
|
||||||
// clear for next data
|
// clear for next data
|
||||||
isr_state = 0x8000;
|
isr_state = 0x8000;
|
||||||
NEXT:
|
NEXT:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue