Update IDF to a0468b2 (#2108)

* Update IDF to a0468b2

* add missing ld file

* Fix PIO builds and change coex policy
This commit is contained in:
Me No Dev
2018-11-26 23:22:11 +01:00
committed by GitHub
parent c3ec91f968
commit 04963009ee
988 changed files with 114643 additions and 65141 deletions

View File

@ -39,14 +39,27 @@
// Forces code into RTC fast memory. See "docs/deep-sleep-stub.rst"
#define RTC_IRAM_ATTR __attribute__((section(".rtc.text")))
#if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
// Forces bss variable into external memory. "
#define EXT_RAM_ATTR __attribute__((section(".ext_ram.bss")))
#else
#define EXT_RAM_ATTR
#endif
// Forces data into RTC slow memory. See "docs/deep-sleep-stub.rst"
// Any variable marked with this attribute will keep its value
// during a deep sleep / wake cycle.
#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
// Forces read-only data into RTC slow memory. See "docs/deep-sleep-stub.rst"
// Forces read-only data into RTC memory. See "docs/deep-sleep-stub.rst"
#define RTC_RODATA_ATTR __attribute__((section(".rtc.rodata")))
// Allows to place data into RTC_SLOW memory.
#define RTC_SLOW_ATTR __attribute__((section(".rtc.force_slow")))
// Allows to place data into RTC_FAST memory.
#define RTC_FAST_ATTR __attribute__((section(".rtc.force_fast")))
// Forces data into noinit section to avoid initialization after restart.
#define __NOINIT_ATTR __attribute__((section(".noinit")))
@ -55,4 +68,7 @@
// after restart or during a deep sleep / wake cycle.
#define RTC_NOINIT_ATTR __attribute__((section(".rtc_noinit")))
// Forces to not inline function
#define NOINLINE_ATTR __attribute__((noinline))
#endif /* __ESP_ATTR_H__ */

View File

@ -13,6 +13,7 @@
// limitations under the License.
#pragma once
#include <stdint.h>
/**
* @file esp_clk.h

View File

@ -14,6 +14,11 @@
#ifndef ESP_CORE_DUMP_H_
#define ESP_CORE_DUMP_H_
/**************************************************************************************/
/******************************** EXCEPTION MODE API **********************************/
/**************************************************************************************/
/**
* @brief Initializes core dump module internal data.
*
@ -25,29 +30,29 @@ void esp_core_dump_init();
* @brief Saves core dump to flash.
*
* The structure of data stored in flash is as follows:
* | MAGIC1 |
*
* | TOTAL_LEN | TASKS_NUM | TCB_SIZE |
* | TCB_ADDR_1 | STACK_TOP_1 | STACK_END_1 | TCB_1 | STACK_1 |
* . . . .
* . . . .
* | TCB_ADDR_N | STACK_TOP_N | STACK_END_N | TCB_N | STACK_N |
* | MAGIC2 |
* | CRC32 |
*
* Core dump in flash consists of header and data for every task in the system at the moment of crash.
* For flash data integrity control two magic numbers are used at the beginning and the end of core dump.
* For flash data integrity control CRC is used at the end of core the dump data.
* The structure of core dump data is described below in details.
* 1) MAGIC1 and MAGIC2 are special numbers stored at the beginning and the end of core dump.
* They are used to control core dump data integrity. Size of every number is 4 bytes.
* 2) Core dump starts with header:
* 2.1) TOTAL_LEN is total length of core dump data in flash including magic numbers. Size is 4 bytes.
* 2.2) TASKS_NUM is the number of tasks for which data are stored. Size is 4 bytes.
* 2.3) TCB_SIZE is the size of task's TCB structure. Size is 4 bytes.
* 3) Core dump header is followed by the data for every task in the system.
* 1) Core dump starts with header:
* 1.1) TOTAL_LEN is total length of core dump data in flash including CRC. Size is 4 bytes.
* 1.2) TASKS_NUM is the number of tasks for which data are stored. Size is 4 bytes.
* 1.3) TCB_SIZE is the size of task's TCB structure. Size is 4 bytes.
* 2) Core dump header is followed by the data for every task in the system.
* Task data are started with task header:
* 3.1) TCB_ADDR is the address of TCB in memory. Size is 4 bytes.
* 3.2) STACK_TOP is the top of task's stack (address of the topmost stack item). Size is 4 bytes.
* 3.2) STACK_END is the end of task's stack (address from which task's stack starts). Size is 4 bytes.
* 4) Task header is followed by TCB data. Size is TCB_SIZE bytes.
* 5) Task's stack is placed after TCB data. Size is (STACK_END - STACK_TOP) bytes.
* 2.1) TCB_ADDR is the address of TCB in memory. Size is 4 bytes.
* 2.2) STACK_TOP is the top of task's stack (address of the topmost stack item). Size is 4 bytes.
* 2.2) STACK_END is the end of task's stack (address from which task's stack starts). Size is 4 bytes.
* 3) Task header is followed by TCB data. Size is TCB_SIZE bytes.
* 4) Task's stack is placed after TCB data. Size is (STACK_END - STACK_TOP) bytes.
* 5) CRC is placed at the end of the data.
*/
void esp_core_dump_to_flash();
@ -55,10 +60,26 @@ void esp_core_dump_to_flash();
* @brief Print base64-encoded core dump to UART.
*
* The structure of core dump data is the same as for data stored in flash (@see esp_core_dump_to_flash) with some notes:
* 1) Magic numbers are not present in core dump printed to UART.
* 2) Since magic numbers are omitted TOTAL_LEN does not include their size.
* 1) CRC is not present in core dump printed to UART.
* 2) Since CRC is omitted TOTAL_LEN does not include its size.
* 3) Printed base64 data are surrounded with special messages to help user recognize the start and end of actual data.
*/
void esp_core_dump_to_uart();
/**************************************************************************************/
/*********************************** USER MODE API ************************************/
/**************************************************************************************/
/**
* @brief Retrieves address and size of coredump data in flash.
* This function is always available, even when core dump is disabled in menuconfig.
*
* @param out_addr pointer to store image address in flash.
* @param out_size pointer to store image size in flash (including CRC). In bytes.
*
* @return ESP_OK on success, otherwise \see esp_err_t
*/
esp_err_t esp_core_dump_image_get(size_t* out_addr, size_t *out_size);
#endif

