lwip: Adapted lwip port layer to use 2.1.2-esp in 4.0

This commit is contained in:
David Cermak 2019-11-27 10:34:04 +01:00 committed by Jack
parent e6006a6bdf
commit 5e67f9578d
3 changed files with 17 additions and 5 deletions

@ -1 +1 @@
Subproject commit f2bd195eed8f0d6e5cb784bccdba6c9b2e487e75
Subproject commit c483f30ba22ac3c56c113f2466c39e7d6f60ab89

View File

@ -61,7 +61,7 @@
* @param buf memory alloc in L2 layer
* @note this function is also the callback when invoke pbuf_free
*/
static void ethernet_free_rx_buf_l2(void *buf)
static void ethernet_free_rx_buf_l2(struct netif *netif, void *buf)
{
free(buf);
}
@ -158,7 +158,7 @@ void ethernetif_input(struct netif *netif, void *buffer, uint16_t len)
if (buffer == NULL || !netif_is_up(netif)) {
if (buffer) {
ethernet_free_rx_buf_l2(buffer);
ethernet_free_rx_buf_l2(netif, buffer);
}
return;
}
@ -166,7 +166,7 @@ void ethernetif_input(struct netif *netif, void *buffer, uint16_t len)
/* acquire new pbuf, type: PBUF_REF */
p = pbuf_alloc(PBUF_RAW, len, PBUF_REF);
if (p == NULL) {
ethernet_free_rx_buf_l2(buffer);
ethernet_free_rx_buf_l2(netif, buffer);
return;
}
p->payload = buffer;

View File

@ -52,6 +52,18 @@
#include "tcpip_adapter.h"
/**
* @brief Free resources allocated in L2 layer
*
* This function translates the free_tx_buf to the prototype used on 2.1.2-esp branch
*
* @param buf memory alloc in L2 layer
* @note this function is also the callback when invoke pbuf_free
*/
static void wlanif_free_rx_buf_l2(struct netif *netif, void *buf)
{
esp_wifi_internal_free_rx_buffer(buf);
}
/**
* In this function, the hardware should be initialized.
@ -82,7 +94,7 @@ low_level_init(struct netif *netif)
#endif
#if !ESP_L2_TO_L3_COPY
netif->l2_buffer_free_notify = esp_wifi_internal_free_rx_buffer;
netif->l2_buffer_free_notify = wlanif_free_rx_buf_l2;
#endif
}