diff --git a/tests/irq_disable_restore/main.c b/tests/irq_disable_restore/main.c index 552d01f271..0881381e6d 100644 --- a/tests/irq_disable_restore/main.c +++ b/tests/irq_disable_restore/main.c @@ -56,6 +56,21 @@ int main(void) "======================================\n" "\n"); + /* Short enable-restore sequence to check if the irq_is_enabled() function + * is reporting the correct IRQ state */ + print_str("Verifying IRQ state tracking works: "); + int state_a = irq_is_enabled(); + unsigned state = irq_disable(); + int state_b = irq_is_enabled(); + irq_restore(state); + int state_c = irq_is_enabled(); + if ((state_a != 0) && (state_b == 0) && (state_c != 0)) { + print_str("[SUCCESS]\n"); + } + else { + print_str("[FAILURE]\n"); + } + print_str("Verifying test works: "); xtimer_set(&xt, DELAY / 2); atomic_store(&a, 1); @@ -76,7 +91,7 @@ int main(void) print_str("Test result: "); xtimer_set(&xt, DELAY / 2); - unsigned state = irq_disable(); + state = irq_disable(); atomic_store(&a, 2); busy_delay(); atomic_store(&b, 2);