View File

@ -78,6 +78,9 @@ const char *esp_err_to_name_r(esp_err_t code, char *buf, size_t buflen);
/** @cond */
void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const char *function, const char *expression) __attribute__((noreturn));
/** @cond */
void _esp_error_check_failed_without_abort(esp_err_t rc, const char *file, int line, const char *function, const char *expression);
#ifndef __ASSERT_FUNC
/* This won't happen on IDF, which defines __ASSERT_FUNC in assert.h, but it does happen when building on the host which
uses /usr/include/assert.h or equivalent.
@ -102,6 +105,13 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
esp_err_t __err_rc = (x); \
(void) sizeof(__err_rc); \
} while(0);
#elif defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT)
#define ESP_ERROR_CHECK(x) do { \
esp_err_t __err_rc = (x); \
if (__err_rc != ESP_OK) { \
abort(); \
} \
} while(0);
#else
#define ESP_ERROR_CHECK(x) do { \
esp_err_t __err_rc = (x); \
@ -112,6 +122,27 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
} while(0);
#endif
/**
* Macro which can be used to check the error code. Prints the error code, error location, and the failed statement to
* serial output.
* In comparison with ESP_ERROR_CHECK(), this prints the same error message but isn't terminating the program.
*/
#ifdef NDEBUG
#define ESP_ERROR_CHECK_WITHOUT_ABORT(x) ({ \
esp_err_t __err_rc = (x); \
__err_rc; \
})
#else
#define ESP_ERROR_CHECK_WITHOUT_ABORT(x) ({ \
esp_err_t __err_rc = (x); \
if (__err_rc != ESP_OK) { \
_esp_error_check_failed_without_abort(__err_rc, __FILE__, __LINE__, \
__ASSERT_FUNC, #x); \
} \
__err_rc; \
})
#endif //NDEBUG
#ifdef __cplusplus
}
#endif

View File

