bigmac: implement software reset registers.

This commit is contained in:
Maxim Poliakovski 2023-07-08 23:30:44 +02:00
parent e76e3afa87
commit a424d48447
2 changed files with 16 additions and 0 deletions

View File

@ -74,6 +74,17 @@ void BigMac::write(uint16_t reg_offset, uint16_t value) {
}
this->srom_csr_old = value;
break;
case BigMacReg::TX_SW_RST:
if (value == 1) {
LOG_F(INFO, "%s: transceiver soft reset asserted", this->name.c_str());
this->tx_reset = 0; // acknowledge SW reset
}
break;
case BigMacReg::RX_SW_RST:
if (!value) {
LOG_F(INFO, "%s: receiver soft reset asserted", this->name.c_str());
}
break;
default:
LOG_F(WARNING, "%s: unimplemented register at 0x%X is written with 0x%X",
this->name.c_str(), reg_offset, value);

View File

@ -40,6 +40,8 @@ enum BigMacReg : uint16_t {
CHIP_ID = 0x170,
MIF_CSR = 0x180,
SROM_CSR = 0x190,
TX_SW_RST = 0x420,
RX_SW_RST = 0x620,
};
/* MIF_CSR bit definitions. */
@ -123,6 +125,9 @@ public:
private:
uint8_t chip_id; // BigMac Chip ID
// BigMac state
uint16_t tx_reset = 0;
// MII state
uint8_t mif_csr_old = 0;
uint8_t mii_bit_counter = 0;