From 610f91d87152cbe48d3054fcf437d8239da6ef35 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 21 Dec 2024 21:59:13 +0100 Subject: IMP: :boom: Breaking changes some checks are needed to be done. Signed-off-by: Amlal --- dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc (limited to 'dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc') diff --git a/dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc b/dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc new file mode 100644 index 00000000..c3fe73e1 --- /dev/null +++ b/dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc @@ -0,0 +1,66 @@ +/* ------------------------------------------- + + Copyright (C) 2024, TQ B.V, all rights reserved. + +------------------------------------------- */ + +#include +#include + +/// @file Flash.cc +/// @brief Flash memory builtin. + +#ifdef __USE_MBCI_FLASH__ + +#define kMaxFlash (4U) + +namespace Kernel +{ + /// /:/BRIDGE/FLSH/1 + 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 __USE_MBCI_FLASH__ (Bridge) -- cgit v1.2.3