@ -60,6 +60,7 @@ typedef struct {
#define PART_SUBTYPE_DATA_OTA 0x00
#define PART_SUBTYPE_DATA_RF 0x01
#define PART_SUBTYPE_DATA_WIFI 0x02
#define PART_SUBTYPE_DATA_NVS_KEYS 0x04
#define PART_TYPE_END 0xff
#define PART_SUBTYPE_END 0xff

View File

@ -0,0 +1,152 @@
// Copyright 2018 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 <stddef.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
//Opaque pointers as handles for ram/range data
typedef struct esp_himem_ramdata_t *esp_himem_handle_t;
typedef struct esp_himem_rangedata_t *esp_himem_rangehandle_t;
//ESP32 MMU block size
#define ESP_HIMEM_BLKSZ (0x8000)
#define ESP_HIMEM_MAPFLAG_RO 1 /*!< Indicates that a mapping will only be read from. Note that this is unused for now. */
/**
* @brief Allocate a block in high memory
*
* @param size Size of the to-be-allocated block, in bytes. Note that this needs to be
* a multiple of the external RAM mmu block size (32K).
* @param[out] handle_out Handle to be returned
* @returns - ESP_OK if succesful
* - ESP_ERR_NO_MEM if out of memory
* - ESP_ERR_INVALID_SIZE if size is not a multiple of 32K
*/
esp_err_t esp_himem_alloc(size_t size, esp_himem_handle_t *handle_out);
/**
* @brief Allocate a memory region to map blocks into
*
* This allocates a contiguous CPU memory region that can be used to map blocks
* of physical memory into.
*
* @param size Size of the range to be allocated. Note this needs to be a multiple of
* the external RAM mmu block size (32K).
* @param[out] handle_out Handle to be returned
* @returns - ESP_OK if succesful
* - ESP_ERR_NO_MEM if out of memory or address space
* - ESP_ERR_INVALID_SIZE if size is not a multiple of 32K
*/
esp_err_t esp_himem_alloc_map_range(size_t size, esp_himem_rangehandle_t *handle_out);
/**
* @brief Map a block of high memory into the CPUs address space
*
* This effectively makes the block available for read/write operations.
*
* @note The region to be mapped needs to have offsets and sizes that are aligned to the
* SPI RAM MMU block size (32K)
*
* @param handle Handle to the block of memory, as given by esp_himem_alloc
* @param range Range handle to map the memory in
* @param ram_offset Offset into the block of physical memory of the block to map
* @param range_offset Offset into the address range where the block will be mapped
* @param len Length of region to map
* @param flags One of ESP_HIMEM_MAPFLAG_*
* @param[out] out_ptr Pointer to variable to store resulting memory pointer in
* @returns - ESP_OK if the memory could be mapped
* - ESP_ERR_INVALID_ARG if offset, range or len aren't MMU-block-aligned (32K)
* - ESP_ERR_INVALID_SIZE if the offsets/lengths don't fit in the allocated memory or range
* - ESP_ERR_INVALID_STATE if a block in the selected ram offset/length is already mapped, or
* if a block in the selected range offset/length already has a mapping.
*/
esp_err_t esp_himem_map(esp_himem_handle_t handle, esp_himem_rangehandle_t range, size_t ram_offset, size_t range_offset, size_t len, int flags, void **out_ptr);
/**
* @brief Free a block of physical memory
*
* This clears out the associated handle making the memory available for re-allocation again.
* This will only succeed if none of the memory blocks currently have a mapping.
*
* @param handle Handle to the block of memory, as given by esp_himem_alloc
* @returns - ESP_OK if the memory is succesfully freed
* - ESP_ERR_INVALID_ARG if the handle still is (partially) mapped
*/
esp_err_t esp_himem_free(esp_himem_handle_t handle);
/**
* @brief Free a mapping range
*
* This clears out the associated handle making the range available for re-allocation again.
* This will only succeed if none of the range blocks currently are used for a mapping.
*
* @param handle Handle to the range block, as given by esp_himem_alloc_map_range
* @returns - ESP_OK if the memory is succesfully freed
* - ESP_ERR_INVALID_ARG if the handle still is (partially) mapped to
*/
esp_err_t esp_himem_free_map_range(esp_himem_rangehandle_t handle);
/**
* @brief Unmap a region
*
* @param range Range handle
* @param ptr Pointer returned by esp_himem_map
* @param len Length of the block to be unmapped. Must be aligned to the SPI RAM MMU blocksize (32K)
* @returns - ESP_OK if the memory is succesfully unmapped,
* - ESP_ERR_INVALID_ARG if ptr or len are invalid.
*/
esp_err_t esp_himem_unmap(esp_himem_rangehandle_t range, void *ptr, size_t len);
/**
* @brief Get total amount of memory under control of himem API
*
* @returns Amount of memory, in bytes
*/
size_t esp_himem_get_phys_size();
/**
* @brief Get free amount of memory under control of himem API
*
* @returns Amount of free memory, in bytes
*/
size_t esp_himem_get_free_size();
/**
* @brief Get amount of SPI memory address space needed for bankswitching
*
* @note This is also weakly defined in esp32/spiram.c and returns 0 there, so
* if no other function in this file is used, no memory is reserved.
*
* @returns Amount of reserved area, in bytes
*/
size_t esp_himem_reserved_area_size();
#ifdef __cplusplus
}
#endif

View File

@ -194,18 +194,19 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre
/**
* @brief Disable and free an interrupt.
*
* Use an interrupt handle to disable the interrupt and release the resources
* associated with it.
* Use an interrupt handle to disable the interrupt and release the resources associated with it.
* If the current core is not the core that registered this interrupt, this routine will be assigned to
* the core that allocated this interrupt, blocking and waiting until the resource is successfully released.
*
* @note
* When the handler shares its source with other handlers, the interrupt status
* bits it's responsible for should be managed properly before freeing it. see
* ``esp_intr_disable`` for more details.
* ``esp_intr_disable`` for more details. Please do not call this function in ``esp_ipc_call_blocking``.
*
* @param handle The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus
*
* @return ESP_ERR_INVALID_ARG if handle is invalid, or esp_intr_free runs on another core than
* where the interrupt is allocated on.
* @return ESP_ERR_INVALID_ARG the handle is NULL
* ESP_FAIL failed to release this handle
* ESP_OK otherwise
*/
esp_err_t esp_intr_free(intr_handle_t handle);

View File

