mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-29 10:17:15 +02:00
Update IDF to 9274814 (#767)
* Update IDF to 9274814 * Fix error in i2c and Arduino
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -20,24 +20,38 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "soc/adc_channel.h"
|
||||
|
||||
typedef enum {
|
||||
ADC_ATTEN_0db = 0, /*!<The input voltage of ADC will be reduced to about 1/1 */
|
||||
ADC_ATTEN_2_5db = 1, /*!<The input voltage of ADC will be reduced to about 1/1.34 */
|
||||
ADC_ATTEN_6db = 2, /*!<The input voltage of ADC will be reduced to about 1/2 */
|
||||
ADC_ATTEN_11db = 3, /*!<The input voltage of ADC will be reduced to about 1/3.6*/
|
||||
ADC_ATTEN_DB_0 = 0, /*!<The input voltage of ADC will be reduced to about 1/1 */
|
||||
ADC_ATTEN_DB_2_5 = 1, /*!<The input voltage of ADC will be reduced to about 1/1.34 */
|
||||
ADC_ATTEN_DB_6 = 2, /*!<The input voltage of ADC will be reduced to about 1/2 */
|
||||
ADC_ATTEN_DB_11 = 3, /*!<The input voltage of ADC will be reduced to about 1/3.6*/
|
||||
ADC_ATTEN_MAX,
|
||||
} adc_atten_t;
|
||||
|
||||
typedef enum {
|
||||
ADC_WIDTH_9Bit = 0, /*!< ADC capture width is 9Bit*/
|
||||
ADC_WIDTH_10Bit = 1, /*!< ADC capture width is 10Bit*/
|
||||
ADC_WIDTH_11Bit = 2, /*!< ADC capture width is 11Bit*/
|
||||
ADC_WIDTH_12Bit = 3, /*!< ADC capture width is 12Bit*/
|
||||
ADC_WIDTH_BIT_9 = 0, /*!< ADC capture width is 9Bit*/
|
||||
ADC_WIDTH_BIT_10 = 1, /*!< ADC capture width is 10Bit*/
|
||||
ADC_WIDTH_BIT_11 = 2, /*!< ADC capture width is 11Bit*/
|
||||
ADC_WIDTH_BIT_12 = 3, /*!< ADC capture width is 12Bit*/
|
||||
ADC_WIDTH_MAX,
|
||||
} adc_bits_width_t;
|
||||
|
||||
//this definitions are only for being back-compatible
|
||||
#define ADC_ATTEN_0db ADC_ATTEN_DB_0
|
||||
#define ADC_ATTEN_2_5db ADC_ATTEN_DB_2_5
|
||||
#define ADC_ATTEN_6db ADC_ATTEN_DB_6
|
||||
#define ADC_ATTEN_11db ADC_ATTEN_DB_11
|
||||
//this definitions are only for being back-compatible
|
||||
#define ADC_WIDTH_9Bit ADC_WIDTH_BIT_9
|
||||
#define ADC_WIDTH_10Bit ADC_WIDTH_BIT_10
|
||||
#define ADC_WIDTH_11Bit ADC_WIDTH_BIT_11
|
||||
#define ADC_WIDTH_12Bit ADC_WIDTH_BIT_12
|
||||
|
||||
typedef enum {
|
||||
ADC1_CHANNEL_0 = 0, /*!< ADC1 channel 0 is GPIO36 */
|
||||
ADC1_CHANNEL_1, /*!< ADC1 channel 1 is GPIO37 */
|
||||
@ -64,11 +78,43 @@ typedef enum {
|
||||
ADC2_CHANNEL_MAX,
|
||||
} adc2_channel_t;
|
||||
|
||||
typedef enum {
|
||||
ADC_CHANNEL_0 = 0, /*!< ADC channel */
|
||||
ADC_CHANNEL_1, /*!< ADC channel */
|
||||
ADC_CHANNEL_2, /*!< ADC channel */
|
||||
ADC_CHANNEL_3, /*!< ADC channel */
|
||||
ADC_CHANNEL_4, /*!< ADC channel */
|
||||
ADC_CHANNEL_5, /*!< ADC channel */
|
||||
ADC_CHANNEL_6, /*!< ADC channel */
|
||||
ADC_CHANNEL_7, /*!< ADC channel */
|
||||
ADC_CHANNEL_8, /*!< ADC channel */
|
||||
ADC_CHANNEL_9, /*!< ADC channel */
|
||||
ADC_CHANNEL_MAX,
|
||||
} adc_channel_t;
|
||||
|
||||
typedef enum {
|
||||
ADC_UNIT_1 = 1, /*!< SAR ADC 1*/
|
||||
ADC_UNIT_2 = 2, /*!< SAR ADC 2, not supported yet*/
|
||||
ADC_UNIT_BOTH = 3, /*!< SAR ADC 1 and 2, not supported yet */
|
||||
ADC_UNIT_ALTER = 7, /*!< SAR ADC 1 and 2 alternative mode, not supported yet */
|
||||
ADC_UNIT_MAX,
|
||||
} adc_unit_t;
|
||||
|
||||
typedef enum {
|
||||
ADC_ENCODE_12BIT, /*!< ADC to I2S data format, [15:12]-channel [11:0]-12 bits ADC data */
|
||||
ADC_ENCODE_11BIT, /*!< ADC to I2S data format, [15]-1 [14:11]-channel [10:0]-11 bits ADC data */
|
||||
ADC_ENCODE_MAX,
|
||||
} adc_i2s_encode_t;
|
||||
|
||||
typedef enum {
|
||||
ADC_I2S_DATA_SRC_IO_SIG = 0, /*!< I2S data from GPIO matrix signal */
|
||||
ADC_I2S_DATA_SRC_ADC = 1, /*!< I2S data from ADC */
|
||||
ADC_I2S_DATA_SRC_MAX,
|
||||
} adc_i2s_source_t;
|
||||
|
||||
/**
|
||||
* @brief Configure ADC1 capture width.
|
||||
*
|
||||
* @brief Configure ADC1 capture width, meanwhile enable output invert for ADC1.
|
||||
* The configuration is for all channels of ADC1
|
||||
*
|
||||
* @param width_bit Bit capture width for ADC1
|
||||
*
|
||||
* @return
|
||||
@ -77,6 +123,16 @@ typedef enum {
|
||||
*/
|
||||
esp_err_t adc1_config_width(adc_bits_width_t width_bit);
|
||||
|
||||
/**
|
||||
* @brief Configure ADC capture width.
|
||||
* @param adc_unit ADC unit index
|
||||
* @param width_bit Bit capture width for ADC unit.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t adc_set_data_width(adc_unit_t adc_unit, adc_bits_width_t width_bit);
|
||||
|
||||
/**
|
||||
* @brief Configure the ADC1 channel, including setting attenuation.
|
||||
*
|
||||
@ -89,10 +145,10 @@ esp_err_t adc1_config_width(adc_bits_width_t width_bit);
|
||||
*
|
||||
* When VDD_A is 3.3V:
|
||||
*
|
||||
* - 0dB attenuaton (ADC_ATTEN_0db) gives full-scale voltage 1.1V
|
||||
* - 2.5dB attenuation (ADC_ATTEN_2_5db) gives full-scale voltage 1.5V
|
||||
* - 6dB attenuation (ADC_ATTEN_6db) gives full-scale voltage 2.2V
|
||||
* - 11dB attenuation (ADC_ATTEN_11db) gives full-scale voltage 3.9V (see note below)
|
||||
* - 0dB attenuaton (ADC_ATTEN_DB_0) gives full-scale voltage 1.1V
|
||||
* - 2.5dB attenuation (ADC_ATTEN_DB_2_5) gives full-scale voltage 1.5V
|
||||
* - 6dB attenuation (ADC_ATTEN_DB_6) gives full-scale voltage 2.2V
|
||||
* - 11dB attenuation (ADC_ATTEN_DB_11) gives full-scale voltage 3.9V (see note below)
|
||||
*
|
||||
* @note The full-scale voltage is the voltage corresponding to a maximum reading (depending on ADC1 configured
|
||||
* bit width, this value is: 4095 for 12-bits, 2047 for 11-bits, 1023 for 10-bits, 511 for 9 bits.)
|
||||
@ -134,6 +190,62 @@ int adc1_get_raw(adc1_channel_t channel);
|
||||
int adc1_get_voltage(adc1_channel_t channel) __attribute__((deprecated));
|
||||
/** @endcond */
|
||||
|
||||
/**
|
||||
* @brief Power on SAR ADC
|
||||
*/
|
||||
void adc_power_on();
|
||||
|
||||
/**
|
||||
* @brief Power off SAR ADC
|
||||
*/
|
||||
void adc_power_off();
|
||||
|
||||
/**
|
||||
* @brief Initialize ADC pad
|
||||
* @param adc_unit ADC unit index
|
||||
* @param channel ADC channel index
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t adc_gpio_init(adc_unit_t adc_unit, adc_channel_t channel);
|
||||
|
||||
/**
|
||||
* @brief Set ADC data invert
|
||||
* @param adc_unit ADC unit index
|
||||
* @param inv_en whether enable data invert
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t adc_set_data_inv(adc_unit_t adc_unit, bool inv_en);
|
||||
|
||||
/**
|
||||
* @brief Set ADC source clock
|
||||
* @param clk_div ADC clock divider, ADC clock is divided from APB clock
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t adc_set_clk_div(uint8_t clk_div);
|
||||
|
||||
/**
|
||||
* @brief Set I2S data source
|
||||
* @param src I2S DMA data source, I2S DMA can get data from digital signals or from ADC.
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
*/
|
||||
esp_err_t adc_set_i2s_data_source(adc_i2s_source_t src);
|
||||
|
||||
/**
|
||||
* @brief Initialize I2S ADC mode
|
||||
* @param adc_unit ADC unit index
|
||||
* @param channel ADC channel index
|
||||
* @return
|
||||
* - ESP_OK success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel);
|
||||
|
||||
/**
|
||||
* @brief Configure ADC1 to be usable by the ULP
|
||||
*
|
||||
|
@ -200,7 +200,7 @@ esp_err_t i2c_isr_free(intr_handle_t handle);
|
||||
* - ESP_OK Success
|
||||
* - ESP_ERR_INVALID_ARG Parameter error
|
||||
*/
|
||||
esp_err_t i2c_set_pin(i2c_port_t i2c_num, gpio_num_t sda_io_num, gpio_num_t scl_io_num,
|
||||
esp_err_t i2c_set_pin(i2c_port_t i2c_num, int sda_io_num, int scl_io_num,
|
||||
gpio_pullup_t sda_pullup_en, gpio_pullup_t scl_pullup_en, i2c_mode_t mode);
|
||||
|
||||
/**
|
||||
@ -341,7 +341,7 @@ esp_err_t i2c_master_stop(i2c_cmd_handle_t cmd_handle);
|
||||
* - ESP_ERR_INVALID_STATE I2C driver not installed or not in master mode.
|
||||
* - ESP_ERR_TIMEOUT Operation timeout because the bus is busy.
|
||||
*/
|
||||
esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle, portBASE_TYPE ticks_to_wait);
|
||||
esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle, TickType_t ticks_to_wait);
|
||||
|
||||
/**
|
||||
* @brief I2C slave write data to internal ringbuffer, when tx fifo empty, isr will fill the hardware
|
||||
@ -358,7 +358,7 @@ esp_err_t i2c_master_cmd_begin(i2c_port_t i2c_num, i2c_cmd_handle_t cmd_handle,
|
||||
* - ESP_FAIL(-1) Parameter error
|
||||
* - Others(>=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
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
34
tools/sdk/include/lwip/port/netif/wlanif.h → tools/sdk/include/esp32/esp32/pm.h
Executable file → Normal file
34
tools/sdk/include/lwip/port/netif/wlanif.h → tools/sdk/include/esp32/esp32/pm.h
Executable file → Normal file
@ -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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#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_ */
|
@ -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();
|
||||
|
@ -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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -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);
|
||||
|
||||
|
179
tools/sdk/include/esp32/esp_pm.h
Normal file
179
tools/sdk/include/esp32/esp_pm.h
Normal file
@ -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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#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
|
@ -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
|
||||
#endif
|
||||
|
226
tools/sdk/include/esp32/esp_timer.h
Normal file
226
tools/sdk/include/esp32/esp_timer.h
Normal file
@ -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.
|
||||
*
|
||||
* <to be implemented> 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. </to be implemented>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdio.h>
|
||||
#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
|
||||
|
@ -71,7 +71,7 @@ typedef struct {
|
||||
for uint32 arithmetic */
|
||||
uint32_t offset; /**<Offset in mV used to correct LUT Voltages to current v_ref */
|
||||
uint32_t ideal_offset; /**<Offset in mV at the ideal reference voltage */
|
||||
adc_bits_width_t bit_width; /**<Bit width of ADC e.g. ADC_WIDTH_12Bit */
|
||||
adc_bits_width_t bit_width; /**<Bit width of ADC e.g. ADC_WIDTH_BIT_12 */
|
||||
const esp_adc_cal_lookup_table_t *table; /**<Pointer to LUT */
|
||||
} esp_adc_cal_characteristics_t;
|
||||
|
||||
|
@ -95,8 +95,20 @@
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#define configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS 1
|
||||
|
||||
/* TODO: config freq by menuconfig */
|
||||
#define XT_CLOCK_FREQ (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000)
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
/**
|
||||
* This function is defined to provide a deprecation warning whenever
|
||||
* XT_CLOCK_FREQ macro is used.
|
||||
* Update the code to use esp_clk_cpu_freq function instead.
|
||||
* @return current CPU clock frequency, in Hz
|
||||
*/
|
||||
int xt_clock_freq(void) __attribute__((deprecated));
|
||||
|
||||
#define XT_CLOCK_FREQ (xt_clock_freq())
|
||||
|
||||
#endif // __ASSEMBLER__
|
||||
|
||||
|
||||
/* Required for configuration-dependent settings */
|
||||
#include "xtensa_config.h"
|
||||
@ -190,8 +202,19 @@
|
||||
#define configTOTAL_HEAP_SIZE (&_heap_end - &_heap_start)//( ( size_t ) (64 * 1024) )
|
||||
|
||||
#define configMAX_TASK_NAME_LEN ( CONFIG_FREERTOS_MAX_TASK_NAME_LEN )
|
||||
#define configUSE_TRACE_FACILITY 0 /* Used by vTaskList in main.c */
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0 /* Used by vTaskList in main.c */
|
||||
|
||||
#ifdef CONFIG_FREERTOS_USE_TRACE_FACILITY
|
||||
#define configUSE_TRACE_FACILITY 1 /* Used by uxTaskGetSystemState(), and other trace facility functions */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1 /* Used by vTaskList() */
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
||||
#define configGENERATE_RUN_TIME_STATS 1 /* Used by vTaskGetRunTimeStats() */
|
||||
#endif
|
||||
|
||||
#define configUSE_TRACE_FACILITY_2 0 /* Provided by Xtensa port patch */
|
||||
#define configBENCHMARK 0 /* Provided by Xtensa port patch */
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -203,7 +203,7 @@ void vPortCPUInitializeMutex(portMUX_TYPE *mux);
|
||||
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
|
||||
void vPortCPUAcquireMutex(portMUX_TYPE *mux, const char *function, int line);
|
||||
bool vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout_cycles, const char *function, int line);
|
||||
portBASE_TYPE vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *function, int line);
|
||||
void vPortCPUReleaseMutex(portMUX_TYPE *mux, const char *function, int line);
|
||||
|
||||
|
||||
void vTaskEnterCritical( portMUX_TYPE *mux, const char *function, int line );
|
||||
|
@ -55,7 +55,7 @@ Should be included by all Xtensa generic and RTOS port-specific sources.
|
||||
/*
|
||||
Include any RTOS specific definitions that are needed by this header.
|
||||
*/
|
||||
#include <FreeRTOSConfig.h>
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
/*
|
||||
Convert FreeRTOSConfig definitions to XTENSA definitions.
|
||||
|
@ -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 <FreeRTOSConfig.h>
|
||||
#include "FreeRTOSConfig.h"
|
||||
|
||||
/*
|
||||
Select timer to use for periodic tick, and determine its interrupt number
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
||||
|
@ -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" {
|
||||
|
21
tools/sdk/include/lwip/port/netif/ethernetif.h → tools/sdk/include/lwip/arch/vfs_lwip.h
Executable file → Normal file
21
tools/sdk/include/lwip/port/netif/ethernetif.h → tools/sdk/include/lwip/arch/vfs_lwip.h
Executable file → Normal file
@ -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_ */
|
@ -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);
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#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
|
||||
|
@ -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 <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#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 <stdio.h>
|
||||
|
||||
#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__ */
|
@ -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 <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __PERF_H__
|
||||
#define __PERF_H__
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
#endif /* __PERF_H__ */
|
@ -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 <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#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__ */
|
||||
|
@ -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_ */
|
@ -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 <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#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__ */
|
@ -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_ */
|
@ -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"
|
@ -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"
|
@ -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
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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 ; */
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user