Annotation of nono/vm/goldfish_tty.h, revision 1.1

1.1     ! root        1: //
        !             2: // nono
        !             3: // Copyright (C) 2024 nono project
        !             4: // Licensed under nono-license.txt
        !             5: //
        !             6: 
        !             7: //
        !             8: // Goldfish TTY
        !             9: //
        !            10: 
        !            11: #pragma once
        !            12: 
        !            13: #include "device.h"
        !            14: #include "message.h"
        !            15: #include <deque>
        !            16: 
        !            17: class GFPICDevice;
        !            18: class HostCOMDevice;
        !            19: class MainbusDevice;
        !            20: 
        !            21: class GFTTYDevice : public IODevice
        !            22: {
        !            23:        using inherited = IODevice;
        !            24: 
        !            25:        static const uint32 PUT_CHAR    = 0x00;
        !            26:        static const uint32 BYTES_READY = 0x04;
        !            27:        static const uint32 COMMAND             = 0x08;
        !            28:        static const uint32 DATA_PTR    = 0x10;
        !            29:        static const uint32 DATA_LEN    = 0x14;
        !            30:        static const uint32 VERSION             = 0x20;
        !            31: 
        !            32:        static const uint32 CMD_INT_DISABLE             = 0x00;
        !            33:        static const uint32 CMD_INT_ENABLE              = 0x01;
        !            34:        static const uint32 CMD_WRITE_BUFFER    = 0x02;
        !            35:        static const uint32 CMD_READ_BUFFER             = 0x03;
        !            36: 
        !            37:  public:
        !            38:        GFTTYDevice();
        !            39:        ~GFTTYDevice() override;
        !            40: 
        !            41:        bool Create() override;
        !            42:        void SetLogLevel(int loglevel_) override;
        !            43:        bool Init() override;
        !            44:        void ResetHard(bool poweron) override;
        !            45: 
        !            46:        busdata Read32(uint32 addr) override;
        !            47:        busdata Write32(uint32 addr, uint32 data) override;
        !            48:        busdata Peek8(uint32 addr) override;
        !            49: 
        !            50:  private:
        !            51:        void Command(uint32);
        !            52:        void ChangeInterrupt();
        !            53: 
        !            54:        // シリアルから1バイト受信のメッセージとイベントコールバック
        !            55:        void HostRxCallback();
        !            56:        void RxMessage(MessageID, uint32);
        !            57: 
        !            58:        // 受信キュー
        !            59:        std::deque<uint8> rxq {};
        !            60: 
        !            61:        uint32 dma_ptr {};
        !            62:        uint32 dma_len {};
        !            63:        bool intr_enable {};
        !            64: 
        !            65:        std::unique_ptr<HostCOMDevice> hostcom /*{}*/;
        !            66: 
        !            67:        GFPICDevice *gfpic {};
        !            68:        MainbusDevice *mainbus {};
        !            69: };
        !            70: 
        !            71: static inline GFTTYDevice *GetGFTTYDevice() {
        !            72:        return Object::GetObject<GFTTYDevice>(OBJ_GFTTY);
        !            73: }

unix.superglobalmegacorp.com

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