aboutsummaryrefslogtreecommitdiff
path: root/kapi/include
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-04-02 15:07:54 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-04-02 15:07:54 +0200
commitab4c59912c526d515e6e72188c08a7f92e5573e8 (patch)
tree0b6b561efb6fd8ac7a174edc6d4514a98f890861 /kapi/include
parent66ffd2ad8c793c4eea1527848fe4772e42595718 (diff)
downloadteachos-ab4c59912c526d515e6e72188c08a7f92e5573e8.tar.xz
teachos-ab4c59912c526d515e6e72188c08a7f92e5573e8.zip
x86_64: implement legacy PIT driver
Diffstat (limited to 'kapi/include')
-rw-r--r--kapi/include/kapi/devices.hpp24
-rw-r--r--kapi/include/kapi/devices/bus.hpp2
-rw-r--r--kapi/include/kapi/devices/manager.hpp37
3 files changed, 42 insertions, 21 deletions
diff --git a/kapi/include/kapi/devices.hpp b/kapi/include/kapi/devices.hpp
index 2028a64..5c01b2f 100644
--- a/kapi/include/kapi/devices.hpp
+++ b/kapi/include/kapi/devices.hpp
@@ -1,10 +1,9 @@
#ifndef TEACHOS_KAPI_DEVICES_HPP
#define TEACHOS_KAPI_DEVICES_HPP
-#include "kapi/devices/bus.hpp" // IWYU pragma: export
-#include "kapi/devices/device.hpp" // IWYU pragma: export
-
-#include <cstddef>
+#include "kapi/devices/bus.hpp" // IWYU pragma: export
+#include "kapi/devices/device.hpp" // IWYU pragma: export
+#include "kapi/devices/manager.hpp" // IWYU pragma: export
namespace kapi::devices
{
@@ -22,23 +21,6 @@ namespace kapi::devices
//! @return a reference to the root bus.
auto get_root_bus() -> bus &;
- //! Ask the kernel to allocate a new major number.
- //!
- //! @return a new, unused major number.
- auto allocate_major_number() -> std::size_t;
-
- //! Register a new device with the kernel's device manager.
- //!
- //! @param device The device to register.
- //! @return true if the device was registered successfully, false otherwise.
- auto register_device(device & device) -> bool;
-
- //! Unregister a device from the kernel's device manager.
- //!
- //! @param device The device to unregister.
- //! @return true if the device was unregistered successfully, false otherwise.
- auto unregister_device(device & device) -> bool;
-
//! @}
//! @addtogroup platform-defined
diff --git a/kapi/include/kapi/devices/bus.hpp b/kapi/include/kapi/devices/bus.hpp
index ccaf0f2..a5457e1 100644
--- a/kapi/include/kapi/devices/bus.hpp
+++ b/kapi/include/kapi/devices/bus.hpp
@@ -2,6 +2,7 @@
#define TEACHOS_KAPI_DEVICES_BUS_HPP
#include "kapi/devices/device.hpp"
+#include "kapi/devices/manager.hpp"
#include "kapi/system.hpp"
#include <kstd/memory>
@@ -58,6 +59,7 @@ namespace kapi::devices
{
auto observer = m_observers.emplace_back(child.get());
m_devices.push_back(std::move(child));
+ kapi::devices::register_device(*observer);
if (m_initialized.test())
{
diff --git a/kapi/include/kapi/devices/manager.hpp b/kapi/include/kapi/devices/manager.hpp
new file mode 100644
index 0000000..56cd678
--- /dev/null
+++ b/kapi/include/kapi/devices/manager.hpp
@@ -0,0 +1,37 @@
+#ifndef TEACHOS_KAPI_DEVICES_MANAGER_HPP
+#define TEACHOS_KAPI_DEVICES_MANAGER_HPP
+
+// IWYU pragma: private, include "kapi/devices.hpp"
+
+#include "kapi/devices/device.hpp"
+
+#include <cstddef>
+
+namespace kapi::devices
+{
+
+ //! @addtogroup kernel-defined
+ //! @{
+
+ //! Ask the kernel to allocate a new major number.
+ //!
+ //! @return a new, unused major number.
+ auto allocate_major_number() -> std::size_t;
+
+ //! Register a new device with the kernel's device manager.
+ //!
+ //! @param device The device to register.
+ //! @return true if the device was registered successfully, false otherwise.
+ auto register_device(device & device) -> bool;
+
+ //! Unregister a device from the kernel's device manager.
+ //!
+ //! @param device The device to unregister.
+ //! @return true if the device was unregistered successfully, false otherwise.
+ auto unregister_device(device & device) -> bool;
+
+ //! @}
+
+} // namespace kapi::devices
+
+#endif \ No newline at end of file