Fix irq
This commit is contained in:
parent
37d772d1c7
commit
9756f3f3ce
@ -1,11 +1,13 @@
|
||||
#include "interrupt.h"
|
||||
#include "vga.h"
|
||||
#include "io.h"
|
||||
#include "pic.h"
|
||||
#include "irq.h"
|
||||
|
||||
// Need GCC > 6
|
||||
__attribute__((interrupt)) void keyboard_handler(struct interrupt_frame *frame)
|
||||
{
|
||||
printString("Keyboard!", RED, BLACK, 0, 7);
|
||||
EOIIrq(IRQ_KEYBOARD);
|
||||
char c = 0;
|
||||
if (inb(0x60) != c) {
|
||||
c = inb(0x60);
|
||||
@ -17,6 +19,8 @@ __attribute__((interrupt)) void keyboard_handler(struct interrupt_frame *frame)
|
||||
|
||||
__attribute__((interrupt)) void timer_handler(struct interrupt_frame *frame)
|
||||
{
|
||||
printString("Timer!", RED, BLACK, 0, 9);
|
||||
static int timeCnt = 0;
|
||||
EOIIrq(IRQ_TIMER);
|
||||
printInt(timeCnt++, RED, BLACK, 0, 9);
|
||||
(void)frame;
|
||||
}
|
||||
|
8
pic.c
8
pic.c
@ -42,6 +42,14 @@ void initPic(void)
|
||||
outb(PIC_SLAVE_DATA, 0xFF);
|
||||
}
|
||||
|
||||
void EOIIrq(int irq)
|
||||
{
|
||||
if (irq >= 8)
|
||||
outb(PIC_SLAVE_CMD, PIC_EOI);
|
||||
|
||||
outb(PIC_MASTER_CMD, PIC_EOI);
|
||||
}
|
||||
|
||||
void disableIrq(int irq)
|
||||
{
|
||||
if (irq < 8) {
|
||||
|
Loading…
Reference in New Issue
Block a user