23 lines
454 B
C
23 lines
454 B
C
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "pic.h"
|
|
#include "io.h"
|
|
#include "intr.h"
|
|
|
|
void pic_init(void) {
|
|
io_out8(PIC1_CMD, ICW1_INIT | ICW1_ICW4);
|
|
io_out8(PIC2_CMD, ICW1_INIT | ICW1_ICW4);
|
|
|
|
io_out8(PIC1_DATA, INTR_IRQBASE);
|
|
io_out8(PIC2_DATA, INTR_IRQBASE+8);
|
|
|
|
io_out8(PIC1_DATA, 4);
|
|
io_out8(PIC2_DATA, 2);
|
|
|
|
io_out8(PIC1_DATA, ICW4_8086);
|
|
io_out8(PIC2_DATA, ICW4_8086);
|
|
|
|
io_out8(PIC1_DATA, 0xff);
|
|
io_out8(PIC2_DATA, 0xff);
|
|
}
|