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);
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;
}
}
#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 */
#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)