diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 13:36:01 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-02 13:36:01 +0200 |
| commit | d0c532af74d8d486d734904fd330d5dae7f49754 (patch) | |
| tree | db85c8ae19b4aba06afcf903aa7edba414c16f6f /kapi/include | |
| parent | e7af7ceea2324dcf7d2222986c09d1c478ee4c7e (diff) | |
| download | teachos-d0c532af74d8d486d734904fd330d5dae7f49754.tar.xz teachos-d0c532af74d8d486d734904fd330d5dae7f49754.zip | |
kapi: add basic device subsystem
Diffstat (limited to 'kapi/include')
| -rw-r--r-- | kapi/include/kapi/devices.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/kapi/include/kapi/devices.hpp b/kapi/include/kapi/devices.hpp new file mode 100644 index 0000000..60a39bd --- /dev/null +++ b/kapi/include/kapi/devices.hpp @@ -0,0 +1,46 @@ +#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> + +namespace kapi::devices +{ + + //! @addtogroup kernel-defined + //! @{ + + //! Initialize the kernel's device management subsystem. + auto init() -> void; + + //! Get the virtual system root bus. + //! + //! @warning This function will panic if the root bus has not been initialized. + //! + //! @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; + + //! @} + +} // namespace kapi::devices + +#endif
\ No newline at end of file |
