mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 13:00:19 +00:00
Merge branch 'feature/lwip_rework_patches' into 'master'
lw-IP: Reworked patches Closes IDFGH-6197 See merge request espressif/esp-idf!17388
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
*/
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_netif_net_stack.h"
|
||||
#include "netif/wlanif.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_private/wifi.h"
|
||||
#include "esp_wifi_netif.h"
|
||||
@@ -24,28 +26,6 @@ typedef struct wifi_netif_driver {
|
||||
|
||||
static const char* TAG = "wifi_netif";
|
||||
|
||||
/**
|
||||
* @brief Local storage for netif handles and callbacks for specific wifi interfaces
|
||||
*/
|
||||
static esp_netif_receive_t s_wifi_rxcbs[MAX_WIFI_IFS] = { NULL };
|
||||
static esp_netif_t *s_wifi_netifs[MAX_WIFI_IFS] = { NULL };
|
||||
|
||||
/**
|
||||
* @brief WiFi netif driver IO functions, a thin glue layer
|
||||
* to the original wifi interface API
|
||||
*/
|
||||
static esp_err_t wifi_sta_receive(void *buffer, uint16_t len, void *eb)
|
||||
{
|
||||
return s_wifi_rxcbs[WIFI_IF_STA](s_wifi_netifs[WIFI_IF_STA], buffer, len, eb);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
|
||||
static esp_err_t wifi_ap_receive(void *buffer, uint16_t len, void *eb)
|
||||
{
|
||||
return s_wifi_rxcbs[WIFI_IF_AP](s_wifi_netifs[WIFI_IF_AP], buffer, len, eb);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void wifi_free(void *h, void* buffer)
|
||||
{
|
||||
if (buffer) {
|
||||
@@ -88,7 +68,6 @@ void esp_wifi_destroy_if_driver(wifi_netif_driver_t h)
|
||||
if (h) {
|
||||
esp_wifi_internal_reg_rxcb(h->wifi_if, NULL); // ignore the potential error
|
||||
// as the wifi might have been already uninitialized
|
||||
s_wifi_netifs[h->wifi_if] = NULL;
|
||||
}
|
||||
free(h);
|
||||
}
|
||||
@@ -129,7 +108,6 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
wifi_interface_t wifi_interface = ifx->wifi_if;
|
||||
s_wifi_rxcbs[wifi_interface] = fn;
|
||||
wifi_rxcb_t rxcb = NULL;
|
||||
esp_err_t ret;
|
||||
|
||||
@@ -137,12 +115,12 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
|
||||
{
|
||||
|
||||
case WIFI_IF_STA:
|
||||
rxcb = wifi_sta_receive;
|
||||
rxcb = wifi_rxcb_sta;
|
||||
break;
|
||||
|
||||
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
|
||||
case WIFI_IF_AP:
|
||||
rxcb = wifi_ap_receive;
|
||||
rxcb = wifi_rxcb_ap;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -155,10 +133,10 @@ esp_err_t esp_wifi_register_if_rxcb(wifi_netif_driver_t ifx, esp_netif_receive_t
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
s_wifi_netifs[wifi_interface] = ifx->base.netif;
|
||||
if ((ret = esp_wifi_internal_reg_rxcb(wifi_interface, rxcb)) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "esp_wifi_internal_reg_rxcb for if=%d failed with %d", wifi_interface, ret);
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
set_wifi_netif(wifi_interface, esp_netif_get_netif_impl(arg));
|
||||
return ESP_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user