openMSX
SdCard.hh
Go to the documentation of this file.
1 #ifndef SDCARD_HH
2 #define SDCARD_HH
3 
4 #include "openmsx.hh"
6 #include "DiskImageUtils.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class DeviceConfig;
12 class HD;
13 
14 class SdCard
15 {
16 public:
17  explicit SdCard(const DeviceConfig& config);
18  ~SdCard();
19 
20  byte transfer(byte value, bool cs);
21 
22  template<typename Archive>
23  void serialize(Archive& ar, unsigned version);
24 
25 // private:
26  enum Mode {
32  };
33 
34 private:
35  void executeCommand();
36  byte readCurrentByteFromCurrentSector();
37 
38  const std::unique_ptr<HD> hd; // can be nullptr
39 
40  byte cmdBuf[6];
41  SectorBuffer sectorBuf;
42  unsigned cmdIdx;
43 
44  cb_queue<byte> responseQueue;
45 
46  byte transferDelayCounter;
47  Mode mode;
48  unsigned currentSector;
49  int currentByteInSector;
50 };
51 
52 } // namespace openmsx
53 
54 #endif
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
byte transfer(byte value, bool cs)
Definition: SdCard.cc:70
This implements a queue on top of circular_buffer (not part of boost).
SdCard(const DeviceConfig &config)
Definition: SdCard.cc:37
void serialize(Archive &ar, unsigned version)
Definition: SdCard.cc:335