summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-08-03 00:14:49 -0400
committerMan, Jianting (Meco) <[email protected]>2022-08-03 22:45:27 -0400
commit067315ff409e4196f9b4540e92beb861a9a6eec7 (patch)
tree5ac83dcd224c7fd0e7aca869d91ae102ef7b15b9 /components
parent1990af6c96163105f27b914eb90501058321a2fd (diff)
[phy] fix the PHY_FULL_DUPLEX conflicts
Diffstat (limited to 'components')
-rw-r--r--components/drivers/include/drivers/phy.h44
-rw-r--r--components/drivers/phy/phy.c2
2 files changed, 13 insertions, 33 deletions
diff --git a/components/drivers/include/drivers/phy.h b/components/drivers/include/drivers/phy.h
index e1783fe328..e582a85319 100644
--- a/components/drivers/include/drivers/phy.h
+++ b/components/drivers/include/drivers/phy.h
@@ -19,52 +19,34 @@ 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. */
-};
+#define PHY_SPEED_10M 0U /* PHY 10M speed. */
+#define PHY_SPEED_100M 1U /* PHY 100M speed. */
/* Defines the PHY link duplex. */
-enum phy_duplex
-{
- PHY_HALF_DUPLEX = 0U, /* PHY half duplex. */
- PHY_FULL_DUPLEX /* PHY full duplex. */
-};
+#define PHY_HALF_DUPLEX 0U /* PHY half duplex. */
+#define PHY_FULL_DUPLEX 1U /* 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. */
-};
+#define PHY_LOCAL_LOOP 0U /* PHY local loopback. */
+#define PHY_REMOTE_LOOP 1U /* PHY remote loopback. */
+#define PHY_STATUS_OK 0U
+#define PHY_STATUS_FAIL 1U
+#define PHY_STATUS_TIMEOUT 2U
-struct rt_phy_msg
+typedef struct rt_phy_msg
{
rt_uint32_t reg;
rt_uint32_t value;
-};
+}rt_phy_msg_t;
-typedef struct rt_phy_msg rt_phy_msg_t;
-
-
-struct rt_phy_device
+typedef struct rt_phy_device
{
struct rt_device parent;
struct rt_mdio_bus *bus;
rt_uint32_t addr;
struct rt_phy_ops *ops;
-};
-
-typedef struct rt_phy_device rt_phy_t;
-
-
-enum {
- PHY_STATUS_OK = 0,
- PHY_STATUS_FAIL,
- PHY_STATUS_TIMEOUT,
-};
+}rt_phy_t;
typedef rt_int32_t rt_phy_status;
diff --git a/components/drivers/phy/phy.c b/components/drivers/phy/phy.c
index 8e91aea99f..ef47a91d7c 100644
--- a/components/drivers/phy/phy.c
+++ b/components/drivers/phy/phy.c
@@ -31,8 +31,6 @@ static rt_size_t phy_device_write(rt_device_t dev, rt_off_t pos, const void *buf
return phy->bus->ops->write(phy->bus, phy->addr, msg->reg, &(msg->value), 4);
}
-
-
#ifdef RT_USING_DEVICE_OPS
const static struct rt_device_ops phy_ops =
{