@ -33,21 +33,6 @@ typedef void (*esp_ipc_func_t)(void* arg);
* These APIs can only be used when FreeRTOS scheduler is running.
*/
/*
* Initialize inter-processor call module. This function is called automatically
* on CPU start and should not be called from the application.
*
* This function start two tasks, one on each CPU. These tasks are started
* with high priority. These tasks are normally inactive, waiting until one of
* the esp_ipc_call_* functions to be used. One of these tasks will be
* woken up to execute the callback provided to esp_ipc_call_nonblocking or
* esp_ipc_call_blocking.
*/
/** @cond */
void esp_ipc_init();
/** @endcond */
/**
* @brief Execute a function on the given CPU
*

View File

@ -185,6 +185,8 @@ typedef enum {
Fixed Root Setting of each device is variable as that setting changes of the root. */
MESH_EVENT_SCAN_DONE, /**< if self-organized networking is disabled, user can call esp_wifi_scan_start() to trigger
this event, and add the corresponding scan done handler in this event. */
MESH_EVENT_NETWORK_STATE, /**< network state, such as whether current mesh network has a root. */
MESH_EVENT_STOP_RECONNECTION, /**< the root stops reconnecting to the router and non-root devices stop reconnecting to their parents. */
MESH_EVENT_MAX,
} mesh_event_id_t;
@ -229,13 +231,18 @@ typedef enum {
* @brief Mesh disconnect reason code
*/
typedef enum {
MESH_REASON_CYCLIC = 100, /**< cyclic is detected */
MESH_REASON_PARENT_IDLE, /**< parent is idle */
MESH_REASON_LEAF, /**< the connected device is changed to a leaf */
MESH_REASON_DIFF_ID, /**< in different mesh ID */
MESH_REASON_ROOTS, /**< root conflict is detected */
MESH_REASON_PARENT_STOPPED, /**< parent has stopped the mesh */
MESH_REASON_SCAN_FAIL, /**< scan fail */
MESH_REASON_CYCLIC = 100, /**< cyclic is detected */
MESH_REASON_PARENT_IDLE, /**< parent is idle */
MESH_REASON_LEAF, /**< the connected device is changed to a leaf */
MESH_REASON_DIFF_ID, /**< in different mesh ID */
MESH_REASON_ROOTS, /**< root conflict is detected */
MESH_REASON_PARENT_STOPPED, /**< parent has stopped the mesh */
MESH_REASON_SCAN_FAIL, /**< scan fail */
MESH_REASON_IE_UNKNOWN, /**< unknown IE */
MESH_REASON_WAIVE_ROOT, /**< waive root */
MESH_REASON_PARENT_WORSE, /**< parent with very poor RSSI */
MESH_REASON_EMPTY_PASSWORD, /**< use an empty password to connect to an encrypted parent */
MESH_REASON_PARENT_UNENCRYPTED, /**< connect to an unencrypted parent/router */
} mesh_disconnect_reason_t;
/*******************************************************
@ -367,6 +374,13 @@ typedef struct {
uint8_t number; /**< the number of APs scanned */
} mesh_event_scan_done_t;
/**
* @brief Network state information
*/
typedef struct {
bool is_rootless; /**< whether current mesh network has a root */
} mesh_event_network_state_t;
/**
* @brief Mesh event information
*/
@ -390,6 +404,7 @@ typedef union {
mesh_event_root_conflict_t root_conflict; /**< other powerful root */
mesh_event_root_fixed_t root_fixed; /**< fixed root */
mesh_event_scan_done_t scan_done; /**< scan done */
mesh_event_network_state_t network_state; /**< network state, such as whether current mesh network has a root. */
} mesh_event_info_t;
/**
@ -541,7 +556,7 @@ esp_err_t esp_mesh_deinit(void);
* - Create TX and RX queues according to the configuration.
* - Register mesh packets receive callback.
*
* @attention This API shall be called after esp_mesh_init() and esp_mesh_set_config().
* @attention  This API shall be called after mesh initialization and configuration.
*
* @return
* - ESP_OK
@ -711,10 +726,10 @@ esp_err_t esp_mesh_recv_toDS(mesh_addr_t *from, mesh_addr_t *to,
* Root conflict function could eliminate redundant roots connected with the same BSSID, but couldn't handle roots
* connected with different BSSID. Because users might have such requirements of setting up routers with same SSID
* for the future replacement. But in that case, if the above situations happen, please make sure applications
* implement forward functions on the root to guarantee devices in different mesh network can communicate with each other.
* implement forward functions on the root to guarantee devices in different mesh networks can communicate with each other.
* max_connection of mesh softAP is limited by the max number of Wi-Fi softAP supported (max:10).
*
* @attention This API shall be called between esp_mesh_init() and esp_mesh_start().
* @attention This API shall be called before mesh is started after mesh is initialized.
*
* @param[in] config pointer to mesh stack configuration
*
@ -739,7 +754,7 @@ esp_err_t esp_mesh_get_config(mesh_cfg_t *config);
/**
* @brief Get router configuration
*
* @attention This API shall be called between esp_mesh_init() and esp_mesh_start().
* @attention This API is used to dynamically modify the router configuration after mesh is configured.
*
* @param[in] router pointer to router configuration
*
@ -763,7 +778,7 @@ esp_err_t esp_mesh_get_router(mesh_router_t *router);
/**
* @brief Set mesh network ID
*
* @attention This API could be called either before esp_mesh_start() or after esp_mesh_start().
* @attention This API is used to dynamically modify the mesh network ID.
*
* @param[in] id pointer to mesh network ID
*
@ -786,6 +801,8 @@ esp_err_t esp_mesh_get_id(mesh_addr_t *id);
/**
* @brief Designate device type over the mesh network
* - MESH_ROOT: designates the root node for a mesh network
* - MESH_LEAF: designates a device as a standalone Wi-Fi station
*
* @param[in] type device type
*
@ -806,10 +823,10 @@ esp_err_t esp_mesh_set_type(mesh_type_t type);
mesh_type_t esp_mesh_get_type(void);
/**
* @brief Set network max layer value (max:25, default:15)
* @brief Set network max layer value (max:25, default:25)
* - Network max layer limits the max hop count.
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] max_layer max layer value
*
@ -830,7 +847,7 @@ int esp_mesh_get_max_layer(void);
/**
* @brief Set mesh softAP password
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] pwd pointer to the password
* @param[in] len password length
@ -845,7 +862,7 @@ esp_err_t esp_mesh_set_ap_password(const uint8_t *pwd, int len);
/**
* @brief Set mesh softAP authentication mode
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] authmode authentication mode
*
@ -866,7 +883,7 @@ wifi_auth_mode_t esp_mesh_get_ap_authmode(void);
/**
* @brief Set mesh softAP max connection value
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] connections the number of max connections
*
@ -914,16 +931,20 @@ esp_err_t esp_mesh_get_parent_bssid(mesh_addr_t *bssid);
bool esp_mesh_is_root(void);
/**
* @brief Enable/disable mesh networking self-organized, self-organized by default
* - If self-organized is disabled, users shall set a parent for the device via
* esp_mesh_set_parent();
* @brief Enable/disable self-organized networking
* - Self-organized networking has three main functions:
* select the root node;
* find a preferred parent;
* initiate reconnection if a disconnection is detected.
* - Self-organized networking is enabled by default.
* - If self-organized is disabled, users should set a parent for the device via esp_mesh_set_parent().
*
* @attention This API could be called either before esp_mesh_start() or after esp_mesh_start().
* @attention This API is used to dynamically modify whether to enable the self organizing.
*
* @param[in] enable enable or disable self-organized networking
* @param[in] select_parent
* - If self-organized networking is enabled, let the device search for a new parent or
* keep connecting to the previous parent.
* @param[in] select_parent Only valid when self-organized networking is enabled.
* - if select_parent is set to true, the root will give up its mesh root status and search for a new parent
* like other non-root devices.
*
* @return
* - ESP_OK
@ -976,7 +997,7 @@ esp_err_t esp_mesh_waive_root(const mesh_vote_t *vote, int reason);
* - During the networking, only obtaining vote percentage reaches this threshold,
* the device could be a root.
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] percentage vote percentage threshold
*
@ -1090,7 +1111,7 @@ int esp_mesh_available_txupQ_num(const mesh_addr_t *addr, uint32_t *xseqno_in);
/**
* @brief Set the number of queue
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] qsize default:32 (min:16)
*
@ -1179,7 +1200,7 @@ bool esp_mesh_is_my_group(const mesh_addr_t *addr);
/**
* @brief Set mesh network capacity
*
* @attention This API shall be called before esp_mesh_start().
* @attention This API shall be called before mesh is started.
*
* @param[in] num mesh network capacity
*
@ -1191,17 +1212,19 @@ bool esp_mesh_is_my_group(const mesh_addr_t *addr);
esp_err_t esp_mesh_set_capacity_num(int num);
/**
* @brief Get mesh network capacity
* @brief Get mesh network capacity
*
* @return mesh network capacity
* @return mesh network capacity
*/
int esp_mesh_get_capacity_num(void);
/**
* @brief Set mesh IE crypto functions
* @brief Set mesh IE crypto functions
*
* @param[in] crypto_funcs crypto functions for mesh IE
* @attention This API can be called at any time after mesh is initialized.
*
* @param[in] crypto_funcs crypto functions for mesh IE
* - If crypto_funcs is set to NULL, mesh IE is no longer encrypted.
* @return
* - ESP_OK
*/
@ -1210,15 +1233,13 @@ esp_err_t esp_mesh_set_ie_crypto_funcs(const mesh_crypto_funcs_t *crypto_funcs);
/**
* @brief Set mesh IE crypto key
*
* @attention This API shall be called after esp_mesh_set_config() and before esp_mesh_start().
* @attention This API can be called at any time after mesh is initialized.
*
* @param[in] key ASCII crypto key
* @param[in] len length in bytes, range:8~64
*
* @return
* - ESP_OK
* - ESP_ERR_MESH_NOT_ALLOWED
* - ESP_ERR_MESH_NOT_CONFIG
* - ESP_MESH_ERR_ARGUMENT
*/
esp_err_t esp_mesh_set_ie_crypto_key(const char *key, int len);
@ -1236,9 +1257,9 @@ esp_err_t esp_mesh_set_ie_crypto_key(const char *key, int len);
esp_err_t esp_mesh_get_ie_crypto_key(char *key, int len);
/**
* @brief Set delay time before network starts root healing
* @brief Set delay time before starting root healing
*
* @param[in] delay_ms delay time in milliseconds
* @param[in] delay_ms delay time in milliseconds
*
* @return
* - ESP_OK
@ -1253,9 +1274,9 @@ esp_err_t esp_mesh_set_root_healing_delay(int delay_ms);
int esp_mesh_get_root_healing_delay(void);
/**
* @brief Set mesh event callback
* @brief Set mesh event callback
*
* @param[in] event_cb mesh event call back
* @param[in] event_cb mesh event call back
*
* @return
* - ESP_OK
@ -1285,12 +1306,23 @@ esp_err_t esp_mesh_fix_root(bool enable);
bool esp_mesh_is_root_fixed(void);
/**
* @brief Specify a parent for the device
* @brief Set a specified parent for the device
*
* @attention This API can be called at any time after mesh is configured.
*
* @param[in] parent parent configuration, the SSID and the channel of the parent are mandatory.
* @param[in] parent_mesh_id parent mesh ID, if not set, use the device default one.
* @param[in] my_type my mesh type
* @param[in] my_layer my mesh layer
* - If the BSSID is set, make sure that the SSID and BSSID represent the same parent,
* otherwise the device will never find this specified parent.
* @param[in] parent_mesh_id parent mesh ID,
* - If this value is not set, the original mesh ID is used.
* @param[in] my_type mesh type
* - If the parent set for the device is the same as the router in the network configuration,
* then my_type shall set MESH_ROOT and my_layer shall set MESH_ROOT_LAYER.
* @param[in] my_layer mesh layer
* - my_layer of the device may change after joining the network.
* - If my_type is set MESH_NODE, my_layer shall be greater than MESH_ROOT_LAYER.
* - If my_type is set MESH_LEAF, the device becomes a standalone Wi-Fi station and no longer
* has the ability to extend the network.
*
* @return
* - ESP_OK
@ -1330,7 +1362,7 @@ esp_err_t esp_mesh_scan_get_ap_ie_len(int *len);
esp_err_t esp_mesh_scan_get_ap_record(wifi_ap_record_t *ap_record, void *buffer);
/**
* @brief flush upstream packets pending in to_parent queue and to_parent_p2p queue
* @brief Flush upstream packets pending in to_parent queue and to_parent_p2p queue
*
* @return
* - ESP_OK
@ -1338,10 +1370,10 @@ esp_err_t esp_mesh_scan_get_ap_record(wifi_ap_record_t *ap_record, void *buffer)
esp_err_t esp_mesh_flush_upstream_packets(void);
/**
* @brief get the number of nodes in the subnet of a specific child
* @brief Get the number of nodes in the subnet of a specific child
*
* @param child_mac an associated child address of this device
* @param nodes_num pointer to the number of nodes in the subnet of a specific child
* @param[in] child_mac an associated child address of this device
* @param[out] nodes_num pointer to the number of nodes in the subnet of a specific child
*
* @return
* - ESP_OK
@ -1351,11 +1383,11 @@ esp_err_t esp_mesh_flush_upstream_packets(void);
esp_err_t esp_mesh_get_subnet_nodes_num(const mesh_addr_t *child_mac, int *nodes_num);
/**
* @brief get nodes in the subnet of a specific child
* @brief Get nodes in the subnet of a specific child
*
* @param child_mac an associated child address of this device
* @param nodes pointer to nodes in the subnet of a specific child
* @param nodes_num the number of nodes in the subnet of a specific child
* @param[in] child_mac an associated child address of this device
* @param[out] nodes pointer to nodes in the subnet of a specific child
* @param[in] nodes_num the number of nodes in the subnet of a specific child
*
* @return
* - ESP_OK
@ -1364,6 +1396,22 @@ esp_err_t esp_mesh_get_subnet_nodes_num(const mesh_addr_t *child_mac, int *nodes
*/
esp_err_t esp_mesh_get_subnet_nodes_list(const mesh_addr_t *child_mac, mesh_addr_t *nodes, int nodes_num);
/**
* @brief Disconnect from current parent
*
* @return
* - ESP_OK
*/
esp_err_t esp_mesh_disconnect(void);
/**
* @brief Connect to current parent
*
* @return
* - ESP_OK
*/
esp_err_t esp_mesh_connect(void);
#ifdef __cplusplus
}
#endif

