Skip to content

Commit 95e3a8f

Browse files
authored
Merge pull request #2882 from cesanta/phy
Add MG_TCPIP_PHY_CONF
2 parents bdc009e + ffeff3a commit 95e3a8f

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

mongoose.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,10 +2915,10 @@ struct mg_phy {
29152915

29162916
// PHY configuration settings, bitmask
29172917
enum {
2918-
MG_PHY_LEDS_ACTIVE_HIGH =
2919-
(1 << 0), // Set if PHY LEDs are connected to ground
2920-
MG_PHY_CLOCKS_MAC =
2921-
(1 << 1) // Set when PHY clocks MAC. Otherwise, MAC clocks PHY
2918+
// Set if PHY LEDs are connected to ground
2919+
MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0),
2920+
// Set when PHY clocks MAC. Otherwise, MAC clocks PHY
2921+
MG_PHY_CLOCKS_MAC = (1 << 1),
29222922
};
29232923

29242924
enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M };
@@ -3028,6 +3028,10 @@ struct mg_tcpip_driver_stm32h_data {
30283028
uint8_t phy_conf; // PHY config
30293029
};
30303030

3031+
#ifndef MG_TCPIP_PHY_CONF
3032+
#define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC
3033+
#endif
3034+
30313035
#ifndef MG_TCPIP_PHY_ADDR
30323036
#define MG_TCPIP_PHY_ADDR 0
30333037
#endif
@@ -3042,6 +3046,7 @@ struct mg_tcpip_driver_stm32h_data {
30423046
static struct mg_tcpip_if mif_; \
30433047
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
30443048
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
3049+
driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \
30453050
mif_.ip = MG_TCPIP_IP; \
30463051
mif_.mask = MG_TCPIP_MASK; \
30473052
mif_.gw = MG_TCPIP_GW; \

src/drivers/phy.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ struct mg_phy {
99

1010
// PHY configuration settings, bitmask
1111
enum {
12-
MG_PHY_LEDS_ACTIVE_HIGH =
13-
(1 << 0), // Set if PHY LEDs are connected to ground
14-
MG_PHY_CLOCKS_MAC =
15-
(1 << 1) // Set when PHY clocks MAC. Otherwise, MAC clocks PHY
12+
// Set if PHY LEDs are connected to ground
13+
MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0),
14+
// Set when PHY clocks MAC. Otherwise, MAC clocks PHY
15+
MG_PHY_CLOCKS_MAC = (1 << 1),
1616
};
1717

1818
enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M };

src/drivers/stm32h.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ struct mg_tcpip_driver_stm32h_data {
2828
uint8_t phy_conf; // PHY config
2929
};
3030

31+
#ifndef MG_TCPIP_PHY_CONF
32+
#define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC
33+
#endif
34+
3135
#ifndef MG_TCPIP_PHY_ADDR
3236
#define MG_TCPIP_PHY_ADDR 0
3337
#endif
@@ -42,6 +46,7 @@ struct mg_tcpip_driver_stm32h_data {
4246
static struct mg_tcpip_if mif_; \
4347
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
4448
driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
49+
driver_data_.phy_conf = MG_TCPIP_PHY_CONF; \
4550
mif_.ip = MG_TCPIP_IP; \
4651
mif_.mask = MG_TCPIP_MASK; \
4752
mif_.gw = MG_TCPIP_GW; \

0 commit comments

Comments
 (0)