mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions: From compare_set.h (file removed): - compare_and_set_native() - compare_and_set_extram() From portmacro.h - uxPortCompareSet() - uxPortCompareSetExtram() Users should call esp_cpu_compare_and_set() instead as this function hides the details of atomic CAS on internal and external RAM addresses. Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
This commit is contained in:
parent
d37fa7e244
commit
781d06af73
@ -12,6 +12,7 @@
|
||||
#include "esp_log.h"
|
||||
#include "unity.h"
|
||||
#include "unity_test_utils.h"
|
||||
#include "soc/soc.h"
|
||||
|
||||
extern "C" void setUp()
|
||||
{
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "esp_attr.h"
|
||||
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
/* The actual max size of DMA buffer is 4095
|
||||
* Set 4092 here to align with 4-byte, so that the position of the slot data in the buffer will be relatively fixed */
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/pulse_cnt.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
// If ISR handler is allowed to run whilst cache is disabled,
|
||||
// Make sure all the code and related variables used by the handler are in the SRAM
|
||||
|
@ -16,6 +16,7 @@
|
||||
#endif
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
#include "soc/rmt_periph.h"
|
||||
#include "soc/rtc.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/rmt_tx.h"
|
||||
#include "rmt_private.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
static const char *TAG = "rmt";
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "esp_log.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/queue.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "soc/soc.h"
|
||||
|
||||
#define TEST_TIMER_RESOLUTION_HZ 1000000 // 1MHz resolution
|
||||
#define TIMER_DELTA 0.001
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "driver/twai.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/twai_periph.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "hal/twai_hal.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "hal/adc_types.h"
|
||||
#include "hal/adc_hal.h"
|
||||
#include "hal/dma_types.h"
|
||||
#include "esp_memory_utils.h"
|
||||
//For DMA
|
||||
#if SOC_GDMA_SUPPORTED
|
||||
#include "esp_private/gdma.h"
|
||||
|
@ -3,7 +3,7 @@ idf_build_get_property(target IDF_TARGET)
|
||||
set(requires soc)
|
||||
set(priv_requires efuse spi_flash bootloader_support)
|
||||
|
||||
set(srcs "compare_set.c" "cpu.c" "esp_memory_utils.c")
|
||||
set(srcs "cpu.c" "esp_memory_utils.c")
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND srcs "esp_clk.c"
|
||||
"clk_ctrl_os.c"
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include "compare_set.h"
|
||||
#include "spinlock.h"
|
||||
#include "soc/soc_caps.h"
|
||||
|
||||
#if __XTENSA__ && SOC_SPIRAM_SUPPORTED
|
||||
|
||||
static spinlock_t global_extram_lock = SPINLOCK_INITIALIZER;
|
||||
|
||||
void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
uint32_t intlevel, old_value;
|
||||
__asm__ __volatile__ ("rsil %0, " XTSTR(XCHAL_EXCM_LEVEL) "\n"
|
||||
: "=r"(intlevel));
|
||||
|
||||
spinlock_acquire(&global_extram_lock, SPINLOCK_WAIT_FOREVER);
|
||||
|
||||
old_value = *addr;
|
||||
if (old_value == compare) {
|
||||
*addr = *set;
|
||||
}
|
||||
|
||||
spinlock_release(&global_extram_lock);
|
||||
|
||||
__asm__ __volatile__ ("memw \n"
|
||||
"wsr %0, ps\n"
|
||||
:: "r"(intlevel));
|
||||
|
||||
*set = old_value;
|
||||
}
|
||||
#else // __XTENSA__ && SOC_SPIRAM_SUPPORTED
|
||||
|
||||
void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
#endif // endif
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "esp_attr.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "hal/cpu_hal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static inline void __attribute__((always_inline)) compare_and_set_native(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
cpu_ll_compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
|
||||
void compare_and_set_extram(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -17,6 +17,7 @@
|
||||
#include "freertos/task.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_attr.h"
|
||||
#include "hal/cpu_hal.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "esp_attr.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_sleep.h"
|
||||
#include "esp_private/esp_timer_private.h"
|
||||
#include "esp_private/system_internal.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <sys/param.h>
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "essl_internal.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "test_fatfs_common.h"
|
||||
#include "wear_levelling.h"
|
||||
#include "esp_partition.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
|
||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "esp_macros.h"
|
||||
#include "hal/cpu_hal.h"
|
||||
#include "esp_private/crosscore_int.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -241,42 +242,6 @@ static inline BaseType_t xPortInIsrContext(void)
|
||||
// Added for backward compatibility with IDF
|
||||
#define xPortInterruptedFromISRContext() xPortInIsrContext()
|
||||
|
||||
// ---------------------- Spinlocks ------------------------
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction
|
||||
*
|
||||
* @note Isn't a real atomic CAS.
|
||||
* @note [refactor-todo] check if we still need this
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to void return type)
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction in external RAM
|
||||
*
|
||||
* @note Isn't a real atomic CAS.
|
||||
* @note [refactor-todo] check if we still need this
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to void return type)
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
compare_and_set_extram(addr, compare, set);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------ Critical Sections --------------------
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "FreeRTOS.h" /* This pulls in portmacro.h */
|
||||
#include "task.h"
|
||||
#include "portmacro.h"
|
||||
|
||||
#include "esp_memory_utils.h"
|
||||
#ifdef CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
||||
#include "soc/periph_defs.h"
|
||||
#include "soc/system_reg.h"
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include "portbenchmark.h"
|
||||
#include "esp_macros.h"
|
||||
#include "hal/cpu_hal.h"
|
||||
#include "compare_set.h" /* For compare_and_set_native(). [refactor-todo] Use esp_cpu.h instead */
|
||||
#include "esp_private/crosscore_int.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
/*
|
||||
Note: We should not include any FreeRTOS headers (directly or indirectly) here as this will create a reverse dependency
|
||||
@ -285,18 +285,6 @@ static inline void vPortClearInterruptMaskFromISR(UBaseType_t prev_level)
|
||||
|
||||
// ---------------------- Spinlocks ------------------------
|
||||
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
|
||||
static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
compare_and_set_extram(addr, compare, set);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool __attribute__((always_inline)) vPortCPUAcquireMutexTimeout(portMUX_TYPE *mux, int timeout)
|
||||
{
|
||||
return (spinlock_acquire(mux, timeout));
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "esp_heap_caps_init.h"
|
||||
#include "esp_freertos_hooks.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#if CONFIG_SPIRAM
|
||||
/* Required by esp_psram_extram_reserve_dma_pool() */
|
||||
#include "esp_psram.h"
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
|
||||
#include "esp_newlib.h"
|
||||
#include "compare_set.h" /* For compare_and_set_native(). [refactor-todo] Use esp_cpu.h instead */
|
||||
|
||||
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
|
||||
#include <limits.h>
|
||||
@ -182,32 +181,6 @@ typedef struct {
|
||||
(mux)->count = 0; \
|
||||
})
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction
|
||||
*
|
||||
* @note Isn't a real atomic CAS.
|
||||
* @note [refactor-todo] check if we still need this
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to void return type)
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction in external RAM
|
||||
*
|
||||
* @note Isn't a real atomic CAS.
|
||||
* @note [refactor-todo] check if we still need this
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to void return type)
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
|
||||
|
||||
// ------------------ Critical Sections --------------------
|
||||
|
||||
/**
|
||||
@ -434,22 +407,6 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
|
||||
|
||||
// --------------------- Interrupts ------------------------
|
||||
|
||||
|
||||
|
||||
// ---------------------- Spinlocks ------------------------
|
||||
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
|
||||
static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
compare_and_set_extram(addr, compare, set);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---------------------- Yielding -------------------------
|
||||
|
||||
FORCE_INLINE_ATTR bool xPortCanYield(void)
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "task.h"
|
||||
#include "portmacro.h"
|
||||
#include "port_systick.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
|
||||
|
||||
|
@ -76,11 +76,12 @@
|
||||
#include "esp_private/crosscore_int.h"
|
||||
#include "esp_macros.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_newlib.h" /* required for esp_reent_init() in tasks.c */
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_system.h" /* required by esp_get_...() functions in portable.h. [refactor-todo] Update portable.h */
|
||||
#include "compare_set.h" /* For compare_and_set_native(). [refactor-todo] Use esp_cpu.h instead */
|
||||
#include "portbenchmark.h"
|
||||
|
||||
/* [refactor-todo] These includes are not directly used in this file. They are kept into to prevent a breaking change. Remove these. */
|
||||
@ -405,38 +406,6 @@ void vPortSetStackWatchpoint( void *pxStackStart );
|
||||
*/
|
||||
FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void);
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction
|
||||
*
|
||||
* This subroutine will atomically compare *addr to 'compare'. If *addr == compare, *addr is set to *set. *set is
|
||||
* updated with the previous value of *addr (either 'compare' or some other value.)
|
||||
*
|
||||
* @warning From the ISA docs: in some (unspecified) cases, the s32c1i instruction may return the "bitwise inverse" of
|
||||
* the old mem if the mem wasn't written. This doesn't seem to happen on the ESP32 (portMUX assertions would
|
||||
* fail).
|
||||
*
|
||||
* @note [refactor-todo] Check if this can be deprecated
|
||||
* @note [refactor-todo] Check if this function should be renamed (due to void return type)
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
|
||||
|
||||
/**
|
||||
* @brief Wrapper for atomic compare-and-set instruction in external RAM
|
||||
*
|
||||
* Atomic compare-and-set but the target address is placed in external RAM
|
||||
*
|
||||
* @note [refactor-todo] Check if this can be deprecated
|
||||
*
|
||||
* @param[inout] addr Pointer to target address
|
||||
* @param[in] compare Compare value
|
||||
* @param[inout] set Pointer to set value
|
||||
*/
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set);
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------- FreeRTOS Porting Interface ----------------------------------------------
|
||||
@ -661,18 +630,6 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
|
||||
return (BaseType_t) cpu_hal_get_core_id();
|
||||
}
|
||||
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSet(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
compare_and_set_native(addr, compare, set);
|
||||
}
|
||||
|
||||
static inline void __attribute__((always_inline)) uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set)
|
||||
{
|
||||
#ifdef CONFIG_SPIRAM
|
||||
compare_and_set_extram(addr, compare, set);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------ Misc ---------------------------------------------------------
|
||||
|
@ -75,6 +75,7 @@
|
||||
#include "task.h" /* Required for TaskHandle_t, tskNO_AFFINITY, and vTaskStartScheduler */
|
||||
#include "port_systick.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
_Static_assert(tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "incorrect tskNO_AFFINITY value");
|
||||
|
||||
|
@ -75,6 +75,7 @@
|
||||
#include "lwip/sys.h"
|
||||
#include <string.h>
|
||||
#include "esp_rom_md5.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
#ifdef CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "soc/lldesc.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "sys/param.h"
|
||||
#if CONFIG_PM_ENABLE
|
||||
#include "esp_pm.h"
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/lock.h>
|
||||
|
||||
#include "esp_log.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_crypto_lock.h"
|
||||
#include "esp_attr.h"
|
||||
#include "soc/lldesc.h"
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_cpu.h"
|
||||
|
||||
#include "hal/sha_hal.h"
|
||||
#include "hal/sha_types.h"
|
||||
@ -106,7 +107,6 @@ static SemaphoreHandle_t sha_get_engine_state(esp_sha_type sha_type)
|
||||
unsigned idx = sha_engine_index(sha_type);
|
||||
volatile SemaphoreHandle_t *engine = &engine_states[idx];
|
||||
SemaphoreHandle_t result = *engine;
|
||||
uint32_t set_engine = 0;
|
||||
|
||||
if (result == NULL) {
|
||||
// Create a new semaphore for 'in use' flag
|
||||
@ -115,10 +115,8 @@ static SemaphoreHandle_t sha_get_engine_state(esp_sha_type sha_type)
|
||||
xSemaphoreGive(new_engine); // start available
|
||||
|
||||
// try to atomically set the previously NULL *engine to new_engine
|
||||
set_engine = (uint32_t)new_engine;
|
||||
uxPortCompareSet((volatile uint32_t *)engine, 0, &set_engine);
|
||||
|
||||
if (set_engine != 0) { // we lost a race setting *engine
|
||||
if (!esp_cpu_compare_and_set((volatile uint32_t *)engine, 0, (uint32_t)new_engine)) {
|
||||
// we lost a race setting *engine
|
||||
vSemaphoreDelete(new_engine);
|
||||
}
|
||||
result = *engine;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
|
||||
static const uint8_t key_256[] = {
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "test_apb_dport_access.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "test_utils.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
TEST_CASE("mbedtls SHA self-tests", "[mbedtls]")
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <string.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "sys/queue.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
@ -493,18 +494,8 @@ int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
uint32_t res = 1;
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
if (esp_ptr_external_ram(once_control)) {
|
||||
uxPortCompareSetExtram((uint32_t *) &once_control->init_executed, 0, &res);
|
||||
} else {
|
||||
#endif
|
||||
uxPortCompareSet((uint32_t *) &once_control->init_executed, 0, &res);
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
}
|
||||
#endif
|
||||
// Check if compare and set was successful
|
||||
if (res == 0) {
|
||||
if (esp_cpu_compare_and_set((volatile uint32_t *)&once_control->init_executed, 0, 1)) {
|
||||
ESP_LOGV(TAG, "%s: call init_routine %p", __FUNCTION__, once_control);
|
||||
init_routine();
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "esp_ipc.h"
|
||||
#endif
|
||||
#include "esp_attr.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "esp_log.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "soc/mmu.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "esp_flash_encrypt.h"
|
||||
#include "esp_log.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <spi_flash_mmap.h>
|
||||
#include <esp_attr.h>
|
||||
#include <esp_flash_encrypt.h>
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
#include "esp_private/cache_utils.h"
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "soc/soc.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user