t

Fork of mbed-dev by mbed official

Revision:
168:e84263d55307
Parent:
160:d5399cc887bb
Child:
171:19eb464bc2be
diff -r c97ed07ec1a8 -r e84263d55307 platform/mbed_critical.c
--- a/platform/mbed_critical.c	Thu Jun 08 15:02:37 2017 +0100
+++ b/platform/mbed_critical.c	Wed Jun 21 17:46:44 2017 +0100
@@ -37,6 +37,22 @@
 #endif
 }
 
+bool core_util_is_isr_active(void)
+{
+#if defined(__CORTEX_A9)
+    switch(__get_CPSR() & 0x1FU) {
+        case MODE_USR:
+        case MODE_SYS:
+            return false;
+        case MODE_SVC:
+        default:
+            return true;
+    }
+#else
+    return (__get_IPSR() != 0U);
+#endif
+}
+
 MBED_WEAK void core_util_critical_section_enter(void)
 {
     bool interrupts_disabled = !core_util_are_interrupts_enabled();