esp_netif: Enable use of the ESP-IDF with a non-LWIP (and non-BSD-style) IP stack.

Note: besides the esp-netif component, this commit also disables
net_sockets.c from mbedtls, which is one of the base components and uses BSD API (not specifically lwIP). This might be refactored to use CONFIG_SUPPORT_BSD_API instead of CONFIG_ESP_NETIF_TCPIP_LWIP
in the future.
It also disables smartconfig_ack.c and wifi_init.c from esp_wifi
component for referencing some lwIP config options (smartconfig_ack.c changes might be also
updated to check CONFIG_SUPPORT_BSD_API)

Merges https://github.com/espressif/esp-idf/pull/5856
pull/5682/merge
cnlohr 2020-09-11 15:37:28 -07:00 zatwierdzone przez David Cermak
rodzic 65c94dfb4c
commit 507c08251e
9 zmienionych plików z 50 dodań i 7 usunięć

Wyświetl plik

@ -18,6 +18,7 @@
#include "esp_netif.h"
#include "esp_netif_private.h"
#include "esp_netif_sta_list.h"
#if CONFIG_ESP_NETIF_LOOPBACK
@ -432,7 +433,7 @@ const char *esp_netif_get_desc(esp_netif_t *esp_netif)
return esp_netif->if_desc;
}
uint32_t esp_netif_get_event_id(esp_netif_t *esp_netif, esp_netif_ip_event_type_t event_type)
int32_t esp_netif_get_event_id(esp_netif_t *esp_netif, esp_netif_ip_event_type_t event_type)
{
return 0;
}

Wyświetl plik

@ -16,6 +16,8 @@
#include "esp_netif_lwip_internal.h"
#include "esp_netif_lwip_ppp.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#include "netif/wlanif.h"
#include "netif/ethernetif.h"
@ -59,3 +61,5 @@ const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_eth = &s_e
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_sta = &s_wifi_netif_config_sta;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_wifi_ap = &s_wifi_netif_config_ap;
const esp_netif_netstack_config_t *_g_esp_netif_netstack_default_ppp = &s_netif_config_ppp;
#endif /*CONFIG_ESP_NETIF_TCPIP_LWIP*/

Wyświetl plik

@ -19,6 +19,8 @@
#include "esp_netif_slip.h"
#include "lwip/netif.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
struct esp_netif_netstack_lwip_vanilla_config {
err_t (*init_fn)(struct netif*);
void (*input_fn)(void *netif, void *buffer, size_t len, void *eb);
@ -126,3 +128,5 @@ struct esp_netif_obj {
char * if_desc;
int route_prio;
};
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -12,8 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "lwip/dns.h"
#include "esp_netif.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#include "lwip/dns.h"
#include "netif/ppp/pppapi.h"
#include "netif/ppp/pppos.h"
#include "esp_log.h"
@ -21,8 +25,8 @@
#include "esp_event.h"
#include "esp_netif_ppp.h"
#include "esp_netif_lwip_internal.h"
#include "lwip/ip6_addr.h"
#include <string.h>
#include "lwip/ip6_addr.h"
ESP_EVENT_DEFINE_BASE(NETIF_PPP_STATUS);
@ -384,3 +388,5 @@ esp_err_t esp_netif_ppp_set_params(esp_netif_t *netif, const esp_netif_ppp_confi
LOG_PPP_DISABLED_AND_DO(return ESP_ERR_NOT_SUPPORTED)
#endif /* PPPOS_SUPPORT */
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -15,6 +15,8 @@
#ifndef _ESP_NETIF_LWIP_PPP_H_
#define _ESP_NETIF_LWIP_PPP_H_
#if CONFIG_ESP_NETIF_TCPIP_LWIP
/**
* @brief Creates new PPP related structure
*
@ -75,4 +77,7 @@ esp_err_t esp_netif_stop_ppp(netif_related_data_t *netif_related);
*/
void esp_netif_ppp_set_default_netif(netif_related_data_t *netif_related);
#endif // _ESP_NETIF_LWIP_PPP_H_
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */
#endif // _ESP_NETIF_LWIP_PPP_H_

Wyświetl plik

@ -13,12 +13,16 @@
// limitations under the License.
#include "lwip/dns.h"
#include "esp_netif.h"
#include "esp_log.h"
#include "esp_netif_slip.h"
#include "esp_netif_lwip_internal.h"
#include "esp_netif_net_stack.h"
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#include "lwip/dns.h"
#include "lwip/opt.h"
#include "lwip/ip6_addr.h"
#include "lwip/netif.h"
@ -296,3 +300,4 @@ void sio_send(uint8_t c, sio_fd_t fd)
ESP_LOGD(TAG, "%s: uart_write_bytes error %i", __func__, ret);
}
}
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */

Wyświetl plik

@ -17,14 +17,17 @@
* it will use UDP to send 'ACK' to cellphone.
*/
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "lwip/sockets.h"
#include "esp_netif.h"
#include "esp_log.h"
#include "esp_wifi.h"
#include "esp_event.h"
#if CONFIG_ESP_NETIF_TCPIP_LWIP
#include <string.h>
#include "lwip/sockets.h"
#include "esp_smartconfig.h"
#include "smartconfig_ack.h"
@ -208,3 +211,6 @@ void sc_send_ack_stop(void)
{
s_sc_ack_send = false;
}
#endif

Wyświetl plik

@ -149,6 +149,8 @@ static void esp_wifi_config_info(void)
#ifdef CONFIG_ESP32_WIFI_RX_BA_WIN
ESP_LOGI(TAG, "rx ba win: %d", CONFIG_ESP32_WIFI_RX_BA_WIN);
#endif
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
ESP_LOGI(TAG, "tcpip mbox: %d", CONFIG_LWIP_TCPIP_RECVMBOX_SIZE);
ESP_LOGI(TAG, "udp mbox: %d", CONFIG_LWIP_UDP_RECVMBOX_SIZE);
ESP_LOGI(TAG, "tcp mbox: %d", CONFIG_LWIP_TCP_RECVMBOX_SIZE);
@ -171,6 +173,10 @@ static void esp_wifi_config_info(void)
#ifdef CONFIG_LWIP_IRAM_OPTIMIZATION
ESP_LOGI(TAG, "LWIP IRAM OP enabled");
#endif
#else
ESP_LOGI(TAG, "LWIP disabled");
#endif
}
esp_err_t esp_wifi_init(const wifi_init_config_t *config)
@ -241,3 +247,4 @@ void wifi_apb80m_release(void)
esp_pm_lock_release(s_wifi_modem_sleep_lock);
}
#endif //CONFIG_PM_ENABLE

Wyświetl plik

@ -27,6 +27,8 @@
#include MBEDTLS_CONFIG_FILE
#endif
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
#if !defined(MBEDTLS_NET_C)
#if defined(MBEDTLS_PLATFORM_C)
@ -441,3 +443,6 @@ void mbedtls_net_free( mbedtls_net_context *ctx )
}
#endif /* MBEDTLS_NET_C */
#endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */