diff options
Diffstat (limited to 'picirq.c')
-rw-r--r-- | picirq.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -1,8 +1,10 @@ +// Intel 8259A programmable interrupt controllers. + #include "types.h" #include "x86.h" #include "traps.h" -// I/O Addresses of the two 8259A programmable interrupt controllers +// I/O Addresses of the two programmable interrupt controllers #define IO_PIC1 0x20 // Master (IRQs 0-7) #define IO_PIC2 0xA0 // Slave (IRQs 8-15) @@ -10,21 +12,20 @@ // Current IRQ mask. // Initial IRQ mask has interrupt 2 enabled (for slave 8259A). -static ushort irq_mask_8259A = 0xFFFF & ~(1<<IRQ_SLAVE); +static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE); static void -irq_setmask_8259A(ushort mask) +pic_setmask(ushort mask) { - irq_mask_8259A = mask; - - outb(IO_PIC1+1, (char)mask); - outb(IO_PIC2+1, (char)(mask >> 8)); + irqmask = mask; + outb(IO_PIC1+1, mask); + outb(IO_PIC2+1, mask >> 8); } void -irq_enable(int irq) +pic_enable(int irq) { - irq_setmask_8259A(irq_mask_8259A & ~(1<<irq)); + pic_setmask(irqmask & ~(1<<irq)); } // Initialize the 8259A interrupt controllers. @@ -78,6 +79,6 @@ pic_init(void) outb(IO_PIC2, 0x68); // OCW3 outb(IO_PIC2, 0x0a); // OCW3 - if(irq_mask_8259A != 0xFFFF) - irq_setmask_8259A(irq_mask_8259A); + if(irqmask != 0xFFFF) + pic_setmask(irqmask); } |