summaryrefslogtreecommitdiff
path: root/src/drivers/ao_cc1120.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-06-27 19:47:52 -0700
committerKeith Packard <keithp@keithp.com>2012-06-27 19:47:52 -0700
commitbd21c050fd8b96b33ab6859c942bf55cf2b91868 (patch)
treef5d38393e4b0c0e50bd2e23773767a77f9c896df /src/drivers/ao_cc1120.c
parent407cefae9cb95c5910b3bd79851776c48729e06b (diff)
altos: Make profiling Viterbi decoder more useful
This blocks starting the decoder until all of the data have arrived so that the time spent in the decoder is easily computed. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/drivers/ao_cc1120.c')
-rw-r--r--src/drivers/ao_cc1120.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/drivers/ao_cc1120.c b/src/drivers/ao_cc1120.c
index 30663042..1d28148b 100644
--- a/src/drivers/ao_cc1120.c
+++ b/src/drivers/ao_cc1120.c
@@ -605,8 +605,10 @@ ao_radio_rx_isr(void)
rx_data[rx_data_cur++] = d;
if (rx_waiting && rx_data_cur - rx_data_consumed >= AO_FEC_DECODE_BLOCK) {
#if AO_PROFILE
- if (rx_data_consumed == 0)
+ if (!rx_packet_tick)
rx_packet_tick = ao_profile_tick();
+ if (rx_data_cur < rx_data_count)
+ return;
#endif
rx_waiting = 0;
ao_wakeup(&ao_radio_wake);
@@ -630,6 +632,9 @@ ao_radio_rx_wait(void)
if (ao_radio_abort)
return 0;
rx_data_consumed += AO_FEC_DECODE_BLOCK;
+#if AO_PROFILE
+ return rx_data_cur - rx_data_consumed;
+#endif
return AO_FEC_DECODE_BLOCK;
}
@@ -649,6 +654,7 @@ ao_radio_recv(__xdata void *d, uint8_t size)
}
#if AO_PROFILE
rx_start_tick = ao_profile_tick();
+ rx_packet_tick = 0;
#endif
len = size + 2; /* CRC bytes */
len += 1 + ~(len & 1); /* 1 or two pad bytes */