2018-06-30 01:03:40 +02:00
|
|
|
#include "interrupt.h"
|
2018-07-17 23:02:27 +02:00
|
|
|
#include "io.h"
|
2018-07-18 01:41:10 +02:00
|
|
|
#include "irq.h"
|
2018-07-18 15:35:49 +02:00
|
|
|
#include "pic.h"
|
|
|
|
#include "vga.h"
|
2018-06-30 01:03:40 +02:00
|
|
|
|
|
|
|
// Need GCC > 6
|
|
|
|
__attribute__((interrupt)) void keyboard_handler(struct interrupt_frame *frame)
|
|
|
|
{
|
2018-07-18 01:41:10 +02:00
|
|
|
EOIIrq(IRQ_KEYBOARD);
|
2018-07-17 23:02:27 +02:00
|
|
|
char c = 0;
|
|
|
|
if (inb(0x60) != c) {
|
|
|
|
c = inb(0x60);
|
2018-07-18 15:35:49 +02:00
|
|
|
if (c > 0) {
|
|
|
|
printInt(c);
|
2018-07-18 15:06:31 +02:00
|
|
|
}
|
2018-07-17 23:02:27 +02:00
|
|
|
}
|
|
|
|
(void)frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
__attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
|
|
|
|
{
|
2018-07-18 01:41:10 +02:00
|
|
|
static int timeCnt = 0;
|
|
|
|
EOIIrq(IRQ_TIMER);
|
2018-07-18 15:35:49 +02:00
|
|
|
printIntDetails(timeCnt++, RED, BLACK, 20, VGA_HEIGHT - 1);
|
2018-07-17 23:02:27 +02:00
|
|
|
(void)frame;
|
2018-06-30 01:03:40 +02:00
|
|
|
}
|