--- nono/vm/rtl8019as.h 2026/04/29 17:05:21 1.1.1.1 +++ nono/vm/rtl8019as.h 2026/04/29 17:05:51 1.1.1.6 @@ -11,10 +11,8 @@ #pragma once #include "ethernet.h" -#include "event.h" #include "hostnet.h" #include "message.h" -#include "monitor.h" class InterruptDevice; @@ -238,7 +236,7 @@ struct RTL8019 }; }; -class RTL8019ASDevice : public EthernetDevice +class RTL8019ASDevice : public EthernetDevice, public IHWAddrFilter { using inherited = EthernetDevice; @@ -259,19 +257,19 @@ class RTL8019ASDevice : public EthernetD }; public: - RTL8019ASDevice(int n_, int vector_); - virtual ~RTL8019ASDevice() override; + RTL8019ASDevice(uint n_, int vector_); + ~RTL8019ASDevice() override; bool Init() override; void ResetHard(bool poweron) override; - uint64 Read8(uint32 addr) override; - uint64 Read16(uint32 addr) override; - uint64 Write8(uint32 addr, uint32 data) override; - uint64 Write16(uint32 addr, uint32 data) override; - uint64 Peek8(uint32 addr) override; + busdata Read(busaddr addr) override; + busdata Write(busaddr addr, uint32 data) override; + busdata Peek1(uint32 addr) override; - int InterruptAcknowledge(); + busdata InterruptAcknowledge(); + + int HWAddrFilter(const MacAddr& dstaddr) const override; private: static inline uint32 Decoder(uint32 addr); @@ -279,7 +277,7 @@ class RTL8019ASDevice : public EthernetD uint32 ReadReg(uint32 rn); uint32 ReadDMA8(uint32 a0); uint32 ReadDMA16(); - uint32 WriteReg(uint32 rn, uint32 data); + void WriteReg(uint32 rn, uint32 data); void WriteCR(uint32 data); void WritePSTART(uint32 data); void WritePSTOP(uint32 data); @@ -296,9 +294,9 @@ class RTL8019ASDevice : public EthernetD void WriteTCR(uint32 data); void WriteDCR(uint32 data); void WriteIMR(uint32 data); - void WritePAR(int n, uint32 data); + void WritePAR(uint n, uint32 data); void WriteCURR(uint32 data); - void WriteMAR(int n, uint32 data); + void WriteMAR(uint n, uint32 data); void Write9346CR(uint32 data); void WriteCONFIG0(uint32 data); void WriteCONFIG1(uint32 data); @@ -362,16 +360,16 @@ class RTL8019ASDevice : public EthernetD // 送信 void Transmit(); - void TXEvent(Event&); + void TXEvent(Event *); // 受信 - void HostRxCallback(MessageID msgid, uint32 arg); - void RXEvent(Event&); - void RXHead(int remain); - void RXCopy(Event&, int remain); - void RXDone(Event&); + void RxMessage(MessageID msgid, uint32 arg); + void RXEvent(Event *); + void RXHead(); + void RXCopy(Event *, uint remain); + void RXDone(Event *); - void TXLedEvent(Event&); - void RXLedEvent(Event&); + void TXLedEvent(Event *); + void RXLedEvent(Event *); void IncCounter(int n); @@ -403,7 +401,7 @@ class RTL8019ASDevice : public EthernetD // 割り込みマスク (bit7 は 0 にすること) uint32 intr_mask {}; // 割り込みベクタ (NereidBoardDevice から渡される) - int intr_vector {}; + uint32 intr_vector {}; uint32 tsr {}; uint32 rsr {}; // DIS 以外のビットを保持 @@ -442,8 +440,8 @@ class RTL8019ASDevice : public EthernetD uint16 local_addr {}; // CLDA: 書き込み位置 uint16 next_page_addr {}; // 次パケットの受信開始位置 - macaddr_t par {}; - std::array mar {}; + MacAddr par {}; + uint64 mar {}; std::array error_counter {}; // 9346CR @@ -469,12 +467,12 @@ class RTL8019ASDevice : public EthernetD bool tx_led {}; bool rx_led {}; - Monitor monitor { this }; + Monitor *monitor {}; - Event tx_event { this }; - Event rx_event { this }; - Event txled_event { this }; - Event rxled_event { this }; + Event *tx_event {}; + Event *rx_event {}; + Event *txled_event {}; + Event *rxled_event {}; InterruptDevice *interrupt {};