HariboteOS/day7/keyboard.c
2021-03-17 23:52:39 +08:00

22 lines
407 B
C

#include "fifo.h"
#include "keyboard.h"
#include "io.h"
struct FIFO8 keyfifo;
unsigned char keybuf[KEY_FIFO_BUF_SIZE];
void wait_KBC_sendready(void) {
for (;;) {
if ((io_in8(PORT_KEYSTA) & KEYSTA_SEND_NOTREADY) == 0) {
break;
}
}
}
void init_keyboard(void) {
wait_KBC_sendready();
io_out8(PORT_KEYCMD, KEYCMD_WRITE_MODE);
wait_KBC_sendready();
io_out8(PORT_KEYDAT, KBC_MODE);
}