fix timing advance from msg2/rar
This commit is contained in:
@@ -384,11 +384,16 @@ typedef struct {
|
||||
short ssb_rsrp_dBm;
|
||||
} NR_SSB_meas_t;
|
||||
|
||||
typedef enum ta_type {
|
||||
no_ta = 0,
|
||||
adjustment_ta,
|
||||
rar_ta,
|
||||
} ta_type_t;
|
||||
|
||||
typedef struct NR_UL_TIME_ALIGNMENT {
|
||||
/// TA command and TAGID received from the gNB
|
||||
bool ta_apply;
|
||||
ta_type_t ta_apply;
|
||||
int ta_command;
|
||||
int ta_total;
|
||||
uint32_t tag_id;
|
||||
int frame;
|
||||
int slot;
|
||||
|
||||
@@ -401,7 +401,6 @@ and fills the PRACH PDU per each FD occasion.
|
||||
void nr_ue_pucch_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, int slotP, void *phy_data);
|
||||
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot);
|
||||
void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot);
|
||||
void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
/* \brief This function schedules the Msg3 transmission
|
||||
@param
|
||||
|
||||
@@ -3722,12 +3722,11 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
|
||||
const int tag = ((NR_MAC_CE_TA *)pduP)[1].TAGID;
|
||||
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment;
|
||||
ul_time_alignment->ta_total += ta - 31;
|
||||
ul_time_alignment->tag_id = tag;
|
||||
ul_time_alignment->ta_command = ta;
|
||||
ul_time_alignment->frame = frameP;
|
||||
ul_time_alignment->slot = slot;
|
||||
ul_time_alignment->ta_apply = true;
|
||||
ul_time_alignment->ta_apply = adjustment_ta;
|
||||
/*
|
||||
#ifdef DEBUG_HEADER_PARSING
|
||||
LOG_D(MAC, "[UE] CE %d : UE Timing Advance : %d\n", i, pduP[1]);
|
||||
@@ -3735,21 +3734,9 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
|
||||
*/
|
||||
|
||||
if (ta == 31)
|
||||
LOG_D(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n",
|
||||
frameP,
|
||||
slot,
|
||||
ta,
|
||||
tag,
|
||||
CC_id,
|
||||
ul_time_alignment->ta_total);
|
||||
LOG_D(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d \n", frameP, slot, ta, tag, CC_id);
|
||||
else
|
||||
LOG_I(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d TA total %d\n",
|
||||
frameP,
|
||||
slot,
|
||||
ta,
|
||||
tag,
|
||||
CC_id,
|
||||
ul_time_alignment->ta_total);
|
||||
LOG_I(NR_MAC, "[%d.%d] Received TA_COMMAND %u TAGID %u CC_id %d \n", frameP, slot, ta, tag, CC_id);
|
||||
|
||||
break;
|
||||
case DL_SCH_LCID_CON_RES_ID:
|
||||
@@ -4129,9 +4116,9 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
|
||||
// TA command
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->ul_time_alignment;
|
||||
const int ta = rar->TA2 + (rar->TA1 << 5);
|
||||
ul_time_alignment->ta_command = 31 + ta;
|
||||
ul_time_alignment->ta_total = ta;
|
||||
ul_time_alignment->ta_apply = true;
|
||||
ul_time_alignment->ta_command = ta;
|
||||
ul_time_alignment->ta_apply = rar_ta;
|
||||
|
||||
LOG_W(MAC, "received TA command %d\n", 31 + ta);
|
||||
#ifdef DEBUG_RAR
|
||||
// CSI
|
||||
@@ -4221,6 +4208,8 @@ static void nr_ue_process_rar(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *d
|
||||
return;
|
||||
}
|
||||
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, tda_info.k2);
|
||||
ul_time_alignment->frame = frame_tx;
|
||||
ul_time_alignment->slot = slot_tx;
|
||||
|
||||
if (ret != -1) {
|
||||
uint16_t rnti = mac->crnti;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
//#define SRS_DEBUG
|
||||
|
||||
static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP);
|
||||
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
|
||||
|
||||
fapi_nr_ul_config_request_pdu_t *lockGet_ul_config(NR_UE_MAC_INST_t *mac, frame_t frame_tx, int slot_tx, uint8_t pdu_type)
|
||||
{
|
||||
@@ -1018,7 +1019,7 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info
|
||||
|
||||
ue_dci_configuration(mac, dl_config, rx_frame, rx_slot);
|
||||
|
||||
if (mac->ul_time_alignment.ta_apply)
|
||||
if (mac->ul_time_alignment.ta_apply != no_ta)
|
||||
schedule_ta_command(dl_config, &mac->ul_time_alignment);
|
||||
if (mac->state == UE_CONNECTED) {
|
||||
nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
|
||||
@@ -3354,15 +3355,16 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
|
||||
return num_sdus > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment)
|
||||
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment)
|
||||
{
|
||||
fapi_nr_ta_command_pdu *ta = &dl_config->dl_config_list[dl_config->number_pdus].ta_command_pdu;
|
||||
ta->ta_frame = ul_time_alignment->frame;
|
||||
ta->ta_slot = ul_time_alignment->slot;
|
||||
ta->is_rar = ul_time_alignment->ta_apply == rar_ta;
|
||||
ta->ta_command = ul_time_alignment->ta_command;
|
||||
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_CONFIG_TA_COMMAND;
|
||||
dl_config->number_pdus += 1;
|
||||
ul_time_alignment->ta_apply = false;
|
||||
ul_time_alignment->ta_apply = no_ta;
|
||||
}
|
||||
|
||||
uint32_t nr_get_pbr(long prioritizedbitrate)
|
||||
|
||||
Reference in New Issue
Block a user