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 <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);
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  [[nodiscard]] byte readCurrentByteFromCurrentSector();
37 
38 private:
39  const std::unique_ptr<HD> hd; // can be nullptr
40 
41  byte cmdBuf[6];
42  SectorBuffer sectorBuf;
43  unsigned cmdIdx;
44 
45  cb_queue<byte> responseQueue;
46 
47  byte transferDelayCounter;
48  Mode mode;
49  unsigned currentSector;
50  int currentByteInSector;
51 };
52 
53 } // namespace openmsx
54 
55 #endif
SdCard(const DeviceConfig &config)
Definition: SdCard.cc:37
void serialize(Archive &ar, unsigned version)
Definition: SdCard.cc:337
byte transfer(byte value, bool cs)
Definition: SdCard.cc:72
This file implemented 3 utility functions:
Definition: Autofire.cc:9
HD
Definition: HD.cc:286