CE process watching WIP

This commit is contained in:
2026-03-18 15:30:41 +01:00
parent 76b1533ad0
commit 77ab25bcee
18 changed files with 110 additions and 39 deletions

View File

@@ -213,6 +213,33 @@ DEFINE_DEVICE_OP (ps2kb_read_key) {
return ST_OK;
}
DEFINE_DEVICE_OP (ps2kb_read_key_nonblock) {
uint64_t frb, fsq;
uint8_t* chbuf = (uint8_t*)a1;
if (chbuf == NULL)
return -ST_BAD_ADDRESS_SPACE;
spin_lock (&ps2kb_ringbuffer_lock, &frb);
size_t prev_count = ps2kb_ringbuffer.count;
ringbuffer_pop (uint8_t, &ps2kb_ringbuffer, chbuf);
size_t new_count = ps2kb_ringbuffer.count;
/* didn't pop anything */
if (prev_count == new_count) {
spin_unlock (&ps2kb_ringbuffer_lock, frb);
return -ST_TRY_AGAIN;
}
spin_unlock (&ps2kb_ringbuffer_lock, frb);
return ST_OK;
}
static void ps2kb_set_typematic (uint8_t delay, uint8_t rate) {
while (inb (KB_CTL_STATUS) & 0x02)
;