cpu/atmega_common: context switching rewrite #8898
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP context switching rewrite for the ATmegas. It has three goals:
Race conditions are solved by waiting in thread_yield_higher for a condition set by the context switching interrupt.
The code that allows periph/gpio.c to generically handle pins has been moved to include/periph_cpu_pins.h so that it can be used by both the gpio code and the context switching code. Context switching with pins can then use the GPIO_PIN like everything else. This is necessary for preventing the context switching fix from making board.h sloppy. When using the pin option AVR_CONTEXT_SWAP_INTERRUPT_VECT must still be set due to preprocessor limitations. When using the counter option, you just need to set which counter is used.
References: Fixes #8896. Race conditions are tested for by #8897. Some other issues may be found to be context switching issues.