blob: 9bd71b57ff08fc8ba0e498f543d65af5d9149d7b (
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
|
/* -------------------------------------------
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 __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)
|