SIM_INTERFACE(mii_management) { int (*serial_access)(conf_object_t *obj, int data_in, int clock); uint16 (*read_register)(conf_object_t *obj, int phy, int reg); void (*write_register)(conf_object_t *obj, int phy, int reg, uint16 value); }; #define MII_MANAGEMENT_INTERFACE "mii_management"
Interface that should be implemented by classes that represents one or multiple PHY's that have MII management interfaces.
The read_register function should return the 16-bit value of the specified register. There are 32 registers numbered 0-31. The phy argument indicates the PHY number (0-31). Classes that represents one PHY can ignore this argument. The write_register function is called when a register is written.
To support low-level bitwise accesses via MDIO and MDC pins, the
function serial_access can be used. It is recommended to
leave this function unimplemented and let an instance of
mii-management-bus convert the low-level bit operations
to higher level read/write register calls.
The serial_access function takes as argument the MDIO and MDC
pin levels on the master, and return the MDIO pin from the slave. Note
that mii-management-bus also have signal
interfaces for these pins.