Merge pull request #2882 from cesanta/phy

Add MG_TCPIP_PHY_CONF
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2024-09-03 11:26:43 -03:00
commit 95e3a8f3cc
3 files changed
+18 -8

No files matched your search

+9 -4
View File
@@ -2915,10 +2915,10 @@ struct mg_phy {
// PHY configuration settings, bitmask // PHY configuration settings, bitmask
enum { enum {
MG_PHY_LEDS_ACTIVE_HIGH = // Set if PHY LEDs are connected to ground
(1 << 0), // Set if PHY LEDs are connected to ground MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0),
MG_PHY_CLOCKS_MAC = // Set when PHY clocks MAC. Otherwise, MAC clocks PHY
(1 << 1) // 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 }; enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M };
@@ -3028,6 +3028,10 @@ struct mg_tcpip_driver_stm32h_data {
uint8_t phy_conf; // PHY config 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 #ifndef MG_TCPIP_PHY_ADDR
#define MG_TCPIP_PHY_ADDR 0 #define MG_TCPIP_PHY_ADDR 0
#endif #endif
@@ -3042,6 +3046,7 @@ struct mg_tcpip_driver_stm32h_data {
static struct mg_tcpip_if mif_; \ static struct mg_tcpip_if mif_; \
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \ driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \ driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \
mif_.ip = MG_TCPIP_IP; \ mif_.ip = MG_TCPIP_IP; \
mif_.mask = MG_TCPIP_MASK; \ mif_.mask = MG_TCPIP_MASK; \
mif_.gw = MG_TCPIP_GW; \ mif_.gw = MG_TCPIP_GW; \
+4 -4
View File
@@ -9,10 +9,10 @@ struct mg_phy {
// PHY configuration settings, bitmask // PHY configuration settings, bitmask
enum { enum {
MG_PHY_LEDS_ACTIVE_HIGH = // Set if PHY LEDs are connected to ground
(1 << 0), // Set if PHY LEDs are connected to ground MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0),
MG_PHY_CLOCKS_MAC = // Set when PHY clocks MAC. Otherwise, MAC clocks PHY
(1 << 1) // 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 }; enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M };
+5
View File
@@ -28,6 +28,10 @@ struct mg_tcpip_driver_stm32h_data {
uint8_t phy_conf; // PHY config 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 #ifndef MG_TCPIP_PHY_ADDR
#define MG_TCPIP_PHY_ADDR 0 #define MG_TCPIP_PHY_ADDR 0
#endif #endif
@@ -42,6 +46,7 @@ struct mg_tcpip_driver_stm32h_data {
static struct mg_tcpip_if mif_; \ static struct mg_tcpip_if mif_; \
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \ driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \ driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \
mif_.ip = MG_TCPIP_IP; \ mif_.ip = MG_TCPIP_IP; \
mif_.mask = MG_TCPIP_MASK; \ mif_.mask = MG_TCPIP_MASK; \
mif_.gw = MG_TCPIP_GW; \ mif_.gw = MG_TCPIP_GW; \