This commit is contained in:
2025-09-27 15:16:26 +02:00
parent 5af7c5276a
commit 3b1bb9d531
63 changed files with 1087 additions and 407 deletions

View File

@ -7,7 +7,7 @@
#include "ps2kbproc.h"
Proc *PS2KBPROC = NULL;
Ps2KbFastBuf PS2KB_BUF;
Ps2KbFastBuf PS2KB_BUF = {0};
void ps2kbproc_init(Proc *proc) {
PS2KBPROC = proc;
@ -17,22 +17,23 @@ void ps2kbproc_init(Proc *proc) {
uint8_t *buf = dlmalloc(IPC_PIPE_MAX);
rbuf_init(&PS2KB_BUF.rbuf, buf, IPC_PIPE_MAX);
spinlock_init(&PS2KB_BUF.spinlock);
PS2KB_BUF.init = true;
}
void ps2kbproc_fn(void) {
for (;;) {
uint8_t b = 0;
spinlock_acquire(&PS2KB_BUF.spinlock);
if (rbuf_pop(&PS2KB_BUF.rbuf, &b) == 0) {
spinlock_acquire(&PS2KBPROC->bcast_pipes.spinlock);
IpcPipe *head = PS2KBPROC->bcast_pipes.list;
while (head != NULL) {
ipc_pipewrite(head, &b, 1);
head = head->next;
}
spinlock_release(&PS2KBPROC->bcast_pipes.spinlock);
}
spinlock_release(&PS2KB_BUF.spinlock);
/* uint8_t b = 0; */
/* spinlock_acquire(&PS2KB_BUF.spinlock); */
/* if (rbuf_pop(&PS2KB_BUF.rbuf, &b) == 0) { */
/* spinlock_acquire(&PS2KBPROC->bcast_pipes.spinlock); */
/* IpcPipe *head = PS2KBPROC->bcast_pipes.list; */
/* while (head != NULL) { */
/* ipc_pipewrite(head, &b, 1); */
/* head = head->next; */
/* } */
/* spinlock_release(&PS2KBPROC->bcast_pipes.spinlock); */
/* } */
/* spinlock_release(&PS2KB_BUF.spinlock); */
}
}