aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/include/ps2.h9
-rw-r--r--drivers/include/tty.h (renamed from drivers/tty.h)0
-rw-r--r--drivers/include/vga.h (renamed from drivers/vga.h)0
-rw-r--r--drivers/ps2.c29
-rw-r--r--drivers/tty.c6
5 files changed, 44 insertions, 0 deletions
diff --git a/drivers/include/ps2.h b/drivers/include/ps2.h
new file mode 100644
index 0000000..924ef24
--- /dev/null
+++ b/drivers/include/ps2.h
@@ -0,0 +1,9 @@
+#include <stdint.h>
+
+#define PS2_SCROLL_LOCK (1 << 0)
+#define PS2_NUM_LOCK (1 << 1)
+#define PS2_CAPS_LOCK (1 << 2)
+
+void ps2_set_leds(uint8_t status);
+
+void ps2_init(void);
diff --git a/drivers/tty.h b/drivers/include/tty.h
index 0e142c6..0e142c6 100644
--- a/drivers/tty.h
+++ b/drivers/include/tty.h
diff --git a/drivers/vga.h b/drivers/include/vga.h
index bf13cba..bf13cba 100644
--- a/drivers/vga.h
+++ b/drivers/include/vga.h
diff --git a/drivers/ps2.c b/drivers/ps2.c
new file mode 100644
index 0000000..ff85091
--- /dev/null
+++ b/drivers/ps2.c
@@ -0,0 +1,29 @@
+#include <stdint.h>
+#include <stdio.h>
+#include "io.h"
+#include "isr.h"
+#include "ps2.h"
+
+void ps2_set_leds(uint8_t status)
+{
+ outb(0x60, 0xED);
+ outb(0x60, status);
+}
+
+static void ps2_handler(struct regs_t regs)
+{
+ uint8_t scancode = inb(0x60);
+ /* TODO: handle scancode */
+}
+
+static void ps2_set_scancode_set(uint8_t set)
+{
+ outb(0x60, 0xF0);
+ outb(0x60, set);
+}
+
+void ps2_init(void)
+{
+ set_interrupt_handler(IRQ(1), ps2_handler);
+ ps2_set_scancode_set(1);
+}
diff --git a/drivers/tty.c b/drivers/tty.c
index c2be189..6668be7 100644
--- a/drivers/tty.c
+++ b/drivers/tty.c
@@ -65,14 +65,20 @@ void tty_putchar(char ch)
{
term_x = 0;
if(++term_y == VGA_HEIGHT)
+ {
+ tty_clear();
term_y = 0;
+ }
}
}
else
{
term_x = 0;
if(++term_y == VGA_HEIGHT)
+ {
+ tty_clear();
term_y = 0;
+ }
}
update_cursor();
}