|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2020 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // M88200 CMMU の I/O デバイス部分 ! 8: ! 9: #pragma once ! 10: ! 11: #include "device.h" ! 12: #include "m88200.h" ! 13: ! 14: class CMMUDevice ! 15: : public IODevice ! 16: { ! 17: using inherited = IODevice; ! 18: ! 19: // レジスタオフセット ! 20: static const uint32 IDR = 0x000; ! 21: static const uint32 SCR = 0x004; ! 22: static const uint32 SSR = 0x008; ! 23: static const uint32 SAR = 0x00c; ! 24: static const uint32 SCTR = 0x104; ! 25: static const uint32 PFSR = 0x108; ! 26: static const uint32 PFAR = 0x10c; ! 27: ! 28: static const uint32 SAPR = 0x200; ! 29: static const uint32 UAPR = 0x204; ! 30: ! 31: static const uint32 BWP0 = 0x400; ! 32: static const uint32 BWP7 = 0x41c; ! 33: static const uint32 CDP0 = 0x800; ! 34: static const uint32 CDP3 = 0x80c; ! 35: static const uint32 CTP0 = 0x840; ! 36: static const uint32 CTP3 = 0x84c; ! 37: ! 38: static const uint32 CSSP = 0x880; ! 39: ! 40: public: ! 41: CMMUDevice(); ! 42: ~CMMUDevice() override; ! 43: ! 44: bool Init() override; ! 45: ! 46: uint64 Read32(uint32 addr) override; ! 47: uint64 Write32(uint32 addr, uint32 data) override; ! 48: uint64 Peek8(uint32 addr) override; ! 49: ! 50: private: ! 51: // アドレスデコーダ ! 52: static uint32 Decoder(uint32 addr); ! 53: ! 54: // 指定された ID の CMMU(m88200) を返す。なければ NULL を返す。 ! 55: m88200 *GetCMMU(uint id) const { ! 56: if (id >= countof(cmmus) || cmmus[id] == NULL) { ! 57: return NULL; ! 58: } ! 59: return cmmus[id]; ! 60: } ! 61: // CMMU へのリンク (最大 4 MPU) ! 62: m88200 *cmmus[8] {}; ! 63: ! 64: // Peek8() の下請け ! 65: uint32 Peek32(uint32 addr) const; ! 66: }; ! 67: ! 68: extern std::unique_ptr<CMMUDevice> gCMMU;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.