View File

@ -66,7 +66,7 @@ typedef struct {
uint8_t oui[3]; /**< organization identifier */
/**< mesh networking IE content */
uint8_t type; /** ESP defined IE type */
uint8_t encryped : 1; /**< whether mesh networking IE is encrypted */
uint8_t encrypted : 1; /**< whether mesh networking IE is encrypted */
uint8_t version : 7; /**< mesh networking IE version */
/**< content */
uint8_t mesh_type; /**< mesh device type */

View File

@ -21,26 +21,12 @@
#include <stdbool.h>
#include "esp_err.h"
typedef enum {
ESP_SPIRAM_VOLT_3V3 = 0, /*!< SPI RAM voltage is 3.3v */
ESP_SPIRAM_VOLT_1V8 = 1, /*!< SPI RAM voltage is 1.8v */
ESP_SPIRAM_VOLT_INVALID, /*!< SPI RAM voltage is invalid*/
} esp_spiram_volt_t;
typedef enum {
ESP_SPIRAM_SIZE_32MBITS = 0, /*!< SPI RAM size is 32 MBits */
ESP_SPIRAM_SIZE_64MBITS = 1, /*!< SPI RAM size is 64 MBits */
ESP_SPIRAM_SIZE_INVALID, /*!< SPI RAM size is invalid */
} esp_spiram_size_t;
/**
* @brief get SPI RAM voltage
* @return
* - ESP_SPIRAM_VOLT_INVALID if SPI RAM not enabled or not valid.
* - SPI RAM voltage
*/
esp_spiram_volt_t esp_spiram_get_chip_volt();
/**
* @brief get SPI RAM size
* @return
@ -70,7 +56,7 @@ void esp_spiram_init_cache();
/**
* @brief Memory test for SPI RAM. Should be called after SPI RAM is initialized and
* (in case of a dual-core system) the app CPU is online. This test overwrites the
* (in case of a dual-core system) the app CPU is online. This test overwrites the
* memory with crap, so do not call after e.g. the heap allocator has stored important
* stuff in SPI RAM.
*
@ -116,4 +102,14 @@ void esp_spiram_writeback_cache();
esp_err_t esp_spiram_reserve_dma_pool(size_t size);
/**
* @brief If SPI RAM(PSRAM) has been initialized
*
* @return
* - true SPI RAM has been initialized successfully
* - false SPI RAM hasn't been initialized or initialized failed
*/
bool esp_spiram_is_initialized(void);
#endif

View File

@ -27,6 +27,7 @@
#define _ESP_TASK_H_
#include "sdkconfig.h"
#include "freertos/FreeRTOSConfig.h"
#define ESP_TASK_PRIO_MAX (configMAX_PRIORITIES)
#define ESP_TASK_PRIO_MIN (0)

View File

@ -109,6 +109,7 @@ typedef struct {
int tx_ba_win; /**< WiFi Block Ack TX window size */
int rx_ba_win; /**< WiFi Block Ack RX window size */
int wifi_task_core_id; /**< WiFi Task Core ID */
int beacon_max_len; /**< WiFi softAP maximum length of the beacon */
int magic; /**< WiFi init magic number, it should be the last field */
} wifi_init_config_t;
@ -176,6 +177,12 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
#define WIFI_TASK_CORE_ID 0
#endif
#ifdef CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN
#define WIFI_SOFTAP_BEACON_MAX_LEN CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN
#else
#define WIFI_SOFTAP_BEACON_MAX_LEN 752
#endif
#define WIFI_INIT_CONFIG_DEFAULT() { \
.event_handler = &esp_event_send, \
.osi_funcs = &g_wifi_osi_funcs, \
@ -193,6 +200,7 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs;
.tx_ba_win = WIFI_DEFAULT_TX_BA_WIN,\
.rx_ba_win = WIFI_DEFAULT_RX_BA_WIN,\
.wifi_task_core_id = WIFI_TASK_CORE_ID,\
.beacon_max_len = WIFI_SOFTAP_BEACON_MAX_LEN, \
.magic = WIFI_INIT_CONFIG_MAGIC\
};

