Commit Graph

13 Commits (0f2fa7883cf75bec70d3ade0ec8d3e00b8151a7c)

Author SHA1 Message Date
Jon Thacker e0365e0bf9 atmega: use software interrupt for context swap
Fixes #5745
For AVR based boards, three defines must be defined AVR_CONTEXT_SWAP_INIT,
AVR_CONTEXT_SWAP_INTERRUPT_VECT, and AVR_CONTEXT_SWAP_TRIGGER.
These defines are used to trigger a software interrupt used for context
switching.

When AVR_CONTEXT_SWAP_INTERRUPT_VECT is handled, the scheduler is run
and a context swap will happen if necessary, with the resulting thread
starting following the reti instruction. This results in threads running
at normal priority instead of at interrupt priority.

Atmega devices do provide a pure software interrupt. The method used
here for waspmote-pro and arduino-mega2560 is to use pin change
interrupts, set the pin to act as an output, and toggle the value to
simulate a software interrupt. The main limitation here is that a
physical pin is now occupied and must be defined for each board
supported by RIOT. On the plus side, it provides an easy method for
detecting context swaps with an oscilloscope.
7 years ago
kYc0o 03d380845e Merge pull request #5593 from jthacker/atmega_regs_common
cpu/atmega_common: generalize register/peripheral definitions
7 years ago
Joakim Nohlgård b02e0eca47 ps: Add current stack pointer and start of stack to isr_stack ps output (DEVELHELP) 7 years ago
Jon Thacker 2aec999900 cpu/atmega_common: generalize register/peripheral definitions
Makes AVR register definitions dependent on what avr-libc defines
for a given MCU, rather then duplicating that effort here.
Definitions done in this way are based on functionality provided,
rather than a specific MCU device.
7 years ago
MohmadAyman 53df3e8b57 core: cpu: provide function to acquire ISR stack usage 7 years ago
Kaspar Schleiser c3f7186d4e unify usage of inline assembly 8 years ago
DipSwitch 0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 8 years ago
Kaspar Schleiser 2b010b5337 core: rename tcb_t -> thread_t, move into thread.h 8 years ago
Kaspar Schleiser 9082273746 core: header cleanup 8 years ago
Joakim Gebart 13832d8e62 everything: Remove filename from @file Doxygen command 8 years ago
Oleg Hahm db8f3d2650 cpu: use typed function pointer for thread_arch_init 9 years ago
Hinnerk van Bruinehsen 9933dd0b78 cpu: arm/cortex-mX/atmega: use uintptr_t for sp cast 9 years ago
Hinnerk van Bruinehsen a6b77b4745 cpu: atmega_common: Initial import 9 years ago