Handle ps2 keyboard, no APIC for now
This commit is contained in:
19
kernel/drivers/ps2kb/ps2kb.c
Normal file
19
kernel/drivers/ps2kb/ps2kb.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdint.h>
|
||||
#include "ps2kb.h"
|
||||
#include "hal/hal.h"
|
||||
#include "kprintf.h"
|
||||
|
||||
void ps2kb_write(uint8_t val) {
|
||||
while (io_in8(0x64) & 2);
|
||||
io_out8(0x64, val);
|
||||
}
|
||||
|
||||
uint8_t ps2kb_read(void) {
|
||||
while (!(io_in8(0x64) & 1));
|
||||
return io_in8(0x60);
|
||||
}
|
||||
|
||||
void ps2kb_intr(void) {
|
||||
uint8_t scancode = ps2kb_read();
|
||||
kprintf("%02x\n", scancode);
|
||||
}
|
10
kernel/drivers/ps2kb/ps2kb.h
Normal file
10
kernel/drivers/ps2kb/ps2kb.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef DRIVERS_PS2KB_H_
|
||||
#define DRIVERS_PS2KB_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void ps2kb_write(uint8_t val);
|
||||
uint8_t ps2kb_read(void);
|
||||
void ps2kb_intr(void);
|
||||
|
||||
#endif // DRIVERS_PS2KB_H_
|
Reference in New Issue
Block a user