diff options
author | Keith Packard <keithp@keithp.com> | 2014-07-05 00:04:06 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-07-05 00:38:10 -0700 |
commit | 292cb8380b478542555b5f370e8252eafa2f74ac (patch) | |
tree | c596a045bf49faefe845e42539691db7adbca8cc /src/lpc/ao_arch_funcs.h | |
parent | e0ee2ac6bc68b73e13bf34fac3ffd4a3b79dce98 (diff) |
altos: Rework packet receive for cc1120
Instead of blocking on PQT, just set up the receiver to start going
and when the first bit interrupt comes in, grab the SPI bus if
possible and configure it for reception. This improves sensitivity in
the radio by a significant amount while making the code conceptually a
bit nicer.
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 | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lpc/ao_arch_funcs.h b/src/lpc/ao_arch_funcs.h index 0891903e..21a7a8e5 100644 --- a/src/lpc/ao_arch_funcs.h +++ b/src/lpc/ao_arch_funcs.h @@ -161,16 +161,17 @@ static inline void ao_arch_restore_stack(void) { #endif /* HAS_TASK */ -#define ao_arch_wait_interrupt() do { \ - asm(".global ao_idle_loc\n\twfi\nao_idle_loc:"); \ - ao_arch_release_interrupts(); \ - ao_arch_block_interrupts(); \ +#define ao_arch_wait_interrupt() do { \ + asm("\twfi\n"); \ + ao_arch_release_interrupts(); \ + asm(".global ao_idle_loc\n\nao_idle_loc:"); \ + ao_arch_block_interrupts(); \ } while (0) -#define ao_arch_critical(b) do { \ - ao_arch_block_interrupts(); \ - do { b } while (0); \ - ao_arch_release_interrupts(); \ +#define ao_arch_critical(b) do { \ + uint32_t __mask = ao_arch_irqsave(); \ + do { b } while (0); \ + ao_arch_irqrestore(__mask); \ } while (0) /* |