ibmpc: Fix ACK check in host_send() for Z-150 AT #661

Zenith Z-150 AT doesn't seems to place ACK signaling normally.
https://github.com/tmk/tmk_keyboard/issues/661#issue-743168434
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#zenith-z-150-beige

IBM genuine PC host checks data line only, not clock on ACK. In this
case Z-150 AT ACK signaling can be handled.
http://www.halicery.com/Hardware/Intel%208042%20and%208048/8042_PS2_INTERN.TEXT (026C:)
http://halicery.com/8042/8042_1503033.TXT (0274:)

Place 'inhibit' on lines for long enough to cancel current state and
recovery from ERROR but not sure this really helps.
This commit is contained in:
tmk 2021-02-05 23:46:18 +09:00
parent 8381eb480f
commit 0a1dcacbfd

View file

@ -135,18 +135,12 @@ int16_t ibmpc_host_send(uint8_t data)
/* Stop bit */
wait_us(15);
data_hi();
WAIT(clock_hi, 50, 6);
if (ibmpc_protocol == IBMPC_PROTOCOL_AT_Z150) { goto RECV; }
WAIT(clock_lo, 50, 7);
/* Ack */
WAIT(data_lo, 50, 8);
WAIT(data_lo, 300, 6);
WAIT(data_hi, 300, 7);
WAIT(clock_hi, 300, 8);
/* wait for idle state */
WAIT(clock_hi, 50, 9);
WAIT(data_hi, 50, 10);
RECV:
// clear buffer to get response correctly
recv_data = 0xFFFF;
ibmpc_host_isr_clear();
@ -156,6 +150,8 @@ RECV:
return ibmpc_host_recv_response();
ERROR:
ibmpc_error |= IBMPC_ERR_SEND;
inhibit();
wait_ms(2);
idle();
IBMPC_INT_ON();
return -1;