1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-31 09:21:19 +01:00

cpu/cortexm_common: implement irq_is_enabled()

This commit is contained in:
Hauke Petersen 2019-03-06 18:02:11 +01:00
parent b526394d82
commit 65b7f84568

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2014-2015 Freie Universität Berlin
* Copyright (C) 2014-2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
@ -60,6 +60,17 @@ static inline __attribute__((always_inline)) void irq_restore(
__set_PRIMASK(state);
}
/**
* @brief See if IRQs are currently enabled
*/
static inline __attribute__((always_inline)) int irq_is_enabled(void)
{
/* so far, all existing Cortex-M are only using the least significant bit
* in the PRIMARK register. If ever any other bit is used for different
* purposes, this function will not work properly anymore. */
return (__get_PRIMASK() == 0);
}
/**
* @brief See if the current context is inside an ISR
*/