1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:17:35 +00:00

Add IRQHandler class that can be subclasses to handle an IRQ.

Also move Keyboard to a class implementation using this pattern.
This commit is contained in:
Andreas Kling 2018-10-22 12:58:29 +02:00
parent 8f941561b4
commit a9ca75c98b
8 changed files with 152 additions and 100 deletions

25
Kernel/IRQHandler.cpp Normal file
View file

@ -0,0 +1,25 @@
#include "IRQHandler.h"
#include "i386.h"
#include "PIC.h"
IRQHandler::IRQHandler(byte irq)
: m_irqNumber(irq)
{
registerIRQHandler(m_irqNumber, *this);
}
IRQHandler::~IRQHandler()
{
unregisterIRQHandler(m_irqNumber, *this);
}
void IRQHandler::enableIRQ()
{
PIC::enable(m_irqNumber);
}
void IRQHandler::disableIRQ()
{
PIC::disable(m_irqNumber);
}