openMSX
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
10namespace openmsx {
11
12class DeviceConfig;
13class HD;
14
15class SdCard
16{
17public:
18 explicit SdCard(const DeviceConfig& config);
20
21 byte transfer(byte value, bool cs);
22
23 template<typename Archive>
24 void serialize(Archive& ar, unsigned version);
25
26// private:
34
35private:
36 void executeCommand();
37 [[nodiscard]] byte readCurrentByteFromCurrentSector();
38
39private:
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 = COMMAND;
50 unsigned currentSector = 0;
51 int currentByteInSector = 0;
52};
53
54} // namespace openmsx
55
56#endif
This implements a queue on top of circular_buffer (not part of boost).
void serialize(Archive &ar, unsigned version)
Definition SdCard.cc:333
byte transfer(byte value, bool cs)
Definition SdCard.cc:68
This file implemented 3 utility functions:
Definition Autofire.cc:11