ibmpc: Fix buffer full check
recv_data should appear to as 'sstt' when it is full with two data. Both upper and lower byte should be checked.
This commit is contained in:
parent
4028b200be
commit
77c5017cb2
1 changed files with 3 additions and 1 deletions
|
|
@ -229,6 +229,8 @@ void ibmpc_host_isr_clear(void)
|
||||||
recv_data = 0xFFFF;
|
recv_data = 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define LO8(w) (*((uint8_t *)&(w)))
|
||||||
|
#define HI8(w) (*(((uint8_t *)&(w))+1))
|
||||||
// NOTE: With this ISR data line can be read within 2us after clock falling edge.
|
// NOTE: With this ISR data line can be read within 2us after clock falling edge.
|
||||||
// To read data line early as possible:
|
// To read data line early as possible:
|
||||||
// write naked ISR with asembly code to read the line and call C func to do other job?
|
// write naked ISR with asembly code to read the line and call C func to do other job?
|
||||||
|
|
@ -379,7 +381,7 @@ DONE:
|
||||||
ibmpc_error = IBMPC_ERR_FF;
|
ibmpc_error = IBMPC_ERR_FF;
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
if ((recv_data & 0xFF00) != 0xFF00) {
|
if (HI8(recv_data) != 0xFF && LO8(recv_data) != 0xFF) {
|
||||||
// buffer full
|
// buffer full
|
||||||
ibmpc_error = IBMPC_ERR_FULL;
|
ibmpc_error = IBMPC_ERR_FULL;
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue