[Zion] Add a keyboard interrupt handler and a driver manager.
This commit is contained in:
parent
d9a936db09
commit
838ef01a2a
12 changed files with 106 additions and 23 deletions
26
zion/interrupt/driver_manager.cpp
Normal file
26
zion/interrupt/driver_manager.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "interrupt/driver_manager.h"
|
||||
|
||||
#include "debug/debug.h"
|
||||
|
||||
DriverManager* gDriverManager = nullptr;
|
||||
|
||||
DriverManager& DriverManager::Get() { return *gDriverManager; }
|
||||
|
||||
DriverManager::DriverManager() { gDriverManager = this; }
|
||||
|
||||
void DriverManager::WriteMessage(uint64_t irq_num, IpcMessage&& message) {
|
||||
if (!driver_map_.Contains(irq_num)) {
|
||||
dbgln("WARN IRQ for {x} with no registered driver", irq_num);
|
||||
return;
|
||||
}
|
||||
|
||||
driver_map_.at(irq_num)->Send(glcr::Move(message));
|
||||
}
|
||||
|
||||
glcr::ErrorCode DriverManager::RegisterListener(uint64_t irq_num,
|
||||
glcr::RefPtr<Port> port) {
|
||||
if (driver_map_.Contains(irq_num)) {
|
||||
return glcr::ALREADY_EXISTS;
|
||||
}
|
||||
return driver_map_.Insert(irq_num, port);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue