add PIT
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "../include/types.h"
|
||||
#include "../include/screen.h"
|
||||
#include "../include/pic.h"
|
||||
#include "../include/pit.h"
|
||||
|
||||
typedef size_t uword_t;
|
||||
struct interrupt_frame
|
||||
@@ -14,6 +15,7 @@ struct interrupt_frame
|
||||
uword_t ss;
|
||||
};
|
||||
|
||||
__attribute__((interrupt)) void isr_timer(struct interrupt_frame *frame);
|
||||
void isr_custom();
|
||||
void default_handler();
|
||||
|
||||
@@ -54,6 +56,7 @@ void isr_install() {
|
||||
for(int i = 32; i < 255; i++)
|
||||
idt_set_descriptor(i, (uint32)default_handler, 0x8E);
|
||||
|
||||
idt_set_descriptor(0x20, (uint32)isr_timer, 0x8E);
|
||||
idt_set_descriptor(0x21, (uint32)isr_custom, 0x8E);
|
||||
|
||||
|
||||
@@ -66,6 +69,12 @@ void default_handler()
|
||||
|
||||
}
|
||||
|
||||
__attribute__((interrupt)) void isr_timer(struct interrupt_frame *frame)
|
||||
{
|
||||
pit_init();
|
||||
pic_end_int(0x0);
|
||||
}
|
||||
|
||||
void handle_keyboard()
|
||||
{
|
||||
uint8_t scancode = inb(0x60);
|
||||
@@ -76,7 +85,7 @@ __attribute__((interrupt)) void isr_custom(struct interrupt_frame *frame)
|
||||
{
|
||||
//terminal_writestring("YOOOOO!!!!!! I LOVE KATYA!!!!");
|
||||
handle_keyboard();
|
||||
pic_end_int(0x21);
|
||||
pic_end_int(0x1);
|
||||
}
|
||||
|
||||
void isr0()
|
||||
|
||||
Reference in New Issue
Block a user