IRQ refactor

master
E. Almqvist 3 years ago
parent 26cc3ff8c3
commit 4bfd2b6b1d
  1. 21
      kernel/pic.c
  2. 4
      kernel/pic.h

@ -36,3 +36,24 @@ void pic_disable() {
outb(PIC1_DATA, 0xff); outb(PIC1_DATA, 0xff);
outb(PIC2_DATA, 0xff); outb(PIC2_DATA, 0xff);
} }
// set a specific irq
void irq(uint8 idx, bool t) {
uint16 port;
uint8 data;
if(idx < 8) {
port = PIC1_DATA;
} else {
port = PIC2_DATA;
idx -= 8;
}
if( t == true ) { // set irq
data = inb(port) | (1 << idx);
outb(port, data);
} else { // clear irq
data = inb(port) & ~(1 << idx);
outb(port, data);
}
}

@ -34,4 +34,6 @@ void pic_remap(uint, uint);
void pic_disable(); void pic_disable();
// IRQs // IRQs
void irq_set(uint8); void irq(uint8, bool);
static uint16 irq_reg(int ocw3);

Loading…
Cancel
Save