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