/* Copyright (C) 2021 Rain */ /* This file is part of XNIX. */ /* XNIX is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) and later version. */ /* XNIX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* You should have received a copy of the GNU General Public License along with XNIX. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include struct fifo kbd_fifo; errno_t kbd_init(void) { schk_init(); __fifo_buf_t *key_buf = kmalloc(&pool, MAX_KEYS * sizeof(__fifo_buf_t)); memset(key_buf, 0x00, MAX_KEYS * sizeof(__uint64_t)); fifo_init(&kbd_fifo, key_buf, MAX_KEYS); schk_leave(); return 0; } void do_keyboard(void) { __uint8_t code = inb(KBD_DATA); printk(white, "%b\n", code); /* insert it to the fifo */ fifo_put(&kbd_fifo, code); return; }