|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // 電源周り
9: //
10:
11: #pragma once
12:
13: #include "device.h"
1.1.1.2 ! root 14: #include "event.h"
1.1 root 15: #include "message.h"
16:
17: class PowerDevice : public Device
18: {
19: using inherited = Device;
20: public:
21: PowerDevice();
22: ~PowerDevice() override;
23:
1.1.1.2 ! root 24: // 電源ボタンを押す
! 25: void PowerButton();
1.1 root 26:
27: // リセットを指示
28: // (どのスレッドから呼んでもよい)
29: void MakeResetHard();
30:
31: // リスタートを指示
32: // (どのスレッドから呼んでもよい)
33: void MakeRestart();
34:
1.1.1.2 ! root 35: // 電源が実際にオンなら true を返す。
1.1 root 36: bool IsPower() const { return ispower; }
37:
1.1.1.2 ! root 38: // 電源 LED 点灯なら true を返す。
! 39: bool GetPowerLED() const { return led; }
! 40:
! 41: // X68030 では電源ボタンが押されていれば true を返す。
! 42: // LUNA では意味を持たないので呼ばないこと。
! 43: bool IsPowerPressed() const { return power_button; }
! 44:
! 45: void SetAlarmOut(bool alarm_out_);
! 46: void SetSystemPowerOn(bool poweron);
1.1 root 47: private:
48: void DoPowerOn();
49: void DoResetHard();
50: void DoPowerOff(MessageID);
1.1.1.2 ! root 51: void DoPowerButton();
1.1 root 52:
53: // メッセージコールバック
54: void ResetCallback(MessageID, uint32);
55: void PowerOffCallback(MessageID, uint32);
1.1.1.2 ! root 56: void PowerButtonCallback(MessageID, uint32);
! 57:
! 58: void PowerCallback(Event&);
! 59:
! 60: void Change();
1.1 root 61:
62: // 電源オンなら true
63: bool ispower {};
1.1.1.2 ! root 64:
! 65: // 電源 LED
! 66: bool led {};
! 67:
! 68: // 電源ボタン状態
! 69: bool power_button {};
! 70:
! 71: // ALARM_OUT 信号状態
! 72: bool alarm_out {};
! 73:
! 74: // システム内の電源オン信号に相当
! 75: bool system_poweron {};
! 76:
! 77: // 電源オフイベント
! 78: Event event { this };
1.1 root 79: };
80:
81: extern PowerDevice *gPower;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.