diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-25 14:04:14 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-12-25 14:04:14 +0100 |
| commit | 4ed658c633ce5d7c5bde4acdbe322e5f51592369 (patch) | |
| tree | 2eaf1d46946bf86123f1561338c81aaff8956662 /dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc | |
| parent | 02fd0b59edbcb2b5c08ab1f36bbffc12ba08a5d3 (diff) | |
IMPL: Important refactors and improvements of ZkaOS.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc')
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc b/dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc new file mode 100644 index 00000000..d5a9ecf4 --- /dev/null +++ b/dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc @@ -0,0 +1,66 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Inc, all rights reserved. + +------------------------------------------- */ + +#include <NewKit/Defines.h> +#include <ArchKit/ArchKit.h> + +/// @file Flash.cc +/// @brief Flash memory builtin. + +#ifdef ZKA_USE_MBCI_FLASH + +#define kMaxFlash (4U) + +namespace Kernel +{ + /// /Mount/Flash/n + constexpr auto kFlashBridgeMagic = "FLSH"; + constexpr auto kFlashBridgeRevision = 1; + + STATIC const Boolean kFlashEnabled = No; + STATIC SizeT kFlashSize[kMaxFlash] = {}; + STATIC SizeT kFlashSectorSz[kMaxFlash] = {}; + + /// @brief Enable flash memory builtin. + STATIC Void drv_enable_flash(Int32 slot); + + /// @brief Disable flash memory builtin. + STATIC Void drv_disable_flash(Int32 slot); + + /// @brief get sector count. + /// @return drive sector count. + SizeT drv_get_sector_count(Int32 slot) + { + if (slot > kMaxFlash) + return 0; + + return kFlashSectorSz[slot]; + } + + /// @brief get device size. + /// @return drive size + SizeT drv_get_size(Int32 slot) + { + if (slot > kMaxFlash) + return 0; + + return kFlashSize[slot]; + } + + /// @brief Enable flash memory at slot. + STATIC Void drv_enable_flash(Int32 arg) + { + kcout << "Enabled FLSH hardware.\r"; + } + + /// @brief Disable flash memory at slot. + STATIC Void drv_disable_flash(Int32 arg) + { + kcout << "Disabled FLSH hardware.\r"; + } +} // namespace Kernel + +#endif // if ZKA_USE_MBCI_FLASH (Bridge) |
