From ffeff3ab69d828fb0faa7b09ec8fc4fab5e5f34e Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 3 Sep 2024 12:49:37 +0100 Subject: [PATCH] Add MG_TCPIP_PHY_CONF --- mongoose.h | 13 +++++++++---- src/drivers/phy.h | 8 ++++---- src/drivers/stm32h.h | 5 +++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/mongoose.h b/mongoose.h index 1cc3d837..8eb0713c 100644 --- a/mongoose.h +++ b/mongoose.h @@ -2901,10 +2901,10 @@ struct mg_phy { // PHY configuration settings, bitmask enum { - MG_PHY_LEDS_ACTIVE_HIGH = - (1 << 0), // Set if PHY LEDs are connected to ground - MG_PHY_CLOCKS_MAC = - (1 << 1) // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + // Set if PHY LEDs are connected to ground + MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0), + // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + MG_PHY_CLOCKS_MAC = (1 << 1), }; enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M }; @@ -3014,6 +3014,10 @@ struct mg_tcpip_driver_stm32h_data { uint8_t phy_conf; // PHY config }; +#ifndef MG_TCPIP_PHY_CONF +#define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC +#endif + #ifndef MG_TCPIP_PHY_ADDR #define MG_TCPIP_PHY_ADDR 0 #endif @@ -3028,6 +3032,7 @@ struct mg_tcpip_driver_stm32h_data { static struct mg_tcpip_if mif_; \ driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \ driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \ + driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \ mif_.ip = MG_TCPIP_IP; \ mif_.mask = MG_TCPIP_MASK; \ mif_.gw = MG_TCPIP_GW; \ diff --git a/src/drivers/phy.h b/src/drivers/phy.h index f96e9bae..30ae6ba3 100644 --- a/src/drivers/phy.h +++ b/src/drivers/phy.h @@ -9,10 +9,10 @@ struct mg_phy { // PHY configuration settings, bitmask enum { - MG_PHY_LEDS_ACTIVE_HIGH = - (1 << 0), // Set if PHY LEDs are connected to ground - MG_PHY_CLOCKS_MAC = - (1 << 1) // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + // Set if PHY LEDs are connected to ground + MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0), + // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + MG_PHY_CLOCKS_MAC = (1 << 1), }; enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M }; diff --git a/src/drivers/stm32h.h b/src/drivers/stm32h.h index 6fa3285c..7938d42f 100644 --- a/src/drivers/stm32h.h +++ b/src/drivers/stm32h.h @@ -28,6 +28,10 @@ struct mg_tcpip_driver_stm32h_data { uint8_t phy_conf; // PHY config }; +#ifndef MG_TCPIP_PHY_CONF +#define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC +#endif + #ifndef MG_TCPIP_PHY_ADDR #define MG_TCPIP_PHY_ADDR 0 #endif @@ -42,6 +46,7 @@ struct mg_tcpip_driver_stm32h_data { static struct mg_tcpip_if mif_; \ driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \ driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \ + driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \ mif_.ip = MG_TCPIP_IP; \ mif_.mask = MG_TCPIP_MASK; \ mif_.gw = MG_TCPIP_GW; \