|
SatCat5
|
Interface object for a "cfgbus_mdio" block (direct registers only).
MDIO is a common interface for configuring an Ethernet PHY. It is similar to I2C, but typically runs at ~1.6 Mbps. This class provides a simple interface to the "cfgbus_mdio" block, allowing both writes and reads.
Definition at line 38 of file cfgbus_mdio.h.
#include <cfgbus_mdio.h>
Public Member Functions | |
| Mdio (satcat5::cfg::ConfigBus *cfg, unsigned devaddr, unsigned regaddr=satcat5::cfg::REGADDR_ANY) | |
| Constructor ties this driver to a ConfigBus address. | |
| bool | can_read () const |
| Is there space in the callback queue? (Note: Reads may still fail if hardware queue is full.) | |
| bool | direct_write (unsigned phy, unsigned reg, unsigned data) |
| Direct write to designated MDIO register. More... | |
| bool | direct_read (unsigned phy, unsigned reg, unsigned ref, satcat5::cfg::MdioEventListener *callback) |
| Direct read from designated MDIO register. More... | |
Static Public Member Functions | |
| static unsigned | count_always () |
| Count active objects of this type. | |
Protected Member Functions | |
| void | poll_always () |
| Child class MUST override this method. More... | |
| u32 | hw_rd_status () |
| bool | hw_wr_command (u32 cmd) |
| void | poll_register () |
| Register this pollable object, called by the constructor. | |
| void | poll_unregister () |
| Unregister this pollable object, called by the destructor. | |
Protected Attributes | |
| satcat5::cfg::Register | m_ctrl_reg |
| unsigned | m_addr_rdcount |
| unsigned | m_addr_rdidx |
| u16 | m_addr_buff [SATCAT5_MDIO_BUFFSIZE] |
| satcat5::cfg::MdioEventListener * | m_callback [SATCAT5_MDIO_BUFFSIZE] |
Private Attributes | |
| satcat5::poll::Always * | m_next |
| bool satcat5::cfg::Mdio::direct_read | ( | unsigned | phy, |
| unsigned | reg, | ||
| unsigned | ref, | ||
| satcat5::cfg::MdioEventListener * | callback | ||
| ) |
Direct read from designated MDIO register.
The "ref" argument is echoed to the callback's "regaddr", to handle indirect read sequences. See also: "MdioGenericMmd" (Returns true if successful.)
Definition at line 55 of file cfgbus_mdio.cc.
| bool satcat5::cfg::Mdio::direct_write | ( | unsigned | phy, |
| unsigned | reg, | ||
| unsigned | data | ||
| ) |
Direct write to designated MDIO register.
(Returns true if successful.)
Definition at line 49 of file cfgbus_mdio.cc.
|
protectedvirtual |
Child class MUST override this method.
(This method should rarely be called directly.)
Implements satcat5::poll::Always.
Definition at line 43 of file cfgbus_mdio.cc.