Fix PIC, add small delays when initializing
This commit is contained in:
@ -25,22 +25,44 @@
|
||||
|
||||
void intr_pic_init(void) {
|
||||
io_out8(PIC1_CMD, ICW1_INIT | ICW1_ICW4);
|
||||
io_wait();
|
||||
io_out8(PIC2_CMD, ICW1_INIT | ICW1_ICW4);
|
||||
io_wait();
|
||||
|
||||
io_out8(PIC1_DATA, INTR_IRQBASE);
|
||||
io_wait();
|
||||
io_out8(PIC2_DATA, INTR_IRQBASE+8);
|
||||
io_wait();
|
||||
|
||||
io_out8(PIC1_DATA, 2);
|
||||
io_wait();
|
||||
io_out8(PIC2_DATA, 2);
|
||||
io_wait();
|
||||
|
||||
io_out8(PIC1_DATA, ICW4_8086);
|
||||
io_wait();
|
||||
io_out8(PIC2_DATA, ICW4_8086);
|
||||
io_wait();
|
||||
|
||||
io_out8(PIC1_DATA, 0);
|
||||
io_out8(PIC2_DATA, 0);
|
||||
intr_pic_mask();
|
||||
}
|
||||
|
||||
void intr_pic_eoi(void) {
|
||||
io_out8(PIC2_CMD, PIC_EOI);
|
||||
void intr_pic_mask(void) {
|
||||
io_out8(PIC1_DATA, 0xFF);
|
||||
io_wait();
|
||||
io_out8(PIC2_DATA, 0xFF);
|
||||
io_wait();
|
||||
}
|
||||
|
||||
void intr_pic_unmask(void) {
|
||||
io_out8(PIC1_DATA, 0);
|
||||
io_wait();
|
||||
io_out8(PIC2_DATA, 0);
|
||||
io_wait();
|
||||
}
|
||||
|
||||
void intr_pic_eoi(bool pic2) {
|
||||
if (pic2)
|
||||
io_out8(PIC2_CMD, PIC_EOI);
|
||||
io_out8(PIC1_CMD, PIC_EOI);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user