mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 07:34:32 +02:00
Merge branch 'feature/add_internal_api_header' into 'master'
Feature/add internal api header 1. Add esp_wifi_internal.h 2. Rename system_pp_recycle_rx_pkt to esp_wifi_internal_free_rx_buffer 3. rename esp_wifi_tx_is_stop to esp_wifi_internal_tx_is_stop 4. rename ieee80211_output to esp_wifi_internal_tx See merge request !151
This commit is contained in:
80
components/esp32/include/esp_wifi_internal.h
Normal file
80
components/esp32/include/esp_wifi_internal.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
/*
|
||||||
|
* All the APIs declared here are internal only APIs, it can only be used by
|
||||||
|
* espressif internal modules, such as SSC, LWIP, TCPIP adapter etc, espressif
|
||||||
|
* customers are not recommended to use them.
|
||||||
|
*
|
||||||
|
* If someone really want to use specified APIs declared in here, please contact
|
||||||
|
* espressif AE/developer to make sure you know the limitations or risk of
|
||||||
|
* the API, otherwise you may get unexpected behavior!!!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __ESP_WIFI_INTERNAL_H__
|
||||||
|
#define __ESP_WIFI_INTERNAL_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/queue.h"
|
||||||
|
#include "rom/queue.h"
|
||||||
|
#include "esp_err.h"
|
||||||
|
#include "esp_wifi_types.h"
|
||||||
|
#include "esp_event.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief get whether the wifi driver is allowed to transmit data or not
|
||||||
|
*
|
||||||
|
* @param none
|
||||||
|
*
|
||||||
|
* @return true : upper layer should stop to transmit data to wifi driver
|
||||||
|
* @return false : upper layer can transmit data to wifi driver
|
||||||
|
*/
|
||||||
|
bool esp_wifi_internal_tx_is_stop(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief free the rx buffer which allocated by wifi driver
|
||||||
|
*
|
||||||
|
* @param void* buffer: rx buffer pointer
|
||||||
|
*
|
||||||
|
* @return nonoe
|
||||||
|
*/
|
||||||
|
void esp_wifi_internal_free_rx_buffer(void* buffer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief transmit the buffer via wifi driver
|
||||||
|
*
|
||||||
|
* @attention1 TODO should modify the return type from bool to int
|
||||||
|
*
|
||||||
|
* @param wifi_interface_t wifi_if : wifi interface id
|
||||||
|
* @param void *buffer : the buffer to be tansmit
|
||||||
|
* @param u16_t len : the length of buffer
|
||||||
|
*
|
||||||
|
* @return True : success transmit the buffer to wifi driver
|
||||||
|
* False : failed to transmit the buffer to wifi driver
|
||||||
|
*/
|
||||||
|
bool esp_wifi_internal_tx(wifi_interface_t wifi_if, void *buffer, u16_t len);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ESP_WIFI_H__ */
|
Submodule components/esp32/lib updated: a1e5f8b953...d3920845c9
@@ -388,10 +388,8 @@ static void lwip_socket_drop_registered_memberships(int s);
|
|||||||
#endif /* LWIP_IGMP */
|
#endif /* LWIP_IGMP */
|
||||||
|
|
||||||
#ifdef LWIP_ESP8266
|
#ifdef LWIP_ESP8266
|
||||||
|
#include "esp_wifi_internal.h"
|
||||||
/* Since esp_wifi_tx_is_stop/system_get_free_heap_size are not an public wifi API, so extern them here*/
|
#include "esp_system.h"
|
||||||
extern size_t system_get_free_heap_size(void);
|
|
||||||
extern bool esp_wifi_tx_is_stop(void);
|
|
||||||
|
|
||||||
/* Please be notified that this flow control is just a workaround for fixing wifi Q full issue.
|
/* Please be notified that this flow control is just a workaround for fixing wifi Q full issue.
|
||||||
* Under UDP/TCP pressure test, we found that the sockets may cause wifi tx queue full if the socket
|
* Under UDP/TCP pressure test, we found that the sockets may cause wifi tx queue full if the socket
|
||||||
@@ -402,9 +400,9 @@ extern bool esp_wifi_tx_is_stop(void);
|
|||||||
*/
|
*/
|
||||||
static inline void esp32_tx_flow_ctrl(void)
|
static inline void esp32_tx_flow_ctrl(void)
|
||||||
{
|
{
|
||||||
uint8_t _wait_delay = 0;
|
uint8_t _wait_delay = 1;
|
||||||
|
|
||||||
while ((system_get_free_heap_size() < HEAP_HIGHWAT) || esp_wifi_tx_is_stop()){
|
while ((system_get_free_heap_size() < HEAP_HIGHWAT) || esp_wifi_internal_tx_is_stop()){
|
||||||
vTaskDelay(_wait_delay/portTICK_RATE_MS);
|
vTaskDelay(_wait_delay/portTICK_RATE_MS);
|
||||||
if (_wait_delay < 64) _wait_delay *= 2;
|
if (_wait_delay < 64) _wait_delay *= 2;
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,7 @@ static const char mem_debug_file[] ICACHE_RODATA_ATTR STORE_ATTR = __FILE__;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LWIP_ESP8266
|
#ifdef LWIP_ESP8266
|
||||||
|
#include "esp_wifi_internal.h"
|
||||||
#define EP_OFFSET 0
|
#define EP_OFFSET 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -764,8 +765,7 @@ pbuf_free(struct pbuf *p)
|
|||||||
} else if (type == PBUF_ROM || type == PBUF_REF) {
|
} else if (type == PBUF_ROM || type == PBUF_REF) {
|
||||||
|
|
||||||
#ifdef LWIP_ESP8266
|
#ifdef LWIP_ESP8266
|
||||||
extern void system_pp_recycle_rx_pkt(void*);
|
if (type == PBUF_REF && p->eb != NULL ) esp_wifi_internal_free_rx_buffer(p->eb);
|
||||||
if (type == PBUF_REF && p->eb != NULL ) system_pp_recycle_rx_pkt(p->eb);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memp_free(MEMP_PBUF, p);
|
memp_free(MEMP_PBUF, p);
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
|
||||||
|
#include "esp_wifi_internal.h"
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -18,8 +20,6 @@ err_t wlanif_init(struct netif *netif);
|
|||||||
|
|
||||||
void wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb);
|
void wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb);
|
||||||
|
|
||||||
bool ieee80211_output(wifi_interface_t wifi_if, void *buffer, u16_t len);
|
|
||||||
|
|
||||||
wifi_interface_t wifi_get_interface(void *dev);
|
wifi_interface_t wifi_get_interface(void *dev);
|
||||||
|
|
||||||
void netif_reg_addr_change_cb(void* cb);
|
void netif_reg_addr_change_cb(void* cb);
|
||||||
|
@@ -150,12 +150,12 @@ low_level_output(struct netif *netif, struct pbuf *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ieee80211_output(wifi_if, q->payload, pbuf_x_len);
|
esp_wifi_internal_tx(wifi_if, q->payload, pbuf_x_len);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
for(q = p; q != NULL; q = q->next) {
|
for(q = p; q != NULL; q = q->next) {
|
||||||
ieee80211_output(wifi_if, q->payload, q->len);
|
esp_wifi_internal_tx(wifi_if, q->payload, q->len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user