Handle ps2 keyboard via special process
This commit is contained in:
25
kernel/proc/termproc/termproc.c
Normal file
25
kernel/proc/termproc/termproc.c
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdint.h>
|
||||
#include "proc/proc.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "kprintf.h"
|
||||
#include "hal/hal.h"
|
||||
#include "dlmalloc/malloc.h"
|
||||
|
||||
Proc *TERMPROC;
|
||||
|
||||
void termproc_init(Proc *proc) {
|
||||
TERMPROC = proc;
|
||||
TERMPROC->pipes[1] = dlmalloc(sizeof(IpcPipe));
|
||||
ipc_pipeinit(TERMPROC->pipes[1]);
|
||||
}
|
||||
|
||||
void termproc_fn(void) {
|
||||
char buf[100];
|
||||
for (;;) {
|
||||
hal_memset(buf, 0, sizeof(buf));
|
||||
int32_t read = ipc_piperead(TERMPROC->pipes[1], (uint8_t *)buf, sizeof(buf));
|
||||
if (read > 0) {
|
||||
kprintf("%.*s", read, buf);
|
||||
}
|
||||
}
|
||||
}
|
11
kernel/proc/termproc/termproc.h
Normal file
11
kernel/proc/termproc/termproc.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef PROC_TERMPROC_TERMPROC_H_
|
||||
#define PROC_TERMPROC_TERMPROC_H_
|
||||
|
||||
#include "proc/proc.h"
|
||||
|
||||
extern Proc *TERMPROC;
|
||||
|
||||
void termproc_init(Proc *proc);
|
||||
void termproc_fn(void);
|
||||
|
||||
#endif // PROC_TERMPROC_TERMPROC_H_
|
Reference in New Issue
Block a user