Keyboard in progress

This commit is contained in:
Adrien Bourmault 2019-04-24 11:55:15 +02:00
parent 516a92973b
commit f005894088
1 changed files with 23 additions and 2 deletions

View File

@ -26,9 +26,30 @@
#include <kernel/iomisc.h> #include <kernel/iomisc.h>
extern void KeybIsr(void); extern void KeybIsr(void);
extern void IdtRegisterIrq(void (*isr)(void), uchar irq, uchar flags);
void KeybSetup(void) void KeybSetup(void)
{ {
CpuRegisterIrq(KeybIsr, 0x21, 0x8E); IdtRegisterIrq(KeybIsr, 0x21, 0x8E);
} }
uchar KeybHandler(void)
{
uchar status;
uchar code;
// write EOI
outb(0x20, 0x20);
status = IoReadByteFromPort(KeybStatusPort);
if (status & 0x01) {
code = IoReadByteFromPort(KeybDataPort);
if(code < 0) return 0;
return code;
}
}