File tree Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Expand file tree Collapse file tree 2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,16 @@ extern "C" {
25
25
#endif
26
26
27
27
28
- /** Determine the current interrupts disabled state
28
+ /** Determine the current interrupts enabled state
29
29
*
30
- * This function can be called to determine whether or not interrupts are currently disabled .
30
+ * This function can be called to determine whether or not interrupts are currently enabled .
31
31
* \note
32
32
* NOTE:
33
33
* This function works for both cortex-A and cortex-M, although the underlyng implementation
34
34
* differs.
35
- * @return true if interrupts are disabled , false otherwise
35
+ * @return true if interrupts are enabled , false otherwise
36
36
*/
37
- bool get_interrupts_disabled (void );
37
+ bool are_interrupts_enabled (void );
38
38
39
39
/** Mark the start of a critical section
40
40
*
Original file line number Diff line number Diff line change 29
29
static volatile uint32_t interrupt_enable_counter = 0 ;
30
30
static volatile bool critical_interrupts_disabled = false;
31
31
32
- bool get_interrupts_disabled (void )
32
+ bool are_interrupts_enabled (void )
33
33
{
34
34
#if defined(__CORTEX_A9 )
35
- bool interrupts_disabled = ( bool )((( __get_CPSR () & 0x80 ) >> 7 ) & 0x1 );
35
+ return (( __get_CPSR () & 0x80 ) == 0 );
36
36
#else
37
- bool interrupts_disabled = ( bool ) (__get_PRIMASK () & 0x1 );
37
+ return ( (__get_PRIMASK () & 0x1 ) == 0 );
38
38
#endif
39
- return interrupts_disabled ;
40
39
}
41
40
42
41
void core_util_critical_section_enter ()
43
42
{
44
- bool interrupts_disabled = get_interrupts_disabled ();
43
+ bool interrupts_disabled = ! are_interrupts_enabled ();
45
44
__disable_irq ();
46
45
47
46
/* Save the interrupt disabled state as it was prior to any nested critical section lock use */
@@ -71,7 +70,7 @@ void core_util_critical_section_exit()
71
70
72
71
// FIXME
73
72
#ifndef FEATURE_UVISOR
74
- bool interrupts_disabled = get_interrupts_disabled (); /* get the current interrupt disabled state */
73
+ bool interrupts_disabled = ! are_interrupts_enabled (); /* get the current interrupt disabled state */
75
74
76
75
MBED_ASSERT (interrupts_disabled ); /* Interrupts must be disabled on invoking an exit from a critical section */
77
76
#else
You can’t perform that action at this time.
0 commit comments