openMSX
memory
SdCard.hh
Go to the documentation of this file.
1
#ifndef SDCARD_HH
2
#define SDCARD_HH
3
4
#include "
openmsx.hh
"
5
#include "
circular_buffer.hh
"
6
#include "
DiskImageUtils.hh
"
7
#include <array>
8
#include <memory>
9
10
namespace
openmsx
{
11
12
class
DeviceConfig;
13
class
HD
;
14
15
class
SdCard
16
{
17
public
:
18
explicit
SdCard
(
const
DeviceConfig
& config);
19
~SdCard
();
20
21
byte
transfer
(
byte
value,
bool
cs);
22
23
template
<
typename
Archive>
24
void
serialize
(Archive& ar,
unsigned
version);
25
26
// private:
27
enum class
Mode
{
28
COMMAND
,
29
READ
,
30
MULTI_READ
,
31
WRITE
,
32
MULTI_WRITE
33
};
34
35
private
:
36
void
executeCommand();
37
[[nodiscard]]
byte
readCurrentByteFromCurrentSector();
38
39
private
:
40
const
std::unique_ptr<HD> hd;
// can be nullptr
41
42
std::array<byte, 6> cmdBuf;
43
SectorBuffer
sectorBuf;
44
unsigned
cmdIdx = 0;
45
46
cb_queue<byte>
responseQueue;
47
48
byte
transferDelayCounter = 0;
49
Mode
mode =
Mode::COMMAND
;
50
unsigned
currentSector = 0;
51
int
currentByteInSector = 0;
52
};
53
54
}
// namespace openmsx
55
56
#endif
DiskImageUtils.hh
circular_buffer.hh
cb_queue
This implements a queue on top of circular_buffer (not part of boost).
Definition
circular_buffer.hh:335
openmsx::DeviceConfig
Definition
DeviceConfig.hh:21
openmsx::SdCard
Definition
SdCard.hh:16
openmsx::SdCard::~SdCard
~SdCard()
openmsx::SdCard::Mode
Mode
Definition
SdCard.hh:27
openmsx::SdCard::Mode::COMMAND
@ COMMAND
openmsx::SdCard::Mode::READ
@ READ
openmsx::SdCard::Mode::MULTI_READ
@ MULTI_READ
openmsx::SdCard::Mode::MULTI_WRITE
@ MULTI_WRITE
openmsx::SdCard::Mode::WRITE
@ WRITE
openmsx::SdCard::serialize
void serialize(Archive &ar, unsigned version)
Definition
SdCard.cc:335
openmsx::SdCard::transfer
byte transfer(byte value, bool cs)
Definition
SdCard.cc:68
openmsx
This file implemented 3 utility functions:
Definition
Autofire.cc:11
openmsx::HD
HD
Definition
HD.cc:301
openmsx.hh
openmsx::SectorBuffer
Definition
DiskImageUtils.hh:139
Generated on Thu Dec 19 2024 23:13:46 for openMSX by
1.9.8