12#ifndef ZEPHYR_INCLUDE_DRIVERS_PHY_H_
13#define ZEPHYR_INCLUDE_DRIVERS_PHY_H_
40#define PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3)))
41#define PHY_LINK_IS_SPEED_100M(x) (x & (BIT(2) | BIT(3)))
70__subsystem
struct ethphy_driver_api {
72 int (*get_link)(
const struct device *dev,
76 int (*cfg_link)(
const struct device *dev,
110static inline int z_impl_phy_configure_link(
const struct device *dev,
113 const struct ethphy_driver_api *api =
114 (
const struct ethphy_driver_api *)dev->
api;
116 return api->cfg_link(dev, speeds);
135static inline int z_impl_phy_get_link_state(
const struct device *dev,
138 const struct ethphy_driver_api *api =
139 (
const struct ethphy_driver_api *)dev->
api;
141 return api->get_link(dev,
state);
162static inline int z_impl_phy_link_callback_set(
const struct device *dev,
166 const struct ethphy_driver_api *api =
167 (
const struct ethphy_driver_api *)dev->
api;
169 return api->link_cb_set(dev, callback,
user_data);
187static inline int z_impl_phy_read(
const struct device *dev,
uint16_t reg_addr,
190 const struct ethphy_driver_api *api =
191 (
const struct ethphy_driver_api *)dev->
api;
193 return api->read(dev, reg_addr, value);
211static inline int z_impl_phy_write(
const struct device *dev,
uint16_t reg_addr,
214 const struct ethphy_driver_api *api =
215 (
const struct ethphy_driver_api *)dev->
api;
217 return api->write(dev, reg_addr, value);
229#include <syscalls/phy.h>
void
Definition: eswifi_shell.c:15
int phy_get_link_state(const struct device *dev, struct phy_link_state *state)
Get PHY link state.
int phy_read(const struct device *dev, uint16_t reg_addr, uint32_t *value)
Read PHY registers.
int phy_write(const struct device *dev, uint16_t reg_addr, uint32_t value)
Write PHY register.
int phy_configure_link(const struct device *dev, enum phy_link_speed speeds)
Configure PHY link.
phy_link_speed
Ethernet link speeds.
Definition: phy.h:29
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:60
int phy_link_callback_set(const struct device *dev, phy_callback_t callback, void *user_data)
Set link state change callback.
@ LINK_HALF_100BASE_T
Definition: phy.h:35
@ LINK_HALF_10BASE_T
Definition: phy.h:31
@ LINK_FULL_10BASE_T
Definition: phy.h:33
@ LINK_FULL_100BASE_T
Definition: phy.h:37
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
state
Definition: http_parser_state.h:30
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
Link state.
Definition: phy.h:44
bool is_up
Definition: phy.h:48
enum phy_link_speed speed
Definition: phy.h:46
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
static const intptr_t user_data[5]
Definition: main.c:590