30 lines
875 B
C
30 lines
875 B
C
// pic.c
|
|
// Author: Josh Holtrop
|
|
// Created: 02/26/04
|
|
|
|
#include "hos_defines.h"
|
|
#include "pic.h"
|
|
|
|
//Re-maps the Programmable Interrupr Controllers so IRQ0->pic1 base address, IRG8->pic2 base address
|
|
void pic_remap(int pic1, int pic2)
|
|
{
|
|
byte a1, a2;
|
|
|
|
a1 = inportb(PIC1_DATA); //0x21
|
|
a2 = inportb(PIC2_DATA); //0xA1
|
|
|
|
outportb(PIC1_COMMAND, ICW1_INIT+ICW1_ICW4); //0x20, 0x10+0x01 00010001b
|
|
outportb(PIC2_COMMAND, ICW1_INIT+ICW1_ICW4); //0xA0, 0x10+0x01 00010001b
|
|
outportb(PIC1_DATA, pic1); //0x21, pic1
|
|
outportb(PIC2_DATA, pic2); //0xA1, pic2
|
|
outportb(PIC1_DATA, 4); //0x21, 0x04 00000100b
|
|
outportb(PIC2_DATA, 2); //0xA1, 0x02 00000010b
|
|
outportb(PIC1_DATA, ICW4_8086); //0x21, 0x01 00000001b
|
|
outportb(PIC2_DATA, ICW4_8086); //0xA1, 0x01 00000001b
|
|
|
|
outportb(PIC1_DATA, a1); //0x21
|
|
outportb(PIC2_DATA, a2); //0xA1
|
|
}
|
|
|
|
|