openMSX
MSXFacMidiInterface.hh
Go to the documentation of this file.
1 #ifndef MSXFACMIDIINTERFACE_HH
2 #define MSXFACMIDIINTERFACE_HH
3 
4 #include "MSXDevice.hh"
7 #include "I8251.hh"
8 
9 namespace openmsx {
10 
11 class MSXFacMidiInterface final : public MSXDevice, public MidiInConnector
12 {
13 public:
14  explicit MSXFacMidiInterface(const DeviceConfig& config);
15 
16  void reset(EmuTime::param time) override;
17  byte readIO(word port, EmuTime::param time) override;
18  byte peekIO(word port, EmuTime::param time) const override;
19  void writeIO(word port, byte value, EmuTime::param time) override;
20 
21  // MidiInConnector
22  bool ready() override;
23  bool acceptsData() override;
24  void setDataBits(DataBits bits) override;
25  void setStopBits(StopBits bits) override;
26  void setParityBit(bool enable, ParityBit parity) override;
27  void recvByte(byte value, EmuTime::param time) override;
28 
29  template<typename Archive>
30  void serialize(Archive& ar, unsigned version);
31 
32 private:
33  struct I8251Interf final : I8251Interface {
34  void setRxRDY(bool status, EmuTime::param time) override;
35  void setDTR(bool status, EmuTime::param time) override;
36  void setRTS(bool status, EmuTime::param time) override;
37  bool getDSR(EmuTime::param time) override;
38  bool getCTS(EmuTime::param time) override;
39  void setDataBits(DataBits bits) override;
40  void setStopBits(StopBits bits) override;
41  void setParityBit(bool enable, ParityBit parity) override;
42  void recvByte(byte value, EmuTime::param time) override;
43  void signal(EmuTime::param time) override;
44  } interf;
45 
46  // must come last
47  MidiOutConnector outConnector;
48  I8251 i8251;
49 };
50 
51 } // namespace openmsx
52 
53 #endif
MSXFacMidiInterface(const DeviceConfig &config)
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
void setStopBits(StopBits bits) override
void serialize(Archive &ar, unsigned version)
void setDataBits(DataBits bits) override
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX...
Definition: MSXDevice.hh:31
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
void reset(EmuTime::param time) override
This method is called on reset.
void recvByte(byte value, EmuTime::param time) override
void setParityBit(bool enable, ParityBit parity) override
void writeIO(word port, byte value, EmuTime::param time) override
Write a byte to a given IO port at a certain time to this device.