Merge branch 'ibmpc_f500_support'

This commit is contained in:
tmk 2023-06-16 10:42:26 +09:00
commit db4268bfa1
5 changed files with 4318 additions and 4420 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -179,6 +179,14 @@ DONE:
return id;
}
static void clear_stuck_keys(void)
{
matrix_clear();
clear_keyboard();
xprintf("\n[CLR] ");
}
uint8_t IBMPCConverter::process_interface(void)
{
if (ibmpc.error) {
@ -191,9 +199,8 @@ uint8_t IBMPCConverter::process_interface(void)
* IBMPC_ERR_TIMEOUT Reinit
* IBMPC_ERR_FULL Ignore
* IBMPC_ERR_ILLEGAL Reinit
* IBMPC_ERR_FF Ignore(not used)
*/
// when recv error, neither send error nor buffer full
// send error and buffer full are ignored TODO: refactor
if (!(ibmpc.error & (IBMPC_ERR_SEND | IBMPC_ERR_FULL))) {
state = ERROR;
if (ibmpc.error == IBMPC_ERR_PARITY_AA) {
@ -506,19 +513,6 @@ MOUSE_DONE:
break;
}
// Keyboard Error/Overrun([3]p.26) or Buffer full
// Scan Code Set 1: 0xFF
// Scan Code Set 2 and 3: 0x00
// Buffer full(IBMPC_ERR_FULL): 0xFF
if (keyboard_kind != PC_MOUSE && (code == 0x00 || code == 0xFF)) {
// clear stuck keys
matrix_clear();
clear_keyboard();
xprintf("\n[CLR] ");
break;
}
switch (keyboard_kind) {
case PC_XT:
if (process_cs1(code) == -1) state = ERROR;
@ -657,8 +651,7 @@ MOUSE_DONE:
xprintf("E%u ", timer_read());
// reinit state
init();
matrix_clear();
clear_keyboard();
clear_stuck_keys();
state = INIT;
break;
default:
@ -673,7 +666,7 @@ MOUSE_DONE:
*
* See [3], [a]
*
* E0-escaped scan codes are translated into unused range of the matrix.(54-7F)
* E0-prefixed scan codes are translated into unused range of the matrix.(54-7F)
*
* 01-53: Normal codes used in original XT keyboard
* 54-7F: Not used in original XT keyboard
@ -684,8 +677,8 @@ MOUSE_DONE:
* 70 x * * x * * x * * x * x * x x *
*
* -: codes existed in original XT keyboard
* *: E0-escaped codes translated
* x: Non-espcaped codes(Some are not used in real keyboards probably)
* *: E0-prefixed codes translated
* x: Non-prefixed codes(Some are not used in real keyboards probably)
*
* Codes assigned in range 54-7F:
*
@ -750,6 +743,9 @@ int8_t IBMPCConverter::process_cs1(uint8_t code)
switch (state_cs1) {
case CS1_INIT:
switch (code) {
case 0xFF: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xE0:
state_cs1 = CS1_E0;
break;
@ -898,8 +894,9 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x41: if (0xAB90 == keyboard_id || 0xAB91 == keyboard_id)
return 0x7C; // Keypad ,(5576) -> Keypad *
else
return (code & 0x7F);
return (code & 0x7F); // unknown
// standard E0-prefixed codes [a]
case 0x14: return 0x19; // right control
case 0x1F: return 0x17; // left GUI
case 0x27: return 0x1F; // right GUI
@ -919,7 +916,6 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x7D: return 0x5E; // page up
case 0x7C: return 0x7F; // Print Screen
case 0x7E: return 0x00; // Control'd Pause
case 0x21: return 0x65; // volume down
case 0x32: return 0x6E; // volume up
case 0x23: return 0x6F; // mute
@ -950,7 +946,11 @@ uint8_t IBMPCConverter::cs2_e0code(uint8_t code) {
case 0x0D: return 0x19; // LCompose DEC LK411 -> LGUI
case 0x79: return 0x6D; // KP- DEC LK411 -> PCMM
case 0x83: return 0x28; // F17 DEC LK411
default: return (code & 0x7F);
// https://github.com/tmk/tmk_keyboard/pull/760
case 0x00: return 0x65; // TERM FUNC Siemens F500 -> VOLD
default: return (code & 0x7F); // unknown
}
}
@ -1010,6 +1010,9 @@ int8_t IBMPCConverter::process_cs2(uint8_t code)
code = translate_5576_cs2(code);
}
switch (code) {
case 0x00: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xE0:
state_cs2 = CS2_E0;
break;
@ -1046,7 +1049,7 @@ int8_t IBMPCConverter::process_cs2(uint8_t code)
}
}
break;
case CS2_E0: // E0-Prefixed
case CS2_E0: // E0-prefixed
switch (code) {
case 0x12: // to be ignored
case 0x59: // to be ignored
@ -1258,6 +1261,9 @@ int8_t IBMPCConverter::process_cs3(uint8_t code)
code = translate_televideo_dec_cs3(code);
}
switch (code) {
case 0x00: // Error/Overrun([3]p.26)
clear_stuck_keys();
break;
case 0xF0:
state_cs3 = CS3_F0;
break;

View file

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