diff --git a/os/common/ports/RISCV-ECLIC/chcore.h b/os/common/ports/RISCV-ECLIC/chcore.h index b625c7ed9f..c3ff3785a4 100644 --- a/os/common/ports/RISCV-ECLIC/chcore.h +++ b/os/common/ports/RISCV-ECLIC/chcore.h @@ -353,6 +353,23 @@ struct port_context { } #endif +/** + * @brief Returns a word representing a critical section status. + * + * @return The critical section status. + */ +#define port_get_lock_status() port_get_irq_status() + +/** + * @brief Determines if in a critical section. + * + * @param[in] sts status word returned by @p port_get_lock_status() + * @return The current status. + * @retval false if running outside a critical section. + * @retval true if running within a critical section. + */ +#define port_is_locked(sts) !port_irq_enabled(sts) + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/