diff options
Diffstat (limited to 'src/kernel/arch/i386/driver/ps2.c')
-rw-r--r-- | src/kernel/arch/i386/driver/ps2.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/kernel/arch/i386/driver/ps2.c b/src/kernel/arch/i386/driver/ps2.c index 8955100..97e2878 100644 --- a/src/kernel/arch/i386/driver/ps2.c +++ b/src/kernel/arch/i386/driver/ps2.c @@ -2,6 +2,7 @@ #include <kernel/arch/i386/interrupts/irq.h> #include <kernel/mem/virt.h> #include <kernel/panic.h> +#include <kernel/vfs/request.h> #include <shared/container/ring.h> #include <shared/mem.h> @@ -12,23 +13,33 @@ static volatile ring_t backlog = {(void*)backlog_buf, BACKLOG_CAPACITY, 0, 0}; static struct vfs_request *blocked_on = NULL; -bool ps2_ready(void) { + +static void accept(struct vfs_request *req); +static bool is_ready(struct vfs_backend *self); + + +static struct vfs_backend backend = BACKEND_KERN(is_ready, accept); +void ps2_init(void) { vfs_mount_root_register("/ps2", &backend); } + + + +static bool ps2_ready(void) { return ring_size((void*)&backlog) > 0; } void ps2_recv(uint8_t s) { ring_put1b((void*)&backlog, s); if (blocked_on) { - vfs_ps2_accept(blocked_on); + accept(blocked_on); blocked_on = NULL; } } -size_t ps2_read(uint8_t *buf, size_t len) { +static size_t ps2_read(uint8_t *buf, size_t len) { return ring_get((void*)&backlog, buf, len); } -void vfs_ps2_accept(struct vfs_request *req) { +static void accept(struct vfs_request *req) { // when you fix something here go also fix it in the COM1 driver static uint8_t buf[32]; // pretty damn stupid int ret; @@ -60,4 +71,4 @@ void vfs_ps2_accept(struct vfs_request *req) { } } -bool vfs_ps2_ready(struct vfs_backend *self) { return blocked_on == NULL; } +static bool is_ready(struct vfs_backend *self) { return blocked_on == NULL; } |