--- nono/vm/rp5c15.h 2026/04/29 17:04:59 1.1.1.10 +++ nono/vm/rp5c15.h 2026/04/29 17:05:24 1.1.1.14 @@ -4,11 +4,17 @@ // Licensed under nono-license.txt // +// +// RTC (RP5C15) +// + #pragma once -#include "device.h" -#include "monitor.h" #include "rtc.h" +#include "monitor.h" + +class MFPDevice; +class X68030PowerDevice; struct RP5C15 { @@ -107,17 +113,10 @@ class RP5C15Device : public RTCDevice using inherited = RTCDevice; public: RP5C15Device(); - virtual ~RP5C15Device() override; + ~RP5C15Device() override; bool Init() override; - // アラーム端子出力 - // ALARM 端子は負論理(Low active) だが、ここでは - // アサート(L) のとき true とする。 - // アラーム出力は内部のアラーム用 16Hz, 1Hz と - // アラーム時刻一致の alarm_on との OR 論理となっている。 - bool AlarmOut() const { return alarm_16Hz | alarm_1Hz | alarm_on; } - uint GetSec() const override; // 秒(0-59) uint GetMin() const override; // 分(0-59) uint GetHour() const override; // 時(0-23) @@ -130,9 +129,9 @@ class RP5C15Device : public RTCDevice protected: // BusIO インタフェース static const uint32 NPORT = 16; - uint64 Read(uint32 offset); - uint64 Write(uint32 offset, uint32 data); - uint64 Peek(uint32 offset); + busdata Read(uint32 offset); + busdata Write(uint32 offset, uint32 data); + busdata Peek(uint32 offset); // 仮想 RTC からのクロック void Tick32Hz() override; @@ -149,8 +148,7 @@ class RP5C15Device : public RTCDevice void SetLeap(uint v) override; private: - // レジスタを更新 - void UpdateReg(uint32); + void ChangeAlarmOut(); DECLARE_MONITOR_CALLBACK(MonitorUpdate); @@ -166,6 +164,11 @@ class RP5C15Device : public RTCDevice // CLKOUT 1/60Hz 用の 60秒カウンタ。カレンダとは独立。 uint32 cnt_60sec {}; + // アラーム端子出力。 + // ALARM 端子は負論理(Low active) だが、ここでは + // アサート(L) のとき true とする。 + bool alarm_out {}; + // 内部アラーム 16Hz 信号。CLKOUT、alarm_1Hz とは独立。 bool alarm_16Hz {}; // 内部アラーム 1Hz 信号。CLKOUT、alarm_16Hz とは独立。 @@ -174,5 +177,8 @@ class RP5C15Device : public RTCDevice // XXX アラーム機能自体は未実装。 bool alarm_on {}; + MFPDevice *mfp {}; + X68030PowerDevice *power {}; + Monitor monitor { this }; };