1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/core/irq_disable_restore
Hugues Larrive 3c465836f2 examples and tests: add atmega8 to relevent Makefile.ci
using dist/tools/insufficient_memory/add_insufficient_memory_board.sh
2023-07-11 21:22:02 +02:00
..
tests tests: move core related applications to tests/core/ subdirectory 2023-05-10 15:41:38 +02:00
main.c tests: move core related applications to tests/core/ subdirectory 2023-05-10 15:41:38 +02:00
Makefile tests: move core related applications to tests/core/ subdirectory 2023-05-10 15:41:38 +02:00
Makefile.ci examples and tests: add atmega8 to relevent Makefile.ci 2023-07-11 21:22:02 +02:00
README.md tests: move core related applications to tests/core/ subdirectory 2023-05-10 15:41:38 +02:00

Test for irq_disable() and irq_restore()

This test checks if irq_disable() and irq_restore() work as intended. For that, the test uses two variables a and b, both initialized with 0. The main test will schedule a timer that expires in T/2. It will then set a to 1 and waits for T until it also sets b to one. The expectation is that during the ISR (the timer callback) a has a value of 1, but b still has a value of 0.

The test is repeated, but this time the main thread calls irq_disable() before setting a and irq_restore() after setting b. It is now expected that - even though the timer again expires after setting a and before setting b - the execution of the ISR is delayed until irq_restore() is called. Thus, both a and b should already contain the new value in the ISR.