forked from espressif/arduino-esp32
IDF release/v4.4 ddc44956bf (#5911)
esp-dsp: master 6b25cbb esp-face: master 859f32a esp-rainmaker: f1b82c7 esp32-camera: master 61400bc esp_littlefs: master 3c29afc
This commit is contained in:
@ -155,15 +155,20 @@ void vPortAssertIfInISR(void);
|
||||
BaseType_t xPortInterruptedFromISRContext(void);
|
||||
|
||||
/**
|
||||
* @brief Disable interrupts in a nested manner
|
||||
* @brief Disable interrupts in a nested manner (meant to be called from ISRs)
|
||||
*
|
||||
* - Cleaner solution allows nested interrupts disabling and restoring via local registers or stack.
|
||||
* - They can be called from interrupts too.
|
||||
* - WARNING Only applies to current CPU.
|
||||
* @note [refactor-todo] Define this as portSET_INTERRUPT_MASK_FROM_ISR() instead
|
||||
* @return unsigned Previous interrupt state
|
||||
* @warning Only applies to current CPU.
|
||||
* @return UBaseType_t Previous interrupt level
|
||||
*/
|
||||
static inline unsigned __attribute__((always_inline)) portENTER_CRITICAL_NESTED(void);
|
||||
static inline UBaseType_t xPortSetInterruptMaskFromISR(void);
|
||||
|
||||
/**
|
||||
* @brief Reenable interrupts in a nested manner (meant to be called from ISRs)
|
||||
*
|
||||
* @warning Only applies to current CPU.
|
||||
* @param prev_level Previous interrupt level
|
||||
*/
|
||||
static inline void vPortClearInterruptMaskFromISR(UBaseType_t prev_level);
|
||||
|
||||
/* ---------------------- Spinlocks ------------------------
|
||||
* - Modifications made to critical sections to support SMP
|
||||
@ -416,8 +421,6 @@ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
|
||||
|
||||
// --------------------- Interrupts ------------------------
|
||||
|
||||
#define portEXIT_CRITICAL_NESTED(state) do { portbenchmarkINTERRUPT_RESTORE(state); XTOS_RESTORE_JUST_INTLEVEL(state); } while (0)
|
||||
|
||||
/**
|
||||
* - Only applies to current core
|
||||
* - These cannot be nested. They should be used with a lot of care and cannot be called from interrupt level.
|
||||
@ -430,8 +433,8 @@ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
|
||||
/**
|
||||
* ISR versions to enable/disable interrupts
|
||||
*/
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state)
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() xPortSetInterruptMaskFromISR()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(prev_level) vPortClearInterruptMaskFromISR(prev_level)
|
||||
|
||||
#define portASSERT_IF_IN_ISR() vPortAssertIfInISR()
|
||||
|
||||
@ -530,11 +533,17 @@ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
|
||||
|
||||
// --------------------- Interrupts ------------------------
|
||||
|
||||
static inline unsigned portENTER_CRITICAL_NESTED(void)
|
||||
static inline UBaseType_t xPortSetInterruptMaskFromISR(void)
|
||||
{
|
||||
unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
|
||||
UBaseType_t prev_int_level = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
|
||||
portbenchmarkINTERRUPT_DISABLE();
|
||||
return state;
|
||||
return prev_int_level;
|
||||
}
|
||||
|
||||
static inline void vPortClearInterruptMaskFromISR(UBaseType_t prev_level)
|
||||
{
|
||||
portbenchmarkINTERRUPT_RESTORE(prev_level);
|
||||
XTOS_RESTORE_JUST_INTLEVEL(prev_level);
|
||||
}
|
||||
|
||||
// ---------------------- Spinlocks ------------------------
|
||||
@ -737,6 +746,14 @@ bool xPortcheckValidStackMem(const void *ptr);
|
||||
#define portVALID_TCB_MEM(ptr) xPortCheckValidTCBMem(ptr)
|
||||
#define portVALID_STACK_MEM(ptr) xPortcheckValidStackMem(ptr)
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------- Deprecate ------------------------------------------------------
|
||||
* - Pull in header containing deprecated macros here
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
#include "portmacro_deprecated.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------- Deprecate ------------------------------------------------------
|
||||
* - Macros or functions that should be deprecated in v5.0, then removed in the next major release
|
||||
* - Kept as not to cause a breaking change
|
||||
* - Include this header at the end of portmacro.h
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
* @brief Disable interrupts in a nested manner
|
||||
*
|
||||
* Does the exact same thing as portSET_INTERRUPT_MASK_FROM_ISR()
|
||||
*
|
||||
* @deprecated This function is deprecated. Call portSET_INTERRUPT_MASK_FROM_ISR() instead
|
||||
*/
|
||||
static inline __attribute__((deprecated)) UBaseType_t portENTER_CRITICAL_NESTED(void) {
|
||||
return portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reenables interrupts in a nested manner
|
||||
*
|
||||
* Does the exact same thing as portCLEAR_INTERRUPT_MASK_FROM_ISR()
|
||||
*
|
||||
* @deprecated This function is deprecated. Call portCLEAR_INTERRUPT_MASK_FROM_ISR() instead
|
||||
*/
|
||||
static inline void __attribute__((deprecated)) portEXIT_CRITICAL_NESTED(UBaseType_t prev_level)
|
||||
{
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR(prev_level);
|
||||
}
|
Reference in New Issue
Block a user