Some minor fixes, the PS/2 mouse command F0h (set remote mode) is now implemented, the PS/2 mouse command F3h (set sample rate) now actually changes the host mouse polling rate, and the Intel SIO IB and ZB now forcibly initialize a keyboard and mouse IRQ latch if the board has a PS/2 keyboard controller, to simulate the presence of a latch external to the chip.

This commit is contained in:
OBattler
2023-04-26 01:42:23 +02:00
parent 3b54cb085e
commit 78a897f07a
7 changed files with 56 additions and 15 deletions

View File

@@ -102,6 +102,8 @@ static int mouse_nbut;
static int (*mouse_dev_poll)(int x, int y, int z, int b, void *priv);
static void (*mouse_poll_ex)(void) = NULL;
static double sample_rate = 200.0;
#ifdef ENABLE_MOUSE_LOG
int mouse_do_log = ENABLE_MOUSE_LOG;
@@ -153,7 +155,7 @@ static void
mouse_timer_poll(void *priv)
{
/* Poll at 255 Hz, maximum supported by PS/2 mic. */
timer_on_auto(&mouse_timer, 1000000.0 / 255.0);
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
#ifdef USE_GDBSTUB /* avoid a KBC FIFO overflow when CPU emulation is stalled */
if (gdbstub_step == GDBSTUB_EXEC)
@@ -161,6 +163,15 @@ mouse_timer_poll(void *priv)
mouse_process();
}
void
mouse_set_sample_rate(double new_rate)
{
timer_stop(&mouse_timer);
sample_rate = new_rate;
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
}
void
mouse_reset(void)
{
@@ -179,15 +190,16 @@ mouse_reset(void)
if (mouse_type == 0)
return;
timer_add(&mouse_timer, mouse_timer_poll, NULL, 0);
/* Poll at 100 Hz, the default of a PS/2 mouse. */
sample_rate = 100.0;
timer_on_auto(&mouse_timer, 1000000.0 / sample_rate);
mouse_curr = mouse_devices[mouse_type].device;
if (mouse_curr != NULL)
mouse_priv = device_add(mouse_curr);
timer_add(&mouse_timer, mouse_timer_poll, NULL, 0);
/* Poll at 255 Hz, maximum supported by PS/2 mic. */
timer_on_auto(&mouse_timer, 1000000.0 / 255.0);
}
/* Callback from the hardware driver. */