Annotation of nono/host/hostcom.h, revision 1.1.1.5

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2021 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // シリアルポートのホストデバイス
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "hostdevice.h"
                     14: #include "comdriver.h"
                     15: #include "spscqueue.h"
                     16: 
                     17: class HostCOMDevice : public HostDevice
                     18: {
                     19:        using inherited = HostDevice;
                     20:        using COMQueue = SPSCQueue<uint8, 1024>;
                     21: 
                     22:        // 統計情報
                     23:        struct stat_t {
                     24:                uint64 tx_bytes;                        // VM からの送信バイト数
                     25:                uint64 rx_bytes;                        // VM が受信したバイト数
                     26:                uint64 txqfull_bytes;           // TxQ が一杯で落としたバイト数
                     27:                uint64 rxqfull_bytes;           // RxQ が一杯で落としたバイト数
                     28:                uint64 write_bytes;                     // ホストへの書き出しバイト数
                     29:                uint64 read_bytes;                      // ホストからの読み込みバイト数
                     30: 
1.1.1.3   root       31:                uint txq_peak;                          // キューのおおよその最大使用量
                     32:                uint rxq_peak;                          // キューのおおよその最大使用量
1.1       root       33:        };
                     34: 
                     35:  public:
1.1.1.2   root       36:        HostCOMDevice(Device *parent_, const std::string& objname_);
1.1       root       37:        ~HostCOMDevice() override;
                     38: 
                     39:        void SetLogLevel(int loglevel_) override;
1.1.1.5 ! root       40:        bool Create2() override;
1.1       root       41: 
                     42:        void Dispatch(int udata) override;
                     43:        bool Tx(uint32 data);
                     44:        uint32 Rx();
                     45: 
                     46:  private:
                     47:        bool SelectDriver();
                     48: 
                     49:        int Read() override;
                     50:        void Write(uint32 data) override;
                     51: 
                     52:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     53: 
                     54:        // キュー
                     55:        COMQueue txq {};
                     56:        COMQueue rxq {};
                     57: 
                     58:        std::unique_ptr<COMDriver> driver {};
                     59: 
                     60:        // 統計情報
                     61:        struct stat_t stat {};
                     62: 
1.1.1.4   root       63:        Monitor *monitor {};
1.1       root       64: };

unix.superglobalmegacorp.com

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