FreeNOS
|
Intel 8259 Programmable Interrupt Controller (PIC). More...
#include <IntelPIC.h>
Public Member Functions | |
IntelPIC () | |
Constructor. More... | |
Result | initialize () |
Initialize the PIC. More... | |
virtual Result | enable (uint irq) |
Enable hardware interrupt (IRQ). More... | |
virtual Result | disable (uint irq) |
Disable hardware interrupt (IRQ). More... | |
virtual Result | clear (uint irq) |
Clear hardware interrupt (IRQ). More... | |
Public Member Functions inherited from IntController | |
IntController () | |
Constructor. More... | |
uint | getBase () const |
Get interrupt number base offset. More... | |
virtual Result | nextPending (uint &irq) |
Retrieve the next pending interrupt (IRQ). More... | |
virtual bool | isTriggered (uint irq) |
Check if an IRQ vector is set. More... | |
virtual Result | send (const uint targetCoreId, const uint irq) |
Send an inter-processor-interrupt (IPI). More... | |
Private Types | |
enum | Registers { Command = 0x0, Data = 0x1 } |
Hardware registers. More... | |
enum | CommandFlags { Init1 = (1 << 4) | (1 << 0), CascadeMode = (0), LevelTriggered = (0), Mode8086 = (1), EndOfInterrupt = (0x20) } |
Command Register Flags. More... | |
Private Attributes | |
IntelIO | m_master |
I/O instance for master. More... | |
IntelIO | m_slave |
I/O instance for slave. More... | |
Static Private Attributes | |
static const uint | InterruptBase = 32 |
Base offset for interrupt vectors from the PIC. More... | |
static const uint | MasterBase = 0x20 |
Master PIC I/O port base offset. More... | |
static const uint | SlaveBase = 0xa0 |
Slave PIC I/O port base offset. More... | |
Additional Inherited Members | |
Public Types inherited from IntController | |
enum | Result { Success, InvalidIRQ, InvalidFrequency, IOError, NotFound } |
Result codes. More... | |
Protected Attributes inherited from IntController | |
uint | m_base |
Interrupt number base offset. More... | |
Intel 8259 Programmable Interrupt Controller (PIC).
Definition at line 40 of file IntelPIC.h.
|
private |
Command Register Flags.
Enumerator | |
---|---|
Init1 | |
CascadeMode | |
LevelTriggered | |
Mode8086 | |
EndOfInterrupt |
Definition at line 70 of file IntelPIC.h.
|
private |
IntelPIC::IntelPIC | ( | ) |
Constructor.
Definition at line 20 of file IntelPIC.cpp.
References InterruptBase, IntController::m_base, m_master, m_slave, MasterBase, IntelIO::setPortBase(), and SlaveBase.
|
virtual |
Clear hardware interrupt (IRQ).
Clearing marks the end of an interrupt service routine and causes the PIC to trigger the interrupt vector again on the next trigger moment.
irq | Interrupt Request number to clear. |
Implements IntController.
Definition at line 81 of file IntelPIC.cpp.
References Command, EndOfInterrupt, IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.
|
virtual |
Disable hardware interrupt (IRQ).
irq | Interrupt Request number. |
Implements IntController.
Definition at line 68 of file IntelPIC.cpp.
References Data, IntelIO::inb(), IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.
|
virtual |
Enable hardware interrupt (IRQ).
irq | Interrupt Request number. |
Implements IntController.
Definition at line 55 of file IntelPIC.cpp.
References Data, IntelIO::inb(), IntController::InvalidIRQ, m_master, m_slave, IntelIO::outb(), and IntController::Success.
Referenced by initialize().
IntelPIC::Result IntelPIC::initialize | ( | ) |
Initialize the PIC.
Definition at line 28 of file IntelPIC.cpp.
References CascadeMode, Command, Data, enable(), Init1, InterruptBase, LevelTriggered, m_master, m_slave, Mode8086, IntelIO::outb(), and IntController::Success.
Referenced by IntelKernel::IntelKernel().
|
staticprivate |
Base offset for interrupt vectors from the PIC.
External IRQ numbers 0-15 are remapped to interrupt vectors 32-47, because CPU exceptions on Intel are fixed to vectors 0-17.
Definition at line 50 of file IntelPIC.h.
Referenced by initialize(), and IntelPIC().
|
private |
I/O instance for master.
Definition at line 127 of file IntelPIC.h.
Referenced by clear(), disable(), enable(), initialize(), and IntelPIC().
|
private |
I/O instance for slave.
Definition at line 130 of file IntelPIC.h.
Referenced by clear(), disable(), enable(), initialize(), and IntelPIC().
|
staticprivate |
Master PIC I/O port base offset.
Definition at line 53 of file IntelPIC.h.
Referenced by IntelPIC().
|
staticprivate |