diff options
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/ao_cc1120.c | 8 | ||||
-rw-r--r-- | src/drivers/ao_packet.c | 12 |
2 files changed, 19 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 */ diff --git a/src/drivers/ao_packet.c b/src/drivers/ao_packet.c index 28a0c415..e020c003 100644 --- a/src/drivers/ao_packet.c +++ b/src/drivers/ao_packet.c @@ -61,6 +61,18 @@ ao_packet_recv(void) #ifdef AO_LED_GREEN ao_led_off(AO_LED_GREEN); #endif +#if AO_PROFILE + { + extern uint32_t ao_rx_start_tick, ao_rx_packet_tick, ao_rx_done_tick, ao_rx_last_done_tick; + extern uint32_t ao_fec_decode_start, ao_fec_decode_end; + + printf ("between packet: %d\n", ao_rx_start_tick - ao_rx_last_done_tick); + printf ("receive start delay: %d\n", ao_rx_packet_tick - ao_rx_start_tick); + printf ("decode time: %d\n", ao_fec_decode_end - ao_fec_decode_start); + printf ("rx cleanup: %d\n\n", ao_rx_done_tick - ao_fec_decode_end); + flush(); + } +#endif /* Check to see if we got a valid packet */ if (!dma_done) |