diff options
| author | Franklin Wei <frankhwei536@gmail.com> | 2015-02-02 21:48:38 -0500 |
|---|---|---|
| committer | Franklin Wei <frankhwei536@gmail.com> | 2015-02-02 21:48:38 -0500 |
| commit | c8a195e1eb19d346c03c1dfa6ed66c6215caefa2 (patch) | |
| tree | 3096ea08f7f213d7efe56a86391ab79b27333d40 /drivers | |
| parent | 5c84e678defa9333aefcdcd0870564fb945a8c61 (diff) | |
| download | kappa-c8a195e1eb19d346c03c1dfa6ed66c6215caefa2.zip kappa-c8a195e1eb19d346c03c1dfa6ed66c6215caefa2.tar.gz kappa-c8a195e1eb19d346c03c1dfa6ed66c6215caefa2.tar.bz2 kappa-c8a195e1eb19d346c03c1dfa6ed66c6215caefa2.tar.xz | |
Refactor, begin writing a PS/2 driver
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/include/ps2.h | 9 | ||||
| -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.c | 29 | ||||
| -rw-r--r-- | drivers/tty.c | 6 |
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(); } |