Files
ESPC3-wireless/components/system/include/drivers/chip/phy.h
2024-03-28 12:19:52 +08:00

49 lines
1.1 KiB
C
Executable File

#ifndef __PHY_H__
#define __PHY_H__
#ifdef __cplusplus
extern "C"
{
#endif
/* Defines the PHY link speed. This is align with the speed for MAC. */
enum phy_speed
{
PHY_SPEED_10M = 0U, /* PHY 10M speed. */
PHY_SPEED_100M /* PHY 100M speed. */
};
/* Defines the PHY link duplex. */
enum phy_duplex
{
PHY_HALF_DUPLEX = 0U, /* PHY half duplex. */
PHY_FULL_DUPLEX /* PHY full duplex. */
};
/*! @brief Defines the PHY loopback mode. */
enum phy_loop
{
PHY_LOCAL_LOOP = 0U, /* PHY local loopback. */
PHY_REMOTE_LOOP /* PHY remote loopback. */
};
typedef struct
{
enum phy_speed speed;
enum phy_duplex duplex;
enum phy_loop loop;
} phy_param_t;
int drv_phy_init(unsigned phy_addr, unsigned src_clock_hz, phy_param_t *param);
int drv_phy_read(unsigned reg, unsigned *data);
int drv_phy_write(unsigned reg, unsigned data);
int drv_phy_loopback(unsigned mode, unsigned speed, unsigned enable);
int drv_phy_get_link_status(unsigned *status);
int drv_phy_get_link_speed_duplex(unsigned *speed, unsigned *duplex);
#ifdef __cplusplus
}
#endif
#endif