--- nono/vm/mpscc.cpp 2026/04/29 17:05:25 1.1.1.5 +++ nono/vm/mpscc.cpp 2026/04/29 17:05:29 1.1.1.6 @@ -65,18 +65,6 @@ MPSCCDevice::MPSCCDevice() for (int ch = 0; ch < mpscc.chan.size(); ch++) { auto& chan = mpscc.chan[ch]; chan.Init(ch); - - // time は SetTxPeriod() でセット。 - // 名前は継承先でセットする。機種ごとに名前を使い分けているため。 - txevent[ch].dev = this; - txevent[ch].func = ToEventCallback(&MPSCCDevice::TxCallback); - txevent[ch].code = ch; - txevent[ch].Regist(); - - rxevent[ch].dev = this; - rxevent[ch].func = ToEventCallback(&MPSCCDevice::RxCallback); - rxevent[ch].code = ch; - rxevent[ch].Regist(); } // モニタは継承先で設定する @@ -124,6 +112,21 @@ MPSCCDevice::Init() scheduler->ConnectMessage(MessageID::HOSTCOM_RX, this, ToMessageCallback(&MPSCCDevice::RxMessage)); + + for (int ch = 0; ch < mpscc.chan.size(); ch++) { + // time は SetTxPeriod() でセット。 + // 名前は継承先でセットする。機種ごとに名前を使い分けているため。 + txevent[ch].dev = this; + txevent[ch].func = ToEventCallback(&MPSCCDevice::TxCallback); + txevent[ch].code = ch; + scheduler->RegistEvent(txevent[ch]); + + rxevent[ch].dev = this; + rxevent[ch].func = ToEventCallback(&MPSCCDevice::RxCallback); + rxevent[ch].code = ch; + scheduler->RegistEvent(rxevent[ch]); + } + return true; } @@ -149,6 +152,12 @@ MPSCCDevice::ResetChannelCommon(MPSCCCha ChangeInterrupt(); } +bool +MPSCCDevice::PokePort(uint32 offset, uint32 data) +{ + return false; +} + // CR0/WR0 レジスタの内容を取得 // (値の取り出しだけなら共通) /*static*/ uint8 @@ -206,7 +215,7 @@ MPSCCDevice::GetCR3(const MPSCCChan& cha data |= MPSCC::RXBITS_8; break; default: - VMPANIC("corrupted chan.rxbits=%d", chan.rxbits); + VMPANIC("corrupted chan.rxbits=%u", chan.rxbits); } if (chan.auto_enable) { data |= MPSCC::CR3_AUTO_EN; @@ -264,7 +273,7 @@ MPSCCDevice::GetCR4(const MPSCCChan& cha data |= MPSCC::CLKRATE_64; break; default: - VMPANIC("corrupted chan.clkrate=%d", chan.clkrate); + VMPANIC("corrupted chan.clkrate=%u", chan.clkrate); } data |= chan.syncmode; data |= chan.stopbits << 2; @@ -326,7 +335,7 @@ MPSCCDevice::GetCR5(const MPSCCChan& cha data |= MPSCC::TXBITS_8; break; default: - VMPANIC("corrupted chan.txbits=%d", chan.txbits); + VMPANIC("corrupted chan.txbits=%u", chan.txbits); } if (chan.nDTR) { data |= MPSCC::CR5_nDTR; @@ -398,7 +407,7 @@ MPSCCDevice::GetSR2B() const data |= bitrev(stat << 1); break; default: - VMPANIC("corrupted mpscc.vis=%d", (int)mpscc.vis); + VMPANIC("corrupted mpscc.vis=%u", (uint)mpscc.vis); } return data; @@ -517,7 +526,7 @@ MPSCCDevice::WriteCR4(MPSCCChan& chan, u putlog(2, "Channel %c Synchronous mode not supported", chan.name); } else { const char *sm[] = { "?", "1", "1.5", "2" }; - putlog(2, "Channel %c Async Mode (x%d clock, stopbit %s)", + putlog(2, "Channel %c Async Mode (x%u clock, stopbit %s)", chan.name, chan.clkrate, sm[chan.stopbits]); @@ -822,7 +831,7 @@ MPSCCDevice::GetStopBits(MPSCCChan& chan void MPSCCDevice::SetRxPeriod(MPSCCChan& chan) { - int bit; + uint bit; // 受信データビット数 bit = chan.rxbits; @@ -853,7 +862,7 @@ MPSCCDevice::SetRxPeriod(MPSCCChan& chan if (loglevel >= 2) { nsstr = string_format(" (%" PRIu64 ")", chan.bit12_ns); } - putlogn("Channel %c RX Enable, %.1f bps%s, %d bits/frame", + putlogn("Channel %c RX Enable, %.1f bps%s, %u bits/frame", chan.name, chan.baudrate, nsstr.c_str(), @@ -887,7 +896,7 @@ MPSCCDevice::SetRxPeriod(MPSCCChan& chan void MPSCCDevice::SetTxPeriod(MPSCCChan& chan) { - int bit; + uint bit; // 送信データビット数 bit = chan.txbits; @@ -918,7 +927,7 @@ MPSCCDevice::SetTxPeriod(MPSCCChan& chan if (loglevel >= 2) { nsstr = string_format(" (%" PRIu64 ")", chan.bit12_ns); } - putlogn("Channel %c TX Enable, %.1f bps%s, %d bits/frame", + putlogn("Channel %c TX Enable, %.1f bps%s, %u bits/frame", chan.name, chan.baudrate, nsstr.c_str(),