21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/compiler.h" 23 #include "pedigree/kernel/debugger/Debugger.h" 27 #define BASE_INTERRUPT_VECTOR 0x20 42 return irq + BASE_INTERRUPT_VECTOR;
51 uint8_t irq = Id - BASE_INTERRUPT_VECTOR;
59 uint8_t irq = Id - BASE_INTERRUPT_VECTOR;
99 for (
size_t i = 0; i < 16; i++)
103 void Pic::interrupt(
size_t interruptNumber, InterruptState &state)
105 size_t irq = (interruptNumber - BASE_INTERRUPT_VECTOR);
113 NOTICE(
"PIC: spurious IRQ7");
123 NOTICE(
"PIC: spurious IRQ15");
131 if (
m_Handler[irq]->irq(irq, state) ==
false)
140 NOTICE(
"PIC: unhandled irq #" << irq <<
" occurred");
144 str +=
"Unhandled IRQ: #";
154 void Pic::eoi(uint8_t irq)
160 void Pic::enable(uint8_t irq,
bool enable)
166 mask = mask & ~(1 << irq);
168 mask = mask | (1 << irq);
176 mask = mask & ~(1 << (irq - 8));
178 mask = mask | (1 << (irq - 8));
183 void Pic::enableAll(
bool enable)
virtual bool registerInterruptHandler(size_t nInterruptNumber, InterruptHandler *pHandler)=0
virtual irq_id_t registerPciIrqHandler(IrqHandler *handler, Device *pDevice)
virtual void acknowledgeIrq(irq_id_t Id)
static Debugger & instance()
Handles interrupts and interrupt registrations from kernel components.
virtual uint8_t read8(size_t offset=0)
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)
List< IrqHandler * > m_Handler[16]
void start(InterruptState &state, LargeStaticString &description)
Pic() INITIALISATION_ONLY
virtual void interrupt(size_t interruptNumber, InterruptState &state)
static InterruptManager & instance()
virtual irq_id_t registerIsaIrqHandler(uint8_t irq, IrqHandler *handler, bool bEdge=false)
bool initialise() INITIALISATION_ONLY
virtual void write8(uint8_t value, size_t offset=0)