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