--- nono/vm/spc.h 2026/04/29 17:04:56 1.1.1.10 +++ nono/vm/spc.h 2026/04/29 17:05:10 1.1.1.12 @@ -4,14 +4,17 @@ // Licensed under nono-license.txt // +// +// SPC (MB89352) +// + #pragma once #include "device.h" +#include "event.h" #include "fixedqueue.h" #include "monitor.h" -#include "scheduler.h" #include "scsidev.h" -#include "vm.h" struct SPC { @@ -121,9 +124,10 @@ struct SPC static const int SERR_SHORT_XFER = 0x02; // Short Transfer Period // PCTL レジスタ - // ここでは BusFree INT Enable ビットだけを保持。 - // 残りの MSG, C/D, I/O は親クラスの信号線フラグから生成。 + // BusFree INT Enable は独立して保持。 + // MSG, CD, IO の3ビットは pctl_out で保持。 bool busfree_intr_enable; + uint8 pctl_out; static const int PCTL_MASK = 0x87; // 書き込みマスク static const int PCTL_BFINT_EN = 0x80; // BusFree INT Enable static const int PCTL_MSG = 0x04; @@ -153,12 +157,7 @@ class SPCDevice : public SCSIHostDevice virtual ~SPCDevice() override; bool Init() override; - void ResetHard() override; - - // 接続中のデバイスを ID 順に並べたリストを返す (UI ステータスパネル用) - const std::vector& GetConnectedDevices() const { - return connected_devices; - } + void ResetHard(bool poweron) override; // SCSIBus コールバック @@ -218,6 +217,8 @@ class SPCDevice : public SCSIHostDevice // SERR レジスタ値の取得 uint32 GetSERR() const; + // PCTL レジスタへの書き込み + void WritePCTL(uint32); // PCTL レジスタ値の取得 uint32 GetPCTL() const; @@ -247,7 +248,6 @@ class SPCDevice : public SCSIHostDevice // Transfer コマンド実行 void TransferCommand(); - void TransferCommandStart(Event& ev); void HardwareTransfer(Event& ev); void TransferComplete(); // Transfer コマンド実行中なら true @@ -272,9 +272,6 @@ class SPCDevice : public SCSIHostDevice // 割り込み信号線の接続先デバイス InterruptDevice *interrupt {}; - // 接続中のデバイス(イニシエータ含む)を ID 順に並べたリスト (モニタ用) - std::vector connected_devices {}; - // イベント Event event { this }; Event event_tc { this }; @@ -282,4 +279,4 @@ class SPCDevice : public SCSIHostDevice Monitor monitor { this }; }; -extern std::unique_ptr gSPC; +extern SPCDevice *gSPC;