|
Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Ethernet PHY Interface. More...
Data Structures | |
| struct | phy_link_state |
| Link state. More... | |
Macros | |
| #define | PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3))) |
| #define | PHY_LINK_IS_SPEED_100M(x) (x & (BIT(2) | BIT(3))) |
Typedefs | |
| typedef void(* | phy_callback_t) (const struct device *dev, struct phy_link_state *state, void *user_data) |
Define the callback function signature for phy_link_callback_set() function. More... | |
Enumerations | |
| enum | phy_link_speed { LINK_HALF_10BASE_T = BIT(0) , LINK_FULL_10BASE_T = BIT(1) , LINK_HALF_100BASE_T = BIT(2) , LINK_FULL_100BASE_T = BIT(3) } |
| Ethernet link speeds. More... | |
Functions | |
| int | phy_configure_link (const struct device *dev, enum phy_link_speed speeds) |
| Configure PHY link. More... | |
| int | phy_get_link_state (const struct device *dev, struct phy_link_state *state) |
| Get PHY link state. More... | |
| int | phy_link_callback_set (const struct device *dev, phy_callback_t callback, void *user_data) |
| Set link state change callback. More... | |
| int | phy_read (const struct device *dev, uint16_t reg_addr, uint32_t *value) |
| Read PHY registers. More... | |
| int | phy_write (const struct device *dev, uint16_t reg_addr, uint32_t value) |
| Write PHY register. More... | |
Ethernet PHY Interface.
#include <include/net/phy.h>
#include <include/net/phy.h>
| phy_callback_t |
#include <include/net/phy.h>
Define the callback function signature for phy_link_callback_set() function.
| dev | PHY device structure |
| state | Pointer to link_state structure. |
| user_data | Pointer to data specified by user |
| enum phy_link_speed |
#include <include/net/phy.h>
Ethernet link speeds.
| Enumerator | |
|---|---|
| LINK_HALF_10BASE_T | 10Base-T Half-Duplex |
| LINK_FULL_10BASE_T | 10Base-T Full-Duplex |
| LINK_HALF_100BASE_T | 100Base-T Half-Duplex |
| LINK_FULL_100BASE_T | 100Base-T Full-Duplex |
| int phy_configure_link | ( | const struct device * | dev, |
| enum phy_link_speed | speeds | ||
| ) |
#include <include/net/phy.h>
Configure PHY link.
This route configures the advertised link speeds.
| [in] | dev | PHY device structure |
| speeds | OR'd link speeds to be advertised by the PHY |
| 0 | If successful. |
| -EIO | If communication with PHY failed. |
| -ENOTSUP | If not supported. |
| int phy_get_link_state | ( | const struct device * | dev, |
| struct phy_link_state * | state | ||
| ) |
#include <include/net/phy.h>
Get PHY link state.
Returns the current state of the PHY link. This can be used by to determine when a link is up and the negotiated link speed.
| [in] | dev | PHY device structure |
| state | Pointer to receive PHY state |
| 0 | If successful. |
| -EIO | If communication with PHY failed. |
| int phy_link_callback_set | ( | const struct device * | dev, |
| phy_callback_t | callback, | ||
| void * | user_data | ||
| ) |
#include <include/net/phy.h>
Set link state change callback.
Sets a callback that is invoked when link state changes. This is the preferred method for ethernet drivers to be notified of the PHY link state change.
| [in] | dev | PHY device structure |
| callback | Callback handler | |
| user_data | Pointer to data specified by user. |
| 0 | If successful. |
| -ENOTSUP | If not supported. |
#include <include/net/phy.h>
Read PHY registers.
This routine provides a generic interface to read from a PHY register.
| [in] | dev | PHY device structure |
| [in] | reg_addr | Register address |
| value | Pointer to receive read value |
| 0 | If successful. |
| -EIO | If communication with PHY failed. |
#include <include/net/phy.h>
Write PHY register.
This routine provides a generic interface to write to a PHY register.
| [in] | dev | PHY device structure |
| [in] | reg_addr | Register address |
| [in] | value | Value to write |
| 0 | If successful. |
| -EIO | If communication with PHY failed. |