|
|
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:
14: class SysCtlrDevice
1.1.1.3 ! root 15: : 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:
! 34: void ResetHard() override;
1.1 root 35:
1.1.1.2 root 36: void MonitorUpdate(TextScreen&) override;
1.1 root 37:
38: uint64 Read32(uint32 addr) override;
39: uint64 Write32(uint32 addr, uint32 data) override;
40: uint64 Peek8(uint32 addr) override;
41:
1.1.1.3 ! root 42: // InterruptDevice インタフェース
! 43: void AssertINT(Device *soruce) override;
! 44: void NegateINT(Device *source) override;
! 45: int InterruptAcknowledge(int lv) override;
! 46:
1.1 root 47: private:
1.1.1.3 ! root 48: // デバイスから Intmap 値を引く
! 49: uint32 GetIntmap(Device *source) const;
! 50:
! 51: // 割り込み状態を更新
! 52: void ChangeInterrupt();
! 53:
! 54: // マスク設定レジスタの書き込み値から内部用マスクを作成
! 55: static uint32 MakeIntMask(uint32 data, int n);
! 56:
! 57: // 割り込みマップ (M680x0Interrupt::intmap と同じ構造)
! 58: uint32 intmap {};
! 59:
! 60: // 割り込み回数 (アサートのエッジでカウントアップする)
! 61: // [0] が Intmap の bit31 割り込みのカウント。
! 62: // [27] が Intmap の bit 4 割り込みのカウント。
! 63: uint32 counter[28] {};
! 64:
! 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 root 77: };
78:
1.1.1.3 ! root 79: // グローバルインスタンスはここではなく gInterrupt を使用する
! 80: // (LUNA88K ではこれがメインの割り込みコントローラなので)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.