summaryrefslogtreecommitdiff
path: root/src/ao_radio.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-26 17:39:40 -0800
committerKeith Packard <keithp@keithp.com>2010-12-22 20:39:40 -0800
commit484b44e81b655f1ecb48256095382a56d2839bae (patch)
tree14446271e5d92b9ea9bee040c7787ba48c616229 /src/ao_radio.c
parent07213dc34fa20470a4b36a327a83d75b0f010ebb (diff)
altos: eliminate ao_wake_task
Waking up a task waiting on some random object is a bad idea. Fix the waiters to look for suitable signalling. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_radio.c')
-rw-r--r--src/ao_radio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ao_radio.c b/src/ao_radio.c
index 362b73aa..7b7c5161 100644
--- a/src/ao_radio.c
+++ b/src/ao_radio.c
@@ -377,8 +377,13 @@ ao_radio_recv(__xdata void *packet, uint8_t size) __reentrant
DMA_CFG1_PRIORITY_HIGH);
ao_dma_start(ao_radio_dma);
RFST = RFST_SRX;
+
+ /* Wait for DMA to be done, for the radio receive process to
+ * get aborted or for a receive timeout to fire
+ */
__critical while (!ao_radio_dma_done && !ao_radio_abort)
- ao_sleep(&ao_radio_dma_done);
+ if (ao_sleep(&ao_radio_dma_done))
+ break;
/* If recv was aborted, clean up by stopping the DMA engine
* and idling the radio