1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-10-30 12:03:52 -04:00
kernel/arch/pic.c

31 lines
644 B
C
Raw Normal View History

2017-11-06 05:18:43 -05:00
#include "pic.h"
#include "logger.h"
#include "asm.h"
2017-11-06 05:28:04 -05:00
#define PIC_MASTER_COMMAND 0x20
#define PIC_MASTER_DATA 0x21
#define PIC_SLAVE_COMMAND 0xA0
#define PIC_SLAVE_DATA 0xA1
2017-11-06 05:18:43 -05:00
void pic_initialize()
{
logger_info_from("pic", "Remap the IRQ table.");
2017-11-06 05:28:04 -05:00
outportb(PIC_MASTER_COMMAND, 0x11);
outportb(PIC_SLAVE_COMMAND, 0x11);
outportb(PIC_MASTER_DATA, 0x20);
outportb(PIC_SLAVE_DATA, 0x28);
outportb(PIC_MASTER_DATA, 0x04);
outportb(PIC_SLAVE_DATA, 0x02);
outportb(PIC_MASTER_DATA, 0x01);
outportb(PIC_SLAVE_DATA, 0x01);
outportb(PIC_MASTER_DATA, 0x00);
outportb(PIC_SLAVE_DATA, 0x00);
2017-11-06 05:18:43 -05:00
}