Annotation of nono/vm/message.h, revision 1.1.1.1

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"
                     14: 
                     15: class MessageID
                     16: {
                     17:  public:
                     18:        enum {
                     19:                NONE = 0,
                     20: 
                     21:                POWERON,
                     22:                RESET,
                     23:                POWEROFF_EXIT,
                     24:                POWEROFF_RESTART,
                     25: 
                     26:                SCSIDEV_LOAD_0,
                     27:                SCSIDEV_LOAD_1,
                     28:                SCSIDEV_LOAD_2,
                     29:                SCSIDEV_LOAD_3,
                     30:                SCSIDEV_LOAD_4,
                     31:                SCSIDEV_LOAD_5,
                     32:                SCSIDEV_LOAD_6,
                     33:                SCSIDEV_LOAD_7,
                     34:                SCSIDEV_UNLOAD_0,
                     35:                SCSIDEV_UNLOAD_1,
                     36:                SCSIDEV_UNLOAD_2,
                     37:                SCSIDEV_UNLOAD_3,
                     38:                SCSIDEV_UNLOAD_4,
                     39:                SCSIDEV_UNLOAD_5,
                     40:                SCSIDEV_UNLOAD_6,
                     41:                SCSIDEV_UNLOAD_7,
                     42: 
                     43:                HOSTCOM_RX,
                     44:                HOSTNET_RX,
                     45: 
                     46:                KEY_INPUT,
                     47: 
                     48:                NMI,
                     49: 
                     50:                SCHEDULER_SYNCMODE,
                     51: 
                     52:                MPU_TRACE,
                     53: 
                     54:                MAX,
                     55:        };
                     56: 
                     57:  public:
                     58:        MessageID() {
                     59:                id = NONE;
                     60:        }
                     61:        MessageID(int id_) {
                     62:                id = id_;
                     63:        }
                     64: 
                     65:        MessageID& operator=(int id_) {
                     66:                id = id_;
                     67:                return *this;
                     68:        }
                     69:        operator int() const {
                     70:                return id;
                     71:        }
                     72: 
                     73:        static MessageID SCSIDEV_LOAD(int n) {
                     74:                return MessageID(SCSIDEV_LOAD_0 + n);
                     75:        }
                     76:        static MessageID SCSIDEV_UNLOAD(int n) {
                     77:                return MessageID(SCSIDEV_UNLOAD_0 + n);
                     78:        }
                     79: 
                     80:  private:
                     81:        int id;
                     82: };
                     83: 
                     84: using MessageCallback_t = void (Device::*)(MessageID, uint32);
                     85: #define ToMessageCallback(f) static_cast<MessageCallback_t>(f)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.