Synopsis
typedef struct {
int addr;
unsigned flags;
CTL_NET_PHY_INIT_FN_t init_fn;
CTL_NET_PHY_UPDATE_FN_t update_fn;
CTL_PHY_STATE_t state;
CTL_MUTEX_t mutex;
const char *name;
} CTL_NET_PHY_DRIVER_t;
Description
CTL_NET_PHY_DRIVER_t contains data and hardware-specific function overloads for
the PHY layer. The CTL_NET_PHY_DRIVER_t structure has the following members:
-
addr
- The address of the PHY in use, 0 through 31. The network stack
sets this member before initializing the PHY using init_fn.
-
flags
- The PHY-layer flags including link capability and operating mode.
-
state
- The logical state of the PHY. This member must only be written
by the update_fn method, to reflect the current link state.
-
init_fn
- The MAC layer should call the wrapper version of this function,
ctl_phy_init, during hardware initialization, after the MII is
initialized.
-
update_fn
- The network task will periodically call the wrapper version of
this function, ctl_net_update_phy, to update the PHY state.
-
mutex
- When user-level code wants access to PHY registers, this holds
off the periodic functions so we can access the PHY ourselves.
There is no need for direct access to this mutex as the wrapper
functions ctl_net_read_phy_register and ctl_net_get_phy_state
lock the mutex to prevent simultaneous access by the network task.
-
name
- The device name of the PHY.
See Also
ctl_net_update_phy, ctl_net_get_phy_state, ctl_net_get_phy_flags, ctl_net_read_phy_register.