tests/irq_disable_restore: test irq_is_enabled()
This commit is contained in:
parent
dc1dcb9b5d
commit
8ec355f3d9
@ -56,6 +56,21 @@ int main(void)
|
|||||||
"======================================\n"
|
"======================================\n"
|
||||||
"\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: ");
|
print_str("Verifying test works: ");
|
||||||
xtimer_set(&xt, DELAY / 2);
|
xtimer_set(&xt, DELAY / 2);
|
||||||
atomic_store(&a, 1);
|
atomic_store(&a, 1);
|
||||||
@ -76,7 +91,7 @@ int main(void)
|
|||||||
|
|
||||||
print_str("Test result: ");
|
print_str("Test result: ");
|
||||||
xtimer_set(&xt, DELAY / 2);
|
xtimer_set(&xt, DELAY / 2);
|
||||||
unsigned state = irq_disable();
|
state = irq_disable();
|
||||||
atomic_store(&a, 2);
|
atomic_store(&a, 2);
|
||||||
busy_delay();
|
busy_delay();
|
||||||
atomic_store(&b, 2);
|
atomic_store(&b, 2);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user