configuring n_TimingAdvanceOffset from upper layers, if present
This commit is contained in:
@@ -550,6 +550,7 @@ typedef struct {
|
||||
int ta_frame;
|
||||
int ta_slot;
|
||||
int ta_command;
|
||||
int ta_offset;
|
||||
bool is_rar;
|
||||
} fapi_nr_ta_command_pdu;
|
||||
|
||||
|
||||
@@ -382,9 +382,19 @@ static void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_
|
||||
ue->ta_frame = ta_command_pdu->ta_frame;
|
||||
ue->ta_command = ta_command_pdu->ta_command;
|
||||
}
|
||||
|
||||
LOG_D(PHY,
|
||||
"TA command received in %d.%d Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n",
|
||||
ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot);
|
||||
|
||||
if (ta_command_pdu->ta_offset != -1) {
|
||||
// ta_offset_samples : ta_offset = samples_per_subframe : (Δf_max x N_f / 1000)
|
||||
// As described in Section 4.3.1 in 38.211
|
||||
int ta_offset_samples = (ta_command_pdu->ta_offset * samples_per_subframe) / (4096 * 480);
|
||||
ue->N_TA_offset = ta_offset_samples;
|
||||
LOG_D(PHY, "Received N_TA offset %d from upper layers. Corresponds to %d samples.\n",
|
||||
ta_command_pdu->ta_offset, ta_offset_samples);
|
||||
}
|
||||
}
|
||||
|
||||
static void nr_ue_scheduled_response_dl(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
@@ -1587,6 +1587,24 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
|
||||
}
|
||||
}
|
||||
|
||||
static int get_ta_offset(long *n_TimingAdvanceOffset)
|
||||
{
|
||||
if (!n_TimingAdvanceOffset)
|
||||
return -1;
|
||||
|
||||
switch (*n_TimingAdvanceOffset) {
|
||||
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n0 :
|
||||
return 0;
|
||||
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n25600 :
|
||||
return 25600;
|
||||
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n39936 :
|
||||
return 39936;
|
||||
default :
|
||||
AssertFatal(false, "Invalid n-TimingAdvanceOffset\n");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
int cc_idP,
|
||||
NR_SI_SchedulingInfo_t *si_SchedulingInfo,
|
||||
@@ -1599,6 +1617,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
UPDATE_IE(mac->tdd_UL_DL_ConfigurationCommon, scc->tdd_UL_DL_ConfigurationCommon, NR_TDD_UL_DL_ConfigCommon_t);
|
||||
UPDATE_IE(mac->si_SchedulingInfo, si_SchedulingInfo, NR_SI_SchedulingInfo_t);
|
||||
UPDATE_IE(mac->si_SchedulingInfo_v1700, si_SchedulingInfo_v1700, NR_SI_SchedulingInfo_v1700_t);
|
||||
mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset);
|
||||
|
||||
config_common_ue_sa(mac, scc, cc_idP);
|
||||
configure_common_BWP_dl(mac,
|
||||
@@ -1652,6 +1671,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
if (reconfigurationWithSync->spCellConfigCommon) {
|
||||
NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon;
|
||||
mac->n_ta_offset = get_ta_offset(scc->n_TimingAdvanceOffset);
|
||||
if (scc->physCellId)
|
||||
mac->physCellId = *scc->physCellId;
|
||||
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
|
||||
|
||||
@@ -576,6 +576,7 @@ typedef struct NR_UE_MAC_INST_s {
|
||||
int dmrs_TypeA_Position;
|
||||
int p_Max;
|
||||
int p_Max_alt;
|
||||
int n_ta_offset; // -1 not present, otherwise value to be applied
|
||||
|
||||
long pdsch_HARQ_ACK_Codebook;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
|
||||
mac->uecap_maxMIMO_PUSCH_layers_nocb = 0;
|
||||
mac->p_Max = INT_MIN;
|
||||
mac->p_Max_alt = INT_MIN;
|
||||
mac->n_ta_offset = -1;
|
||||
reset_mac_inst(mac);
|
||||
|
||||
// need to inizialize because might not been setup (optional timer)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
|
||||
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);
|
||||
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UE_MAC_INST_t *mac);
|
||||
static void nr_ue_fill_phr(NR_UE_MAC_INST_t *mac,
|
||||
NR_SINGLE_ENTRY_PHR_MAC_CE *phr,
|
||||
float P_CMAX,
|
||||
@@ -1245,7 +1245,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 != no_ta)
|
||||
schedule_ta_command(dl_config, &mac->ul_time_alignment);
|
||||
schedule_ta_command(dl_config, mac);
|
||||
|
||||
nr_scheduled_response_t scheduled_response = {.dl_config = dl_config,
|
||||
.module_id = mac->ue_id,
|
||||
@@ -3534,11 +3534,13 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
|
||||
return num_sdus > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
static 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_UE_MAC_INST_t *mac)
|
||||
{
|
||||
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment = &mac->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->ta_offset = mac->n_ta_offset;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user