diff --git a/cores/esp32/esp32-hal-i2c.c b/cores/esp32/esp32-hal-i2c.c index 317e0bd5..dd3d35ba 100644 --- a/cores/esp32/esp32-hal-i2c.c +++ b/cores/esp32/esp32-hal-i2c.c @@ -340,7 +340,8 @@ i2c_err_t i2cRead(i2c_t * i2c, uint16_t address, bool addr_10bit, uint8_t * data // Save bytes from the buffer as they arrive instead of doing them at the end of the loop since there is no // pause from an END operation in this approach. if((!isEndNear) && (nextCmdCount < 2)) { - if (willRead = ((len>32)?32:len)) { + willRead = ((len>32)?32:len); + if (willRead > 0) { if (willRead > 1) { i2cSetCmd(i2c, cmdIdx, I2C_CMD_READ, (amountRead[ inc( &cmdIdx ) ] = willRead -1), false, false, false); nextCmdCount++; diff --git a/tools/sdk/bin/bootloader.bin b/tools/sdk/bin/bootloader.bin index 9ef5534e..84381228 100644 Binary files a/tools/sdk/bin/bootloader.bin and b/tools/sdk/bin/bootloader.bin differ diff --git a/tools/sdk/bin/bootloader_qio.bin b/tools/sdk/bin/bootloader_qio.bin index 0d10db37..54207d8d 100644 Binary files a/tools/sdk/bin/bootloader_qio.bin and b/tools/sdk/bin/bootloader_qio.bin differ diff --git a/tools/sdk/include/config/sdkconfig.h b/tools/sdk/include/config/sdkconfig.h index acf727b2..4522d22d 100644 --- a/tools/sdk/include/config/sdkconfig.h +++ b/tools/sdk/include/config/sdkconfig.h @@ -68,7 +68,6 @@ #define CONFIG_CONSOLE_UART_NUM 0 #define CONFIG_ESP32_APPTRACE_LOCK_ENABLE 1 #define CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC 1 -#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0 #define CONFIG_TCP_OVERSIZE_MSS 1 #define CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS 1 #define CONFIG_CONSOLE_UART_DEFAULT 1 @@ -85,7 +84,7 @@ #define CONFIG_TCPIP_TASK_STACK_SIZE 2560 #define CONFIG_FATFS_CODEPAGE_850 1 #define CONFIG_TASK_WDT 1 -#define CONFIG_MAIN_TASK_STACK_SIZE 8192 +#define CONFIG_MAIN_TASK_STACK_SIZE 4096 #define CONFIG_SPIFFS_PAGE_CHECK 1 #define CONFIG_TASK_WDT_TIMEOUT_S 5 #define CONFIG_INT_WDT_TIMEOUT_MS 300 diff --git a/tools/sdk/include/console/esp_console.h b/tools/sdk/include/console/esp_console.h index 17cf5fe7..bea7eee7 100644 --- a/tools/sdk/include/console/esp_console.h +++ b/tools/sdk/include/console/esp_console.h @@ -107,6 +107,8 @@ esp_err_t esp_console_cmd_register(const esp_console_cmd_t *cmd); * @param[out] cmd_ret return code from the command (set if command was run) * @return * - ESP_OK, if command was run + * - ESP_ERR_INVALID_ARG, if the command line is empty, or only contained + * whitespace * - ESP_ERR_NOT_FOUND, if command with given name wasn't registered * - ESP_ERR_INVALID_STATE, if esp_console_init wasn't called */ diff --git a/tools/sdk/include/driver/driver/adc.h b/tools/sdk/include/driver/driver/adc.h index 08d32288..799001dd 100644 --- a/tools/sdk/include/driver/driver/adc.h +++ b/tools/sdk/include/driver/driver/adc.h @@ -20,24 +20,38 @@ extern "C" { #endif #include +#include #include "esp_err.h" #include "driver/gpio.h" #include "soc/adc_channel.h" typedef enum { - ADC_ATTEN_0db = 0, /*!=0) The number of data bytes that pushed to the I2C slave buffer. */ -int i2c_slave_write_buffer(i2c_port_t i2c_num, uint8_t* data, int size, portBASE_TYPE ticks_to_wait); +int i2c_slave_write_buffer(i2c_port_t i2c_num, uint8_t* data, int size, TickType_t ticks_to_wait); /** * @brief I2C slave read data from internal buffer. When I2C slave receive data, isr will copy received data @@ -375,7 +375,7 @@ int i2c_slave_write_buffer(i2c_port_t i2c_num, uint8_t* data, int size, portBASE * - ESP_FAIL(-1) Parameter error * - Others(>=0) The number of data bytes that read from I2C slave buffer. */ -int i2c_slave_read_buffer(i2c_port_t i2c_num, uint8_t* data, size_t max_size, portBASE_TYPE ticks_to_wait); +int i2c_slave_read_buffer(i2c_port_t i2c_num, uint8_t* data, size_t max_size, TickType_t ticks_to_wait); /** * @brief set I2C master clock period @@ -481,6 +481,25 @@ esp_err_t i2c_set_data_timing(i2c_port_t i2c_num, int sample_time, int hold_time */ esp_err_t i2c_get_data_timing(i2c_port_t i2c_num, int* sample_time, int* hold_time); +/** + * @brief set I2C timeout value + * @param i2c_num I2C port number + * @param timeout timeout value for I2C bus (unit: APB 80Mhz clock cycle) + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Parameter error + */ +esp_err_t i2c_set_timeout(i2c_port_t i2c_num, int timeout); + +/** + * @brief get I2C timeout value + * @param i2c_num I2C port number + * @param timeout pointer to get timeout value + * @return + * - ESP_OK Success + * - ESP_ERR_INVALID_ARG Parameter error + */ +esp_err_t i2c_get_timeout(i2c_port_t i2c_num, int* timeout); /** * @brief set I2C data transfer mode * diff --git a/tools/sdk/include/driver/driver/i2s.h b/tools/sdk/include/driver/driver/i2s.h index 354dd2a8..3644a831 100644 --- a/tools/sdk/include/driver/driver/i2s.h +++ b/tools/sdk/include/driver/driver/i2s.h @@ -26,6 +26,7 @@ #include "esp_attr.h" #include "esp_intr_alloc.h" #include "driver/periph_ctrl.h" +#include "driver/adc.h" #include "freertos/semphr.h" #ifdef __cplusplus @@ -118,7 +119,7 @@ typedef enum { I2S_MODE_TX = 4, I2S_MODE_RX = 8, I2S_MODE_DAC_BUILT_IN = 16, /*!< Output I2S data to built-in DAC, no matter the data format is 16bit or 32 bit, the DAC module will only take the 8bits from MSB*/ - //I2S_MODE_ADC_BUILT_IN = 32, /*!< Currently not supported yet, will be added for the next version*/ + I2S_MODE_ADC_BUILT_IN = 32, /*!< Input I2S data from built-in ADC, each data can be 12-bit width at most*/ I2S_MODE_PDM = 64, } i2s_mode_t; @@ -405,6 +406,17 @@ esp_err_t i2s_zero_dma_buffer(i2s_port_t i2s_num); */ esp_err_t i2s_set_clk(i2s_port_t i2s_num, uint32_t rate, i2s_bits_per_sample_t bits, i2s_channel_t ch); +/** + * @brief Set built-in ADC mode for I2S DMA, this function will initialize ADC pad, + * and set ADC parameters. + * @param adc_unit SAR ADC unit index + * @param adc_channel ADC channel index + * @return + * - ESP_OK Success + * - ESP_FAIL Parameter error + */ +esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel); + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/driver/driver/sdmmc_types.h b/tools/sdk/include/driver/driver/sdmmc_types.h index 4bc1e05e..835eaa3f 100644 --- a/tools/sdk/include/driver/driver/sdmmc_types.h +++ b/tools/sdk/include/driver/driver/sdmmc_types.h @@ -102,6 +102,7 @@ typedef struct { #define SCF_RSP_R6 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX) #define SCF_RSP_R7 (SCF_RSP_PRESENT|SCF_RSP_CRC|SCF_RSP_IDX) esp_err_t error; /*!< error returned from transfer */ + int timeout_ms; /*!< response timeout, in milliseconds */ } sdmmc_command_t; /** @@ -127,6 +128,7 @@ typedef struct { esp_err_t (*set_card_clk)(int slot, uint32_t freq_khz); /*!< host function to set card clock frequency */ esp_err_t (*do_transaction)(int slot, sdmmc_command_t* cmdinfo); /*!< host function to do a transaction */ esp_err_t (*deinit)(void); /*!< host function to deinitialize the driver */ + int command_timeout_ms; /*!< timeout, in milliseconds, of a single command. Set to 0 to use the default value. */ } sdmmc_host_t; /** diff --git a/tools/sdk/include/driver/driver/spi_slave.h b/tools/sdk/include/driver/driver/spi_slave.h index 047ab413..ed12cb62 100644 --- a/tools/sdk/include/driver/driver/spi_slave.h +++ b/tools/sdk/include/driver/driver/spi_slave.h @@ -53,6 +53,7 @@ typedef struct { */ struct spi_slave_transaction_t { size_t length; ///< Total data length, in bits + size_t trans_len; ///< Transaction data length, in bits const void *tx_buffer; ///< Pointer to transmit buffer, or NULL for no MOSI phase void *rx_buffer; ///< Pointer to receive buffer, or NULL for no MISO phase void *user; ///< User-defined variable. Can be used to store eg transaction ID. diff --git a/tools/sdk/include/driver/driver/touch_pad.h b/tools/sdk/include/driver/driver/touch_pad.h index ce67a7dc..9d14fe4e 100644 --- a/tools/sdk/include/driver/driver/touch_pad.h +++ b/tools/sdk/include/driver/driver/touch_pad.h @@ -31,8 +31,8 @@ typedef enum { TOUCH_PAD_NUM5, /*!< Touch pad channel 5 is GPIO12*/ TOUCH_PAD_NUM6, /*!< Touch pad channel 6 is GPIO14*/ TOUCH_PAD_NUM7, /*!< Touch pad channel 7 is GPIO27*/ - TOUCH_PAD_NUM8, /*!< Touch pad channel 8 is GPIO32*/ - TOUCH_PAD_NUM9, /*!< Touch pad channel 9 is GPIO33*/ + TOUCH_PAD_NUM8, /*!< Touch pad channel 8 is GPIO33*/ + TOUCH_PAD_NUM9, /*!< Touch pad channel 9 is GPIO32*/ TOUCH_PAD_MAX, } touch_pad_t; diff --git a/tools/sdk/include/driver/driver/uart.h b/tools/sdk/include/driver/driver/uart.h index 6c17fd65..a4227b34 100644 --- a/tools/sdk/include/driver/driver/uart.h +++ b/tools/sdk/include/driver/driver/uart.h @@ -106,7 +106,8 @@ typedef struct { uart_parity_t parity; /*!< UART parity mode*/ uart_stop_bits_t stop_bits; /*!< UART stop bits*/ uart_hw_flowcontrol_t flow_ctrl; /*!< UART HW flow control mode (cts/rts)*/ - uint8_t rx_flow_ctrl_thresh ; /*!< UART HW RTS threshold*/ + uint8_t rx_flow_ctrl_thresh; /*!< UART HW RTS threshold*/ + bool use_ref_tick; /*!< Set to true if UART should be clocked from REF_TICK */ } uart_config_t; /** diff --git a/tools/sdk/include/lwip/port/netif/wlanif.h b/tools/sdk/include/esp32/esp32/pm.h old mode 100755 new mode 100644 similarity index 51% rename from tools/sdk/include/lwip/port/netif/wlanif.h rename to tools/sdk/include/esp32/esp32/pm.h index 9c79f5b0..a7cbf0ea --- a/tools/sdk/include/lwip/port/netif/wlanif.h +++ b/tools/sdk/include/esp32/esp32/pm.h @@ -1,9 +1,9 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// Copyright 2016-2017 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 @@ -13,30 +13,30 @@ // limitations under the License. -#ifndef _WLAN_LWIP_IF_H_ -#define _WLAN_LWIP_IF_H_ +#pragma once +#include +#include +#include "esp_err.h" -#include "esp_wifi.h" - -#include "esp_wifi_internal.h" - -#include "lwip/err.h" +#include "soc/rtc.h" #ifdef __cplusplus extern "C" { #endif -err_t wlanif_init_ap(struct netif *netif); -err_t wlanif_init_sta(struct netif *netif); -void wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb); +/** + * @brief Power management config for ESP32 + * + * Pass a pointer to this structure as an argument to esp_pm_configure function. + */ +typedef struct { + rtc_cpu_freq_t max_cpu_freq; /*!< Maximum CPU frequency to use */ + rtc_cpu_freq_t min_cpu_freq; /*!< Minimum CPU frequency to use when no frequency locks are taken */ + bool light_sleep_enable; /*!< Enter light sleep when no locks are taken */ +} esp_pm_config_esp32_t; -wifi_interface_t wifi_get_interface(void *dev); - -void netif_reg_addr_change_cb(void* cb); #ifdef __cplusplus } #endif - -#endif /* _WLAN_LWIP_IF_H_ */ diff --git a/tools/sdk/include/esp32/esp_clk.h b/tools/sdk/include/esp32/esp_clk.h index 5c6f5cb8..6526aa92 100644 --- a/tools/sdk/include/esp32/esp_clk.h +++ b/tools/sdk/include/esp32/esp_clk.h @@ -18,20 +18,8 @@ * @file esp_clk.h * * This file contains declarations of clock related functions. - * These functions are used in ESP-IDF components, but should not be considered - * to be part of public API. */ -/** - * @brief Initialize clock-related settings - * - * Called from cpu_start.c, not intended to be called from other places. - * This function configures the CPU clock, RTC slow and fast clocks, and - * performs RTC slow clock calibration. - */ -void esp_clk_init(void); - - /** * @brief Get the calibration value of RTC slow clock * @@ -42,7 +30,6 @@ void esp_clk_init(void); */ uint32_t esp_clk_slowclk_cal_get(); - /** * @brief Update the calibration value of RTC slow clock * @@ -55,10 +42,34 @@ uint32_t esp_clk_slowclk_cal_get(); void esp_clk_slowclk_cal_set(uint32_t value); /** - * @brief Disables clock of some peripherals + * @brief Return current CPU clock frequency + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. * - * Called from cpu_start.c, not intended to be called from other places. - * This function disables clock of useless peripherals when cpu starts. + * @return CPU clock frequency, in Hz */ -void esp_perip_clk_init(void); +int esp_clk_cpu_freq(void); +/** + * @brief Return current APB clock frequency + * + * When frequency switching is performed, this frequency may change. + * However it is guaranteed that the frequency never changes with a critical + * section. + * + * @return APB clock frequency, in Hz + */ +int esp_clk_apb_freq(void); + + +/** + * @brief Read value of RTC counter, converting it to microseconds + * @attention The value returned by this function may change abruptly when + * calibration value of RTC counter is updated via esp_clk_slowclk_cal_set + * function. This should not happen unless application calls esp_clk_slowclk_cal_set. + * In ESP-IDF, esp_clk_slowclk_cal_set is only called in startup code. + * + * @return Value or RTC counter, expressed in microseconds + */ +uint64_t esp_clk_rtc_time(); diff --git a/tools/sdk/include/esp32/esp_crosscore_int.h b/tools/sdk/include/esp32/esp_crosscore_int.h index 0e4b2b83..2f1c5b3b 100644 --- a/tools/sdk/include/esp32/esp_crosscore_int.h +++ b/tools/sdk/include/esp32/esp_crosscore_int.h @@ -35,8 +35,20 @@ void esp_crosscore_int_init(); * This is used internally by FreeRTOS in multicore mode * and should not be called by the user. * - * @param coreID Core that should do the yielding + * @param core_id Core that should do the yielding */ -void esp_crosscore_int_send_yield(int coreId); +void esp_crosscore_int_send_yield(int core_id); -#endif \ No newline at end of file + +/** + * Send an interrupt to a CPU indicating it should update its + * CCOMPARE1 value due to a frequency switch. + * + * This is used internally when dynamic frequency switching is + * enabled, and should not be called from application code. + * + * @param core_id Core that should update its CCOMPARE1 value + */ +void esp_crosscore_int_send_freq_switch(int core_id); + +#endif diff --git a/tools/sdk/include/esp32/esp_freertos_hooks.h b/tools/sdk/include/esp32/esp_freertos_hooks.h index 42176cb1..3d211192 100644 --- a/tools/sdk/include/esp32/esp_freertos_hooks.h +++ b/tools/sdk/include/esp32/esp_freertos_hooks.h @@ -38,12 +38,13 @@ typedef void (*esp_freertos_tick_cb_t)(); * @warning Idle callbacks MUST NOT, UNDER ANY CIRCUMSTANCES, CALL * A FUNCTION THAT MIGHT BLOCK. * - * @param esp_freertos_idle_cb_t new_idle_cb : Callback to be called - * @param UBaseType_t cpuid : id of the core + * @param[in] new_idle_cb Callback to be called + * @param[in] cpuid id of the core * - * @return ESP_OK : Callback registered to the specified core's idle hook - * @return ESP_ERR_NO_MEM : No more space on the specified core's idle hook to register callback - * @return ESP_ERR_INVALID_ARG : cpuid is invalid + * @return + * - ESP_OK: Callback registered to the specified core's idle hook + * - ESP_ERR_NO_MEM: No more space on the specified core's idle hook to register callback + * - ESP_ERR_INVALID_ARG: cpuid is invalid */ esp_err_t esp_register_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t new_idle_cb, UBaseType_t cpuid); @@ -56,32 +57,35 @@ esp_err_t esp_register_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t new_idl * @warning Idle callbacks MUST NOT, UNDER ANY CIRCUMSTANCES, CALL * A FUNCTION THAT MIGHT BLOCK. * - * @param esp_freertos_idle_cb_t new_idle_cb : Callback to be called + * @param[in] new_idle_cb Callback to be called * - * @return ESP_OK : Callback registered to the calling core's idle hook - * @return ESP_ERR_NO_MEM : No more space the calling core's idle hook to register callback + * @return + * - ESP_OK: Callback registered to the calling core's idle hook + * - ESP_ERR_NO_MEM: No more space on the calling core's idle hook to register callback */ esp_err_t esp_register_freertos_idle_hook(esp_freertos_idle_cb_t new_idle_cb); /** * @brief Register a callback to be called from the specified core's tick hook. * - * @param esp_freertos_tick_cb_t new_tick_cb : Callback to be called - * @param UBaseType_t cpuid : id of the core + * @param[in] new_tick_cb Callback to be called + * @param[in] cpuid id of the core * - * @return ESP_OK : Callback registered - * @return ESP_ERR_NO_MEM : No more space on the specified core's tick hook to register the callback - * @return ESP_ERR_INVALID_ARG : cpuid is invalid + * @return + * - ESP_OK: Callback registered to specified core's tick hook + * - ESP_ERR_NO_MEM: No more space on the specified core's tick hook to register the callback + * - ESP_ERR_INVALID_ARG: cpuid is invalid */ esp_err_t esp_register_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t new_tick_cb, UBaseType_t cpuid); /** * @brief Register a callback to be called from the calling core's tick hook. * - * @param esp_freertos_tick_cb_t new_tick_cb : Callback to be called + * @param[in] new_tick_cb Callback to be called * - * @return ESP_OK : Callback registered - * @return ESP_ERR_NO_MEM : No more space on the calling core's tick hook to register the callback + * @return + * - ESP_OK: Callback registered to the calling core's tick hook + * - ESP_ERR_NO_MEM: No more space on the calling core's tick hook to register the callback */ esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb); @@ -91,9 +95,7 @@ esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb); * the idle hooks of both cores, the idle hook will be unregistered from * both cores * - * @param esp_freertos_idle_cb_t new_idle_cb : Callback to be unregistered - * - * @return void + * @param[in] old_idle_cb Callback to be unregistered */ void esp_deregister_freertos_idle_hook(esp_freertos_idle_cb_t old_idle_cb); @@ -103,9 +105,7 @@ void esp_deregister_freertos_idle_hook(esp_freertos_idle_cb_t old_idle_cb); * tick hooks of both cores, the tick hook will be unregistered from * both cores * - * @param esp_freertos_idle_cb_t new_idle_cb : Callback to be unregistered - * - * @return void + * @param[in] old_tick_cb Callback to be unregistered */ void esp_deregister_freertos_tick_hook(esp_freertos_tick_cb_t old_tick_cb); diff --git a/tools/sdk/include/esp32/esp_pm.h b/tools/sdk/include/esp32/esp_pm.h new file mode 100644 index 00000000..3887e77a --- /dev/null +++ b/tools/sdk/include/esp32/esp_pm.h @@ -0,0 +1,179 @@ +// Copyright 2016-2017 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. + +#pragma once +#include +#include +#include "esp_err.h" + +// Include SoC-specific definitions. Only ESP32 supported for now. +#include "esp32/pm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Power management constraints + */ +typedef enum { + /** + * Require CPU frequency to be at the maximum value set via esp_pm_configure. + * Argument is unused and should be set to 0. + */ + ESP_PM_CPU_FREQ_MAX, + /** + * Require APB frequency to be at the maximum value supported by the chip. + * Argument is unused and should be set to 0. + */ + ESP_PM_APB_FREQ_MAX, + /** + * Prevent the system from going into light sleep. + * Argument is unused and should be set to 0. + */ + ESP_PM_NO_LIGHT_SLEEP, +} esp_pm_lock_type_t; + +/** + * @brief Set implementation-specific power management configuration + * @param config pointer to implementation-specific configuration structure (e.g. esp_pm_config_esp32) + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the configuration values are not correct + * - ESP_ERR_NOT_SUPPORTED if certain combination of values is not supported, + * or if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_configure(const void* config); + + +/** + * @brief Opaque handle to the power management lock + */ +typedef struct esp_pm_lock* esp_pm_lock_handle_t; + + +/** + * @brief Initialize a lock handle for certain power management parameter + * + * When lock is created, initially it is not taken. + * Call esp_pm_lock_acquire to take the lock. + * + * This function must not be called from an ISR. + * + * @param lock_type Power management constraint which the lock should control + * @param arg argument, value depends on lock_type, see esp_pm_lock_type_t + * @param name arbitrary string identifying the lock (e.g. "wifi" or "spi"). + * Used by the esp_pm_dump_locks function to list existing locks. + * May be set to NULL. If not set to NULL, must point to a string which is valid + * for the lifetime of the lock. + * @param[out] out_handle handle returned from this function. Use this handle when calling + * esp_pm_lock_delete, esp_pm_lock_acquire, esp_pm_lock_release. + * Must not be NULL. + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if the lock structure can not be allocated + * - ESP_ERR_INVALID_ARG if out_handle is NULL or type argument is not valid + * - ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_lock_create(esp_pm_lock_type_t lock_type, int arg, + const char* name, esp_pm_lock_handle_t* out_handle); + +/** + * @brief Take a power management lock + * + * Once the lock is taken, power management algorithm will not switch to the + * mode specified in a call to esp_pm_lock_create, or any of the lower power + * modes (higher numeric values of 'mode'). + * + * The lock is recursive, in the sense that if esp_pm_lock_acquire is called + * a number of times, esp_pm_lock_release has to be called the same number of + * times in order to release the lock. + * + * This function may be called from an ISR. + * + * This function is not thread-safe w.r.t. calls to other esp_pm_lock_* + * functions for the same handle. + * + * @param handle handle obtained from esp_pm_lock_create function + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the handle is invalid + * - ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_lock_acquire(esp_pm_lock_handle_t handle); + +/** + * @brief Release the lock taken using esp_pm_lock_acquire. + * + * Call to this functions removes power management restrictions placed when + * taking the lock. + * + * Locks are recursive, so if esp_pm_lock_acquire is called a number of times, + * esp_pm_lock_release has to be called the same number of times in order to + * actually release the lock. + * + * This function may be called from an ISR. + * + * This function is not thread-safe w.r.t. calls to other esp_pm_lock_* + * functions for the same handle. + * + * @param handle handle obtained from esp_pm_lock_create function + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the handle is invalid + * - ESP_ERR_INVALID_STATE if lock is not acquired + * - ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_lock_release(esp_pm_lock_handle_t handle); + +/** + * @brief Delete a lock created using esp_pm_lock + * + * The lock must be released before calling this function. + * + * This function must not be called from an ISR. + * + * @param handle handle obtained from esp_pm_lock_create function + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the handle argument is NULL + * - ESP_ERR_INVALID_STATE if the lock is still acquired + * - ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_lock_delete(esp_pm_lock_handle_t handle); + +/** + * Dump the list of all locks to stderr + * + * This function dumps debugging information about locks created using + * esp_pm_lock_create to an output stream. + * + * This function must not be called from an ISR. If esp_pm_lock_acquire/release + * are called while this function is running, inconsistent results may be + * reported. + * + * @param stream stream to print information to; use stdout or stderr to print + * to the console; use fmemopen/open_memstream to print to a + * string buffer. + * @return + * - ESP_OK on success + * - ESP_ERR_NOT_SUPPORTED if CONFIG_PM_ENABLE is not enabled in sdkconfig + */ +esp_err_t esp_pm_dump_locks(FILE* stream); + + + +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/include/esp32/esp_spiram.h b/tools/sdk/include/esp32/esp_spiram.h index 2dbff1af..9663dcdd 100644 --- a/tools/sdk/include/esp32/esp_spiram.h +++ b/tools/sdk/include/esp32/esp_spiram.h @@ -27,6 +27,17 @@ */ esp_err_t esp_spiram_init(); +/** + * @brief Configure Cache/MMU for access to external SPI RAM. + * + * Normally this function is called from cpu_start, if CONFIG_SPIRAM_BOOT_INIT + * option is enabled. Applications which need to enable SPI RAM at run time + * can disable CONFIG_SPIRAM_BOOT_INIT, and call this function later. + * + * @attention this function must be called with flash cache disabled. + */ +void esp_spiram_init_cache(); + /** * @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and @@ -76,4 +87,4 @@ void esp_spiram_writeback_cache(); esp_err_t esp_spiram_reserve_dma_pool(size_t size); -#endif \ No newline at end of file +#endif diff --git a/tools/sdk/include/esp32/esp_timer.h b/tools/sdk/include/esp32/esp_timer.h new file mode 100644 index 00000000..e3e8b481 --- /dev/null +++ b/tools/sdk/include/esp32/esp_timer.h @@ -0,0 +1,226 @@ +// Copyright 2017 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. + +#pragma once + +/** + * @file esp_timer.h + * @brief microsecond-precision 64-bit timer API, replacement for ets_timer + * + * esp_timer APIs allow components to receive callbacks when a hardware timer + * reaches certain value. The timer provides microsecond accuracy and + * up to 64 bit range. Note that while the timer itself provides microsecond + * accuracy, callbacks are dispatched from an auxiliary task. Some time is + * needed to notify this task from timer ISR, and then to invoke the callback. + * If more than one callback needs to be dispatched at any particular time, + * each subsequent callback will be dispatched only when the previous callback + * returns. Therefore, callbacks should not do much work; instead, they should + * use RTOS notification mechanisms (queues, semaphores, event groups, etc.) to + * pass information to other tasks. + * + * It should be possible to request the callback to be called + * directly from the ISR. This reduces the latency, but has potential impact on + * all other callbacks which need to be dispatched. This option should only be + * used for simple callback functions, which do not take longer than a few + * microseconds to run. + * + * Implementation note: on the ESP32, esp_timer APIs use the "legacy" FRC2 + * timer. Timer callbacks are called from a task running on the PRO CPU. + */ + +#include +#include +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Opaque type representing a single esp_timer + */ +typedef struct esp_timer* esp_timer_handle_t; + +/** + * @brief Timer callback function type + * @param arg pointer to opaque user-specific data + */ +typedef void (*esp_timer_cb_t)(void* arg); + + +/** + * @brief Method for dispatching timer callback + */ +typedef enum { + ESP_TIMER_TASK, //!< Callback is called from timer task + + /* Not supported for now, provision to allow callbacks to run directly + * from an ISR: + + ESP_TIMER_ISR, //!< Callback is called from timer ISR + + */ +} esp_timer_dispatch_t; + +/** + * @brief Timer configuration passed to esp_timer_create + */ +typedef struct { + esp_timer_cb_t callback; //!< Function to call when timer expires + void* arg; //!< Argument to pass to the callback + esp_timer_dispatch_t dispatch_method; //!< Call the callback from task or from ISR + const char* name; //!< Timer name, used in esp_timer_dump function +} esp_timer_create_args_t; + +/** + * @brief Initialize esp_timer library + * + * @note This function is called from startup code. Applications do not need + * to call this function before using other esp_timer APIs. + * + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if allocation has failed + * - ESP_ERR_INVALID_STATE if already initialized + * - other errors from interrupt allocator + */ +esp_err_t esp_timer_init(); + +/** + * @brief De-initialize esp_timer library + * + * @note Normally this function should not be called from applications + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if not yet initialized + */ +esp_err_t esp_timer_deinit(); + +/** + * @brief Create an esp_timer instance + * + * @note When done using the timer, delete it with esp_timer_delete function. + * + * @param create_args Pointer to a structure with timer creation arguments. + * Not saved by the library, can be allocated on the stack. + * @param[out] out_handle Output, pointer to esp_timer_handle_t variable which + * will hold the created timer handle. + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if some of the create_args are not valid + * - ESP_ERR_INVALID_STATE if esp_timer library is not initialized yet + * - ESP_ERR_NO_MEM if memory allocation fails + */ +esp_err_t esp_timer_create(const esp_timer_create_args_t* create_args, + esp_timer_handle_t* out_handle); + +/** + * @brief Start one-shot timer + * + * Timer should not be running when this function is called. + * + * @param timer timer handle created using esp_timer_create + * @param timeout_us timer timeout, in microseconds relative to the current moment + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the handle is invalid + * - ESP_ERR_INVALID_STATE if the timer is already running + */ +esp_err_t esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us); + +/** + * @brief Start a periodic timer + * + * Timer should not be running when this function is called. This function will + * start the timer which will trigger every 'period' microseconds. + * + * @param timer timer handle created using esp_timer_create + * @param period timer period, in microseconds + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_ARG if the handle is invalid + * - ESP_ERR_INVALID_STATE if the timer is already running + */ +esp_err_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period); + +/** + * @brief Stop the timer + * + * This function stops the timer previously started using esp_timer_start_once + * or esp_timer_start_periodic. + * + * @param timer timer handle created using esp_timer_create + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if the timer is not running + */ +esp_err_t esp_timer_stop(esp_timer_handle_t timer); + +/** + * @brief Delete an esp_timer instance + * + * The timer must be stopped before deleting. A one-shot timer which has expired + * does not need to be stopped. + * + * @param timer timer handle allocated using esp_timer_create + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if the timer is not running + */ +esp_err_t esp_timer_delete(esp_timer_handle_t timer); + +/** + * @brief Get time in microseconds since boot + * @return number of microseconds since esp_timer_init was called (this normally + * happens early during application startup). + */ +int64_t esp_timer_get_time(); + +/** + * @brief Dump the list of timers to a stream + * + * If CONFIG_ESP_TIMER_PROFILING option is enabled, this prints the list of all + * the existing timers. Otherwise, only the list active timers is printed. + * + * The format is: + * + * name period alarm times_armed times_triggered total_callback_run_time + * + * where: + * + * name — timer name (if CONFIG_ESP_TIMER_PROFILING is defined), or timer pointer + * period — period of timer, in microseconds, or 0 for one-shot timer + * alarm - time of the next alarm, in microseconds since boot, or 0 if the timer + * is not started + * + * The following fields are printed if CONFIG_ESP_TIMER_PROFILING is defined: + * + * times_armed — number of times the timer was armed via esp_timer_start_X + * times_triggered - number of times the callback was called + * total_callback_run_time - total time taken by callback to execute, across all calls + * + * @param stream stream (such as stdout) to dump the information to + * @return + * - ESP_OK on success + * - ESP_ERR_NO_MEM if can not allocate temporary buffer for the output + */ +esp_err_t esp_timer_dump(FILE* stream); + + +#ifdef __cplusplus +} +#endif + diff --git a/tools/sdk/include/esp_adc_cal/esp_adc_cal.h b/tools/sdk/include/esp_adc_cal/esp_adc_cal.h index 4a2d06a9..adb65984 100644 --- a/tools/sdk/include/esp_adc_cal/esp_adc_cal.h +++ b/tools/sdk/include/esp_adc_cal/esp_adc_cal.h @@ -71,7 +71,7 @@ typedef struct { for uint32 arithmetic */ uint32_t offset; /** +#include "FreeRTOSConfig.h" /* Convert FreeRTOSConfig definitions to XTENSA definitions. diff --git a/tools/sdk/include/freertos/freertos/xtensa_timer.h b/tools/sdk/include/freertos/freertos/xtensa_timer.h index 9bb8648f..fa4f9609 100644 --- a/tools/sdk/include/freertos/freertos/xtensa_timer.h +++ b/tools/sdk/include/freertos/freertos/xtensa_timer.h @@ -49,7 +49,7 @@ and the Xtensa core configuration need not have a timer. #include "xtensa_rtos.h" /* in case this wasn't included directly */ -#include +#include "FreeRTOSConfig.h" /* Select timer to use for periodic tick, and determine its interrupt number diff --git a/tools/sdk/include/heap/esp_heap_caps.h b/tools/sdk/include/heap/esp_heap_caps.h index a5a9a39c..44822935 100644 --- a/tools/sdk/include/heap/esp_heap_caps.h +++ b/tools/sdk/include/heap/esp_heap_caps.h @@ -276,3 +276,33 @@ void *heap_caps_realloc_prefer( void *ptr, size_t size, size_t num, ... ); * @return A pointer to the memory allocated on success, NULL on failure */ void *heap_caps_calloc_prefer( size_t n, size_t size, size_t num, ... ); + +/** + * @brief Dump the full structure of all heaps with matching capabilities. + * + * Prints a large amount of output to serial (because of locking limitations, + * the output bypasses stdout/stderr). For each (variable sized) block + * in each matching heap, the following output is printed on a single line: + * + * - Block address (the data buffer returned by malloc is 4 bytes after this + * if heap debugging is set to Basic, or 8 bytes otherwise). + * - Data size (the data size may be larger than the size requested by malloc, + * either due to heap fragmentation or because of heap debugging level). + * - Address of next block in the heap. + * - If the block is free, the address of the next free block is also printed. + * + * @param caps Bitwise OR of MALLOC_CAP_* flags indicating the type + * of memory + */ +void heap_caps_dump(uint32_t caps); + +/** + * @brief Dump the full structure of all heaps. + * + * Covers all registered heaps. Prints a large amount of output to serial. + * + * Output is the same as for heap_caps_dump. + * + */ +void heap_caps_dump_all(); + diff --git a/tools/sdk/include/heap/multi_heap.h b/tools/sdk/include/heap/multi_heap.h index 9ea841bf..dbd0cae8 100644 --- a/tools/sdk/include/heap/multi_heap.h +++ b/tools/sdk/include/heap/multi_heap.h @@ -91,6 +91,8 @@ multi_heap_handle_t multi_heap_register(void *start, size_t size); * * The lock argument is supplied to the MULTI_HEAP_LOCK() and MULTI_HEAP_UNLOCK() macros, defined in multi_heap_platform.h. * + * The lock in question must be recursive. + * * When the heap is first registered, the associated lock is NULL. * * @param heap Handle to a registered heap. diff --git a/tools/sdk/include/lwip/apps/dhcpserver.h b/tools/sdk/include/lwip/apps/dhcpserver.h index a0024ab5..943f02a9 100644 --- a/tools/sdk/include/lwip/apps/dhcpserver.h +++ b/tools/sdk/include/lwip/apps/dhcpserver.h @@ -15,8 +15,6 @@ #define __DHCPS_H__ #include "lwip/ip_addr.h" -//#include "esp_common.h" -#define USE_DNS typedef struct dhcps_state{ s16_t state; @@ -46,6 +44,7 @@ typedef struct { enum dhcps_offer_option{ OFFER_START = 0x00, OFFER_ROUTER = 0x01, + OFFER_DNS = 0x02, OFFER_END }; @@ -63,17 +62,29 @@ typedef u32_t dhcps_time_t; typedef u8_t dhcps_offer_t; typedef struct { - dhcps_offer_t dhcps_offer; - dhcps_time_t dhcps_time; - dhcps_lease_t dhcps_poll; + dhcps_offer_t dhcps_offer; + dhcps_offer_t dhcps_dns; + dhcps_time_t dhcps_time; + dhcps_lease_t dhcps_poll; } dhcps_options_t; -#define dhcps_router_enabled(offer) ((offer & OFFER_ROUTER) != 0) +static inline bool dhcps_router_enabled (dhcps_offer_t offer) +{ + return (offer & OFFER_ROUTER) != 0; +} + +static inline bool dhcps_dns_enabled (dhcps_offer_t offer) +{ + return (offer & OFFER_DNS) != 0; +} void dhcps_start(struct netif *netif, ip4_addr_t ip); void dhcps_stop(struct netif *netif); void *dhcps_option_info(u8_t op_id, u32_t opt_len); +void dhcps_set_option_info(u8_t op_id, void *opt_info, u32_t opt_len); bool dhcp_search_ip_on_mac(u8_t *mac, ip4_addr_t *ip); +void dhcps_dns_setserver(const ip_addr_t *dnsserver); +ip4_addr_t dhcps_dns_getserver(); #endif diff --git a/tools/sdk/include/lwip/arch/sys_arch.h b/tools/sdk/include/lwip/arch/sys_arch.h index 716fd9fa..bb7ea18a 100644 --- a/tools/sdk/include/lwip/arch/sys_arch.h +++ b/tools/sdk/include/lwip/arch/sys_arch.h @@ -37,6 +37,7 @@ #include "freertos/task.h" #include "freertos/queue.h" #include "freertos/semphr.h" +#include "arch/vfs_lwip.h" #ifdef __cplusplus extern "C" { diff --git a/tools/sdk/include/lwip/port/netif/ethernetif.h b/tools/sdk/include/lwip/arch/vfs_lwip.h old mode 100755 new mode 100644 similarity index 66% rename from tools/sdk/include/lwip/port/netif/ethernetif.h rename to tools/sdk/include/lwip/arch/vfs_lwip.h index 134e8eb5..88714b03 --- a/tools/sdk/include/lwip/port/netif/ethernetif.h +++ b/tools/sdk/include/lwip/arch/vfs_lwip.h @@ -1,9 +1,9 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// Copyright 2017 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 @@ -12,24 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. - -#ifndef _ETH_LWIP_IF_H_ -#define _ETH_LWIP_IF_H_ - -#include "lwip/err.h" - #ifdef __cplusplus extern "C" { #endif -err_t ethernetif_init(struct netif *netif); +/* Internal declarations used to ingreate LWIP port layer + to ESP-IDF VFS for POSIX I/O. +*/ +extern int lwip_socket_offset; -void ethernetif_input(struct netif *netif, void *buffer, u16_t len); - -void netif_reg_addr_change_cb(void* cb); +void esp_vfs_lwip_sockets_register(); #ifdef __cplusplus } #endif - -#endif /* _ETH_LWIP_IF_H_ */ diff --git a/tools/sdk/include/lwip/lwip/dns.h b/tools/sdk/include/lwip/lwip/dns.h index 5ef12e56..e0802803 100755 --- a/tools/sdk/include/lwip/lwip/dns.h +++ b/tools/sdk/include/lwip/lwip/dns.h @@ -96,6 +96,7 @@ typedef void (*dns_found_callback)(const char *name, const ip_addr_t *ipaddr, vo void dns_init(void); void dns_tmr(void); void dns_setserver(u8_t numdns, const ip_addr_t *dnsserver); +void dns_clear_servers(bool keep_fallback); ip_addr_t dns_getserver(u8_t numdns); err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg); diff --git a/tools/sdk/include/lwip/lwipopts.h b/tools/sdk/include/lwip/lwipopts.h index 47b80ff6..88f4b118 100644 --- a/tools/sdk/include/lwip/lwipopts.h +++ b/tools/sdk/include/lwip/lwipopts.h @@ -34,6 +34,7 @@ #include #include +#include #include #include #include "esp_task.h" @@ -271,6 +272,9 @@ */ #define LWIP_DNS 1 +#define DNS_MAX_SERVERS 3 +#define DNS_FALLBACK_SERVER_INDEX (DNS_MAX_SERVERS - 1) + /* --------------------------------- ---------- UDP options ---------- @@ -687,6 +691,19 @@ #define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC +/** + * POSIX I/O functions are mapped to LWIP via the VFS layer + * (see port/vfs_lwip.c) + */ +#define LWIP_POSIX_SOCKETS_IO_NAMES 0 + + +/** + * Socket offset is also determined via the VFS layer at + * filesystem registration time (see port/vfs_lwip.c) + */ +#define LWIP_SOCKET_OFFSET lwip_socket_offset + /* Enable all Espressif-only options */ #define ESP_LWIP 1 @@ -707,6 +724,7 @@ #define ESP_STATS_TCP 0 #define ESP_DHCP_TIMER 1 #define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__) +#define ESP_PING 1 #define TCP_WND_DEFAULT CONFIG_TCP_WND_DEFAULT #define TCP_SND_BUF_DEFAULT CONFIG_TCP_SND_BUF_DEFAULT diff --git a/tools/sdk/include/lwip/port/arch/cc.h b/tools/sdk/include/lwip/port/arch/cc.h deleted file mode 100644 index cba0b365..00000000 --- a/tools/sdk/include/lwip/port/arch/cc.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef __ARCH_CC_H__ -#define __ARCH_CC_H__ - -#include -#include -#include -#include - -#include "arch/sys_arch.h" - -#define BYTE_ORDER LITTLE_ENDIAN - -typedef uint8_t u8_t; -typedef int8_t s8_t; -typedef uint16_t u16_t; -typedef int16_t s16_t; -typedef uint32_t u32_t; -typedef int32_t s32_t; - -typedef unsigned long mem_ptr_t; -typedef int sys_prot_t; - -#define S16_F "d" -#define U16_F "d" -#define X16_F "x" - -#define S32_F "d" -#define U32_F "d" -#define X32_F "x" - -#define PACK_STRUCT_FIELD(x) x -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#include - -#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) -// __assert_func is the assertion failure handler from newlib, defined in assert.h -#define LWIP_PLATFORM_ASSERT(message) __assert_func(__FILE__, __LINE__, __ASSERT_FUNC, message) - -#ifdef NDEBUG -#define LWIP_NOASSERT -#else // Assertions enabled - -// If assertions are on, the default LWIP_ERROR handler behaviour is to -// abort w/ an assertion failure. Don't do this, instead just print the error (if LWIP_DEBUG is set) -// and run the handler (same as the LWIP_ERROR behaviour if LWIP_NOASSERT is set). -#ifdef LWIP_DEBUG -#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ - puts(message); handler;}} while(0) -#else -// If LWIP_DEBUG is not set, return the error silently (default LWIP behaviour, also.) -#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ - handler;}} while(0) -#endif // LWIP_DEBUG - -#endif /* NDEBUG */ - - -#endif /* __ARCH_CC_H__ */ diff --git a/tools/sdk/include/lwip/port/arch/perf.h b/tools/sdk/include/lwip/port/arch/perf.h deleted file mode 100644 index 089facac..00000000 --- a/tools/sdk/include/lwip/port/arch/perf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/tools/sdk/include/lwip/port/arch/sys_arch.h b/tools/sdk/include/lwip/port/arch/sys_arch.h deleted file mode 100644 index 716fd9fa..00000000 --- a/tools/sdk/include/lwip/port/arch/sys_arch.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ - -#ifndef __SYS_ARCH_H__ -#define __SYS_ARCH_H__ - -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/queue.h" -#include "freertos/semphr.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef xSemaphoreHandle sys_sem_t; -typedef xSemaphoreHandle sys_mutex_t; -typedef xTaskHandle sys_thread_t; - -typedef struct sys_mbox_s { - xQueueHandle os_mbox; - sys_mutex_t lock; - uint8_t alive; -}* sys_mbox_t; - - -#define LWIP_COMPAT_MUTEX 0 - -#if !LWIP_COMPAT_MUTEX -#define sys_mutex_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE ) -#define sys_mutex_set_invalid( x ) ( ( *x ) = NULL ) -#endif - -#define sys_mbox_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE ) -#define sys_mbox_set_invalid( x ) ( ( *x ) = NULL ) - -#define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE ) -#define sys_sem_set_invalid( x ) ( ( *x ) = NULL ) - -void sys_delay_ms(uint32_t ms); -sys_sem_t* sys_thread_sem_init(void); -void sys_thread_sem_deinit(void); -sys_sem_t* sys_thread_sem_get(void); - -#ifdef __cplusplus -} -#endif - -#endif /* __SYS_ARCH_H__ */ - diff --git a/tools/sdk/include/lwip/port/arpa/inet.h b/tools/sdk/include/lwip/port/arpa/inet.h deleted file mode 100644 index 94c6c17e..00000000 --- a/tools/sdk/include/lwip/port/arpa/inet.h +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -#ifndef INET_H_ -#define INET_H_ - -#include "lwip/inet.h" - -#endif /* INET_H_ */ diff --git a/tools/sdk/include/lwip/port/lwipopts.h b/tools/sdk/include/lwip/port/lwipopts.h deleted file mode 100644 index 47b80ff6..00000000 --- a/tools/sdk/include/lwip/port/lwipopts.h +++ /dev/null @@ -1,775 +0,0 @@ -/* - * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Simon Goldschmidt - * - */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#include -#include -#include -#include -#include "esp_task.h" -#include "esp_system.h" -#include "sdkconfig.h" - -/* Enable all Espressif-only options */ - -/* - ----------------------------------------------- - ---------- Platform specific locking ---------- - ----------------------------------------------- -*/ -/** - * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain - * critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT 1 - -/** - * MEMCPY: override this if you have a faster implementation at hand than the - * one included in your C library - */ -#define MEMCPY(dst,src,len) memcpy(dst,src,len) - -/** - * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a - * call to memcpy() if the length is known at compile time and is small. - */ -#define SMEMCPY(dst,src,len) memcpy(dst,src,len) - -#define LWIP_RAND esp_random - -/* - ------------------------------------ - ---------- Memory options ---------- - ------------------------------------ -*/ -/** - * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library - * instead of the lwip internal allocator. Can save code size if you - * already use it. - */ -#define MEM_LIBC_MALLOC 1 - -/** -* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. -* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution -* speed and usage from interrupts! -*/ -#define MEMP_MEM_MALLOC 1 - -/** - * MEM_ALIGNMENT: should be set to the alignment of the CPU - * 4 byte alignment -> #define MEM_ALIGNMENT 4 - * 2 byte alignment -> #define MEM_ALIGNMENT 2 - */ -#define MEM_ALIGNMENT 4 - -/* - ------------------------------------------------ - ---------- Internal Memory Pool Sizes ---------- - ------------------------------------------------ -*/ - -/** - * MEMP_NUM_NETCONN: the number of struct netconns. - * (only needed if you use the sequential API, like api_lib.c) - */ -#define MEMP_NUM_NETCONN CONFIG_LWIP_MAX_SOCKETS - -/** - * MEMP_NUM_RAW_PCB: Number of raw connection PCBs - * (requires the LWIP_RAW option) - */ -#define MEMP_NUM_RAW_PCB 16 - -/** - * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. - * (requires the LWIP_TCP option) - */ -#define MEMP_NUM_TCP_PCB 16 - -/** - * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. - * (requires the LWIP_TCP option) - */ -#define MEMP_NUM_TCP_PCB_LISTEN 16 - -/** - * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - * per active UDP "connection". - * (requires the LWIP_UDP option) - */ -#define MEMP_NUM_UDP_PCB 16 - -/* - -------------------------------- - ---------- ARP options ------- - -------------------------------- -*/ -/** - * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address - * resolution. By default, only the most recent packet is queued per IP address. - * This is sufficient for most protocols and mainly reduces TCP connection - * startup time. Set this to 1 if you know your application sends more than one - * packet in a row to an IP address that is not in the ARP cache. - */ -#define ARP_QUEUEING 1 - -/* - -------------------------------- - ---------- IP options ---------- - -------------------------------- -*/ -/** - * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that - * this option does not affect outgoing packet sizes, which can be controlled - * via IP_FRAG. - */ -#define IP_REASSEMBLY CONFIG_LWIP_IP_REASSEMBLY - -/** - * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note - * that this option does not affect incoming packet sizes, which can be - * controlled via IP_REASSEMBLY. - */ -#define IP_FRAG CONFIG_LWIP_IP_FRAG - -/** - * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) - * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived - * in this time, the whole packet is discarded. - */ -#define IP_REASS_MAXAGE 3 - -/** - * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. - * Since the received pbufs are enqueued, be sure to configure - * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive - * packets even if the maximum amount of fragments is enqueued for reassembly! - */ -#define IP_REASS_MAX_PBUFS 10 - -/* - ---------------------------------- - ---------- ICMP options ---------- - ---------------------------------- -*/ - -#define LWIP_BROADCAST_PING CONFIG_LWIP_BROADCAST_PING - -#define LWIP_MULTICAST_PING CONFIG_LWIP_MULTICAST_PING - -/* - --------------------------------- - ---------- RAW options ---------- - --------------------------------- -*/ -/** - * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. - */ -#define LWIP_RAW 1 - -/* - ---------------------------------- - ---------- DHCP options ---------- - ---------------------------------- -*/ -/** - * LWIP_DHCP==1: Enable DHCP module. - */ -#define LWIP_DHCP 1 - -#define DHCP_MAXRTX 0 - -/** - * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. - */ -#define DHCP_DOES_ARP_CHECK CONFIG_LWIP_DHCP_DOES_ARP_CHECK - -/* - ------------------------------------ - ---------- AUTOIP options ---------- - ------------------------------------ -*/ -#ifdef CONFIG_LWIP_AUTOIP -#define LWIP_AUTOIP 1 - -/** -* LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on -* the same interface at the same time. -*/ -#define LWIP_DHCP_AUTOIP_COOP 1 - -/** -* LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes -* that should be sent before falling back on AUTOIP. This can be set -* as low as 1 to get an AutoIP address very quickly, but you should -* be prepared to handle a changing IP address when DHCP overrides -* AutoIP. -*/ -#define LWIP_DHCP_AUTOIP_COOP_TRIES CONFIG_LWIP_AUTOIP_TRIES - -#define LWIP_AUTOIP_MAX_CONFLICTS CONFIG_LWIP_AUTOIP_MAX_CONFLICTS - -#define LWIP_AUTOIP_RATE_LIMIT_INTERVAL CONFIG_LWIP_AUTOIP_RATE_LIMIT_INTERVAL - -#endif /* CONFIG_LWIP_AUTOIP */ - -/* - ---------------------------------- - ---------- SNMP options ---------- - ---------------------------------- -*/ -/* - ---------------------------------- - ---------- IGMP options ---------- - ---------------------------------- -*/ -/** - * LWIP_IGMP==1: Turn on IGMP module. - */ -#define LWIP_IGMP 1 - -/* - ---------------------------------- - ---------- DNS options ----------- - ---------------------------------- -*/ -/** - * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS - * transport. - */ -#define LWIP_DNS 1 - -/* - --------------------------------- - ---------- UDP options ---------- - --------------------------------- -*/ -/* - --------------------------------- - ---------- TCP options ---------- - --------------------------------- -*/ - - -/** - * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order. - * Define to 0 if your device is low on memory. - */ -#define TCP_QUEUE_OOSEQ CONFIG_TCP_QUEUE_OOSEQ - -/* - * LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all - * events (accept, sent, etc) that happen in the system. - * LWIP_CALLBACK_API==1: The PCB callback function is called directly - * for the event. This is the default. -*/ -#define TCP_MSS CONFIG_TCP_MSS - -/** - * TCP_MSL: The maximum segment lifetime in milliseconds - */ -#define TCP_MSL CONFIG_TCP_MSL - -/** - * TCP_MAXRTX: Maximum number of retransmissions of data segments. - */ -#define TCP_MAXRTX CONFIG_TCP_MAXRTX - -/** - * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments. - */ -#define TCP_SYNMAXRTX CONFIG_TCP_SYNMAXRTX - -/** - * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb. - */ -#define TCP_LISTEN_BACKLOG 1 - - -/** - * TCP_OVERSIZE: The maximum number of bytes that tcp_write may - * allocate ahead of time - */ -#ifdef CONFIG_TCP_OVERSIZE_MSS -#define TCP_OVERSIZE TCP_MSS -#endif -#ifdef CONFIG_TCP_OVERSIZE_QUARTER_MSS -#define TCP_OVERSIZE (TCP_MSS/4) -#endif -#ifdef CONFIG_TCP_OVERSIZE_DISABLE -#define TCP_OVERSIZE 0 -#endif -#ifndef TCP_OVERSIZE -#error "One of CONFIG_TCP_OVERSIZE_xxx options should be set by sdkconfig" -#endif - -/* - ---------------------------------- - ---------- Pbuf options ---------- - ---------------------------------- -*/ - -/* - ------------------------------------------------ - ---------- Network Interfaces options ---------- - ------------------------------------------------ -*/ - -/** - * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname - * field. - */ -#define LWIP_NETIF_HOSTNAME 1 - -/** - * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data - * to be sent into one single pbuf. This is for compatibility with DMA-enabled - * MACs that do not support scatter-gather. - * Beware that this might involve CPU-memcpy before transmitting that would not - * be needed without this flag! Use this only if you need to! - * - * @todo: TCP and IP-frag do not work with this, yet: - */ -#define LWIP_NETIF_TX_SINGLE_PBUF 1 - -/* - ------------------------------------ - ---------- LOOPIF options ---------- - ------------------------------------ -*/ -#ifdef CONFIG_LWIP_NETIF_LOOPBACK -/** - * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP - * address equal to the netif IP address, looping them back up the stack. - */ -#define LWIP_NETIF_LOOPBACK 1 - -/** - * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback - * sending for each netif (0 = disabled) - */ -#define LWIP_LOOPBACK_MAX_PBUFS CONFIG_LWIP_LOOPBACK_MAX_PBUFS -#endif - -/* - ------------------------------------ - ---------- SLIPIF options ---------- - ------------------------------------ -*/ - -/* - ------------------------------------ - ---------- Thread options ---------- - ------------------------------------ -*/ -/** - * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread. - */ -#define TCPIP_THREAD_NAME "tiT" - -/** - * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. - * The stack size value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#define TCPIP_THREAD_STACKSIZE ESP_TASK_TCPIP_STACK - -/** - * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. - * The priority value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#define TCPIP_THREAD_PRIO ESP_TASK_TCPIP_PRIO - -/** - * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages - * The queue size value itself is platform-dependent, but is passed to - * sys_mbox_new() when tcpip_init is called. - */ -#define TCPIP_MBOX_SIZE CONFIG_TCPIP_RECVMBOX_SIZE - -/** - * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_UDP_RECVMBOX_SIZE CONFIG_UDP_RECVMBOX_SIZE - -/** - * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_TCP_RECVMBOX_SIZE CONFIG_TCP_RECVMBOX_SIZE - -/** - * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. - * The queue size value itself is platform-dependent, but is passed to - * sys_mbox_new() when the acceptmbox is created. - */ -#define DEFAULT_ACCEPTMBOX_SIZE 6 - -/** - * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. - * The stack size value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#define DEFAULT_THREAD_STACKSIZE TCPIP_THREAD_STACKSIZE - -/** - * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. - * The priority value itself is platform-dependent, but is passed to - * sys_thread_new() when the thread is created. - */ -#define DEFAULT_THREAD_PRIO TCPIP_THREAD_PRIO - -/** - * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a - * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed - * to sys_mbox_new() when the recvmbox is created. - */ -#define DEFAULT_RAW_RECVMBOX_SIZE 6 - -/* - ---------------------------------------------- - ---------- Sequential layer options ---------- - ---------------------------------------------- -*/ -/** - * LWIP_TCPIP_CORE_LOCKING: (EXPERIMENTAL!) - * Don't use it if you're not an active lwIP project member - */ -#define LWIP_TCPIP_CORE_LOCKING 0 - -/* - ------------------------------------ - ---------- Socket options ---------- - ------------------------------------ -*/ -/** - * LWIP_SO_SNDTIMEO==1: Enable send timeout for sockets/netconns and - * SO_SNDTIMEO processing. - */ -#define LWIP_SO_SNDTIMEO 1 - -/** - * LWIP_SO_RCVTIMEO==1: Enable receive timeout for sockets/netconns and - * SO_RCVTIMEO processing. - */ -#define LWIP_SO_RCVTIMEO 1 - -/** - * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT - * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set - * in seconds. (does not require sockets.c, and will affect tcp.c) - */ -#define LWIP_TCP_KEEPALIVE 1 - -/** - * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. - */ -#define LWIP_SO_RCVBUF CONFIG_LWIP_SO_RCVBUF - -/** - * SO_REUSE==1: Enable SO_REUSEADDR option. - * This option is set via menuconfig. - */ -#define SO_REUSE CONFIG_LWIP_SO_REUSE - -/** - * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets - * to all local matches if SO_REUSEADDR is turned on. - * WARNING: Adds a memcpy for every packet if passing to more than one pcb! - */ -#define SO_REUSE_RXTOALL CONFIG_LWIP_SO_REUSE_RXTOALL - -/* - ---------------------------------------- - ---------- Statistics options ---------- - ---------------------------------------- -*/ - -/** - * LWIP_STATS==1: Enable statistics collection in lwip_stats. - */ -#define LWIP_STATS CONFIG_LWIP_STATS - -#if LWIP_STATS - -/** - * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. - */ -#define LWIP_STATS_DISPLAY CONFIG_LWIP_STATS -#endif - - -/* - --------------------------------- - ---------- PPP options ---------- - --------------------------------- -*/ - -/** - * PPP_SUPPORT==1: Enable PPP. - */ -#define PPP_SUPPORT CONFIG_PPP_SUPPORT - -#if PPP_SUPPORT - -/** - * PAP_SUPPORT==1: Support PAP. - */ -#define PAP_SUPPORT CONFIG_PPP_PAP_SUPPORT - -/** - * CHAP_SUPPORT==1: Support CHAP. - */ -#define CHAP_SUPPORT CONFIG_PPP_CHAP_SUPPORT - -/** - * MSCHAP_SUPPORT==1: Support MSCHAP. - */ -#define MSCHAP_SUPPORT CONFIG_PPP_MSCHAP_SUPPORT - -/** - * CCP_SUPPORT==1: Support CCP. - */ -#define MPPE_SUPPORT CONFIG_PPP_MPPE_SUPPORT - -/** - * PPP_MAXIDLEFLAG: Max Xmit idle time (in ms) before resend flag char. - * TODO: If PPP_MAXIDLEFLAG > 0 and next package is send during PPP_MAXIDLEFLAG time, - * then 0x7E is not added at the begining of PPP package but 0x7E termination - * is always at the end. This behaviour brokes PPP dial with GSM (PPPoS). - * The PPP package should always start and end with 0x7E. - */ - -#define PPP_MAXIDLEFLAG 0 - -/** - * PPP_DEBUG: Enable debugging for PPP. - */ -#define PPP_DEBUG_ON CONFIG_PPP_DEBUG_ON - -#if PPP_DEBUG_ON -#define PPP_DEBUG LWIP_DBG_ON -#else -#define PPP_DEBUG LWIP_DBG_OFF -#endif - -#endif - -/* - -------------------------------------- - ---------- Checksum options ---------- - -------------------------------------- -*/ - -/* - --------------------------------------- - ---------- IPv6 options --------------- - --------------------------------------- -*/ -/** - * LWIP_IPV6==1: Enable IPv6 - */ -#define LWIP_IPV6 1 - -/* - --------------------------------------- - ---------- Hook options --------------- - --------------------------------------- -*/ -#define LWIP_HOOK_IP4_ROUTE_SRC ip4_route_src_hook - -/* - --------------------------------------- - ---------- Debugging options ---------- - --------------------------------------- -*/ -/** - * ETHARP_DEBUG: Enable debugging in etharp.c. - */ -#define ETHARP_DEBUG LWIP_DBG_OFF - -/** - * NETIF_DEBUG: Enable debugging in netif.c. - */ -#define NETIF_DEBUG LWIP_DBG_OFF - -/** - * PBUF_DEBUG: Enable debugging in pbuf.c. - */ -#define PBUF_DEBUG LWIP_DBG_OFF - -/** - * API_LIB_DEBUG: Enable debugging in api_lib.c. - */ -#define API_LIB_DEBUG LWIP_DBG_OFF - -/** - * SOCKETS_DEBUG: Enable debugging in sockets.c. - */ -#define SOCKETS_DEBUG LWIP_DBG_OFF - -/** - * ICMP_DEBUG: Enable debugging in icmp.c. - */ -#define ICMP_DEBUG LWIP_DBG_OFF - -/** - * IP_DEBUG: Enable debugging for IP. - */ -#define IP_DEBUG LWIP_DBG_OFF - -/** - * MEMP_DEBUG: Enable debugging in memp.c. - */ -#define MEMP_DEBUG LWIP_DBG_OFF - -/** - * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug. - */ -#define TCP_INPUT_DEBUG LWIP_DBG_OFF - -/** - * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions. - */ -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF - -/** - * TCPIP_DEBUG: Enable debugging in tcpip.c. - */ -#define TCPIP_DEBUG LWIP_DBG_OFF - -/** - * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be - * updated with the source MAC and IP addresses supplied in the packet. - * You may want to disable this if you do not trust LAN peers to have the - * correct addresses, or as a limited approach to attempt to handle - * spoofing. If disabled, lwIP will need to make a new ARP request if - * the peer is not already in the ARP table, adding a little latency. - * The peer *is* in the ARP table if it requested our address before. - * Also notice that this slows down input processing of every IP packet! - */ -#define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC - - -/* Enable all Espressif-only options */ - -#define ESP_LWIP 1 -#define ESP_LWIP_ARP 1 -#define ESP_PER_SOC_TCP_WND 1 -#define ESP_THREAD_SAFE 1 -#define ESP_THREAD_SAFE_DEBUG LWIP_DBG_OFF -#define ESP_DHCP 1 -#define ESP_DNS 1 -#define ESP_IPV6_AUTOCONFIG 1 -#define ESP_PERF 0 -#define ESP_RANDOM_TCP_PORT 1 -#define ESP_IP4_ATON 1 -#define ESP_LIGHT_SLEEP 1 -#define ESP_L2_TO_L3_COPY CONFIG_L2_TO_L3_COPY -#define ESP_STATS_MEM CONFIG_LWIP_STATS -#define ESP_STATS_DROP CONFIG_LWIP_STATS -#define ESP_STATS_TCP 0 -#define ESP_DHCP_TIMER 1 -#define ESP_LWIP_LOGI(...) ESP_LOGI("lwip", __VA_ARGS__) - -#define TCP_WND_DEFAULT CONFIG_TCP_WND_DEFAULT -#define TCP_SND_BUF_DEFAULT CONFIG_TCP_SND_BUF_DEFAULT - -#if ESP_PERF -#define DBG_PERF_PATH_SET(dir, point) -#define DBG_PERF_FILTER_LEN 1000 - -enum { - DBG_PERF_DIR_RX = 0, - DBG_PERF_DIR_TX, -}; - -enum { - DBG_PERF_POINT_INT = 0, - DBG_PERF_POINT_WIFI_IN = 1, - DBG_PERF_POINT_WIFI_OUT = 2, - DBG_PERF_POINT_LWIP_IN = 3, - DBG_PERF_POINT_LWIP_OUT = 4, - DBG_PERF_POINT_SOC_IN = 5, - DBG_PERF_POINT_SOC_OUT = 6, -}; - -#else -#define DBG_PERF_PATH_SET(dir, point) -#define DBG_PERF_FILTER_LEN 1000 -#endif - -#if ESP_PER_SOC_TCP_WND -#define TCP_WND(pcb) (pcb->per_soc_tcp_wnd) -#define TCP_SND_BUF(pcb) (pcb->per_soc_tcp_snd_buf) -#endif - -/** - * DHCP_DEBUG: Enable debugging in dhcp.c. - */ -#define DHCP_DEBUG LWIP_DBG_OFF -#define LWIP_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF - -#define CHECKSUM_CHECK_UDP 0 -#define CHECKSUM_CHECK_IP 0 - -#define LWIP_NETCONN_FULLDUPLEX 1 -#define LWIP_NETCONN_SEM_PER_THREAD 1 - -#define LWIP_DHCP_MAX_NTP_SERVERS CONFIG_LWIP_DHCP_MAX_NTP_SERVERS -#define LWIP_TIMEVAL_PRIVATE 0 - -#define SNTP_SET_SYSTEM_TIME_US(sec, us) \ - do { \ - struct timeval tv = { .tv_sec = sec, .tv_usec = us }; \ - settimeofday(&tv, NULL); \ - } while (0); - -#define SNTP_GET_SYSTEM_TIME(sec, us) \ - do { \ - struct timeval tv = { .tv_sec = 0, .tv_usec = 0 }; \ - gettimeofday(&tv, NULL); \ - (sec) = tv.tv_sec; \ - (us) = tv.tv_usec; \ - } while (0); - -#define SOC_SEND_LOG //printf - -#endif /* __LWIPOPTS_H__ */ diff --git a/tools/sdk/include/lwip/port/netinet/in.h b/tools/sdk/include/lwip/port/netinet/in.h deleted file mode 100644 index 7eaec633..00000000 --- a/tools/sdk/include/lwip/port/netinet/in.h +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -#ifndef IN_H_ -#define IN_H_ - -#include "lwip/inet.h" - -#define IN6_IS_ADDR_MULTICAST(a) IN_MULTICAST(a) - -#endif /* IN_H_ */ diff --git a/tools/sdk/include/lwip/posix/netdb.h b/tools/sdk/include/lwip/posix/netdb.h deleted file mode 100755 index 12d4c7f5..00000000 --- a/tools/sdk/include/lwip/posix/netdb.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file - * This file is a posix wrapper for lwip/netdb.h. - */ - -/* - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - */ - -#include "lwip/netdb.h" diff --git a/tools/sdk/include/lwip/posix/sys/socket.h b/tools/sdk/include/lwip/posix/sys/socket.h deleted file mode 100755 index 0ed9baf3..00000000 --- a/tools/sdk/include/lwip/posix/sys/socket.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file - * This file is a posix wrapper for lwip/sockets.h. - */ - -/* - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - */ - -#include "lwip/sockets.h" diff --git a/tools/sdk/include/newlib/sys/types.h b/tools/sdk/include/newlib/sys/types.h index ed33e0a6..446946a3 100644 --- a/tools/sdk/include/newlib/sys/types.h +++ b/tools/sdk/include/newlib/sys/types.h @@ -221,6 +221,9 @@ typedef unsigned int mode_t _ST_INT32; typedef unsigned short nlink_t; +/* FD_SET and friends are still LWIP only */ +# if !defined(ESP_PLATFORM) + /* We don't define fd_set and friends if we are compiling POSIX source, or if we have included (or may include as indicated by __USE_W32_SOCKETS) the W32api winsock[2].h header which @@ -266,6 +269,7 @@ typedef struct _types_fd_set { })) # endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) */ +#endif /* !defined(ESP_PLATFORM) */ #undef __MS_types__ #undef _ST_INT32 diff --git a/tools/sdk/include/soc/soc/rtc.h b/tools/sdk/include/soc/soc/rtc.h index b47e39e1..f13c113b 100644 --- a/tools/sdk/include/soc/soc/rtc.h +++ b/tools/sdk/include/soc/soc/rtc.h @@ -276,6 +276,25 @@ rtc_fast_freq_t rtc_clk_fast_freq_get(); */ void rtc_clk_cpu_freq_set(rtc_cpu_freq_t cpu_freq); +/** + * @brief Switch CPU frequency + * + * This is a faster version of rtc_clk_cpu_freq_set, which can handle some of + * the frequency switch paths (XTAL -> PLL, PLL -> XTAL). + * When switching from PLL to XTAL, PLL is not disabled (unlike rtc_clk_cpu_freq_set). + * When switching back from XTAL to PLL, only the same PLL can be used. + * Therefore it is not possible to switch 240 -> XTAL -> (80 or 160) using this + * function. + * + * For unsupported cases, this function falls back to rtc_clk_cpu_freq_set. + * + * Unlike rtc_clk_cpu_freq_set, this function relies on static data, so it is + * less safe to use it e.g. from a panic handler (when memory might be corrupted). + * + * @param cpu_freq new CPU frequency + */ +void rtc_clk_cpu_freq_set_fast(rtc_cpu_freq_t cpu_freq); + /** * @brief Get the currently selected CPU frequency * @@ -296,6 +315,14 @@ rtc_cpu_freq_t rtc_clk_cpu_freq_get(); */ uint32_t rtc_clk_cpu_freq_value(rtc_cpu_freq_t cpu_freq); +/** + * @brief Get rtc_cpu_freq_t enum value for given CPU frequency + * @param cpu_freq_mhz CPU frequency, one of 80, 160, 240, 2, and XTAL frequency + * @param[out] out_val output, rtc_cpu_freq_t value corresponding to the frequency + * @return true if the given frequency value matches one of enum values + */ + bool rtc_clk_cpu_freq_from_mhz(int cpu_freq_mhz, rtc_cpu_freq_t* out_val); + /** * @brief Store new APB frequency value into RTC_APB_FREQ_REG * diff --git a/tools/sdk/include/soc/soc/sens_reg.h b/tools/sdk/include/soc/soc/sens_reg.h index 0a032d21..6383ff62 100644 --- a/tools/sdk/include/soc/soc/sens_reg.h +++ b/tools/sdk/include/soc/soc/sens_reg.h @@ -297,6 +297,8 @@ #define SENS_SAR1_ATTEN_M ((SENS_SAR1_ATTEN_V)<<(SENS_SAR1_ATTEN_S)) #define SENS_SAR1_ATTEN_V 0xFFFFFFFF #define SENS_SAR1_ATTEN_S 0 +#define SENS_SAR1_ATTEN_VAL_MASK 0x3 +#define SENS_SAR2_ATTEN_VAL_MASK 0x3 #define SENS_SAR_ATTEN2_REG (DR_REG_SENS_BASE + 0x0038) /* SENS_SAR2_ATTEN : R/W ;bitpos:[31:0] ;default: 32'hffffffff ; */ diff --git a/tools/sdk/include/soc/soc/soc.h b/tools/sdk/include/soc/soc/soc.h index 0e633821..8121e33b 100644 --- a/tools/sdk/include/soc/soc/soc.h +++ b/tools/sdk/include/soc/soc/soc.h @@ -266,6 +266,7 @@ #define CPU_CLK_FREQ_ROM APB_CLK_FREQ_ROM #define CPU_CLK_FREQ APB_CLK_FREQ #define APB_CLK_FREQ ( 80*1000000 ) //unit: Hz +#define REF_CLK_FREQ ( 1000000 ) #define UART_CLK_FREQ APB_CLK_FREQ #define WDT_CLK_FREQ APB_CLK_FREQ #define TIMER_CLK_FREQ (80000000>>4) //80MHz divided by 16 @@ -296,11 +297,12 @@ #define SOC_DMA_HIGH 0x40000000 // Region of memory that is byte-accessible. See esp_ptr_byte_accessible(). -#define SOC_BYTE_ACCESSIBLE_LOW 0x3FFAE000 +#define SOC_BYTE_ACCESSIBLE_LOW 0x3FF90000 #define SOC_BYTE_ACCESSIBLE_HIGH 0x40000000 -//Region of memory that is internal, as in on the same silicon die as the ESP32 CPUs (excluding RTC data region, that's checked separately.) See esp_ptr_internal(). -#define SOC_MEM_INTERNAL_LOW 0x3F400000 +//Region of memory that is internal, as in on the same silicon die as the ESP32 CPUs +//(excluding RTC data region, that's checked separately.) See esp_ptr_internal(). +#define SOC_MEM_INTERNAL_LOW 0x3FF90000 #define SOC_MEM_INTERNAL_HIGH 0x400C2000 diff --git a/tools/sdk/include/soc/soc/syscon_struct.h b/tools/sdk/include/soc/soc/syscon_struct.h index 60d8ed0a..42bd643d 100644 --- a/tools/sdk/include/soc/soc/syscon_struct.h +++ b/tools/sdk/include/soc/soc/syscon_struct.h @@ -18,112 +18,106 @@ extern "C" { #endif -typedef struct { +typedef volatile struct { union { struct { - volatile uint32_t pre_div: 10; - volatile uint32_t clk_320m_en: 1; - volatile uint32_t clk_en: 1; - volatile uint32_t rst_tick: 1; - volatile uint32_t quick_clk_chng: 1; - volatile uint32_t reserved14: 18; + uint32_t pre_div: 10; + uint32_t clk_320m_en: 1; + uint32_t clk_en: 1; + uint32_t rst_tick: 1; + uint32_t quick_clk_chng: 1; + uint32_t reserved14: 18; }; - volatile uint32_t val; + uint32_t val; }clk_conf; union { struct { - volatile uint32_t xtal_tick: 8; - volatile uint32_t reserved8: 24; + uint32_t xtal_tick: 8; + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }xtal_tick_conf; union { struct { - volatile uint32_t pll_tick: 8; - volatile uint32_t reserved8: 24; + uint32_t pll_tick: 8; + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }pll_tick_conf; union { struct { - volatile uint32_t ck8m_tick: 8; - volatile uint32_t reserved8: 24; + uint32_t ck8m_tick: 8; + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }ck8m_tick_conf; union { struct { - volatile uint32_t start_force: 1; - volatile uint32_t start: 1; - volatile uint32_t sar2_mux: 1; /*1: SAR ADC2 is controlled by DIG ADC2 CTRL 0: SAR ADC2 is controlled by PWDET CTRL*/ - volatile uint32_t work_mode: 2; /*0: single mode 1: double mode 2: alternate mode*/ - volatile uint32_t sar_sel: 1; /*0: SAR1 1: SAR2 only work for single SAR mode*/ - volatile uint32_t sar_clk_gated: 1; - volatile uint32_t sar_clk_div: 8; /*SAR clock divider*/ - volatile uint32_t sar1_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ - volatile uint32_t sar2_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ - volatile uint32_t sar1_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC1 CTRL*/ - volatile uint32_t sar2_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC2 CTRL*/ - volatile uint32_t data_sar_sel: 1; /*1: sar_sel will be coded by the MSB of the 16-bit output data in this case the resolution should not be larger than 11 bits.*/ - volatile uint32_t data_to_i2s: 1; /*1: I2S input data is from SAR ADC (for DMA) 0: I2S input data is from GPIO matrix*/ - volatile uint32_t reserved27: 5; + uint32_t start_force: 1; + uint32_t start: 1; + uint32_t sar2_mux: 1; /*1: SAR ADC2 is controlled by DIG ADC2 CTRL 0: SAR ADC2 is controlled by PWDET CTRL*/ + uint32_t work_mode: 2; /*0: single mode 1: double mode 2: alternate mode*/ + uint32_t sar_sel: 1; /*0: SAR1 1: SAR2 only work for single SAR mode*/ + uint32_t sar_clk_gated: 1; + uint32_t sar_clk_div: 8; /*SAR clock divider*/ + uint32_t sar1_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar2_patt_len: 4; /*0 ~ 15 means length 1 ~ 16*/ + uint32_t sar1_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC1 CTRL*/ + uint32_t sar2_patt_p_clear: 1; /*clear the pointer of pattern table for DIG ADC2 CTRL*/ + uint32_t data_sar_sel: 1; /*1: sar_sel will be coded by the MSB of the 16-bit output data in this case the resolution should not be larger than 11 bits.*/ + uint32_t data_to_i2s: 1; /*1: I2S input data is from SAR ADC (for DMA) 0: I2S input data is from GPIO matrix*/ + uint32_t reserved27: 5; }; - volatile uint32_t val; + uint32_t val; }saradc_ctrl; union { struct { - volatile uint32_t meas_num_limit: 1; - volatile uint32_t max_meas_num: 8; /*max conversion number*/ - volatile uint32_t sar1_inv: 1; /*1: data to DIG ADC1 CTRL is inverted otherwise not*/ - volatile uint32_t sar2_inv: 1; /*1: data to DIG ADC2 CTRL is inverted otherwise not*/ - volatile uint32_t reserved11: 21; + uint32_t meas_num_limit: 1; + uint32_t max_meas_num: 8; /*max conversion number*/ + uint32_t sar1_inv: 1; /*1: data to DIG ADC1 CTRL is inverted otherwise not*/ + uint32_t sar2_inv: 1; /*1: data to DIG ADC2 CTRL is inverted otherwise not*/ + uint32_t reserved11: 21; }; - volatile uint32_t val; + uint32_t val; }saradc_ctrl2; union { struct { - volatile uint32_t rstb_wait: 8; - volatile uint32_t standby_wait: 8; - volatile uint32_t start_wait: 8; - volatile uint32_t sample_cycle: 8; /*sample cycles*/ + uint32_t rstb_wait: 8; + uint32_t standby_wait: 8; + uint32_t start_wait: 8; + uint32_t sample_cycle: 8; /*sample cycles*/ }; - volatile uint32_t val; + uint32_t val; }saradc_fsm; - volatile uint32_t saradc_sar1_patt_tab1; /*item 0 ~ 3 for pattern table 1 (each item one byte)*/ - volatile uint32_t saradc_sar1_patt_tab2; /*Item 4 ~ 7 for pattern table 1 (each item one byte)*/ - volatile uint32_t saradc_sar1_patt_tab3; /*Item 8 ~ 11 for pattern table 1 (each item one byte)*/ - volatile uint32_t saradc_sar1_patt_tab4; /*Item 12 ~ 15 for pattern table 1 (each item one byte)*/ - volatile uint32_t saradc_sar2_patt_tab1; /*item 0 ~ 3 for pattern table 2 (each item one byte)*/ - volatile uint32_t saradc_sar2_patt_tab2; /*Item 4 ~ 7 for pattern table 2 (each item one byte)*/ - volatile uint32_t saradc_sar2_patt_tab3; /*Item 8 ~ 11 for pattern table 2 (each item one byte)*/ - volatile uint32_t saradc_sar2_patt_tab4; /*Item 12 ~ 15 for pattern table 2 (each item one byte)*/ + uint32_t saradc_sar1_patt_tab[4]; /*item 0 ~ 3 for ADC1 pattern table*/ + uint32_t saradc_sar2_patt_tab[4]; /*item 0 ~ 3 for ADC2 pattern table*/ union { struct { - volatile uint32_t apll_tick: 8; - volatile uint32_t reserved8: 24; + uint32_t apll_tick: 8; + uint32_t reserved8: 24; }; - volatile uint32_t val; + uint32_t val; }apll_tick_conf; - volatile uint32_t reserved_40; - volatile uint32_t reserved_44; - volatile uint32_t reserved_48; - volatile uint32_t reserved_4c; - volatile uint32_t reserved_50; - volatile uint32_t reserved_54; - volatile uint32_t reserved_58; - volatile uint32_t reserved_5c; - volatile uint32_t reserved_60; - volatile uint32_t reserved_64; - volatile uint32_t reserved_68; - volatile uint32_t reserved_6c; - volatile uint32_t reserved_70; - volatile uint32_t reserved_74; - volatile uint32_t reserved_78; - volatile uint32_t date; /**/ + uint32_t reserved_40; + uint32_t reserved_44; + uint32_t reserved_48; + uint32_t reserved_4c; + uint32_t reserved_50; + uint32_t reserved_54; + uint32_t reserved_58; + uint32_t reserved_5c; + uint32_t reserved_60; + uint32_t reserved_64; + uint32_t reserved_68; + uint32_t reserved_6c; + uint32_t reserved_70; + uint32_t reserved_74; + uint32_t reserved_78; + uint32_t date; /**/ } syscon_dev_t; #ifdef __cplusplus } #endif - +extern syscon_dev_t SYSCON; #endif /* _SOC_SYSCON_STRUCT_H_ */ diff --git a/tools/sdk/include/tcpip_adapter/tcpip_adapter.h b/tools/sdk/include/tcpip_adapter/tcpip_adapter.h index 2e6db6b5..d7ee00ea 100644 --- a/tools/sdk/include/tcpip_adapter/tcpip_adapter.h +++ b/tools/sdk/include/tcpip_adapter/tcpip_adapter.h @@ -113,6 +113,19 @@ typedef enum { TCPIP_ADAPTER_IF_MAX } tcpip_adapter_if_t; +/*type of DNS server*/ +typedef enum { + TCPIP_ADAPTER_DNS_MAIN= 0, /**DNS main server address*/ + TCPIP_ADAPTER_DNS_BACKUP, /**DNS backup server address,for STA only,support soft-AP in future*/ + TCPIP_ADAPTER_DNS_FALLBACK, /**DNS fallback server address,for STA only*/ + TCPIP_ADAPTER_DNS_MAX /**Max DNS */ +} tcpip_adapter_dns_type_t; + +/*info of DNS server*/ +typedef struct { + ip_addr_t ip; +} tcpip_adapter_dns_info_t; + /* status of DHCP client or DHCP server */ typedef enum { TCPIP_ADAPTER_DHCP_INIT = 0, /**< DHCP client/server in initial state */ @@ -130,6 +143,7 @@ typedef enum{ } tcpip_adapter_option_mode_t; typedef enum{ + TCPIP_ADAPTER_DOMAIN_NAME_SERVER = 6, /**< domain name server */ TCPIP_ADAPTER_ROUTER_SOLICITATION_ADDRESS = 32, /**< solicitation router address */ TCPIP_ADAPTER_REQUESTED_IP_ADDRESS = 50, /**< request IP address pool */ TCPIP_ADAPTER_IP_ADDRESS_LEASE_TIME = 51, /**< request IP address lease time */ @@ -145,14 +159,19 @@ typedef struct tcpip_adapter_api_msg_s { tcpip_adapter_if_t tcpip_if; tcpip_adapter_ip_info_t *ip_info; uint8_t *mac; - const char *hostname; + void *data; } tcpip_adapter_api_msg_t; +typedef struct tcpip_adapter_dns_param_s { + tcpip_adapter_dns_type_t dns_type; + tcpip_adapter_dns_info_t *dns_info; +} tcpip_adapter_dns_param_t; + #define TCPIP_ADAPTER_TRHEAD_SAFE 1 #define TCPIP_ADAPTER_IPC_LOCAL 0 #define TCPIP_ADAPTER_IPC_REMOTE 1 -#define TCPIP_ADAPTER_IPC_CALL(_if, _mac, _ip, _hostname, _fn) do {\ +#define TCPIP_ADAPTER_IPC_CALL(_if, _mac, _ip, _data, _fn) do {\ tcpip_adapter_api_msg_t msg;\ if (tcpip_inited == false) {\ ESP_LOGE(TAG, "tcpip_adapter is not initialized!");\ @@ -160,9 +179,9 @@ typedef struct tcpip_adapter_api_msg_s { }\ memset(&msg, 0, sizeof(msg));\ msg.tcpip_if = (_if);\ - msg.mac = (_mac);\ - msg.ip_info = (_ip);\ - msg.hostname = (_hostname);\ + msg.mac = (uint8_t*)(_mac);\ + msg.ip_info = (tcpip_adapter_ip_info_t*)(_ip);\ + msg.data = (void*)(_data);\ msg.api_fn = (_fn);\ if (TCPIP_ADAPTER_IPC_REMOTE == tcpip_adapter_ipc_check(&msg)) {\ ESP_LOGD(TAG, "check: remote, if=%d fn=%p\n", (_if), (_fn));\ @@ -292,6 +311,47 @@ esp_err_t tcpip_adapter_get_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_i */ esp_err_t tcpip_adapter_set_ip_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_ip_info_t *ip_info); +/** + * @brief Set DNS Server's information + * + * There has an DNS Server information copy in adapter library, set DNS Server for appointed interface and type. + * + * 1.In station mode, if dhcp client is enabled, then only the fallback DNS server can be set(TCPIP_ADAPTER_DNS_FALLBACK). + * Fallback DNS server is only used if no DNS servers are set via DHCP. + * If dhcp client is disabled, then need to set main/backup dns server(TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP). + * + * 2.In soft-AP mode, the DNS Server's main dns server offered to the station is the IP address of soft-AP, + * if the application don't want to use the IP address of soft-AP, they can set the main dns server. + * + * This function is mainly used for setting static or Fallback DNS Server. + * + * @param[in] tcpip_if: the interface which we want to set DNS Server information + * @param[in] type: the type of DNS Server,including TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK + * @param[in] dns: the DNS Server address to be set + * + * @return + * - ESP_OK on success + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS invalid params + */ +esp_err_t tcpip_adapter_set_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns); + +/** + * @brief Get DNS Server's information + * + * When set the DNS Server information successfully, can get the DNS Server's information via the appointed tcpip_if and type + * + * This function is mainly used for getting DNS Server information. + * + * @param[in] tcpip_if: the interface which we want to get DNS Server information + * @param[in] type: the type of DNS Server,including TCPIP_ADAPTER_DNS_MAIN, TCPIP_ADAPTER_DNS_BACKUP, TCPIP_ADAPTER_DNS_FALLBACK + * @param[in] dns: the DNS Server address to be get + * + * @return + * - ESP_OK on success + * - ESP_ERR_TCPIP_ADAPTER_INVALID_PARAMS invalid params + */ +esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns); + /** * @brief Get interface's old IP information * diff --git a/tools/sdk/include/vfs/esp_vfs.h b/tools/sdk/include/vfs/esp_vfs.h index 6ced2ce2..ab645fcc 100644 --- a/tools/sdk/include/vfs/esp_vfs.h +++ b/tools/sdk/include/vfs/esp_vfs.h @@ -43,16 +43,30 @@ extern "C" { */ #define ESP_VFS_FLAG_CONTEXT_PTR 1 +/** + * Flag which indicates that the FD space of the VFS implementation should be made + * the same as the FD space in newlib. This means that the normal masking off + * of VFS-independent fd bits is ignored and the full user-facing fd is passed to + * the VFS implementation. + * + * Set the p_minimum_fd & p_maximum_fd pointers when registering the socket in + * order to know what range of FDs can be used with the registered VFS. + * + * This is mostly useful for LWIP which shares the socket FD space with + * socket-specific functions. + * + */ +#define ESP_VFS_FLAG_SHARED_FD_SPACE 2 + /** * @brief VFS definition structure * * This structure should be filled with pointers to corresponding * FS driver functions. * - * If the FS implementation has an option to use certain offset for - * all file descriptors, this value should be passed into fd_offset - * field. Otherwise VFS component will translate all FDs to start - * at zero offset. + * VFS component will translate all FDs so that the filesystem implementation + * sees them starting at zero. The caller sees a global FD which is prefixed + * with an pre-filesystem-implementation. * * Some FS implementations expect some state (e.g. pointer to some structure) * to be passed in as a first argument. For these implementations, @@ -67,8 +81,7 @@ extern "C" { */ typedef struct { - int fd_offset; /*!< file descriptor offset, determined by the FS driver */ - int flags; /*!< ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT */ + int flags; /*!< ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT, plus optionally ESP_VFS_FLAG_SHARED_FD_SPACE */ union { ssize_t (*write_p)(void* p, int fd, const void * data, size_t size); ssize_t (*write)(int fd, const void * data, size_t size); @@ -145,6 +158,14 @@ typedef struct int (*fcntl_p)(void* ctx, int fd, int cmd, va_list args); int (*fcntl)(int fd, int cmd, va_list args); }; + union { + int (*ioctl_p)(void* ctx, int fd, int cmd, va_list args); + int (*ioctl)(int fd, int cmd, va_list args); + }; + union { + int (*fsync_p)(void* ctx, int fd); + int (*fsync)(int fd); + }; } esp_vfs_t; @@ -170,6 +191,22 @@ typedef struct esp_err_t esp_vfs_register(const char* base_path, const esp_vfs_t* vfs, void* ctx); +/** + * Special case function for registering a VFS that uses a method other than + * open() to open new file descriptors. + * + * This is a special-purpose function intended for registering LWIP sockets to VFS. + * + * @param vfs Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register(). + * @param ctx Pointer to context structure. Meaning is the same as for esp_vfs_register(). + * @param p_min_fd If non-NULL, on success this variable is written with the minimum (global/user-facing) FD that this VFS will use. This is useful when ESP_VFS_FLAG_SHARED_FD_SPACE is set in vfs->flags. + * @param p_max_fd If non-NULL, on success this variable is written with one higher than the maximum (global/user-facing) FD that this VFS will use. This is useful when ESP_VFS_FLAG_SHARED_FD_SPACE is set in vfs->flags. + * + * @return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are + * registered. + */ +esp_err_t esp_vfs_register_socket_space(const esp_vfs_t *vfs, void *ctx, int *p_min_fd, int *p_max_fd); + /** * Unregister a virtual filesystem for given path prefix * diff --git a/tools/sdk/include/vfs/esp_vfs_dev.h b/tools/sdk/include/vfs/esp_vfs_dev.h index b51527fc..b330b4c5 100644 --- a/tools/sdk/include/vfs/esp_vfs_dev.h +++ b/tools/sdk/include/vfs/esp_vfs_dev.h @@ -12,11 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef __ESP_VFS_DEV_H__ -#define __ESP_VFS_DEV_H__ +#pragma once #include "esp_vfs.h" +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Line ending settings */ @@ -81,4 +84,6 @@ void esp_vfs_dev_uart_use_nonblocking(int uart_num); */ void esp_vfs_dev_uart_use_driver(int uart_num); -#endif //__ESP_VFS_DEV_H__ +#ifdef __cplusplus +} +#endif diff --git a/tools/sdk/ld/esp32.common.ld b/tools/sdk/ld/esp32.common.ld index 5b5be9a6..32fc089d 100644 --- a/tools/sdk/ld/esp32.common.ld +++ b/tools/sdk/ld/esp32.common.ld @@ -117,6 +117,7 @@ SECTIONS *(.dram1 .dram1.*) *libesp32.a:panic.o(.rodata .rodata.*) *libphy.a:(.rodata .rodata.*) + *libsoc.a:rtc_clk.o(.rodata .rodata.*) *libapp_trace.a:(.rodata .rodata.*) *libgcov.a:(.rodata .rodata.*) *libheap.a:multi_heap.o(.rodata .rodata.*) diff --git a/tools/sdk/ld/esp32.peripherals.ld b/tools/sdk/ld/esp32.peripherals.ld index 2ff635f2..621fedea 100644 --- a/tools/sdk/ld/esp32.peripherals.ld +++ b/tools/sdk/ld/esp32.peripherals.ld @@ -20,8 +20,9 @@ PROVIDE ( TIMERG0 = 0x3ff5F000 ); PROVIDE ( TIMERG1 = 0x3ff60000 ); PROVIDE ( SPI2 = 0x3ff64000 ); PROVIDE ( SPI3 = 0x3ff65000 ); +PROVIDE ( SYSCON = 0x3ff66000 ); PROVIDE ( I2C1 = 0x3ff67000 ); +PROVIDE ( SDMMC = 0x3ff68000 ); PROVIDE ( MCPWM1 = 0x3ff6C000 ); PROVIDE ( I2S1 = 0x3ff6D000 ); PROVIDE ( UART2 = 0x3ff6E000 ); -PROVIDE ( SDMMC = 0x3ff68000 ); diff --git a/tools/sdk/lib/libapp_trace.a b/tools/sdk/lib/libapp_trace.a index d9fe681d..741ba707 100644 Binary files a/tools/sdk/lib/libapp_trace.a and b/tools/sdk/lib/libapp_trace.a differ diff --git a/tools/sdk/lib/libapp_update.a b/tools/sdk/lib/libapp_update.a index f31ec769..0e955f0c 100644 Binary files a/tools/sdk/lib/libapp_update.a and b/tools/sdk/lib/libapp_update.a differ diff --git a/tools/sdk/lib/libbootloader_support.a b/tools/sdk/lib/libbootloader_support.a index dc22253d..20d0a90b 100644 Binary files a/tools/sdk/lib/libbootloader_support.a and b/tools/sdk/lib/libbootloader_support.a differ diff --git a/tools/sdk/lib/libbt.a b/tools/sdk/lib/libbt.a index fd967009..ae7e13ec 100644 Binary files a/tools/sdk/lib/libbt.a and b/tools/sdk/lib/libbt.a differ diff --git a/tools/sdk/lib/libc.a b/tools/sdk/lib/libc.a index 36a1cc60..56f7e985 100644 Binary files a/tools/sdk/lib/libc.a and b/tools/sdk/lib/libc.a differ diff --git a/tools/sdk/lib/libc_nano.a b/tools/sdk/lib/libc_nano.a index 9afd3798..09029a21 100644 Binary files a/tools/sdk/lib/libc_nano.a and b/tools/sdk/lib/libc_nano.a differ diff --git a/tools/sdk/lib/libcoap.a b/tools/sdk/lib/libcoap.a index e4b71272..a3fa3744 100644 Binary files a/tools/sdk/lib/libcoap.a and b/tools/sdk/lib/libcoap.a differ diff --git a/tools/sdk/lib/libcoexist.a b/tools/sdk/lib/libcoexist.a index d006de98..3bbf3f94 100644 Binary files a/tools/sdk/lib/libcoexist.a and b/tools/sdk/lib/libcoexist.a differ diff --git a/tools/sdk/lib/libconsole.a b/tools/sdk/lib/libconsole.a index b72edd01..d9424e8a 100644 Binary files a/tools/sdk/lib/libconsole.a and b/tools/sdk/lib/libconsole.a differ diff --git a/tools/sdk/lib/libcore.a b/tools/sdk/lib/libcore.a index b93cbee7..d88f7175 100644 Binary files a/tools/sdk/lib/libcore.a and b/tools/sdk/lib/libcore.a differ diff --git a/tools/sdk/lib/libcxx.a b/tools/sdk/lib/libcxx.a index 968f5fd7..3907b7b2 100644 Binary files a/tools/sdk/lib/libcxx.a and b/tools/sdk/lib/libcxx.a differ diff --git a/tools/sdk/lib/libdriver.a b/tools/sdk/lib/libdriver.a index 080ffd77..f0997038 100644 Binary files a/tools/sdk/lib/libdriver.a and b/tools/sdk/lib/libdriver.a differ diff --git a/tools/sdk/lib/libesp32.a b/tools/sdk/lib/libesp32.a index 74ab232d..0d94d812 100644 Binary files a/tools/sdk/lib/libesp32.a and b/tools/sdk/lib/libesp32.a differ diff --git a/tools/sdk/lib/libesp_adc_cal.a b/tools/sdk/lib/libesp_adc_cal.a index bbb36644..32a3ea0c 100644 Binary files a/tools/sdk/lib/libesp_adc_cal.a and b/tools/sdk/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/lib/libespnow.a b/tools/sdk/lib/libespnow.a index aa4cb112..9f34fe3d 100644 Binary files a/tools/sdk/lib/libespnow.a and b/tools/sdk/lib/libespnow.a differ diff --git a/tools/sdk/lib/libethernet.a b/tools/sdk/lib/libethernet.a index 5e2be30d..af0a47e1 100644 Binary files a/tools/sdk/lib/libethernet.a and b/tools/sdk/lib/libethernet.a differ diff --git a/tools/sdk/lib/libexpat.a b/tools/sdk/lib/libexpat.a index f1a6c6b2..61104870 100644 Binary files a/tools/sdk/lib/libexpat.a and b/tools/sdk/lib/libexpat.a differ diff --git a/tools/sdk/lib/libfatfs.a b/tools/sdk/lib/libfatfs.a index adc71235..bcccfba8 100644 Binary files a/tools/sdk/lib/libfatfs.a and b/tools/sdk/lib/libfatfs.a differ diff --git a/tools/sdk/lib/libfreertos.a b/tools/sdk/lib/libfreertos.a index 611c383e..5f4cc1e0 100644 Binary files a/tools/sdk/lib/libfreertos.a and b/tools/sdk/lib/libfreertos.a differ diff --git a/tools/sdk/lib/libheap.a b/tools/sdk/lib/libheap.a index b4eb917d..0efa897b 100644 Binary files a/tools/sdk/lib/libheap.a and b/tools/sdk/lib/libheap.a differ diff --git a/tools/sdk/lib/libjsmn.a b/tools/sdk/lib/libjsmn.a index c36c0b49..274afea6 100644 Binary files a/tools/sdk/lib/libjsmn.a and b/tools/sdk/lib/libjsmn.a differ diff --git a/tools/sdk/lib/libjson.a b/tools/sdk/lib/libjson.a index 9b1b589a..913c9819 100644 Binary files a/tools/sdk/lib/libjson.a and b/tools/sdk/lib/libjson.a differ diff --git a/tools/sdk/lib/liblog.a b/tools/sdk/lib/liblog.a index 1c9a8730..36a23608 100644 Binary files a/tools/sdk/lib/liblog.a and b/tools/sdk/lib/liblog.a differ diff --git a/tools/sdk/lib/liblwip.a b/tools/sdk/lib/liblwip.a index b2015969..62c0517a 100644 Binary files a/tools/sdk/lib/liblwip.a and b/tools/sdk/lib/liblwip.a differ diff --git a/tools/sdk/lib/libmbedtls.a b/tools/sdk/lib/libmbedtls.a index 6d4ffa45..28bf8f95 100644 Binary files a/tools/sdk/lib/libmbedtls.a and b/tools/sdk/lib/libmbedtls.a differ diff --git a/tools/sdk/lib/libmdns.a b/tools/sdk/lib/libmdns.a index 91d0e9db..b3dc5505 100644 Binary files a/tools/sdk/lib/libmdns.a and b/tools/sdk/lib/libmdns.a differ diff --git a/tools/sdk/lib/libmicro-ecc.a b/tools/sdk/lib/libmicro-ecc.a index dc4ad280..55810bf1 100644 Binary files a/tools/sdk/lib/libmicro-ecc.a and b/tools/sdk/lib/libmicro-ecc.a differ diff --git a/tools/sdk/lib/libnet80211.a b/tools/sdk/lib/libnet80211.a index cc815e55..36722353 100644 Binary files a/tools/sdk/lib/libnet80211.a and b/tools/sdk/lib/libnet80211.a differ diff --git a/tools/sdk/lib/libnewlib.a b/tools/sdk/lib/libnewlib.a index ebf700c3..33ba81cf 100644 Binary files a/tools/sdk/lib/libnewlib.a and b/tools/sdk/lib/libnewlib.a differ diff --git a/tools/sdk/lib/libnghttp.a b/tools/sdk/lib/libnghttp.a index 2df3d1f3..c182d1b4 100644 Binary files a/tools/sdk/lib/libnghttp.a and b/tools/sdk/lib/libnghttp.a differ diff --git a/tools/sdk/lib/libnvs_flash.a b/tools/sdk/lib/libnvs_flash.a index a7c10fdc..c800dcb7 100644 Binary files a/tools/sdk/lib/libnvs_flash.a and b/tools/sdk/lib/libnvs_flash.a differ diff --git a/tools/sdk/lib/libopenssl.a b/tools/sdk/lib/libopenssl.a index df6acaaf..8045e885 100644 Binary files a/tools/sdk/lib/libopenssl.a and b/tools/sdk/lib/libopenssl.a differ diff --git a/tools/sdk/lib/libphy.a b/tools/sdk/lib/libphy.a index fbc06687..045a7149 100755 Binary files a/tools/sdk/lib/libphy.a and b/tools/sdk/lib/libphy.a differ diff --git a/tools/sdk/lib/libpp.a b/tools/sdk/lib/libpp.a index 42f164c5..3a3db261 100644 Binary files a/tools/sdk/lib/libpp.a and b/tools/sdk/lib/libpp.a differ diff --git a/tools/sdk/lib/libpthread.a b/tools/sdk/lib/libpthread.a index 8dcfacfd..1feeaae2 100644 Binary files a/tools/sdk/lib/libpthread.a and b/tools/sdk/lib/libpthread.a differ diff --git a/tools/sdk/lib/librtc.a b/tools/sdk/lib/librtc.a index 79f1f99d..7998bdca 100755 Binary files a/tools/sdk/lib/librtc.a and b/tools/sdk/lib/librtc.a differ diff --git a/tools/sdk/lib/libsdmmc.a b/tools/sdk/lib/libsdmmc.a index f83543cd..d08cc064 100644 Binary files a/tools/sdk/lib/libsdmmc.a and b/tools/sdk/lib/libsdmmc.a differ diff --git a/tools/sdk/lib/libsoc.a b/tools/sdk/lib/libsoc.a index 276c02c5..601cffd7 100644 Binary files a/tools/sdk/lib/libsoc.a and b/tools/sdk/lib/libsoc.a differ diff --git a/tools/sdk/lib/libspi_flash.a b/tools/sdk/lib/libspi_flash.a index cd9570a7..b95f85d6 100644 Binary files a/tools/sdk/lib/libspi_flash.a and b/tools/sdk/lib/libspi_flash.a differ diff --git a/tools/sdk/lib/libspiffs.a b/tools/sdk/lib/libspiffs.a index b6496b1d..71f3a77f 100644 Binary files a/tools/sdk/lib/libspiffs.a and b/tools/sdk/lib/libspiffs.a differ diff --git a/tools/sdk/lib/libtcpip_adapter.a b/tools/sdk/lib/libtcpip_adapter.a index 7b2da359..f53692e7 100644 Binary files a/tools/sdk/lib/libtcpip_adapter.a and b/tools/sdk/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/lib/libulp.a b/tools/sdk/lib/libulp.a index 88c4228b..13fa2636 100644 Binary files a/tools/sdk/lib/libulp.a and b/tools/sdk/lib/libulp.a differ diff --git a/tools/sdk/lib/libvfs.a b/tools/sdk/lib/libvfs.a index 4a298675..5250330f 100644 Binary files a/tools/sdk/lib/libvfs.a and b/tools/sdk/lib/libvfs.a differ diff --git a/tools/sdk/lib/libwear_levelling.a b/tools/sdk/lib/libwear_levelling.a index 0d12d7fb..4bb29c83 100644 Binary files a/tools/sdk/lib/libwear_levelling.a and b/tools/sdk/lib/libwear_levelling.a differ diff --git a/tools/sdk/lib/libwpa.a b/tools/sdk/lib/libwpa.a index 4235f8e7..15787279 100644 Binary files a/tools/sdk/lib/libwpa.a and b/tools/sdk/lib/libwpa.a differ diff --git a/tools/sdk/lib/libwpa2.a b/tools/sdk/lib/libwpa2.a index ed475467..63842c26 100644 Binary files a/tools/sdk/lib/libwpa2.a and b/tools/sdk/lib/libwpa2.a differ diff --git a/tools/sdk/lib/libwpa_supplicant.a b/tools/sdk/lib/libwpa_supplicant.a index af40aab1..5ca06e10 100644 Binary files a/tools/sdk/lib/libwpa_supplicant.a and b/tools/sdk/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/lib/libwps.a b/tools/sdk/lib/libwps.a index b890362b..56a88fbf 100644 Binary files a/tools/sdk/lib/libwps.a and b/tools/sdk/lib/libwps.a differ diff --git a/tools/sdk/lib/libxtensa-debug-module.a b/tools/sdk/lib/libxtensa-debug-module.a index c0c00bf9..520e4891 100644 Binary files a/tools/sdk/lib/libxtensa-debug-module.a and b/tools/sdk/lib/libxtensa-debug-module.a differ diff --git a/tools/sdk/sdkconfig b/tools/sdk/sdkconfig index 2970de88..7d4a3feb 100644 --- a/tools/sdk/sdkconfig +++ b/tools/sdk/sdkconfig @@ -91,6 +91,7 @@ CONFIG_OPTIMIZATION_LEVEL_RELEASE= CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y CONFIG_OPTIMIZATION_ASSERTIONS_SILENT= CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED= +CONFIG_CXX_EXCEPTIONS= # # Component config @@ -165,7 +166,7 @@ CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048 -CONFIG_MAIN_TASK_STACK_SIZE=8192 +CONFIG_MAIN_TASK_STACK_SIZE=4096 CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=4096 CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y @@ -242,6 +243,11 @@ CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION= CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 CONFIG_ESP32_PHY_MAX_TX_POWER=20 +# +# Power Management +# +CONFIG_PM_ENABLE= + # # Ethernet # @@ -306,6 +312,7 @@ CONFIG_SUPPORT_STATIC_ALLOCATION= CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=2048 CONFIG_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_USE_TRACE_FACILITY= CONFIG_FREERTOS_DEBUG_INTERNALS= # @@ -338,7 +345,6 @@ CONFIG_LOG_COLORS= # CONFIG_L2_TO_L3_COPY= CONFIG_LWIP_MAX_SOCKETS=10 -CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0 CONFIG_LWIP_SO_REUSE=y CONFIG_LWIP_SO_REUSE_RXTOALL=y CONFIG_LWIP_SO_RCVBUF=y