26 lines
695 B
C++
26 lines
695 B
C++
|
#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);
|
||
|
printf("Keyboard key pressed, seconds since boot: %d\n", PIT::ms_since_boot / 1000);
|
||
|
break;
|
||
|
}
|
||
|
default: printf("Unhandled IRQ: %d", context->irq_number); break;
|
||
|
}
|
||
|
PIC::send_eoi(context->irq_number);
|
||
|
return;
|
||
|
}
|