|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "device.h"
1.1.1.7 ! root 10: #include "monitor.h"
1.1 root 11: #include "scheduler.h"
12:
1.1.1.7 ! root 13: class SysClkDevice : public IODevice
1.1 root 14: {
1.1.1.3 root 15: using inherited = IODevice;
1.1 root 16: public:
17: SysClkDevice();
1.1.1.5 root 18: virtual ~SysClkDevice() override;
1.1 root 19:
1.1.1.3 root 20: bool Init() override;
21: bool PowerOn() override;
1.1 root 22:
1.1.1.2 root 23: protected:
24: // BusIO インタフェース
25: static const uint32 NPORT = 1;
1.1.1.6 root 26: uint64 Read(uint32 offset);
27: uint64 Write(uint32 offset, uint32 data);
28: uint64 Peek(uint32 offset);
1.1 root 29:
30: private:
31: // イベントコールバック
1.1.1.4 root 32: void Callback(Event& ev);
1.1.1.7 ! root 33: void Callback_rt(Event& ev);
! 34:
! 35: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
1.1 root 36:
1.1.1.2 root 37: // 割り込み状態をレジスタイメージにして返す
38: uint8 GetInt() const;
39:
1.1 root 40: // システムクロック割り込み有りなら true。
1.1.1.4 root 41: bool sysint {};
1.1 root 42:
43: // 割り込みイベント
1.1.1.7 ! root 44: Event event { this };
! 45:
! 46: // 本来のイベント間隔。機種によって異なる。
! 47: uint period {};
! 48:
! 49: // システムクロックが刻んでいる時刻
! 50: uint64 stime {};
! 51:
! 52: // システムクロックを実時間に同期する場合 true
! 53: bool sync_rt {};
! 54:
! 55: Monitor monitor { this };
1.1 root 56: };
1.1.1.5 root 57:
58: extern std::unique_ptr<SysClkDevice> gSysClk;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.