14#ifndef ZEPHYR_INCLUDE_DRIVERS_PHY_H_
15#define ZEPHYR_INCLUDE_DRIVERS_PHY_H_
61#define PHY_LINK_IS_FULL_DUPLEX(x) \
62 (x & (LINK_FULL_10BASE | LINK_FULL_100BASE | LINK_FULL_1000BASE | LINK_FULL_2500BASE | \
72#define PHY_LINK_IS_SPEED_1000M(x) (x & (LINK_HALF_1000BASE | LINK_FULL_1000BASE))
81#define PHY_LINK_IS_SPEED_100M(x) (x & (LINK_HALF_100BASE | LINK_FULL_100BASE))
90#define PHY_LINK_IS_SPEED_10M(x) (x & (LINK_HALF_10BASE | LINK_FULL_10BASE))
181__subsystem
struct ethphy_driver_api {
213 int (*get_plca_sts)(
const struct device *dev,
bool *plca_sts);
295 return DEVICE_API_GET(ethphy, dev)->link_cb_set(dev, callback, user_data);
443 return DEVICE_API_GET(ethphy, dev)->get_plca_sts(dev, plca_status);
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1350
static int phy_link_callback_set(const struct device *dev, phy_callback_t callback, void *user_data)
Set link state change callback.
Definition phy.h:288
int genphy_get_plca_cfg(const struct device *dev, struct phy_plca_cfg *plca_cfg)
Write PHY PLCA configuration.
static int phy_set_plca_cfg(const struct device *dev, struct phy_plca_cfg *plca_cfg)
Write PHY PLCA configuration.
Definition phy.h:397
static int phy_read(const struct device *dev, uint16_t reg_addr, uint32_t *value)
Read PHY registers.
Definition phy.h:310
static int phy_write_c45(const struct device *dev, uint8_t devad, uint16_t regad, uint16_t data)
Write PHY C45 register.
Definition phy.h:376
static int phy_get_link_state(const struct device *dev, struct phy_link_state *state)
Get PHY link state.
Definition phy.h:261
static int phy_read_c45(const struct device *dev, uint8_t devad, uint16_t regad, uint16_t *data)
Read PHY C45 register.
Definition phy.h:353
static int phy_write(const struct device *dev, uint16_t reg_addr, uint32_t value)
Write PHY register.
Definition phy.h:331
phy_cfg_link_flag
Ethernet configure link flags.
Definition phy.h:101
static int phy_get_plca_sts(const struct device *dev, bool *plca_status)
Read PHY PLCA status.
Definition phy.h:437
int genphy_set_plca_cfg(const struct device *dev, struct phy_plca_cfg *plca_cfg)
Read PHY PLCA configuration.
static int phy_get_plca_cfg(const struct device *dev, struct phy_plca_cfg *plca_cfg)
Read PHY PLCA configuration.
Definition phy.h:417
phy_link_speed
Ethernet link speeds.
Definition phy.h:35
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.
Definition phy.h:172
int genphy_get_plca_sts(const struct device *dev, bool *plca_status)
Read PHY PLCA status.
static int phy_configure_link(const struct device *dev, enum phy_link_speed speeds, enum phy_cfg_link_flag flags)
Configure PHY link.
Definition phy.h:233
@ PHY_FLAG_AUTO_NEGOTIATION_DISABLED
Auto-negotiation disable.
Definition phy.h:103
@ LINK_HALF_10BASE
10Base Half-Duplex
Definition phy.h:37
@ LINK_FULL_2500BASE
2.5GBase Full-Duplex
Definition phy.h:49
@ LINK_FULL_10BASE
10Base Full-Duplex
Definition phy.h:39
@ LINK_HALF_100BASE
100Base Half-Duplex
Definition phy.h:41
@ LINK_FULL_1000BASE
1000Base Full-Duplex
Definition phy.h:47
@ LINK_HALF_1000BASE
1000Base Half-Duplex
Definition phy.h:45
@ LINK_FULL_5000BASE
5GBase Full-Duplex
Definition phy.h:51
@ LINK_FULL_100BASE
100Base Full-Duplex
Definition phy.h:43
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
#define IS_POWER_OF_TWO(x)
Check if a x is a power of two.
Definition util_macro.h:77
#define EINVAL
Invalid argument.
Definition errno.h:60
#define ENOSYS
Function not implemented.
Definition errno.h:82
#define NULL
Definition iar_missing_defs.h:20
flags
Definition parser.h:97
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
void * data
Address of the device instance private data.
Definition device.h:520
Link state.
Definition phy.h:93
bool is_up
When true the link is active and connected.
Definition phy.h:97
enum phy_link_speed speed
Link speed.
Definition phy.h:95
PLCA (Physical Layer Collision Avoidance) Reconciliation Sublayer configurations.
Definition phy.h:107
uint8_t to_timer
PLCA to_timer in bit-times, which determines the PLCA transmit opportunity.
Definition phy.h:121
uint8_t node_count
PLCA node count.
Definition phy.h:115
uint8_t version
PLCA register map version.
Definition phy.h:109
bool enable
PLCA configured mode (enable/disable)
Definition phy.h:111
uint8_t node_id
PLCA local node identifier.
Definition phy.h:113
uint8_t burst_count
Additional frames a node is allowed to send in single transmit opportunity (TO)
Definition phy.h:117
uint8_t burst_timer
Wait time for the MAC to send a new frame before interrupting the burst.
Definition phy.h:119