2022-09-05 14:13:51 +00:00
|
|
|
#include "interrupts/IRQ.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "io/IO.h"
|
|
|
|
#include "io/PIC.h"
|
|
|
|
#include "scheduling/PIT.h"
|
|
|
|
#include "std/stdio.h"
|
|
|
|
|
|
|
|
void IRQ::interrupt_handler(SavedContext* context)
|
|
|
|
{
|
|
|
|
switch (context->irq_number)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
PIT::tick();
|
|
|
|
Debug::DebugStatus::the()->DebugTick();
|
|
|
|
break;
|
|
|
|
case 1: {
|
|
|
|
volatile unsigned char scancode = IO::inb(0x60);
|
|
|
|
Debug::DebugStatus::the()->DebugKey(scancode);
|
2022-09-06 16:31:27 +00:00
|
|
|
printf("Keyboard key pressed, seconds since boot: %ld\n", PIT::ms_since_boot / 1000);
|
2022-09-05 14:13:51 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-09-06 16:31:27 +00:00
|
|
|
default: printf("Unhandled IRQ: %ld", context->irq_number); break;
|
2022-09-05 14:13:51 +00:00
|
|
|
}
|
|
|
|
PIC::send_eoi(context->irq_number);
|
|
|
|
return;
|
|
|
|
}
|