View File

@ -215,6 +215,15 @@ void *wifi_realloc( void *ptr, size_t size );
*/
void *wifi_calloc( size_t n, size_t size );
/**
* @brief Update WiFi MAC time
*
* @param uint32_t time_delta : time duration since the WiFi/BT common clock is disabled
*
* @return Always returns ESP_OK
*/
esp_err_t esp_wifi_internal_update_mac_time( uint32_t time_delta );
#ifdef __cplusplus
}
#endif

View File

@ -51,6 +51,19 @@ typedef struct {
uint8_t key[32];
} esp_aes_context;
/**
* \brief The AES XTS context-type definition.
*/
typedef struct
{
esp_aes_context crypt; /*!< The AES context to use for AES block
encryption or decryption. */
esp_aes_context tweak; /*!< The AES context used for tweak
computation. */
} esp_aes_xts_context;
/**
* \brief Lock access to AES hardware unit
*
@ -86,6 +99,23 @@ void esp_aes_init( esp_aes_context *ctx );
*/
void esp_aes_free( esp_aes_context *ctx );
/**
* \brief This function initializes the specified AES XTS context.
*
* It must be the first API called before using
* the context.
*
* \param ctx The AES XTS context to initialize.
*/
void esp_aes_xts_init( esp_aes_xts_context *ctx );
/**
* \brief This function releases and clears the specified AES XTS context.
*
* \param ctx The AES XTS context to clear.
*/
void esp_aes_xts_free( esp_aes_xts_context *ctx );
/**
* \brief AES set key schedule (encryption or decryption)
*
@ -233,6 +263,42 @@ int esp_aes_crypt_ctr( esp_aes_context *ctx,
const unsigned char *input,
unsigned char *output );
/**
* \brief This function prepares an XTS context for encryption and
* sets the encryption key.
*
* \param ctx The AES XTS context to which the key should be bound.
* \param key The encryption key. This is comprised of the XTS key1
* concatenated with the XTS key2.
* \param keybits The size of \p key passed in bits. Valid options are:
* <ul><li>256 bits (each of key1 and key2 is a 128-bit key)</li>
* <li>512 bits (each of key1 and key2 is a 256-bit key)</li></ul>
*
* \return \c 0 on success.
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
*/
int esp_aes_xts_setkey_enc( esp_aes_xts_context *ctx,
const unsigned char *key,
unsigned int keybits );
/**
* \brief This function prepares an XTS context for decryption and
* sets the decryption key.
*
* \param ctx The AES XTS context to which the key should be bound.
* \param key The decryption key. This is comprised of the XTS key1
* concatenated with the XTS key2.
* \param keybits The size of \p key passed in bits. Valid options are:
* <ul><li>256 bits (each of key1 and key2 is a 128-bit key)</li>
* <li>512 bits (each of key1 and key2 is a 256-bit key)</li></ul>
*
* \return \c 0 on success.
* \return #MBEDTLS_ERR_AES_INVALID_KEY_LENGTH on failure.
*/
int esp_aes_xts_setkey_dec( esp_aes_xts_context *ctx,
const unsigned char *key,
unsigned int keybits );
/**
* \brief Internal AES block encryption function

View File

@ -83,6 +83,9 @@ static inline unsigned int IRAM_ATTR cache_flash_mmu_set(int cpu_no, int pid, un
* @brief Set Ext-SRAM-Cache mmu mapping.
* Please do not call this function in your SDK application.
*
* Note that this code lives in IRAM and has a bugfix in respect to the ROM version
* of this function (which erroneously refused a vaddr > 2MiB
*
* @param int cpu_no : CPU number, 0 for PRO cpu, 1 for APP cpu.
*
* @param int pod : process identifier. Range 0~7.
@ -106,18 +109,7 @@ static inline unsigned int IRAM_ATTR cache_flash_mmu_set(int cpu_no, int pid, un
* 4 : mmu table to be written is out of range
* 5 : vaddr is out of range
*/
static inline unsigned int IRAM_ATTR cache_sram_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num)
{
extern unsigned int cache_sram_mmu_set_rom(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
unsigned int ret;
DPORT_STALL_OTHER_CPU_START();
ret = cache_sram_mmu_set_rom(cpu_no, pid, vaddr, paddr, psize, num);
DPORT_STALL_OTHER_CPU_END();
return ret;
}
unsigned int IRAM_ATTR cache_sram_mmu_set(int cpu_no, int pid, unsigned int vaddr, unsigned int paddr, int psize, int num);
/**
* @brief Initialise cache access for the cpu.

View File

@ -36,7 +36,7 @@ extern "C" {
#define RX_BUFF_SIZE 0x100
#define TX_BUFF_SIZE 100
//uart int enalbe register ctrl bits
//uart int enable register ctrl bits
#define UART_RCV_INTEN BIT0
#define UART_TRX_INTEN BIT1
#define UART_LINE_STATUS_INTEN BIT2
@ -267,9 +267,11 @@ void uart_tx_flush(uint8_t uart_no);
* here for compatibility.
*/
static inline void IRAM_ATTR uart_tx_wait_idle(uint8_t uart_no) {
while(REG_GET_FIELD(UART_STATUS_REG(uart_no), UART_ST_UTX_OUT)) {
;
}
uint32_t status;
do {
status = READ_PERI_REG(UART_STATUS_REG(uart_no));
/* either tx count or state is non-zero */
} while ((status & (UART_ST_UTX_OUT_M | UART_TXFIFO_CNT_M)) != 0);
}
/**
@ -299,14 +301,14 @@ char uart_rx_one_char_block(void);
*
* @param uint8_t *pString : the pointer to store the string.
*
* @param uint8_t MaxStrlen : the max string length, incude '\0'.
* @param uint8_t MaxStrlen : the max string length, include '\0'.
*
* @return OK.
*/
STATUS UartRxString(uint8_t *pString, uint8_t MaxStrlen);
/**
* @brief Process uart recevied information in the interrupt handler.
* @brief Process uart received information in the interrupt handler.
* Please do not call this function in SDK.
*
* @param void *para : the message receive buffer.

View File

@ -1401,5 +1401,16 @@ extern const unsigned int XCJOIN(Xthal_cp_mask_,XCHAL_CP7_IDENT);
#define XCHAL_ERRATUM_497 0
#endif
/*
* Erratum 572 (releases TBD, but present in ESP32)
* Disable zero-overhead loop buffer to prevent rare illegal instruction
* exceptions while executing zero-overhead loops.
*/
#if ( XCHAL_HAVE_LOOPS && XCHAL_LOOP_BUFFER_SIZE != 0 )
#define XCHAL_ERRATUM_572 1
#else
#define XCHAL_ERRATUM_572 0
#endif
#endif /*XTENSA_CONFIG_CORE_H*/