k-tana-zero/k/pic/pic.c

30 lines
683 B
C

#include "pic.h"
#include "io.h"
void remap_pic(void)
{
// ICW1
outb(MASTER_PORT_A, ICW1_INIT | ICW1_ICW4);
outb(SLAVE_PORT_A, ICW1_INIT | ICW1_ICW4);
// ICW2
outb(MASTER_PORT_B, ICW2_M_OFFSET);
outb(SLAVE_PORT_B, ICW2_S_OFFSET);
// ICW3
outb(MASTER_PORT_B, PIC_PIN_2);
outb(SLAVE_PORT_B, 2);
// ICW4
outb(MASTER_PORT_B, ICW4_INIT);
outb(SLAVE_PORT_B, ICW4_INIT);
// OCW1
outb(MASTER_PORT_B, PIC_PIN_3 | PIC_PIN_4 | PIC_PIN_5 |
PIC_PIN_6 | PIC_PIN_7);
outb(SLAVE_PORT_B, PIC_PIN_0 | PIC_PIN_1 | PIC_PIN_2 | PIC_PIN_3 |
PIC_PIN_4 | PIC_PIN_5);
asm volatile("sti");
}