|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: #pragma once
8:
9: #include "device.h"
10: #include "interrupt.h"
11:
1.1.1.4 ! root 12: class PEDECDevice : public InterruptDevice
1.1 root 13: {
14: using inherited = InterruptDevice;
15: private:
16: static const int baseaddr = 0xe9c000;
17:
18: public:
1.1.1.2 root 19: // int_asserted が下位デバイスからの割り込み信号線 (%1 でアサート)。
20: // int_enabled がマスク (%1 なら割り込み許可)。
21: // よって二者を AND とれば上位に割り込みを上げるかどうかが求まる。
22: // SPC からの割り込みはここでマスク制御しないので int_enabled には
23: // IntmapSPC を常に立てておくこと。
24: // $e9c001 (割り込みステータスレジスタ) のビット順は
25: // これとは全然違うので注意のこと。
26: static const uint32 IntmapSPC = 0x10;
27: static const uint32 IntmapFDC = 0x08;
28: static const uint32 IntmapFDD = 0x04;
29: static const uint32 IntmapHDD = 0x02;
30: static const uint32 IntmapPRT = 0x01;
31:
32: public:
1.1 root 33: PEDECDevice();
34: virtual ~PEDECDevice() override;
35:
36: void ResetHard() override;
37:
38: // InterruptDevice インタフェース
39: void AssertINT(Device *source) override;
40: void NegateINT(Device *source) override;
41: int InterruptAcknowledge(int lv) override;
42:
1.1.1.2 root 43: // 割り込み許可/禁止状態と、割り込みが発生しているかどうかの内部状態を
44: // まとめて返す。割り込みコントローラからのモニタ表示に使う。
45: uint32 GetInt() const { return (int_enabled << 16) | int_asserted; }
46:
1.1 root 47: protected:
48: // BusIO インタフェース
49: static const uint32 NPORT = 8;
1.1.1.3 root 50: uint64 Read(uint32 offset);
51: uint64 Write(uint32 offset, uint32 data);
52: uint64 Peek(uint32 offset);
1.1 root 53:
54: private:
55: // 割り込みステータスレジスタの値を取得
56: uint32 GetStat() const;
57:
58: // 割り込み信号線の状態を変える
59: void ChangeInterrupt();
60:
61: uint32 int_asserted {};
62: uint32 int_enabled {};
63: uint8 vector {};
64: };
65:
66: extern std::unique_ptr<PEDECDevice> gPEDEC;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.