Commit 15aeb34c authored by francescomani's avatar francescomani

improvements in config_common_ue

parent 790c3b99
...@@ -662,7 +662,7 @@ typedef struct ...@@ -662,7 +662,7 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t prach_sequence_length;//RACH sequence length. Only short sequence length is supported for FR2. [38.211, sec 6.3.3.1] Value: 0 = Long sequence 1 = Short sequence uint8_t prach_sequence_length;//RACH sequence length. Only short sequence length is supported for FR2. [38.211, sec 6.3.3.1] Value: 0 = Long sequence 1 = Short sequence
uint8_t prach_sub_c_spacing;//Subcarrier spacing of PRACH. [38.211 sec 4.2] Value:0->4 uint8_t prach_sub_c_spacing;//Subcarrier spacing of PRACH. [38.211 sec 4.2] Value: 0: 15 kHz 1: 30 kHz 2: 60 kHz 3: 120 kHz 4: 1.25 kHz 5: 5 kHz
uint8_t restricted_set_config;//PRACH restricted set config Value: 0: unrestricted 1: restricted set type A 2: restricted set type B uint8_t restricted_set_config;//PRACH restricted set config Value: 0: unrestricted 1: restricted set type A 2: restricted set type B
uint8_t num_prach_fd_occasions;//Corresponds to the parameter 𝑀 in [38.211, sec 6.3.3.2] which equals the higher layer parameter msg1FDM Value: 1,2,4,8 uint8_t num_prach_fd_occasions;//Corresponds to the parameter 𝑀 in [38.211, sec 6.3.3.2] which equals the higher layer parameter msg1FDM Value: 1,2,4,8
fapi_nr_num_prach_fd_occasions_t* num_prach_fd_occasions_list; fapi_nr_num_prach_fd_occasions_t* num_prach_fd_occasions_list;
......
...@@ -142,10 +142,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -142,10 +142,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
// carrier config // carrier config
NR_FrequencyInfoDL_SIB_t *frequencyInfoDL = &scc->downlinkConfigCommon.frequencyInfoDL; NR_FrequencyInfoDL_SIB_t *frequencyInfoDL = &scc->downlinkConfigCommon.frequencyInfoDL;
AssertFatal(frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR,
"Field mandatory present for DL in SIB1\n");
mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR;
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR, mac->nr_band,
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR > 256 ? FR2 : FR1, bw_index); cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index);
uint64_t dl_bw_khz = (12 * frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth) * uint64_t dl_bw_khz = (12 * frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth) *
(15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); (15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing);
...@@ -163,13 +166,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -163,13 +166,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
} }
NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL; NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL;
int UL_band_ind = frequencyInfoUL->frequencyBandList == NULL ? mac->p_Max = frequencyInfoUL->p_Max ?
*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR : *frequencyInfoUL->p_Max :
*frequencyInfoUL->frequencyBandList->list.array[0]->freqBandIndicatorNR; INT_MIN;
bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
UL_band_ind, mac->nr_band,
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(UL_band_ind > 256 ? FR2 : FR1, bw_index); cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index);
if (frequencyInfoUL->absoluteFrequencyPointA == NULL) if (frequencyInfoUL->absoluteFrequencyPointA == NULL)
cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency; cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency;
...@@ -190,7 +193,6 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -190,7 +193,6 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology); mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
// cell config // cell config
cfg->cell_config.phy_cell_id = mac->physCellId; cfg->cell_config.phy_cell_id = mac->physCellId;
cfg->cell_config.frame_duplex_type = mac->frame_type; cfg->cell_config.frame_duplex_type = mac->frame_type;
...@@ -217,12 +219,12 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -217,12 +219,12 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
// TDD Table Configuration // TDD Table Configuration
if (cfg->cell_config.frame_duplex_type == TDD){ if (cfg->cell_config.frame_duplex_type == TDD){
set_tdd_config_nr_ue(&cfg->tdd_table_1, set_tdd_config_nr_ue(&cfg->tdd_table_1,
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->ssb_config.scs_common,
&mac->tdd_UL_DL_ConfigurationCommon->pattern1); &mac->tdd_UL_DL_ConfigurationCommon->pattern1);
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) { if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t)); cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t));
set_tdd_config_nr_ue(cfg->tdd_table_2, set_tdd_config_nr_ue(cfg->tdd_table_2,
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->ssb_config.scs_common,
mac->tdd_UL_DL_ConfigurationCommon->pattern2); mac->tdd_UL_DL_ConfigurationCommon->pattern2);
} }
} }
...@@ -238,8 +240,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -238,8 +240,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
if (rach_ConfigCommon->msg1_SubcarrierSpacing) if (rach_ConfigCommon->msg1_SubcarrierSpacing)
cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing; cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing;
else else {
cfg->prach_config.prach_sub_c_spacing = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; // If absent, the UE applies the SCS as derived from the prach-ConfigurationIndex (for 839)
int config_index = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex;
const int64_t *prach_config_info_p = get_prach_config_info(mac->frequency_range, config_index, mac->frame_type);
int format = prach_config_info_p[0];
cfg->prach_config.prach_sub_c_spacing = format == 3 ? 5 : 4;
}
cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig; cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig;
...@@ -293,82 +300,91 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -293,82 +300,91 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
// carrier config // carrier config
LOG_D(MAC, "Entering UE Config Common\n"); LOG_D(MAC, "Entering UE Config Common\n");
AssertFatal(scc != NULL, "scc cannot be null\n"); AssertFatal(scc->downlinkConfigCommon,
"Not expecting downlinkConfigCommon to be NULL here\n");
struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, if (frequencyInfoDL) { // NeedM for inter-freq handover
*frequencyInfoDL->frequencyBandList.list.array[0], mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0];
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index); mac->frequency_range = mac->nr_band < 256 ? FR1 : FR2;
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
mac->nr_band,
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index);
cfg->carrier_config.dl_frequency = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], cfg->carrier_config.dl_frequency = from_nrarfcn(mac->nr_band,
*scc->ssbSubcarrierSpacing, *scc->ssbSubcarrierSpacing,
frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
cfg->carrier_config.dl_grid_size[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->carrier_config.dl_grid_size[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
cfg->carrier_config.dl_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; cfg->carrier_config.dl_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
} }
else { else {
cfg->carrier_config.dl_grid_size[i] = 0; cfg->carrier_config.dl_grid_size[i] = 0;
cfg->carrier_config.dl_k0[i] = 0; cfg->carrier_config.dl_k0[i] = 0;
}
} }
} }
struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; if (scc->uplinkConfigCommon && scc->uplinkConfigCommon->frequencyInfoUL) {
bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL;
*frequencyInfoUL->frequencyBandList->list.array[0], mac->p_Max = frequencyInfoUL->p_Max ?
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); *frequencyInfoUL->p_Max :
cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index); INT_MIN;
int UL_pointA;
if (frequencyInfoUL->absoluteFrequencyPointA == NULL)
UL_pointA = frequencyInfoDL->absoluteFrequencyPointA;
else
UL_pointA = *frequencyInfoUL->absoluteFrequencyPointA;
cfg->carrier_config.uplink_frequency = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0],
*scc->ssbSubcarrierSpacing,
UL_pointA) / 1000; // freq in kHz
for (int i = 0; i < 5; i++) { int bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { *frequencyInfoUL->frequencyBandList->list.array[0],
cfg->carrier_config.ul_grid_size[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
cfg->carrier_config.ul_k0[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index);
}
else { long *UL_pointA = NULL;
cfg->carrier_config.ul_grid_size[i] = 0; if (frequencyInfoUL->absoluteFrequencyPointA)
cfg->carrier_config.ul_k0[i] = 0; UL_pointA = frequencyInfoUL->absoluteFrequencyPointA;
else if (frequencyInfoDL)
UL_pointA = &frequencyInfoDL->absoluteFrequencyPointA;
if(UL_pointA)
cfg->carrier_config.uplink_frequency = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0],
*scc->ssbSubcarrierSpacing,
*UL_pointA) / 1000; // freq in kHz
for (int i = 0; i < 5; i++) {
if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) {
cfg->carrier_config.ul_grid_size[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
cfg->carrier_config.ul_k0[i] = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
}
else {
cfg->carrier_config.ul_grid_size[i] = 0;
cfg->carrier_config.ul_k0[i] = 0;
}
} }
} }
uint32_t band = *frequencyInfoDL->frequencyBandList.list.array[0];
mac->frequency_range = band<100?FR1:FR2;
frame_type_t frame_type = get_frame_type(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
// cell config // cell config
cfg->cell_config.phy_cell_id = *scc->physCellId; cfg->cell_config.phy_cell_id = *scc->physCellId;
cfg->cell_config.frame_duplex_type = frame_type; cfg->cell_config.frame_duplex_type = mac->frame_type;
// SSB config // SSB config
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing; cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
// SSB Table config // SSB Table config
int scs_scaling = 1<<(cfg->ssb_config.scs_common); if (frequencyInfoDL && frequencyInfoDL->absoluteFrequencySSB) {
if (frequencyInfoDL->absoluteFrequencyPointA < 600000) int scs_scaling = 1<<(cfg->ssb_config.scs_common);
scs_scaling = scs_scaling*3; if (frequencyInfoDL->absoluteFrequencyPointA < 600000)
if (frequencyInfoDL->absoluteFrequencyPointA > 2016666) scs_scaling = scs_scaling*3;
scs_scaling = scs_scaling>>2; if (frequencyInfoDL->absoluteFrequencyPointA > 2016666)
uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA); scs_scaling = scs_scaling>>2;
cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10; uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA);
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_offset_point_a = absolute_diff/(12*scs_scaling) - 10;
cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell;
// NSA -> take ssb offset from SCS // NSA -> take ssb offset from SCS
cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling); cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
}
switch (scc->ssb_PositionsInBurst->present) { switch (scc->ssb_PositionsInBurst->present) {
case 1 : case 1 :
...@@ -394,67 +410,77 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -394,67 +410,77 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
// TDD Table Configuration // TDD Table Configuration
if (cfg->cell_config.frame_duplex_type == TDD){ if (cfg->cell_config.frame_duplex_type == TDD){
set_tdd_config_nr_ue(&cfg->tdd_table_1, set_tdd_config_nr_ue(&cfg->tdd_table_1,
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->ssb_config.scs_common,
&mac->tdd_UL_DL_ConfigurationCommon->pattern1); &mac->tdd_UL_DL_ConfigurationCommon->pattern1);
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) { if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t)); cfg->tdd_table_2 = (fapi_nr_tdd_table_t *) malloc(sizeof(fapi_nr_tdd_table_t));
set_tdd_config_nr_ue(cfg->tdd_table_2, set_tdd_config_nr_ue(cfg->tdd_table_2,
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, cfg->ssb_config.scs_common,
mac->tdd_UL_DL_ConfigurationCommon->pattern2); mac->tdd_UL_DL_ConfigurationCommon->pattern2);
} }
} }
// PRACH configuration // PRACH configuration
uint8_t nb_preambles = 64; uint8_t nb_preambles = 64;
NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; if (scc->uplinkConfigCommon &&
if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) scc->uplinkConfigCommon->initialUplinkBWP &&
nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon) { // all NeedM
cfg->prach_config.prach_sequence_length = rach_ConfigCommon->prach_RootSequenceIndex.present-1; NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL)
nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles;
if (rach_ConfigCommon->msg1_SubcarrierSpacing) cfg->prach_config.prach_sequence_length = rach_ConfigCommon->prach_RootSequenceIndex.present-1;
cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing;
else
cfg->prach_config.prach_sub_c_spacing = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig; if (rach_ConfigCommon->msg1_SubcarrierSpacing)
cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing;
switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { else {
case 0 : // If absent, the UE applies the SCS as derived from the prach-ConfigurationIndex (for 839)
cfg->prach_config.num_prach_fd_occasions = 1; int config_index = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex;
break; const int64_t *prach_config_info_p = get_prach_config_info(mac->frequency_range, config_index, mac->frame_type);
case 1 : int format = prach_config_info_p[0];
cfg->prach_config.num_prach_fd_occasions = 2; cfg->prach_config.prach_sub_c_spacing = format == 3 ? 5 : 4;
break; }
case 2 :
cfg->prach_config.num_prach_fd_occasions = 4;
break;
case 3 :
cfg->prach_config.num_prach_fd_occasions = 8;
break;
default:
AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM);
}
cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t)); cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig;
for (int i = 0; i < cfg->prach_config.num_prach_fd_occasions; i++) {
fapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i]; switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) {
prach_fd_occasion->num_prach_fd_occasions = i; case 0 :
if (cfg->prach_config.prach_sequence_length) cfg->prach_config.num_prach_fd_occasions = 1;
prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139; break;
else case 1 :
prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions = 2;
break;
case 2 :
cfg->prach_config.num_prach_fd_occasions = 4;
break;
case 3 :
cfg->prach_config.num_prach_fd_occasions = 8;
break;
default:
AssertFatal(1==0,"msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM);
}
prach_fd_occasion->k1 = rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart; cfg->prach_config.num_prach_fd_occasions_list = (fapi_nr_num_prach_fd_occasions_t *) malloc(cfg->prach_config.num_prach_fd_occasions*sizeof(fapi_nr_num_prach_fd_occasions_t));
prach_fd_occasion->prach_zero_corr_conf = rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig; for (int i = 0; i < cfg->prach_config.num_prach_fd_occasions; i++) {
prach_fd_occasion->num_root_sequences = compute_nr_root_seq(rach_ConfigCommon, fapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i];
nb_preambles, prach_fd_occasion->num_prach_fd_occasions = i;
frame_type, if (cfg->prach_config.prach_sequence_length)
mac->frequency_range); prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139;
//prach_fd_occasion->num_unused_root_sequences = ??? else
prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l839;
prach_fd_occasion->k1 = rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart;
prach_fd_occasion->prach_zero_corr_conf = rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig;
prach_fd_occasion->num_root_sequences = compute_nr_root_seq(rach_ConfigCommon,
nb_preambles,
mac->frame_type,
mac->frequency_range);
cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
//prach_fd_occasion->num_unused_root_sequences = ???
}
} }
cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
} }
...@@ -680,36 +706,6 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id, ...@@ -680,36 +706,6 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
} }
} }
void configure_scc(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfigCommonSIB_t *scc_sib,
NR_ServingCellConfigCommon_t *scc)
{
// SCC is provided when receiving reconfigurationWithSync
// SCC_SIB is provided when receiving SIB1
// So never at the same time
if (scc) {
if (scc->physCellId)
mac->physCellId = *scc->physCellId;
mac->bwp_dlcommon = scc->downlinkConfigCommon->initialDownlinkBWP;
mac->bwp_ulcommon = scc->uplinkConfigCommon->initialUplinkBWP;
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
mac->tdd_UL_DL_ConfigurationCommon = scc->tdd_UL_DL_ConfigurationCommon;
mac->p_Max = scc->uplinkConfigCommon->frequencyInfoUL->p_Max ?
*scc->uplinkConfigCommon->frequencyInfoUL->p_Max :
INT_MIN;
mac->nr_band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
}
if (scc_sib) {
mac->bwp_dlcommon = &scc_sib->downlinkConfigCommon.initialDownlinkBWP;
mac->bwp_ulcommon = &scc_sib->uplinkConfigCommon->initialUplinkBWP;
mac->tdd_UL_DL_ConfigurationCommon = scc_sib->tdd_UL_DL_ConfigurationCommon;
mac->p_Max = scc_sib->uplinkConfigCommon->frequencyInfoUL.p_Max ?
*scc_sib->uplinkConfigCommon->frequencyInfoUL.p_Max :
INT_MIN;
mac->nr_band = *scc_sib->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR;
}
}
void configure_current_BWP(NR_UE_MAC_INST_t *mac, void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NR_ServingCellConfigCommonSIB_t *scc, NR_ServingCellConfigCommonSIB_t *scc,
const NR_ServingCellConfig_t *spCellConfigDedicated) const NR_ServingCellConfig_t *spCellConfigDedicated)
...@@ -720,6 +716,10 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, ...@@ -720,6 +716,10 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
NR_BWP_t ul_genericParameters = {0}; NR_BWP_t ul_genericParameters = {0};
if(scc) { if(scc) {
DL_BWP->bwp_id = 0;
UL_BWP->bwp_id = 0;
mac->bwp_dlcommon = &scc->downlinkConfigCommon.initialDownlinkBWP;
mac->bwp_ulcommon = &scc->uplinkConfigCommon->initialUplinkBWP;
dl_genericParameters = mac->bwp_dlcommon->genericParameters; dl_genericParameters = mac->bwp_dlcommon->genericParameters;
if(mac->bwp_ulcommon) if(mac->bwp_ulcommon)
ul_genericParameters = mac->bwp_ulcommon->genericParameters; ul_genericParameters = mac->bwp_ulcommon->genericParameters;
...@@ -880,9 +880,13 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, ...@@ -880,9 +880,13 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
AssertFatal(scc, "SIB1 SCC should not be NULL\n"); AssertFatal(scc, "SIB1 SCC should not be NULL\n");
configure_scc(mac, scc, NULL); updateMACie(mac->tdd_UL_DL_ConfigurationCommon,
scc->tdd_UL_DL_ConfigurationCommon,
NR_TDD_UL_DL_ConfigCommon_t);
updateMACie(mac->si_SchedulingInfo,
si_SchedulingInfo,
NR_SI_SchedulingInfo_t);
mac->si_SchedulingInfo = si_SchedulingInfo;
config_common_ue_sa(mac, scc, module_id, cc_idP); config_common_ue_sa(mac, scc, module_id, cc_idP);
// configure BWP only if it is a SIB1 detection in non connected state (after sync) // configure BWP only if it is a SIB1 detection in non connected state (after sync)
// not if it is a periodical update of SIB1 (no change of BWP in that case) // not if it is a periodical update of SIB1 (no change of BWP in that case)
...@@ -899,15 +903,29 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, ...@@ -899,15 +903,29 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
int cc_idP, int cc_idP,
const NR_ReconfigurationWithSync_t *reconfigurationWithSync) const NR_ReconfigurationWithSync_t *reconfigurationWithSync)
{ {
mac->crnti = reconfigurationWithSync->newUE_Identity;
LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti);
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
if (reconfigurationWithSync->rach_ConfigDedicated) { if (reconfigurationWithSync->rach_ConfigDedicated) {
AssertFatal(reconfigurationWithSync->rach_ConfigDedicated->present ==
NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink,
"RACH on supplementaryUplink not supported\n");
ra->rach_ConfigDedicated = reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; ra->rach_ConfigDedicated = reconfigurationWithSync->rach_ConfigDedicated->choice.uplink;
} }
configure_scc(mac, NULL, reconfigurationWithSync->spCellConfigCommon); if (reconfigurationWithSync->spCellConfigCommon) {
mac->crnti = reconfigurationWithSync->newUE_Identity; NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon;
LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti); mac->bwp_dlcommon = scc->downlinkConfigCommon->initialDownlinkBWP;
config_common_ue(mac, reconfigurationWithSync->spCellConfigCommon, module_id, cc_idP); mac->bwp_ulcommon = scc->uplinkConfigCommon->initialUplinkBWP;
if (scc->physCellId)
mac->physCellId = *scc->physCellId;
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
updateMACie(mac->tdd_UL_DL_ConfigurationCommon,
scc->tdd_UL_DL_ConfigurationCommon,
NR_TDD_UL_DL_ConfigCommon_t);
config_common_ue(mac, scc, module_id, cc_idP);
}
mac->state = UE_NOT_SYNC; mac->state = UE_NOT_SYNC;
ra->ra_state = RA_UE_IDLE; ra->ra_state = RA_UE_IDLE;
......
...@@ -435,13 +435,12 @@ typedef struct nr_lcordered_info_s { ...@@ -435,13 +435,12 @@ typedef struct nr_lcordered_info_s {
/*!\brief Top level UE MAC structure */ /*!\brief Top level UE MAC structure */
typedef struct { typedef struct {
NR_UE_L2_STATE_t state; NR_UE_L2_STATE_t state;
int servCellIndex; int servCellIndex;
long physCellId; long physCellId;
//// MAC config int first_sync_frame;
int first_sync_frame; bool get_sib1;
bool get_sib1; bool get_otherSI;
bool get_otherSI; NR_MIB_t *mib;
NR_MIB_t *mib;
struct NR_SI_SchedulingInfo *si_SchedulingInfo; struct NR_SI_SchedulingInfo *si_SchedulingInfo;
int si_window_start; int si_window_start;
ssb_list_info_t ssb_list; ssb_list_info_t ssb_list;
......
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
#define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */ #define NR_DL_MAX_DAI (4) /* TS 38.213 table 9.1.3-1 Value of counter DAI for DCI format 1_0 and 1_1 */
#define NR_DL_MAX_NB_CW (2) /* number of downlink code word */ #define NR_DL_MAX_NB_CW (2) /* number of downlink code word */
#define updateMACie(destination, origin, type) { \
type *tmp = origin; \
origin = destination; \
destination = tmp; \
} \
/**\brief initialize the field in nr_mac instance /**\brief initialize the field in nr_mac instance
\param module_id module id */ \param module_id module id */
void nr_ue_init_mac(module_id_t module_idP); void nr_ue_init_mac(module_id_t module_idP);
......
...@@ -167,6 +167,7 @@ void nr_ue_init_mac(module_id_t module_idP) ...@@ -167,6 +167,7 @@ void nr_ue_init_mac(module_id_t module_idP)
mac->get_sib1 = false; mac->get_sib1 = false;
mac->get_otherSI = false; mac->get_otherSI = false;
mac->phy_config_request_sent = false; mac->phy_config_request_sent = false;
memset(&mac->phy_config, 0, sizeof(mac->phy_config));
mac->state = UE_NOT_SYNC; mac->state = UE_NOT_SYNC;
mac->si_window_start = -1; mac->si_window_start = -1;
mac->servCellIndex = 0; mac->servCellIndex = 0;
......
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