mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-30 02:37:14 +02:00
Update IDF to de750e9 and add BLE (#723)
* Update IDF to de750e9 * Add BLE Library submodule
This commit is contained in:
@ -181,6 +181,7 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_ADV_VSC_EVT 34 /* ADV VSC event */
|
||||
#define BTA_GATTC_CONNECT_EVT 35 /* GATTC CONNECT event */
|
||||
#define BTA_GATTC_DISCONNECT_EVT 36 /* GATTC DISCONNECT event */
|
||||
#define BTA_GATTC_READ_MUTIPLE_EVT 37 /* GATTC Read mutiple event */
|
||||
|
||||
typedef UINT8 tBTA_GATTC_EVT;
|
||||
|
||||
|
@ -165,6 +165,7 @@ typedef struct {
|
||||
tBTA_GATT_AUTH_REQ auth_req;
|
||||
UINT8 num_attr;
|
||||
UINT16 handles[GATT_MAX_READ_MULTI_HANDLES];
|
||||
tBTA_GATTC_EVT cmpl_evt;
|
||||
}tBTA_GATTC_API_READ_MULTI;
|
||||
|
||||
typedef struct {
|
||||
|
@ -864,9 +864,9 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
|
||||
/**
|
||||
* @brief Set a GAP security parameter value. Overrides the default value.
|
||||
*
|
||||
* @param[in] param_type :L the type of the param which to be set
|
||||
* @param[in] param_type : the type of the param which to be set
|
||||
* @param[in] value : the param value
|
||||
* @param[out] len : the length of the param value
|
||||
* @param[in] len : the length of the param value
|
||||
*
|
||||
* @return - ESP_OK : success
|
||||
* - other : failed
|
||||
|
@ -63,6 +63,7 @@ typedef enum {
|
||||
ESP_GATTC_UNREG_FOR_NOTIFY_EVT = 39, /*!< When unregister for notification of a service completes, the event comes */
|
||||
ESP_GATTC_CONNECT_EVT = 40, /*!< When the ble physical connection is set up, the event comes */
|
||||
ESP_GATTC_DISCONNECT_EVT = 41, /*!< When the ble physical connection disconnected, the event comes */
|
||||
ESP_GATTC_READ_MUTIPLE_EVT = 42, /*!< When the ble characteristic or descriptor mutiple complete, the event comes */
|
||||
} esp_gattc_cb_event_t;
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 16
|
||||
#define CONFIG_BLE_SMP_ENABLE 1
|
||||
#define CONFIG_TCP_RECVMBOX_SIZE 6
|
||||
#define CONFIG_LWIP_ETHARP_TRUST_IP_MAC 1
|
||||
#define CONFIG_TCP_WND_DEFAULT 5744
|
||||
#define CONFIG_SW_COEXIST_ENABLE 1
|
||||
#define CONFIG_SPIFFS_USE_MAGIC_LENGTH 1
|
||||
@ -154,6 +155,7 @@
|
||||
#define CONFIG_SPIFFS_OBJ_NAME_LEN 32
|
||||
#define CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT 5
|
||||
#define CONFIG_LOG_BOOTLOADER_LEVEL_NONE 1
|
||||
#define CONFIG_TCPIP_RECVMBOX_SIZE 32
|
||||
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
|
||||
#define CONFIG_ESP32_XTAL_FREQ_AUTO 1
|
||||
#define CONFIG_TCP_MAXRTX 12
|
||||
|
@ -27,14 +27,14 @@ extern "C" {
|
||||
* @brief Sigma-delta channel list
|
||||
*/
|
||||
typedef enum{
|
||||
SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel0 */
|
||||
SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel1 */
|
||||
SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel2 */
|
||||
SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel3 */
|
||||
SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel4 */
|
||||
SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel5 */
|
||||
SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel6 */
|
||||
SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel7 */
|
||||
SIGMADELTA_CHANNEL_0 = 0, /*!< Sigma-delta channel 0 */
|
||||
SIGMADELTA_CHANNEL_1 = 1, /*!< Sigma-delta channel 1 */
|
||||
SIGMADELTA_CHANNEL_2 = 2, /*!< Sigma-delta channel 2 */
|
||||
SIGMADELTA_CHANNEL_3 = 3, /*!< Sigma-delta channel 3 */
|
||||
SIGMADELTA_CHANNEL_4 = 4, /*!< Sigma-delta channel 4 */
|
||||
SIGMADELTA_CHANNEL_5 = 5, /*!< Sigma-delta channel 5 */
|
||||
SIGMADELTA_CHANNEL_6 = 6, /*!< Sigma-delta channel 6 */
|
||||
SIGMADELTA_CHANNEL_7 = 7, /*!< Sigma-delta channel 7 */
|
||||
SIGMADELTA_CHANNEL_MAX,
|
||||
} sigmadelta_channel_t;
|
||||
|
||||
@ -64,7 +64,8 @@ esp_err_t sigmadelta_config(const sigmadelta_config_t *config);
|
||||
*
|
||||
* This function is used to set Sigma-delta channel duty,
|
||||
* If you add a capacitor between the output pin and ground,
|
||||
* the average output voltage Vdc = VDDIO / 256 * duty + VDDIO/2, VDDIO is power supply voltage.
|
||||
* the average output voltage will be Vdc = VDDIO / 256 * duty + VDDIO/2,
|
||||
* where VDDIO is the power supply voltage.
|
||||
*
|
||||
* @param channel Sigma-delta channel number
|
||||
* @param duty Sigma-delta duty of one channel, the value ranges from -128 to 127, recommended range is -90 ~ 90.
|
||||
|
@ -64,4 +64,16 @@ void esp_spiram_writeback_cache();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Reserve a pool of internal memory for specific DMA/internal allocations
|
||||
*
|
||||
* @param size Size of reserved pool in bytes
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NO_MEM when no memory available for pool
|
||||
*/
|
||||
esp_err_t esp_spiram_reserve_dma_pool(size_t size);
|
||||
|
||||
|
||||
#endif
|
@ -517,23 +517,34 @@ esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
|
||||
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
||||
|
||||
/**
|
||||
* @brief Set country code
|
||||
* The default value is WIFI_COUNTRY_CN
|
||||
* @brief configure country info
|
||||
*
|
||||
* @param country country type
|
||||
* @attention 1. The default country is {.cc="CN", .schan=1, .nchan=13, policy=WIFI_COUNTRY_POLICY_AUTO}
|
||||
* @attention 2. When the country policy is WIFI_COUNTRY_POLICY_AUTO, use the country info of AP to which
|
||||
* the station is connected. E.g. if the configured country info is {.cc="USA", .schan=1, .nchan=11},
|
||||
* the country info of the AP to which the station is connected is {.cc="JP", .schan=1, .nchan=14},
|
||||
* then our country info is {.cc="JP", .schan=1, .nchan=14}. If the station disconnected
|
||||
* from the AP, the country info back to {.cc="USA", .schan=1, .nchan=11} again.
|
||||
* @attention 3. When the country policy is WIFI_COUNTRY_POLICY_MANUAL, always use the configured country info.
|
||||
* @attention 4. When the country info is changed because of configuration or because the station connects to a different
|
||||
* external AP, the country IE in probe response/beacon of the soft-AP is changed also.
|
||||
* @attention 5. The country configuration is not stored into flash
|
||||
* @attention 6. This API doesn't validate the per-country rules, it's up to the user to fill in all fields according to
|
||||
* local regulations.
|
||||
*
|
||||
* @param country the configured country info
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
|
||||
* - ESP_ERR_WIFI_ARG: invalid argument
|
||||
* - others: refer to error code in esp_err.h
|
||||
*/
|
||||
esp_err_t esp_wifi_set_country(wifi_country_t country);
|
||||
esp_err_t esp_wifi_set_country(wifi_country_t *country);
|
||||
|
||||
/**
|
||||
* @brief Get country code
|
||||
* @brief get the current country info
|
||||
*
|
||||
* @param country store current country
|
||||
* @param country country info
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
@ -542,6 +553,7 @@ esp_err_t esp_wifi_set_country(wifi_country_t country);
|
||||
*/
|
||||
esp_err_t esp_wifi_get_country(wifi_country_t *country);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set MAC address of the ESP32 WiFi station or the soft-AP interface.
|
||||
*
|
||||
|
@ -40,11 +40,15 @@ typedef esp_interface_t wifi_interface_t;
|
||||
#define WIFI_IF_AP ESP_IF_WIFI_AP
|
||||
|
||||
typedef enum {
|
||||
WIFI_COUNTRY_CN = 0, /**< country China, channel range [1, 14] */
|
||||
WIFI_COUNTRY_JP, /**< country Japan, channel range [1, 14] */
|
||||
WIFI_COUNTRY_US, /**< country USA, channel range [1, 11] */
|
||||
WIFI_COUNTRY_EU, /**< country Europe, channel range [1, 13] */
|
||||
WIFI_COUNTRY_MAX
|
||||
WIFI_COUNTRY_POLICY_AUTO, /**< Country policy is auto, use the country info of AP to which the station is connected */
|
||||
WIFI_COUNTRY_POLICY_MANUAL, /**< Country policy is manual, always use the configured country info */
|
||||
} wifi_country_policy_t;
|
||||
|
||||
typedef struct {
|
||||
char cc[3]; /**< country code string */
|
||||
uint8_t schan; /**< start channel */
|
||||
uint8_t nchan; /**< total channel number */
|
||||
wifi_country_policy_t policy; /**< country policy */
|
||||
} wifi_country_t;
|
||||
|
||||
typedef enum {
|
||||
@ -121,6 +125,16 @@ typedef struct {
|
||||
wifi_scan_time_t scan_time; /**< scan time per channel */
|
||||
} wifi_scan_config_t;
|
||||
|
||||
typedef enum {
|
||||
WIFI_CIPHER_TYPE_NONE = 0, /**< the cipher type is none */
|
||||
WIFI_CIPHER_TYPE_WEP40, /**< the cipher type is WEP40 */
|
||||
WIFI_CIPHER_TYPE_WEP104, /**< the cipher type is WEP104 */
|
||||
WIFI_CIPHER_TYPE_TKIP, /**< the cipher type is TKIP */
|
||||
WIFI_CIPHER_TYPE_CCMP, /**< the cipher type is CCMP */
|
||||
WIFI_CIPHER_TYPE_TKIP_CCMP, /**< the cipher type is TKIP and CCMP */
|
||||
WIFI_CIPHER_TYPE_UNKNOWN, /**< the cipher type is unknown */
|
||||
} wifi_cipher_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t bssid[6]; /**< MAC address of AP */
|
||||
uint8_t ssid[33]; /**< SSID of AP */
|
||||
@ -128,8 +142,14 @@ typedef struct {
|
||||
wifi_second_chan_t second; /**< second channel of AP */
|
||||
int8_t rssi; /**< signal strength of AP */
|
||||
wifi_auth_mode_t authmode; /**< authmode of AP */
|
||||
uint32_t low_rate_enable:1; /**< bit: 0 flag to identify if low rate is enabled or not */
|
||||
uint32_t reserved:31; /**< bit: 1..31 reserved */
|
||||
wifi_cipher_type_t pairwise_cipher; /**< pairwise cipher of AP */
|
||||
wifi_cipher_type_t group_cipher; /**< group cipher of AP */
|
||||
uint32_t phy_11b:1; /**< bit: 0 flag to identify if 11b mode is enabled or not */
|
||||
uint32_t phy_11g:1; /**< bit: 1 flag to identify if 11g mode is enabled or not */
|
||||
uint32_t phy_11n:1; /**< bit: 2 flag to identify if 11n mode is enabled or not */
|
||||
uint32_t phy_lr:1; /**< bit: 3 flag to identify if low rate is enabled or not */
|
||||
uint32_t wps:1; /**< bit: 4 flag to identify if WPS is supported or not */
|
||||
uint32_t reserved:27; /**< bit: 5..31 reserved */
|
||||
} wifi_ap_record_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -82,6 +82,9 @@ extern "C" {
|
||||
#include "esp_crosscore_int.h"
|
||||
|
||||
|
||||
#include <esp_heap_caps.h>
|
||||
#include "soc/soc_memory_layout.h"
|
||||
|
||||
//#include "xtensa_context.h"
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
@ -245,6 +248,18 @@ static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_I
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state)
|
||||
|
||||
//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force
|
||||
//the stack memory to always be internal.
|
||||
#define pvPortMallocTcbMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
|
||||
#define pvPortMallocStackMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
|
||||
|
||||
//xTaskCreateStatic uses these functions to check incoming memory.
|
||||
#define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr))
|
||||
#ifndef CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
|
||||
#define portVALID_STACK_MEM(ptr) esp_ptr_byte_accessible(ptr)
|
||||
#else
|
||||
#define portVALID_STACK_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define MALLOC_CAP_PID7 (1<<9) ///< Memory must be mapped to PID7 memory space (PIDs are not currently used)
|
||||
#define MALLOC_CAP_SPIRAM (1<<10) ///< Memory must be in SPI RAM
|
||||
#define MALLOC_CAP_INTERNAL (1<<11) ///< Memory must be internal; specifically it should not disappear when flash/spiram cache is switched off
|
||||
#define MALLOC_CAP_DEFAULT (1<<12) ///< Memory can be returned in a non-capability-specific memory allocation (e.g. malloc(), calloc()) call
|
||||
#define MALLOC_CAP_INVALID (1<<31) ///< Memory can't be used / list end marker
|
||||
|
||||
/**
|
||||
@ -172,3 +173,18 @@ void heap_caps_print_heap_info( uint32_t caps );
|
||||
* @return True if all heaps are valid, False if at least one heap is corrupt.
|
||||
*/
|
||||
bool heap_caps_check_integrity(uint32_t caps, bool print_errors);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enable malloc() in external memory and set limit below which
|
||||
* malloc() attempts are placed in internal memory.
|
||||
*
|
||||
* When external memory is in use, the allocation strategy is to initially try to
|
||||
* satisfy smaller allocation requests with internal memory and larger requests
|
||||
* with external memory. This sets the limit between the two, as well as generally
|
||||
* enabling allocation in external memory.
|
||||
*
|
||||
* @param limit Limit, in bytes.
|
||||
*/
|
||||
void heap_caps_malloc_extmem_enable(size_t limit);
|
||||
|
@ -73,8 +73,11 @@ esp_err_t heap_caps_add_region(intptr_t start, intptr_t end);
|
||||
* @param start Start address of new region.
|
||||
* @param end End address of new region.
|
||||
*
|
||||
* @return ESP_OK on success, ESP_ERR_INVALID_ARG if a parameter is invalid, ESP_ERR_NO_MEM if no
|
||||
* memory to register new heap.
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_ARG if a parameter is invalid
|
||||
* - ESP_ERR_NO_MEM if no memory to register new heap.
|
||||
* - ESP_FAIL if region overlaps the start and/or end of an existing region
|
||||
*/
|
||||
esp_err_t heap_caps_add_region_with_caps(const uint32_t caps[], intptr_t start, intptr_t end);
|
||||
|
||||
|
@ -416,7 +416,7 @@
|
||||
* The queue size value itself is platform-dependent, but is passed to
|
||||
* sys_mbox_new() when tcpip_init is called.
|
||||
*/
|
||||
#define TCPIP_MBOX_SIZE 32
|
||||
#define TCPIP_MBOX_SIZE CONFIG_TCPIP_RECVMBOX_SIZE
|
||||
|
||||
/**
|
||||
* DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
||||
@ -520,10 +520,20 @@
|
||||
---------- Statistics options ----------
|
||||
----------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
||||
*/
|
||||
#define LWIP_STATS 0
|
||||
#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
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
@ -674,7 +684,7 @@
|
||||
* 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 1
|
||||
#define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC
|
||||
|
||||
|
||||
/* Enable all Espressif-only options */
|
||||
@ -692,8 +702,8 @@
|
||||
#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 0
|
||||
#define ESP_STATS_DROP 0
|
||||
#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__)
|
||||
|
@ -416,7 +416,7 @@
|
||||
* The queue size value itself is platform-dependent, but is passed to
|
||||
* sys_mbox_new() when tcpip_init is called.
|
||||
*/
|
||||
#define TCPIP_MBOX_SIZE 32
|
||||
#define TCPIP_MBOX_SIZE CONFIG_TCPIP_RECVMBOX_SIZE
|
||||
|
||||
/**
|
||||
* DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
||||
@ -520,10 +520,20 @@
|
||||
---------- Statistics options ----------
|
||||
----------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* LWIP_STATS==1: Enable statistics collection in lwip_stats.
|
||||
*/
|
||||
#define LWIP_STATS 0
|
||||
#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
|
||||
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
@ -674,7 +684,7 @@
|
||||
* 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 1
|
||||
#define ETHARP_TRUST_IP_MAC CONFIG_LWIP_ETHARP_TRUST_IP_MAC
|
||||
|
||||
|
||||
/* Enable all Espressif-only options */
|
||||
@ -692,8 +702,8 @@
|
||||
#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 0
|
||||
#define ESP_STATS_DROP 0
|
||||
#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__)
|
||||
|
@ -295,10 +295,15 @@
|
||||
#define SOC_DMA_LOW 0x3FFAE000
|
||||
#define SOC_DMA_HIGH 0x40000000
|
||||
|
||||
// Region of memory that is byte-accessible. See esp_ptr_byte_accesible().
|
||||
// Region of memory that is byte-accessible. See esp_ptr_byte_accessible().
|
||||
#define SOC_BYTE_ACCESSIBLE_LOW 0x3FFAE000
|
||||
#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
|
||||
#define SOC_MEM_INTERNAL_HIGH 0x400C2000
|
||||
|
||||
|
||||
//Interrupt hardware source table
|
||||
//This table is decided by hardware, don't touch this.
|
||||
#define ETS_WIFI_MAC_INTR_SOURCE 0/**< interrupt of WiFi MAC, level*/
|
||||
|
91
tools/sdk/include/soc/soc/soc_memory_layout.h
Normal file
91
tools/sdk/include/soc/soc/soc_memory_layout.h
Normal file
@ -0,0 +1,91 @@
|
||||
// Copyright 2010-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.
|
||||
#pragma once
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
#define SOC_MEMORY_TYPE_NO_PRIOS 3
|
||||
|
||||
/* Type descriptor holds a description for a particular type of memory on a particular SoC.
|
||||
*/
|
||||
typedef struct {
|
||||
const char *name; ///< Name of this memory type
|
||||
uint32_t caps[SOC_MEMORY_TYPE_NO_PRIOS]; ///< Capabilities for this memory type (as a prioritised set)
|
||||
bool aliased_iram; ///< If true, this is data memory that is is also mapped in IRAM
|
||||
bool startup_stack; ///< If true, memory of this type is used for ROM stack during startup
|
||||
} soc_memory_type_desc_t;
|
||||
|
||||
/* Constant table of tag descriptors for all this SoC's tags */
|
||||
extern const soc_memory_type_desc_t soc_memory_types[];
|
||||
extern const size_t soc_memory_type_count;
|
||||
|
||||
/* Region descriptor holds a description for a particular region of memory on a particular SoC.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
intptr_t start; ///< Start address of the region
|
||||
size_t size; ///< Size of the region in bytes
|
||||
size_t type; ///< Type of the region (index into soc_memory_types array)
|
||||
intptr_t iram_address; ///< If non-zero, is equivalent address in IRAM
|
||||
} soc_memory_region_t;
|
||||
|
||||
extern const soc_memory_region_t soc_memory_regions[];
|
||||
extern const size_t soc_memory_region_count;
|
||||
|
||||
/* Region descriptor holds a description for a particular region of
|
||||
memory reserved on this SoC for a particular use (ie not available
|
||||
for stack/heap usage.) */
|
||||
typedef struct
|
||||
{
|
||||
intptr_t start;
|
||||
intptr_t end;
|
||||
} soc_reserved_region_t;
|
||||
|
||||
extern const soc_reserved_region_t soc_reserved_regions[];
|
||||
extern const size_t soc_reserved_region_count;
|
||||
|
||||
inline static bool IRAM_ATTR esp_ptr_dma_capable(const void *p)
|
||||
{
|
||||
return (intptr_t)p >= SOC_DMA_LOW && (intptr_t)p < SOC_DMA_HIGH;
|
||||
}
|
||||
|
||||
inline static bool IRAM_ATTR esp_ptr_executable(const void *p)
|
||||
{
|
||||
intptr_t ip = (intptr_t) p;
|
||||
return (ip >= SOC_IROM_LOW && ip < SOC_IROM_HIGH)
|
||||
|| (ip >= SOC_IRAM_LOW && ip < SOC_IRAM_HIGH)
|
||||
|| (ip >= SOC_RTC_IRAM_LOW && ip < SOC_RTC_IRAM_HIGH);
|
||||
}
|
||||
|
||||
inline static bool IRAM_ATTR esp_ptr_byte_accessible(const void *p)
|
||||
{
|
||||
bool r;
|
||||
r = ((intptr_t)p >= SOC_BYTE_ACCESSIBLE_LOW && (intptr_t)p < SOC_BYTE_ACCESSIBLE_HIGH);
|
||||
#if CONFIG_SPIRAM_SUPPORT
|
||||
r |= ((intptr_t)p >= SOC_EXTRAM_DATA_LOW && (intptr_t)p < SOC_EXTRAM_DATA_HIGH);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
inline static bool IRAM_ATTR esp_ptr_internal(const void *p) {
|
||||
bool r;
|
||||
r = ((intptr_t)p >= SOC_MEM_INTERNAL_LOW && (intptr_t)p < SOC_MEM_INTERNAL_HIGH);
|
||||
r |= ((intptr_t)p >= SOC_RTC_DATA_LOW && (intptr_t)p < SOC_RTC_DATA_HIGH);
|
||||
return r;
|
||||
}
|
Reference in New Issue
Block a user