Skip to content

Commit 284843f

Browse files
committed
Restore mbed OS 5.4 mbed_lwip_ function prototypes
External EMAC drivers are currently directly attaching to lwip_stack.c via mbed_lwip_bringup et al. Restore the original prototypes to avoid compatibility breakage.
1 parent 42cd1e1 commit 284843f

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

features/FEATURE_LWIP/lwip-interface/EthernetInterface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ nsapi_error_t EthernetInterface::set_dhcp(bool dhcp)
4646

4747
nsapi_error_t EthernetInterface::connect()
4848
{
49-
return mbed_lwip_bringup(_dhcp, false,
49+
return mbed_lwip_bringup_2(_dhcp, false,
5050
_ip_address[0] ? _ip_address : 0,
5151
_netmask[0] ? _netmask : 0,
5252
_gateway[0] ? _gateway : 0);
5353
}
5454

5555
nsapi_error_t EthernetInterface::disconnect()
5656
{
57-
return mbed_lwip_bringdown(false);
57+
return mbed_lwip_bringdown_2(false);
5858
}
5959

6060
const char *EthernetInterface::get_mac_address()

features/FEATURE_LWIP/lwip-interface/lwip_stack.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,13 @@ nsapi_error_t mbed_lwip_init(emac_interface_t *emac)
482482
return mbed_lwip_emac_init(emac);
483483
}
484484

485-
nsapi_error_t mbed_lwip_bringup(bool dhcp, bool ppp, const char *ip, const char *netmask, const char *gw)
485+
// Backwards compatibility with people using DEVICE_EMAC
486+
nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask, const char *gw)
487+
{
488+
return mbed_lwip_bringup_2(dhcp, false, ip, netmask, gw);
489+
}
490+
491+
nsapi_error_t mbed_lwip_bringup_2(bool dhcp, bool ppp, const char *ip, const char *netmask, const char *gw)
486492
{
487493
// Check if we've already connected
488494
if (lwip_connected) {
@@ -625,7 +631,13 @@ void mbed_lwip_clear_ipv6_addresses(struct netif *lwip_netif)
625631
}
626632
#endif
627633

628-
nsapi_error_t mbed_lwip_bringdown(bool ppp)
634+
// Backwards compatibility with people using DEVICE_EMAC
635+
nsapi_error_t mbed_lwip_bringdown(void)
636+
{
637+
return mbed_lwip_bringdown_2(false);
638+
}
639+
640+
nsapi_error_t mbed_lwip_bringdown_2(bool ppp)
629641
{
630642
// Check if we've connected
631643
if (!lwip_connected) {

features/FEATURE_LWIP/lwip-interface/lwip_stack.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
extern "C" {
2525
#endif
2626

27-
// Access to lwip through the nsapi
27+
// Access to lwip through the nsapi - be wary of API changes as external 1st-generation EMAC
28+
// drivers attach through these.
2829
nsapi_error_t mbed_lwip_init(emac_interface_t *emac);
2930
nsapi_error_t mbed_lwip_emac_init(emac_interface_t *emac);
30-
nsapi_error_t mbed_lwip_bringup(bool dhcp, bool ppp, const char *ip, const char *netmask, const char *gw);
31-
nsapi_error_t mbed_lwip_bringdown(bool ppp);
31+
nsapi_error_t mbed_lwip_bringup(bool dhcp, const char *ip, const char *netmask, const char *gw);
32+
nsapi_error_t mbed_lwip_bringup_2(bool dhcp, bool ppp, const char *ip, const char *netmask, const char *gw);
33+
nsapi_error_t mbed_lwip_bringdown(void);
34+
nsapi_error_t mbed_lwip_bringdown_2(bool ppp);
3235

3336
const char *mbed_lwip_get_mac_address(void);
3437
char *mbed_lwip_get_ip_address(char *buf, nsapi_size_t buflen);

features/FEATURE_LWIP/lwip-interface/ppp_lwip.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_error_t)
354354

355355
// mustn't start calling input until after connect -
356356
// attach deferred until ppp_lwip_connect, called from mbed_lwip_bringup
357-
nsapi_error_t retcode = mbed_lwip_bringup(false, true, NULL, NULL, NULL);
357+
nsapi_error_t retcode = mbed_lwip_bringup_2(false, true, NULL, NULL, NULL);
358358

359359
if (retcode != NSAPI_ERROR_OK && connect_error_code != NSAPI_ERROR_OK) {
360360
return connect_error_code;
@@ -365,7 +365,7 @@ nsapi_error_t nsapi_ppp_connect(FileHandle *stream, Callback<void(nsapi_error_t)
365365

366366
nsapi_error_t nsapi_ppp_disconnect(FileHandle *stream)
367367
{
368-
return mbed_lwip_bringdown(true);
368+
return mbed_lwip_bringdown_2(true);
369369
}
370370

371371
NetworkStack *nsapi_ppp_get_stack()

0 commit comments

Comments
 (0)