Commit 73442050 authored by francescomani's avatar francescomani

configuring n_TimingAdvanceOffset from upper layers, if present

parent 57314212
...@@ -549,6 +549,7 @@ typedef struct { ...@@ -549,6 +549,7 @@ typedef struct {
int ta_frame; int ta_frame;
int ta_slot; int ta_slot;
int ta_command; int ta_command;
int ta_offset;
bool is_rar; bool is_rar;
} fapi_nr_ta_command_pdu; } fapi_nr_ta_command_pdu;
......
...@@ -374,9 +374,19 @@ static void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_ ...@@ -374,9 +374,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_frame = ta_command_pdu->ta_frame;
ue->ta_command = ta_command_pdu->ta_command; ue->ta_command = ta_command_pdu->ta_command;
} }
LOG_D(PHY, 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 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); 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, static void nr_ue_scheduled_response_dl(NR_UE_MAC_INST_t *mac,
......
...@@ -1460,6 +1460,27 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, ...@@ -1460,6 +1460,27 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
} }
} }
static void configure_ta_offset(NR_UE_MAC_INST_t *mac, long *n_TimingAdvanceOffset)
{
if (!n_TimingAdvanceOffset) {
mac->n_ta_offset = -1;
return;
}
switch (*n_TimingAdvanceOffset) {
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n0 :
mac->n_ta_offset = 0;
break;
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n25600 :
mac->n_ta_offset = 25600;
break;
case NR_ServingCellConfigCommonSIB__n_TimingAdvanceOffset_n39936 :
mac->n_ta_offset = 39936;
break;
default :
AssertFatal(false, "Invalide n-TimingAdvanceOffset\n");
}
}
void nr_rrc_mac_config_req_sib1(module_id_t module_id, void nr_rrc_mac_config_req_sib1(module_id_t module_id,
int cc_idP, int cc_idP,
NR_SI_SchedulingInfo_t *si_SchedulingInfo, NR_SI_SchedulingInfo_t *si_SchedulingInfo,
...@@ -1470,6 +1491,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, ...@@ -1470,6 +1491,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->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, si_SchedulingInfo, NR_SI_SchedulingInfo_t);
configure_ta_offset(mac, scc->n_TimingAdvanceOffset);
config_common_ue_sa(mac, scc, cc_idP); config_common_ue_sa(mac, scc, cc_idP);
configure_common_BWP_dl(mac, configure_common_BWP_dl(mac,
...@@ -1513,6 +1535,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, ...@@ -1513,6 +1535,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
if (reconfigurationWithSync->spCellConfigCommon) { if (reconfigurationWithSync->spCellConfigCommon) {
NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon; NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon;
configure_ta_offset(mac, scc->n_TimingAdvanceOffset);
if (scc->physCellId) if (scc->physCellId)
mac->physCellId = *scc->physCellId; mac->physCellId = *scc->physCellId;
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position; mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
......
...@@ -566,6 +566,7 @@ typedef struct NR_UE_MAC_INST_s { ...@@ -566,6 +566,7 @@ typedef struct NR_UE_MAC_INST_s {
int dmrs_TypeA_Position; int dmrs_TypeA_Position;
int p_Max; int p_Max;
int p_Max_alt; int p_Max_alt;
int n_ta_offset; // -1 not present, otherwise value to be applied
long pdsch_HARQ_ACK_Codebook; long pdsch_HARQ_ACK_Codebook;
......
...@@ -70,6 +70,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac) ...@@ -70,6 +70,7 @@ void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
mac->uecap_maxMIMO_PUSCH_layers_nocb = 0; mac->uecap_maxMIMO_PUSCH_layers_nocb = 0;
mac->p_Max = INT_MIN; mac->p_Max = INT_MIN;
mac->p_Max_alt = INT_MIN; mac->p_Max_alt = INT_MIN;
mac->n_ta_offset = -1;
reset_mac_inst(mac); reset_mac_inst(mac);
// need to inizialize because might not been setup (optional timer) // need to inizialize because might not been setup (optional timer)
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
} }
static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_frame_t slotP); 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);
void clear_ul_config_request(NR_UE_MAC_INST_t *mac, int scs) void clear_ul_config_request(NR_UE_MAC_INST_t *mac, int scs)
{ {
...@@ -1179,7 +1179,7 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info ...@@ -1179,7 +1179,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); ue_dci_configuration(mac, dl_config, rx_frame, rx_slot);
if (mac->ul_time_alignment.ta_apply != no_ta) if (mac->ul_time_alignment.ta_apply != no_ta)
schedule_ta_command(dl_config, &mac->ul_time_alignment); schedule_ta_command(dl_config, mac);
if (mac->state == UE_CONNECTED) { if (mac->state == UE_CONNECTED) {
nr_schedule_csirs_reception(mac, rx_frame, rx_slot); nr_schedule_csirs_reception(mac, rx_frame, rx_slot);
nr_schedule_csi_for_im(mac, rx_frame, rx_slot); nr_schedule_csi_for_im(mac, rx_frame, rx_slot);
...@@ -3381,11 +3381,13 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac, ...@@ -3381,11 +3381,13 @@ uint8_t nr_ue_get_sdu(NR_UE_MAC_INST_t *mac,
return num_sdus > 0 ? 1 : 0; 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; 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_frame = ul_time_alignment->frame;
ta->ta_slot = ul_time_alignment->slot; 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->is_rar = ul_time_alignment->ta_apply == rar_ta;
ta->ta_command = ul_time_alignment->ta_command; 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->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_CONFIG_TA_COMMAND;
......
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