summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/ARM64/Storage
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:13 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:45 +0100
commit610f91d87152cbe48d3054fcf437d8239da6ef35 (patch)
treea386f7047ab73d088169ab2371ddc6ffe8020f1c /dev/Kernel/HALKit/ARM64/Storage
parent509fcca5986651c8ba712fb395f8498f2dea4109 (diff)
IMP: :boom: Breaking changes some checks are needed to be done.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/ARM64/Storage')
-rw-r--r--dev/Kernel/HALKit/ARM64/Storage/.gitkeep0
-rw-r--r--dev/Kernel/HALKit/ARM64/Storage/HalFlash.cc66
2 files changed, 66 insertions, 0 deletions
diff --git a/dev/Kernel/HALKit/ARM64/Storage/.gitkeep b/dev/Kernel/HALKit/ARM64/Storage/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/Kernel/HALKit/ARM64/Storage/.gitkeep
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 <NewKit/Defines.h>
+#include <ArchKit/ArchKit.h>
+
+/// @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)