|
|
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 root 8: // LUNA88K のシステムコントローラのような何か
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.4 root 15: class SysCtlrDevice : public InterruptDevice
1.1 root 16: {
1.1.1.3 root 17: using inherited = InterruptDevice;
18:
19: // 割り込みマップ 76543210
20: static const uint32 IntmapNMI = 0x80000000;
21: static const uint32 IntmapSysClk = 0x08000000;
22: static const uint32 IntmapSIO = 0x00800000;
23: static const uint32 IntmapLance = 0x00080000;
24: static const uint32 IntmapSPC = 0x00008000;
25: static const uint32 IntmapSoft3 = 0x00000080;
26: static const uint32 IntmapSoft2 = 0x00000040;
27: static const uint32 IntmapSoft1 = 0x00000020;
28: static const uint32 IntmapSoft0 = 0x00000010;
29:
1.1 root 30: public:
31: SysCtlrDevice();
1.1.1.3 root 32: virtual ~SysCtlrDevice() override;
33:
1.1.1.6 ! root 34: void ResetHard(bool poweron) override;
1.1 root 35:
36: uint64 Read32(uint32 addr) override;
37: uint64 Write32(uint32 addr, uint32 data) override;
38: uint64 Peek8(uint32 addr) override;
39:
1.1.1.3 root 40: // InterruptDevice インタフェース
41: int InterruptAcknowledge(int lv) override;
42:
1.1 root 43: private:
1.1.1.3 root 44: // デバイスから Intmap 値を引く
1.1.1.5 root 45: uint32 GetIntmap(Device *source) const override;
1.1.1.3 root 46:
47: // 割り込み状態を更新
1.1.1.5 root 48: void ChangeInterrupt() override;
1.1.1.3 root 49:
50: // マスク設定レジスタの書き込み値から内部用マスクを作成
51: static uint32 MakeIntMask(uint32 data, int n);
52:
1.1.1.4 root 53: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
54:
1.1.1.3 root 55: // CPU ごとのパラメータ
56: struct {
57: // 割り込みマスク (設定値)
58: // 書き込み時の値をそのまま保持しておくので bit31-26 のみ有効。他は %0。
59: uint32 maskval;
60:
61: // 内部用 intmap に対する割り込みマスク
62: uint32 intmask;
63:
64: // 現在の最高位の割り込みレベル
65: int ipl;
66: } cpu[4] {};
1.1.1.4 root 67:
68: Monitor monitor { this };
1.1 root 69: };
70:
1.1.1.3 root 71: // グローバルインスタンスはここではなく gInterrupt を使用する
72: // (LUNA88K ではこれがメインの割り込みコントローラなので)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.