|
|
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 MPU88xx0Device;
16:
1.1.1.4 root 17: class SysCtlrDevice : public InterruptDevice
1.1 root 18: {
1.1.1.3 root 19: using inherited = InterruptDevice;
20:
21: // 割り込みマップ 76543210
22: static const uint32 IntmapNMI = 0x80000000;
23: static const uint32 IntmapSysClk = 0x08000000;
24: static const uint32 IntmapSIO = 0x00800000;
1.1.1.9 root 25: static const uint32 IntmapXPHigh = 0x00400000;
1.1.1.3 root 26: static const uint32 IntmapLance = 0x00080000;
27: static const uint32 IntmapSPC = 0x00008000;
1.1.1.9 root 28: static const uint32 IntmapXPLow = 0x00000080;
29: static const uint32 IntmapSoft = 0x00000040;
1.1.1.3 root 30:
1.1 root 31: public:
32: SysCtlrDevice();
1.1.1.9 root 33: ~SysCtlrDevice() override;
1.1.1.3 root 34:
1.1.1.7 root 35: bool Init() override;
1.1.1.6 root 36: void ResetHard(bool poweron) override;
1.1 root 37:
1.1.1.10 root 38: busdata Read(busaddr addr) override;
39: busdata Write(busaddr addr, uint32 data) override;
40: busdata Peek1(uint32 addr) override;
41:
42: // 割り込みマスク設定
43: void WriteIntMask(uint32 n, uint32 data);
1.1 root 44:
1.1.1.3 root 45: // InterruptDevice インタフェース
1.1.1.9 root 46: busdata InterruptAcknowledge(int lv) override;
1.1.1.3 root 47:
1.1 root 48: private:
1.1.1.12! root 49: // Peek1() の下請け
! 50: uint32 Peek4(uint32 addr) const;
! 51:
1.1.1.3 root 52: // 割り込み状態を更新
1.1.1.5 root 53: void ChangeInterrupt() override;
1.1.1.3 root 54:
55: // マスク設定レジスタの書き込み値から内部用マスクを作成
1.1.1.10 root 56: static uint32 MakeIntMask(uint32 data, uint n);
1.1.1.3 root 57:
1.1.1.4 root 58: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
59:
1.1.1.3 root 60: // CPU ごとのパラメータ
61: struct {
62: // 割り込みマスク (設定値)
63: // 書き込み時の値をそのまま保持しておくので bit31-26 のみ有効。他は %0。
64: uint32 maskval;
65:
66: // 内部用 intmap に対する割り込みマスク
67: uint32 intmask;
68:
69: // 現在の最高位の割り込みレベル
70: int ipl;
1.1.1.9 root 71:
72: // ソフトウェア割り込みの Intmap (アサート中なら IntmapSoft)
73: uint32 softint;
74:
75: // ソフトウェア割り込み回数
76: uint64 softint_count;
1.1.1.3 root 77: } cpu[4] {};
1.1.1.4 root 78:
1.1.1.7 root 79: MPU88xx0Device *mpu88xx0 {};
80:
1.1.1.11 root 81: Monitor *monitor {};
1.1 root 82: };
83:
1.1.1.7 root 84: // 参照はここではなく GetInterruptDevice() を使用する
85: // (LUNA-88K ではこれがメインの割り込みコントローラなので)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.