diff options
| author | Keith Packard <keithp@keithp.com> | 2013-04-28 23:02:12 -0700 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-05-07 20:07:52 -0700 |
| commit | f677a83348a9568679240ee9d731ab454f289831 (patch) | |
| tree | 8a8bd51ae7cce01fac472fb33a653f0489e74f0d /src/core | |
| parent | 0488cd9cffc837e99490a0761216bbc5847ff400 (diff) | |
altos: Provide timeout value to ao_radio_recv
Instead of using ao_alarm around calls to ao_radio_recv, provide an
explicit timeout value as needed by radio functions with more
complicated system interaction than the cc1111. The timeout is 8 bits
of clock ticks.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/ao.h | 2 | ||||
| -rw-r--r-- | src/core/ao_monitor.c | 2 | ||||
| -rw-r--r-- | src/core/ao_radio_cmac.c | 6 |
3 files changed, 3 insertions, 7 deletions
diff --git a/src/core/ao.h b/src/core/ao.h index 548e8738..2a8eb042 100644 --- a/src/core/ao.h +++ b/src/core/ao.h @@ -535,7 +535,7 @@ ao_radio_send(const __xdata void *d, uint8_t size) __reentrant; #if HAS_RADIO_RECV uint8_t -ao_radio_recv(__xdata void *d, uint8_t size) __reentrant; +ao_radio_recv(__xdata void *d, uint8_t size, uint8_t timeout) __reentrant; void ao_radio_recv_abort(void); diff --git a/src/core/ao_monitor.c b/src/core/ao_monitor.c index 5876bef7..18f170b4 100644 --- a/src/core/ao_monitor.c +++ b/src/core/ao_monitor.c @@ -81,7 +81,7 @@ ao_monitor_get(void) size = ao_monitoring; break; } - if (!ao_radio_recv(&ao_monitor_ring[ao_monitor_head], size + 2)) + if (!ao_radio_recv(&ao_monitor_ring[ao_monitor_head], size + 2, 0)) continue; ao_monitor_head = ao_monitor_ring_next(ao_monitor_head); ao_wakeup(DATA_TO_XDATA(&ao_monitor_head)); diff --git a/src/core/ao_radio_cmac.c b/src/core/ao_radio_cmac.c index fc0ca8b1..4920b50c 100644 --- a/src/core/ao_radio_cmac.c +++ b/src/core/ao_radio_cmac.c @@ -85,11 +85,7 @@ radio_cmac_recv(uint8_t len, uint16_t timeout) __reentrant #if HAS_MONITOR ao_monitor_set(0); #endif - if (timeout) - ao_alarm(timeout); - - i = ao_radio_recv(cmac_data, len + AO_CMAC_KEY_LEN + 2); - ao_clear_alarm(); + i = ao_radio_recv(cmac_data, len + AO_CMAC_KEY_LEN + 2, timeout); if (!i) { ao_radio_cmac_rssi = 0; |
