--- nono/vm/scheduler.h 2026/04/29 17:04:36 1.1.1.3 +++ nono/vm/scheduler.h 2026/04/29 17:04:42 1.1.1.5 @@ -29,6 +29,7 @@ class Scheduler : public Device static const uint REQ_POWER_ON = 0x0010; // 電源オン static const uint REQ_POWER_OFF = 0x0020; // 電源オフ static const uint REQ_EXIT = 0x0040; // アプリケーション終了 + static const uint REQ_RESET = 0x0080; // ハードウェアリセット // 動作モード // 動作モード変数 (mode) は高速モードか通常モードかと、MPU が通常状態が @@ -52,7 +53,8 @@ class Scheduler : public Device bool Init() override; - bool MonitorUpdate() override; + nnSize GetMonitorSize() override; + void MonitorUpdate(TextScreen&) override; // スレッド開始 void ThreadRun(); @@ -68,6 +70,11 @@ class Scheduler : public Device atomic_reqflag |= REQ_POWER_OFF; } + // リセット要求 + void RequestResetHard() { + atomic_reqflag |= REQ_RESET; + } + // サイクル数を仮想時間 [nsec] に変換 uint64 Cycle2Vtime(uint64 cycle) const { return cycle * 1000 * 1000 / mpu_clock; @@ -108,20 +115,23 @@ class Scheduler : public Device std::mutex cvmtx {}; private: + // リセットイベントコールバック + void ResetCallback(Event& ev); + pthread_t thread {}; - bool thread_created = false; // スレッドが作成されたら true + bool thread_created {}; // スレッドが作成されたら true // スケジューラの動作モード。SCHED_* - uint32 mode = 0; + uint32 mode {}; - int mpu_clock = 0; // MPU クロック [kHz] + int mpu_clock {}; // MPU クロック [kHz] - uint64 rtimestart = 0; // スケジューラ開始実時刻 - uint64 rtimebase = 0; // 実時間の基準時刻 - uint64 vtimebase = 0; // 仮想時間の基準時刻 + uint64 rtimestart {}; // スケジューラ開始実時刻 + uint64 rtimebase {}; // 実時間の基準時刻 + uint64 vtimebase {}; // 仮想時間の基準時刻 // 前回 RTC へ 32Hz 入力パルスを入れた時刻 (実時間の絶対時刻系) - uint64 rtc_last_clock = 0; + uint64 rtc_last_clock {}; }; extern std::unique_ptr gScheduler;