summaryrefslogtreecommitdiff
path: root/src-avr/ao.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-05-18 00:12:40 -0700
committerKeith Packard <keithp@keithp.com>2011-05-18 00:12:40 -0700
commite7e2fdf45dfbf6393ee0a0ec22e1e5ea49d6cfd5 (patch)
treeea31fc296501fc096a4f3a7544d918ec123724aa /src-avr/ao.h
parentce78906727aa59fc2b91f0fde4c7186b037359ff (diff)
src-avr: Suspend interrupts while switching stacks
Setting the stack pointer takes two instructions, so make sure we don't get an interrupt in the middle of it. Let the restoration of SREG set the interrupt flag as appropriate. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src-avr/ao.h')
-rw-r--r--src-avr/ao.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src-avr/ao.h b/src-avr/ao.h
index 242c26c7..90298a3e 100644
--- a/src-avr/ao.h
+++ b/src-avr/ao.h
@@ -50,7 +50,11 @@
struct ao_task {
__xdata void *wchan; /* current wait channel (NULL if running) */
uint16_t alarm; /* abort ao_sleep time */
+#ifdef AVR
+ uint8_t *sp; /* saved stack pointer */
+#else
uint8_t stack_count; /* amount of saved stack */
+#endif
uint8_t task_id; /* unique id */
__code char *name; /* task name */
uint8_t stack[AO_STACK_SIZE]; /* saved stack */