diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 951050349e..09a13fa0e2 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -641,6 +641,7 @@ typedef struct NR_UL_TIME_ALIGNMENT { char ta_slot; /// TA command and TAGID received from the gNB uint16_t ta_command; + uint32_t ta_total; uint8_t tag_id; } NR_UL_TIME_ALIGNMENT_t; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 1e67617ee7..63dd78f4f0 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3711,9 +3711,12 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, /*uint8_t ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; uint8_t tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID;*/ + const int ta = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; + const int tag = ((NR_MAC_CE_TA *)pduP)[1].TAGID; ul_time_alignment->apply_ta = 1; - ul_time_alignment->ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND; - ul_time_alignment->tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID; + ul_time_alignment->ta_command = ta; //here + ul_time_alignment->ta_total += ta - 31; + ul_time_alignment->tag_id = tag; /* #ifdef DEBUG_HEADER_PARSING @@ -4094,7 +4097,9 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t // TA command ul_time_alignment->apply_ta = 1; - ul_time_alignment->ta_command = 31 + rar->TA2 + (rar->TA1 << 5); + const int ta = rar->TA2 + (rar->TA1 << 5); + ul_time_alignment->ta_command = 31 + ta; + ul_time_alignment->ta_total = ta; #ifdef DEBUG_RAR // CSI