aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
Diffstat (limited to 'kapi')
-rw-r--r--kapi/include/kapi/memory.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/kapi/include/kapi/memory.hpp b/kapi/include/kapi/memory.hpp
index 914ca61..ae33904 100644
--- a/kapi/include/kapi/memory.hpp
+++ b/kapi/include/kapi/memory.hpp
@@ -79,6 +79,36 @@ namespace kapi::memory
//! @param page The page to unmap
auto unmap(page page) -> void;
+ //! Initialize the Memory-mapped I/O region system.
+ //!
+ //! @param base The base address for the MMIO region.
+ //! @param page_count The number of pages the MMIO region is spans.
+ auto init_mmio(linear_address base, std::size_t page_count) -> void;
+
+ //! Allocate a Memory-mapped I/O region of the given size.
+ //!
+ //! @warning This function will panic if the MMIO system has not been initialized!
+ //! @param page_count The number of pages to allocate.
+ auto allocate_mmio_region(std::size_t page_count) -> linear_address;
+
+ //! Map a region of Memory-mapped I/O address space to a given hardware address using the given flags.
+ //!
+ //! @warning This function will panic if no page mapper has been registered, or the page has already been mapped.
+ //! This function will not ensure that the frame is not already in use.
+ //!
+ //! This function will always set the @p uncached flag.
+ //!
+ //! @param base The base of the virtual region.
+ //! @param hw_base The base of the hardware region.
+ //! @param flags The flags to apply.
+ auto map_mmio_region(linear_address base, physical_address hw_base, page_mapper::flags flags = {}) -> std::byte *;
+
+ //! Release a Memory-mapped I/O region.
+ //!
+ //! @warning This function will panic if the MMIO system has not been initialized!
+ //! @param base The start address of the region to release.
+ auto release_mmio_region(linear_address base) -> void;
+
//! @}
//! @addtogroup kapi-memory-platform-defined