1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

tests/irq_disable_restore: test irq_is_enabled()

This commit is contained in:
Hauke Petersen 2021-08-19 08:58:47 +02:00
parent dc1dcb9b5d
commit 8ec355f3d9

View File

@ -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);