aboutsummaryrefslogtreecommitdiff
path: root/drivers/ps2.c
diff options
context:
space:
mode:
authorFranklin Wei <frankhwei536@gmail.com>2015-02-03 18:23:04 -0500
committerFranklin Wei <frankhwei536@gmail.com>2015-02-03 18:23:04 -0500
commite065a7048aa98d253cdcc9298c934bb7af7feaa9 (patch)
tree99768597eda705f9ea1947c96c899a74e3bdc97c /drivers/ps2.c
parentc8a195e1eb19d346c03c1dfa6ed66c6215caefa2 (diff)
downloadkappa-e065a7048aa98d253cdcc9298c934bb7af7feaa9.zip
kappa-e065a7048aa98d253cdcc9298c934bb7af7feaa9.tar.gz
kappa-e065a7048aa98d253cdcc9298c934bb7af7feaa9.tar.bz2
kappa-e065a7048aa98d253cdcc9298c934bb7af7feaa9.tar.xz
some work
Diffstat (limited to 'drivers/ps2.c')
-rw-r--r--drivers/ps2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/ps2.c b/drivers/ps2.c
index ff85091..0d466aa 100644
--- a/drivers/ps2.c
+++ b/drivers/ps2.c
@@ -4,20 +4,31 @@
#include "isr.h"
#include "ps2.h"
+static void ps2_wait(void)
+{
+ /* wait for the keyboard */
+ while(1)
+ if ((inb(0x64) & 2) == 0) break;
+}
+
void ps2_set_leds(uint8_t status)
{
+ ps2_wait();
outb(0x60, 0xED);
outb(0x60, status);
}
static void ps2_handler(struct regs_t regs)
{
+ (void) regs;
uint8_t scancode = inb(0x60);
/* TODO: handle scancode */
+ printf("key %x\n", scancode);
}
static void ps2_set_scancode_set(uint8_t set)
{
+ ps2_wait();
outb(0x60, 0xF0);
outb(0x60, set);
}