--- nono/vm/dmac.h 2026/04/29 17:05:38 1.1.1.16 +++ nono/vm/dmac.h 2026/04/29 17:05:55 1.1.1.18 @@ -12,7 +12,6 @@ #include "device.h" #include "bus.h" -#include "event.h" #include "fixedqueue.h" #include @@ -106,9 +105,10 @@ struct DMAC static const uint32 SIZE_16BIT = 1; // 16bit static const uint32 SIZE_32BIT = 2; // 32bit static const uint32 SIZE_8BIT_UNPK = 3; // 8bit UnPacked - static const uint32 CHAIN_NOCHAIN = 0; // Chain operation is disabled + static const uint32 CHAIN_DISABLED = 0; // Chain operation is disabled + static const uint32 CHAIN_reserved = 1; // (Undefined, reserved) static const uint32 CHAIN_ARRAY = 2; // Array Chaining - static const uint32 CHAIN_LINK = 3; // Linked Array Chaining + static const uint32 CHAIN_LINKARRAY = 3; // Linked Array Chaining static const uint32 REQG_AUTO_LIM = 0; // Auto Request (Limited) static const uint32 REQG_AUTO_MAX = 1; // AUto Request (Max) static const uint32 REQG_EXTERNAL = 2; // External Request @@ -146,9 +146,13 @@ struct DMAC }; // 各チャンネル -class DMACChan +class DMACChan : public Device { + using inherited = Device; public: + DMACChan(int ch_, const char *desc_); + ~DMACChan() override; + // 二次変数など int ch; // チャンネル番号 const char *desc; // チャンネルの用途(モニタ表示用) @@ -311,11 +315,13 @@ class DMACDevice : public IODevice // 転送 void StartTransfer(DMACChan *chan); void AbortTransfer(DMACChan *chan); + std::string MakeStartLog(DMACChan *chan); + bool LoadLinkArray(DMACChan *chan); DMACChan *SelectChannel(); // 転送イベントコールバック - void StartCallback(Event& ev); - void TransferCallback(Event& ev); + void StartCallback(Event *); + void TransferCallback(Event *); // ログ出力 void TransferLog(DMACChan *, uint op, busaddr addr, busdata r, uint64 data); @@ -329,8 +335,13 @@ class DMACDevice : public IODevice void AssertACK(DMACChan *); void NegateACK(DMACChan *); + // メインメモリアクセス + busdata ReadMem(busaddr addr); + busdata ReadMem4(busaddr addr); + busdata WriteMem(busaddr addr, uint32 data); + // レジスタ - std::array channel {}; + std::array, 4> channels {}; uint8 gcr; // ユーザ空間制御 @@ -342,7 +353,7 @@ class DMACDevice : public IODevice MainbusDevice *mainbus {}; Syncer *syncer {}; - Event event { this }; + Event *event {}; Monitor *monitor {};