Expand description
8259 Programmable Interrupt Controller (PIC) driver
Inspired by MaestroOS pic.rs
The PIC handles hardware interrupts (IRQs) and maps them to CPU interrupt vectors. We remap IRQs to vectors 0x20-0x2F.
Constantsยง
- COMMAND_
EOI ๐ - End-of-interrupt command
- ICW1_
ICW4 ๐ - ICW1_
INIT ๐ - ICW1: Initialization + ICW4 needed
- ICW3_
CASCADE ๐ - ICW3: Cascade identity for slave
- ICW3_
SLAVE_ ๐PIC - ICW3: Slave PIC on IRQ2
- ICW4_
8086 ๐ - ICW4: 8086 mode
- MASTER_
COMMAND ๐ - Master PIC command port
- MASTER_
DATA ๐ - Master PIC data port
- PIC1_
OFFSET - IRQ offset for master PIC (IRQ0 -> interrupt 0x20)
- PIC2_
OFFSET - IRQ offset for slave PIC (IRQ8 -> interrupt 0x28)
- SLAVE_
COMMAND ๐ - Slave PIC command port
- SLAVE_
DATA ๐ - Slave PIC data port
Functionsยง
- disable
- Disable all IRQs on both PICs.
- disable_
irq - Disable a specific IRQ line.
- disable_
permanently - Disable the 8259 PIC permanently by masking all IRQs.
- enable_
irq - Enable a specific IRQ line.
- end_
of_ interrupt - Send End-Of-Interrupt to the PIC for the given IRQ.
- init
- Initialize the PIC with the given offsets.