openMSX
MSXFacMidiInterface.hh
Go to the documentation of this file.
1#ifndef MSXFACMIDIINTERFACE_HH
2#define MSXFACMIDIINTERFACE_HH
3
4#include "MSXDevice.hh"
5#include "MidiInConnector.hh"
6#include "MidiOutConnector.hh"
7#include "I8251.hh"
8
9namespace openmsx {
10
11class MSXFacMidiInterface final : public MSXDevice, public MidiInConnector
12{
13public:
14 explicit MSXFacMidiInterface(const DeviceConfig& config);
15
16 void reset(EmuTime::param time) override;
17 [[nodiscard]] byte readIO(word port, EmuTime::param time) override;
18 [[nodiscard]] byte peekIO(word port, EmuTime::param time) const override;
19 void writeIO(word port, byte value, EmuTime::param time) override;
20
21 // MidiInConnector
22 [[nodiscard]] bool ready() override;
23 [[nodiscard]] 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
32private:
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 [[nodiscard]] bool getDSR(EmuTime::param time) override;
38 [[nodiscard]] 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
An MSXDevice is an emulated hardware component connected to the bus of the emulated MSX.
Definition: MSXDevice.hh:33
void setDataBits(DataBits bits) override
void recvByte(byte value, EmuTime::param time) 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.
byte readIO(word port, EmuTime::param time) override
Read a byte from an IO port at a certain time from this device.
MSXFacMidiInterface(const DeviceConfig &config)
void serialize(Archive &ar, unsigned version)
void setParityBit(bool enable, ParityBit parity) override
void setStopBits(StopBits bits) override
void reset(EmuTime::param time) override
This method is called on reset.
byte peekIO(word port, EmuTime::param time) const override
Read a byte from a given IO port.
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint16_t word
16 bit unsigned integer
Definition: openmsx.hh:29