Skip to content

Commit 43edd07

Browse files
committed
fix(eppp): Per C++ issues and PPP disabled
1 parent 1f3e55d commit 43edd07

File tree

2 files changed

+57
-43
lines changed

2 files changed

+57
-43
lines changed

components/eppp_link/eppp_link.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static int get_netif_num(esp_netif_t *netif)
163163
return netif_cnt;
164164
}
165165

166+
#ifdef CONFIG_LWIP_PPP_SUPPORT
166167
static void on_ppp_event(void *arg, esp_event_base_t base, int32_t event_id, void *data)
167168
{
168169
esp_netif_t **netif = data;
@@ -172,6 +173,7 @@ static void on_ppp_event(void *arg, esp_event_base_t base, int32_t event_id, voi
172173
h->netif_stop = true;
173174
}
174175
}
176+
#endif
175177

176178
static void on_ip_event(void *arg, esp_event_base_t base, int32_t event_id, void *data)
177179
{
@@ -222,7 +224,9 @@ static void remove_handlers(void)
222224
vEventGroupDelete(s_event_group);
223225
s_event_group = NULL;
224226
esp_event_handler_unregister(IP_EVENT, ESP_EVENT_ANY_ID, on_ip_event);
227+
#ifdef CONFIG_LWIP_PPP_SUPPORT
225228
esp_event_handler_unregister(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, on_ppp_event);
229+
#endif
226230
}
227231
}
228232

@@ -296,11 +300,13 @@ esp_netif_t *eppp_open(eppp_type_t role, eppp_config_t *config, int connect_time
296300
remove_handlers();
297301
return NULL;
298302
}
303+
#ifdef CONFIG_LWIP_PPP_SUPPORT
299304
if (esp_event_handler_register(NETIF_PPP_STATUS, ESP_EVENT_ANY_ID, on_ppp_event, NULL) != ESP_OK) {
300305
ESP_LOGE(TAG, "Failed to register PPP status handler");
301306
remove_handlers();
302307
return NULL;
303308
}
309+
#endif // CONFIG_LWIP_PPP_SUPPORT
304310
}
305311
esp_netif_t *netif = eppp_init(role, config);
306312
if (!netif) {

components/eppp_link/include/eppp_link.h

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
*/
66
#pragma once
77

8+
#ifdef __cplusplus
9+
extern "C" {
10+
#endif
11+
812
#define EPPP_DEFAULT_SERVER_IP() ESP_IP4TOADDR(192, 168, 11, 1)
913
#define EPPP_DEFAULT_CLIENT_IP() ESP_IP4TOADDR(192, 168, 11, 2)
1014

@@ -110,49 +114,49 @@ typedef enum eppp_transport {
110114

111115
typedef struct eppp_config_t {
112116
eppp_transport_t transport;
113-
union {
114-
struct eppp_config_spi_s {
115-
int host;
116-
bool is_master;
117-
int mosi;
118-
int miso;
119-
int sclk;
120-
int cs;
121-
int intr;
122-
int freq;
123-
int input_delay_ns;
124-
int cs_ena_pretrans;
125-
int cs_ena_posttrans;
126-
} spi;
127-
128-
struct eppp_config_uart_s {
129-
int port;
130-
int baud;
131-
int tx_io;
132-
int rx_io;
133-
int queue_size;
134-
int rx_buffer_size;
135-
} uart;
136-
137-
struct eppp_config_sdio_s {
138-
bool is_host;
139-
int width;
140-
int clk;
141-
int cmd;
142-
int d0;
143-
int d1;
144-
int d2;
145-
int d3;
146-
} sdio;
147-
148-
struct eppp_config_ethernet_s {
149-
int mdc_io;
150-
int mdio_io;
151-
int phy_addr;
152-
int rst_io;
153-
} ethernet;
154-
155-
};
117+
// union {
118+
struct eppp_config_spi_s {
119+
int host;
120+
bool is_master;
121+
int mosi;
122+
int miso;
123+
int sclk;
124+
int cs;
125+
int intr;
126+
int freq;
127+
int input_delay_ns;
128+
int cs_ena_pretrans;
129+
int cs_ena_posttrans;
130+
} spi;
131+
132+
struct eppp_config_uart_s {
133+
int port;
134+
int baud;
135+
int tx_io;
136+
int rx_io;
137+
int queue_size;
138+
int rx_buffer_size;
139+
} uart;
140+
141+
struct eppp_config_sdio_s {
142+
bool is_host;
143+
int width;
144+
int clk;
145+
int cmd;
146+
int d0;
147+
int d1;
148+
int d2;
149+
int d3;
150+
} sdio;
151+
152+
struct eppp_config_ethernet_s {
153+
int mdc_io;
154+
int mdio_io;
155+
int phy_addr;
156+
int rst_io;
157+
} ethernet;
158+
159+
// };
156160
struct eppp_config_task_s {
157161
bool run_task;
158162
int stack_size;
@@ -201,3 +205,7 @@ esp_err_t eppp_perform(esp_netif_t *netif);
201205
typedef esp_err_t (*eppp_channel_fn_t)(esp_netif_t *netif, int nr, void *buffer, size_t len);
202206

203207
esp_err_t eppp_add_channels(esp_netif_t *netif, int nr, eppp_channel_fn_t *tx, const eppp_channel_fn_t rx);
208+
209+
#ifdef __cplusplus
210+
}
211+
#endif

0 commit comments

Comments
 (0)