Programmable Interrupt Controller. More...
Macros | |
#define | PIC1_CMD 0x20 |
the master PIC's command port | |
#define | PIC1_DATA 0x21 |
the master PIC's data port | |
#define | PIC2_CMD 0xA0 |
the slave PIC's command port | |
#define | PIC2_DATA 0xA1 |
the slave PIC's data port | |
#define | PIC_EOI 0x20 |
"end of interrupt" signals that an IRQ has been handled | |
#define | INT_IRQ0 0x20 |
where we want to map the master PIC's IRQs | |
#define | INT_IRQ8 0x28 |
where we want to map the slave PIC's IRQs | |
Functions | |
void | pic_init () |
Initializes the PIC. More... | |
void | pic_send_eoi (uint8_t intr) |
Sends an "end of interrupt" signal. More... | |
Programmable Interrupt Controller.
The PIC manages IRQs (hardware interrupts). It maps actual IRQs to interrupt vectors. After booting, the IRQs need to be remapped to avoid conflicts.
void pic_init | ( | ) |
Initializes the PIC.
Before PIC initialization the interrupt vectors look like this:
We "bend" the mapping "IRQ -> interrupt vector" to prevent those conflicts by re-initializing the master and slave PICs and setting the interrupt vectors 0x20 and 0x28 respectively.
So after initialization we have this:
void pic_send_eoi | ( | uint8_t | intr | ) |
Sends an "end of interrupt" signal.
This tells the master PIC that we're ready to process new interrupts. No new interrupts are fired until an EOI is sent.
intr | the interrupt vector that has been handled |
For IRQ8-15 (issued by slave), we send an EOI to the slave PIC as well.
Definition at line 61 of file pic.c.