@@ -155,15 +155,20 @@ void vPortAssertIfInISR(void);
155
155
BaseType_t xPortInterruptedFromISRContext (void );
156
156
157
157
/* *
158
- * @brief Disable interrupts in a nested manner
158
+ * @brief Disable interrupts in a nested manner (meant to be called from ISRs)
159
159
*
160
- * - Cleaner solution allows nested interrupts disabling and restoring via local registers or stack.
161
- * - They can be called from interrupts too.
162
- * - WARNING Only applies to current CPU.
163
- * @note [refactor-todo] Define this as portSET_INTERRUPT_MASK_FROM_ISR() instead
164
- * @return unsigned Previous interrupt state
160
+ * @warning Only applies to current CPU.
161
+ * @return UBaseType_t Previous interrupt level
165
162
*/
166
- static inline unsigned __attribute__ ((always_inline)) portENTER_CRITICAL_NESTED(void );
163
+ static inline UBaseType_t xPortSetInterruptMaskFromISR (void );
164
+
165
+ /* *
166
+ * @brief Reenable interrupts in a nested manner (meant to be called from ISRs)
167
+ *
168
+ * @warning Only applies to current CPU.
169
+ * @param prev_level Previous interrupt level
170
+ */
171
+ static inline void vPortClearInterruptMaskFromISR (UBaseType_t prev_level);
167
172
168
173
/* ---------------------- Spinlocks ------------------------
169
174
* - Modifications made to critical sections to support SMP
@@ -416,8 +421,6 @@ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
416
421
417
422
// --------------------- Interrupts ------------------------
418
423
419
- #define portEXIT_CRITICAL_NESTED (state ) do { portbenchmarkINTERRUPT_RESTORE (state); XTOS_RESTORE_JUST_INTLEVEL (state); } while (0 )
420
-
421
424
/* *
422
425
* - Only applies to current core
423
426
* - 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);
430
433
/* *
431
434
* ISR versions to enable/disable interrupts
432
435
*/
433
- #define portSET_INTERRUPT_MASK_FROM_ISR () portENTER_CRITICAL_NESTED ()
434
- #define portCLEAR_INTERRUPT_MASK_FROM_ISR (state ) portEXIT_CRITICAL_NESTED(state )
436
+ #define portSET_INTERRUPT_MASK_FROM_ISR () xPortSetInterruptMaskFromISR ()
437
+ #define portCLEAR_INTERRUPT_MASK_FROM_ISR (prev_level ) vPortClearInterruptMaskFromISR(prev_level )
435
438
436
439
#define portASSERT_IF_IN_ISR () vPortAssertIfInISR()
437
440
@@ -530,11 +533,17 @@ static inline BaseType_t IRAM_ATTR xPortGetCoreID(void);
530
533
531
534
// --------------------- Interrupts ------------------------
532
535
533
- static inline unsigned portENTER_CRITICAL_NESTED (void )
536
+ static inline UBaseType_t xPortSetInterruptMaskFromISR (void )
534
537
{
535
- unsigned state = XTOS_SET_INTLEVEL (XCHAL_EXCM_LEVEL);
538
+ UBaseType_t prev_int_level = XTOS_SET_INTLEVEL (XCHAL_EXCM_LEVEL);
536
539
portbenchmarkINTERRUPT_DISABLE ();
537
- return state;
540
+ return prev_int_level;
541
+ }
542
+
543
+ static inline void vPortClearInterruptMaskFromISR (UBaseType_t prev_level)
544
+ {
545
+ portbenchmarkINTERRUPT_RESTORE (prev_level);
546
+ XTOS_RESTORE_JUST_INTLEVEL (prev_level);
538
547
}
539
548
540
549
// ---------------------- Spinlocks ------------------------
@@ -737,6 +746,14 @@ bool xPortcheckValidStackMem(const void *ptr);
737
746
#define portVALID_TCB_MEM (ptr ) xPortCheckValidTCBMem(ptr)
738
747
#define portVALID_STACK_MEM (ptr ) xPortcheckValidStackMem(ptr)
739
748
749
+
750
+
751
+ /* ---------------------------------------------------- Deprecate ------------------------------------------------------
752
+ * - Pull in header containing deprecated macros here
753
+ * ------------------------------------------------------------------------------------------------------------------ */
754
+
755
+ #include " portmacro_deprecated.h"
756
+
740
757
#ifdef __cplusplus
741
758
}
742
759
#endif
0 commit comments