From 4ed658c633ce5d7c5bde4acdbe322e5f51592369 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 25 Dec 2024 14:04:14 +0100 Subject: IMPL: Important refactors and improvements of ZkaOS. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc | 66 +++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc (limited to 'dev/Kernel/HALKit/ARM64/Storage/HalFlashMemory.cc') 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 +#include + +/// @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) -- cgit v1.2.3