Rewrite PS2KB using the new devctl interface
This commit is contained in:
@ -14,7 +14,6 @@
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "kproc/kproc.h"
|
||||
#include "ps2kbproc/ps2kbproc.h"
|
||||
#include "serialproc/serialproc.h"
|
||||
#include "sysdefs/processctl.h"
|
||||
|
||||
@ -308,18 +307,6 @@ void proc_init(void) {
|
||||
spinlock_init(&PROCS.spinlock);
|
||||
PROCS.procs = NULL;
|
||||
|
||||
/* kproc_init(proc_spawnkern(&kproc_fn, "kproc")); */
|
||||
/* proc_register(KPROC); */
|
||||
/* PROCS.current = KPROC; */
|
||||
/* KPROC->state = PROC_READY; */
|
||||
|
||||
/* ps2kbproc_init(proc_spawnkern(&ps2kbproc_fn, "ps2kbproc")); */
|
||||
/* proc_register(PS2KBPROC); */
|
||||
/* PS2KBPROC->state = PROC_READY; */
|
||||
|
||||
/* serialproc_init(proc_spawnkern(&serialproc_fn, "serialproc")); */
|
||||
/* proc_register(SERIALPROC); */
|
||||
|
||||
Proc *init = proc_spawnuser("base", "/bin/init");
|
||||
PROCS.current = init;
|
||||
proc_register(init);
|
||||
|
@ -1,39 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include "proc/proc.h"
|
||||
#include "dlmalloc/malloc.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "kprintf.h"
|
||||
#include "rbuf/rbuf.h"
|
||||
#include "ps2kbproc.h"
|
||||
|
||||
Proc *PS2KBPROC = NULL;
|
||||
Ps2KbFastBuf PS2KB_BUF = {0};
|
||||
|
||||
void ps2kbproc_init(Proc *proc) {
|
||||
PS2KBPROC = proc;
|
||||
|
||||
PS2KBPROC->bcast_pipes.list = NULL;
|
||||
|
||||
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); */
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
#ifndef PROC_PS2KB_PS2KBPROC_H_
|
||||
#define PROC_PS2KB_PS2KBPROC_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "proc/proc.h"
|
||||
#include "rbuf/rbuf.h"
|
||||
#include "spinlock/spinlock.h"
|
||||
|
||||
typedef struct {
|
||||
RBuf rbuf;
|
||||
SpinLock spinlock;
|
||||
bool init;
|
||||
} Ps2KbFastBuf;
|
||||
|
||||
extern Proc *PS2KBPROC;
|
||||
extern Ps2KbFastBuf PS2KB_BUF;
|
||||
|
||||
void ps2kbproc_fn(void);
|
||||
void ps2kbproc_init(Proc *proc);
|
||||
|
||||
#endif // PROC_PS2KB_PS2KBPROC_H_
|
Reference in New Issue
Block a user