|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
1.1.1.6 root 7: //
1.1.1.7 root 8: // LUNA-88K のシステムコントローラのような何か
1.1.1.6 root 9: //
1.1 root 10:
11: #pragma once
12:
1.1.1.3 root 13: #include "interrupt.h"
1.1 root 14:
1.1.1.7 root 15: class LanceDevice;
16: class MPU88xx0Device;
17: class NMIDevice;
18: class SIODevice;
19: class SPCDevice;
20: class SysClkDevice;
21:
1.1.1.4 root 22: class SysCtlrDevice : public InterruptDevice
1.1 root 23: {
1.1.1.3 root 24: using inherited = InterruptDevice;
25:
26: // 割り込みマップ 76543210
27: static const uint32 IntmapNMI = 0x80000000;
28: static const uint32 IntmapSysClk = 0x08000000;
1.1.1.7 root 29: static const uint32 IntmapXPHigh = 0x04000000;
1.1.1.3 root 30: static const uint32 IntmapSIO = 0x00800000;
31: static const uint32 IntmapLance = 0x00080000;
32: static const uint32 IntmapSPC = 0x00008000;
1.1.1.7 root 33: static const uint32 IntmapXPLow = 0x00000800;
1.1.1.3 root 34: static const uint32 IntmapSoft3 = 0x00000080;
35: static const uint32 IntmapSoft2 = 0x00000040;
36: static const uint32 IntmapSoft1 = 0x00000020;
37: static const uint32 IntmapSoft0 = 0x00000010;
38:
1.1 root 39: public:
40: SysCtlrDevice();
1.1.1.3 root 41: virtual ~SysCtlrDevice() override;
42:
1.1.1.7 root 43: bool Init() override;
1.1.1.6 root 44: void ResetHard(bool poweron) override;
1.1 root 45:
46: uint64 Read32(uint32 addr) override;
47: uint64 Write32(uint32 addr, uint32 data) override;
48: uint64 Peek8(uint32 addr) override;
49:
1.1.1.3 root 50: // InterruptDevice インタフェース
51: int InterruptAcknowledge(int lv) override;
52:
1.1 root 53: private:
1.1.1.3 root 54: // デバイスから Intmap 値を引く
1.1.1.8 ! root 55: uint32 GetIntmap(const Device *source) const override;
1.1.1.3 root 56:
57: // 割り込み状態を更新
1.1.1.5 root 58: void ChangeInterrupt() override;
1.1.1.3 root 59:
60: // マスク設定レジスタの書き込み値から内部用マスクを作成
61: static uint32 MakeIntMask(uint32 data, int n);
62:
1.1.1.4 root 63: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
64:
1.1.1.3 root 65: // CPU ごとのパラメータ
66: struct {
67: // 割り込みマスク (設定値)
68: // 書き込み時の値をそのまま保持しておくので bit31-26 のみ有効。他は %0。
69: uint32 maskval;
70:
71: // 内部用 intmap に対する割り込みマスク
72: uint32 intmask;
73:
74: // 現在の最高位の割り込みレベル
75: int ipl;
76: } cpu[4] {};
1.1.1.4 root 77:
1.1.1.7 root 78: LanceDevice *lance {};
79: MPU88xx0Device *mpu88xx0 {};
80: NMIDevice *nmi {};
81: SIODevice *sio {};
82: SPCDevice *spc {};
83: SysClkDevice *sysclk {};
84:
1.1.1.4 root 85: Monitor monitor { this };
1.1 root 86: };
87:
1.1.1.7 root 88: // 参照はここではなく GetInterruptDevice() を使用する
89: // (LUNA-88K ではこれがメインの割り込みコントローラなので)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.