Commit 51d8a982 authored by hsum's avatar hsum

Correcting the logic for timing_window judgment.

parent 13d8c745
......@@ -1308,28 +1308,15 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
{
uint32_t recv_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
uint32_t current_sfn_slot_dec = NFAPI_SFNSLOT2DEC(phy->sfn,phy->slot);
//printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
uint8_t in_window = 0;
// printf("p7_msg_sfn: %d, p7_msg_slot: %d, phy_sfn:%d , phy_slot:%d \n",sfn,slot,phy->sfn,phy->slot);
uint8_t timing_window = phy->_public.slot_buffer_size;
if(current_sfn_slot_dec <= recv_sfn_slot_dec + timing_window){
in_window = 1;
}
else if(current_sfn_slot_dec + NFAPI_MAX_SFNSLOTDEC <= recv_sfn_slot_dec + timing_window){ //checking for wrap
in_window = 1;
}
else if (recv_sfn_slot_dec==0 && current_sfn_slot_dec >= (NFAPI_MAX_SFNSLOTDEC-timing_window)){
in_window = 1;
if(abs(recv_sfn_slot_dec - current_sfn_slot_dec) > timing_window){
if(abs(NFAPI_MAX_SFNSLOTDEC + recv_sfn_slot_dec - current_sfn_slot_dec) > timing_window){
return 0;
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_slot_dec, name, recv_sfn_slot_dec, (current_sfn_slot_dec - recv_sfn_slot_dec), timing_window);
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is out of window %d (delta:%d) [max:%d]\n", current_sfn_slot_dec, name, recv_sfn_slot_dec, (current_sfn_slot_dec - recv_sfn_slot_dec), timing_window);
}//Need to add more cases
return in_window;
return 1;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment