diff options
author | Keith Packard <keithp@keithp.com> | 2013-05-18 03:21:43 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-05-18 03:21:43 -0700 |
commit | c4991db4809ae547fdb245e3cb42517fa7524de5 (patch) | |
tree | 10584b3204ad66b46c3dd39714aa2ff5d9448466 /src/lpc/ao_arch_funcs.h | |
parent | 5311720525ac73e9d42067b68adf25fc2e054af5 (diff) |
altos/lpc: Use separate interrupt stack
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/lpc/ao_arch_funcs.h')
-rw-r--r-- | src/lpc/ao_arch_funcs.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index bc4c47ee..3cd873ec 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -208,4 +208,17 @@ ao_spi_init(void); } \ } while (0) +#define HAS_ARCH_START_SCHEDULER 1 + +static inline void ao_arch_start_scheduler(void) { + uint32_t sp; + uint32_t control; + + asm("mrs %0,msp" : "=&r" (sp)); + asm("msr psp,%0" : : "r" (sp)); + asm("mrs %0,control" : "=&r" (control)); + control |= (1 << 1); + asm("msr control,%0" : : "r" (control)); +} + #endif /* _AO_ARCH_FUNCS_H_ */ |