14 constexpr
unsigned STAT_OE = 0x10;
15 constexpr
unsigned STAT_FE = 0x20;
32 :
MidiInConnector(motherBoard.getPluggingController(), name_ +
"-MIDI-in")
33 , syncRecv (motherBoard.getScheduler())
34 , syncTrans(motherBoard.getScheduler())
35 , rxIRQ(motherBoard, name_ +
"-rx-IRQ")
36 , txIRQ(motherBoard, name_ +
"-tx-IRQ")
37 , txBuffer1(0), txBuffer2(0)
38 , outConnector(motherBoard.getPluggingController(), name_ +
"-MIDI-out")
45 syncRecv .removeSyncPoint();
46 syncTrans.removeSyncPoint();
56 void YM2148::recvByte(
byte value, EmuTime::param time)
58 assert(acceptsData() && ready());
78 void YM2148::execRecv(EmuTime::param time)
93 bool YM2148::acceptsData()
100 void YM2148::setDataBits(DataBits )
104 void YM2148::setStopBits(StopBits )
108 void YM2148::setParityBit(
bool , ParityBit )
147 byte diff = commandReg ^ value;
157 syncRecv.removeSyncPoint();
169 syncTrans.removeSyncPoint();
181 if (!(commandReg &
CMD_TXEN))
return;
183 if (syncTrans.pendingSyncPoint()) {
197 void YM2148::send(
byte value, EmuTime::param time)
204 void YM2148::execTrans(EmuTime::param time)
208 outConnector.
recvByte(txBuffer1, time);
217 send(txBuffer2, time);
227 template<
typename Archive>
230 if (ar.versionAtLeast(version, 2)) {
231 ar.template serializeBase<MidiInConnector>(*
this);
232 ar.serialize(
"outConnector", outConnector,
234 "syncRecv", syncRecv,
235 "syncTrans", syncTrans,
241 "rxBuffer", rxBuffer,
242 "txBuffer1", txBuffer1,
243 "txBuffer2", txBuffer2,
245 "commandReg", commandReg);
static constexpr EmuDuration hz(unsigned x)
void set()
Set the interrupt request on the bus.
void reset()
Reset the interrupt request on the bus.
bool getState() const
Get the interrupt state.
MidiInDevice & getPluggedMidiInDev() const
virtual void signal(EmuTime::param time)=0
void recvByte(byte value, EmuTime::param time) override
byte readData(EmuTime::param time)
void writeCommand(byte value)
YM2148(const std::string &name, MSXMotherBoard &motherBoard)
void serialize(Archive &ar, unsigned version)
byte peekData(EmuTime::param time) const
byte readStatus(EmuTime::param time) const
byte peekStatus(EmuTime::param time) const
void writeData(byte value, EmuTime::param time)
This file implemented 3 utility functions:
constexpr unsigned CMD_RXEN
constexpr auto BIT_DURATION
constexpr unsigned CMD_ER
constexpr unsigned CMD_TXIE
constexpr unsigned CMD_IR
constexpr unsigned CMD_RXIE
constexpr byte STAT_RXRDY
constexpr auto CHAR_DURATION
constexpr byte STAT_TXRDY
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)