]> git.dujemihanovic.xyz Git - nameless-os.git/blobdiff - kernel/kernel.c
Add PS/2 driver
[nameless-os.git] / kernel / kernel.c
index 4c6efd8692da90d7ab15cf782846b3194e9483f7..3f6c256d8029f2a06429da169381e0b401dea300 100644 (file)
@@ -1,8 +1,9 @@
+#include <stdint.h>
 #include <tty.h>
 #include <io.h>
 #include <irq/idt.h>
 #include <irq/i8259a.h>
-#include <stdint.h>
+#include <input/ps2.h>
 
 extern void double_fault(struct abort_frame *frame);
 extern void keyb_handler(struct interrupt_frame *frame);
@@ -11,10 +12,22 @@ struct idtr idtr __attribute__((aligned(0x10)));
 
 void kmain(void)
 {
+       int ps2_success;
        screen_clear();
        kprint("Welcome to Nameless OS!\nRunning revision: ", 0);
        kprint(GIT_COMMIT, 0);
        kprint("\n", 0);
+       ps2_success = ps2_initialize();
+       switch (ps2_success) {
+               case -1:
+                       kprint("No PS/2 devices found or working, we will have no input\n", 0);
+                       break;
+               case 0:
+                       kprint("Found one working PS/2 device\n", 0);
+                       break;
+               case 1:
+                       kprint("Found two working PS/2 devices\n", 0);
+       }
        kprint("Preparing IDT...\n", 0);
        idt_set_descriptor(idt, 0x8, 0x8, (uint32_t) double_fault, IDT_TRAP_GATE, 0x0);
        idt_set_descriptor(idt, 0x21, 0x8, (uint32_t) keyb_handler, IDT_INTERRUPT_GATE, 0x0);