summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/ARM64/Storage/HalMFlash.cc
blob: 2a764101395ea0642ae584a90a6a5a93d86269dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* -------------------------------------------

	Copyright (C) 2024, Theater Quality Corp, all rights reserved.

------------------------------------------- */

#ifdef ZKA_USE_MBCI_FLASH

#include <NewKit/Defines.h>
#include <ArchKit/ArchKit.h>
#include <Mod/MFlash/MFlash.h>

/// @file HalMFlash.cc
/// @brief MBCI Flash builtin.

#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)