Add special event pipes, rework ps2kb process

This commit is contained in:
2025-09-08 22:12:50 +02:00
parent 94dd38d010
commit ab224eda8e
9 changed files with 101 additions and 13 deletions

View File

@ -27,13 +27,21 @@ void main(void) {
uprintf("Hello world using uprintf\n");
while(1) {
int32_t kbchar;
int32_t read = dev_ps2kb_read(&kbchar);
if (ipcpipe(IPCPIPE_SELFPID, 10, IPCPIPE_MAKE, NULL, 0) < 0) {
uprintf("failed to create 10th pipe\n");
}
if (read > 0 && (kbchar >= 0x20 && kbchar <= 0x7F || kbchar == 0xA)) {
uprintf("%c", kbchar & 0xFF);
ipcpipe(3, 1, IPCPIPE_WRITE, (uint8_t *)&kbchar, 1);
int32_t r = ipcpipe(IPCPIPE_SELFPID, 10, IPCPIPE_REG_EVT_PIPE, NULL, 1);
uprintf("%d\n", r);
while(1) {
int32_t kbchr;
int32_t read = ipcpipe(IPCPIPE_SELFPID, 10, IPCPIPE_READ, (uint8_t *)&kbchr, sizeof(kbchr));
if (read > 0) {
kbchr &= 0xFF;
if ((kbchr >= 0x20 && kbchr <= 0x7F) || kbchr == 0xA) {
uprintf("%c", kbchr & 0xFF);
}
}
}