|
|
|
@@ -142,10 +142,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
|
|
|
|
|
// carrier config
|
|
|
|
|
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,
|
|
|
|
|
*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR,
|
|
|
|
|
mac->nr_band,
|
|
|
|
|
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) *
|
|
|
|
|
(15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing);
|
|
|
|
@@ -163,13 +166,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL;
|
|
|
|
|
int UL_band_ind = frequencyInfoUL->frequencyBandList == NULL ?
|
|
|
|
|
*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR :
|
|
|
|
|
*frequencyInfoUL->frequencyBandList->list.array[0]->freqBandIndicatorNR;
|
|
|
|
|
mac->p_Max = frequencyInfoUL->p_Max ?
|
|
|
|
|
*frequencyInfoUL->p_Max :
|
|
|
|
|
INT_MIN;
|
|
|
|
|
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);
|
|
|
|
|
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)
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
|
|
mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
|
|
|
|
|
// cell config
|
|
|
|
|
|
|
|
|
|
cfg->cell_config.phy_cell_id = mac->physCellId;
|
|
|
|
|
cfg->cell_config.frame_duplex_type = mac->frame_type;
|
|
|
|
|
|
|
|
|
@@ -217,12 +219,12 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
// TDD Table Configuration
|
|
|
|
|
if (cfg->cell_config.frame_duplex_type == TDD){
|
|
|
|
|
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);
|
|
|
|
|
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
|
|
|
|
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,
|
|
|
|
|
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
|
|
|
|
cfg->ssb_config.scs_common,
|
|
|
|
|
mac->tdd_UL_DL_ConfigurationCommon->pattern2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -238,8 +240,13 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
|
|
|
|
|
if (rach_ConfigCommon->msg1_SubcarrierSpacing)
|
|
|
|
|
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;
|
|
|
|
|
else {
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
@@ -293,82 +300,91 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
// carrier config
|
|
|
|
|
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;
|
|
|
|
|
int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
|
|
|
|
*frequencyInfoDL->frequencyBandList.list.array[0],
|
|
|
|
|
frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
|
|
|
|
cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index);
|
|
|
|
|
NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
|
|
|
|
|
if (frequencyInfoDL) { // NeedM for inter-freq handover
|
|
|
|
|
mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0];
|
|
|
|
|
mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology);
|
|
|
|
|
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],
|
|
|
|
|
*scc->ssbSubcarrierSpacing,
|
|
|
|
|
frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
|
|
|
|
cfg->carrier_config.dl_frequency = from_nrarfcn(mac->nr_band,
|
|
|
|
|
*scc->ssbSubcarrierSpacing,
|
|
|
|
|
frequencyInfoDL->absoluteFrequencyPointA)/1000; // freq in kHz
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
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_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cfg->carrier_config.dl_grid_size[i] = 0;
|
|
|
|
|
cfg->carrier_config.dl_k0[i] = 0;
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
|
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_k0[i] = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cfg->carrier_config.dl_grid_size[i] = 0;
|
|
|
|
|
cfg->carrier_config.dl_k0[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL;
|
|
|
|
|
bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
|
|
|
|
*frequencyInfoUL->frequencyBandList->list.array[0],
|
|
|
|
|
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
|
|
|
|
cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index);
|
|
|
|
|
if (scc->uplinkConfigCommon && scc->uplinkConfigCommon->frequencyInfoUL) {
|
|
|
|
|
NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL;
|
|
|
|
|
mac->p_Max = frequencyInfoUL->p_Max ?
|
|
|
|
|
*frequencyInfoUL->p_Max :
|
|
|
|
|
INT_MIN;
|
|
|
|
|
|
|
|
|
|
int UL_pointA;
|
|
|
|
|
if (frequencyInfoUL->absoluteFrequencyPointA == NULL)
|
|
|
|
|
UL_pointA = frequencyInfoDL->absoluteFrequencyPointA;
|
|
|
|
|
else
|
|
|
|
|
UL_pointA = *frequencyInfoUL->absoluteFrequencyPointA;
|
|
|
|
|
int bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
|
|
|
|
*frequencyInfoUL->frequencyBandList->list.array[0],
|
|
|
|
|
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth);
|
|
|
|
|
cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index);
|
|
|
|
|
|
|
|
|
|
cfg->carrier_config.uplink_frequency = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0],
|
|
|
|
|
*scc->ssbSubcarrierSpacing,
|
|
|
|
|
UL_pointA) / 1000; // freq in kHz
|
|
|
|
|
long *UL_pointA = NULL;
|
|
|
|
|
if (frequencyInfoUL->absoluteFrequencyPointA)
|
|
|
|
|
UL_pointA = frequencyInfoUL->absoluteFrequencyPointA;
|
|
|
|
|
else if (frequencyInfoDL)
|
|
|
|
|
UL_pointA = &frequencyInfoDL->absoluteFrequencyPointA;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
|
|
|
|
|
cfg->ssb_config.scs_common = *scc->ssbSubcarrierSpacing;
|
|
|
|
|
|
|
|
|
|
// SSB Table config
|
|
|
|
|
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
|
|
|
|
if (frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
|
|
|
|
scs_scaling = scs_scaling*3;
|
|
|
|
|
if (frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
|
|
|
|
scs_scaling = scs_scaling>>2;
|
|
|
|
|
uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA);
|
|
|
|
|
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
|
|
|
|
|
cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
|
|
|
|
|
if (frequencyInfoDL && frequencyInfoDL->absoluteFrequencySSB) {
|
|
|
|
|
int scs_scaling = 1<<(cfg->ssb_config.scs_common);
|
|
|
|
|
if (frequencyInfoDL->absoluteFrequencyPointA < 600000)
|
|
|
|
|
scs_scaling = scs_scaling*3;
|
|
|
|
|
if (frequencyInfoDL->absoluteFrequencyPointA > 2016666)
|
|
|
|
|
scs_scaling = scs_scaling>>2;
|
|
|
|
|
uint32_t absolute_diff = (*frequencyInfoDL->absoluteFrequencySSB - frequencyInfoDL->absoluteFrequencyPointA);
|
|
|
|
|
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
|
|
|
|
|
cfg->ssb_table.ssb_subcarrier_offset = absolute_diff%(12*scs_scaling);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (scc->ssb_PositionsInBurst->present) {
|
|
|
|
|
case 1 :
|
|
|
|
@@ -394,67 +410,77 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
// TDD Table Configuration
|
|
|
|
|
if (cfg->cell_config.frame_duplex_type == TDD){
|
|
|
|
|
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);
|
|
|
|
|
if (mac->tdd_UL_DL_ConfigurationCommon->pattern2) {
|
|
|
|
|
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,
|
|
|
|
|
frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
|
|
|
|
|
cfg->ssb_config.scs_common,
|
|
|
|
|
mac->tdd_UL_DL_ConfigurationCommon->pattern2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PRACH configuration
|
|
|
|
|
uint8_t nb_preambles = 64;
|
|
|
|
|
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 (scc->uplinkConfigCommon &&
|
|
|
|
|
scc->uplinkConfigCommon->initialUplinkBWP &&
|
|
|
|
|
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_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.prach_sequence_length = rach_ConfigCommon->prach_RootSequenceIndex.present-1;
|
|
|
|
|
|
|
|
|
|
cfg->prach_config.restricted_set_config = rach_ConfigCommon->restrictedSetConfig;
|
|
|
|
|
|
|
|
|
|
switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) {
|
|
|
|
|
case 0 :
|
|
|
|
|
cfg->prach_config.num_prach_fd_occasions = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 1 :
|
|
|
|
|
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);
|
|
|
|
|
if (rach_ConfigCommon->msg1_SubcarrierSpacing)
|
|
|
|
|
cfg->prach_config.prach_sub_c_spacing = *rach_ConfigCommon->msg1_SubcarrierSpacing;
|
|
|
|
|
else {
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) {
|
|
|
|
|
case 0 :
|
|
|
|
|
cfg->prach_config.num_prach_fd_occasions = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 1 :
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
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];
|
|
|
|
|
prach_fd_occasion->num_prach_fd_occasions = i;
|
|
|
|
|
if (cfg->prach_config.prach_sequence_length)
|
|
|
|
|
prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139;
|
|
|
|
|
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.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));
|
|
|
|
|
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];
|
|
|
|
|
prach_fd_occasion->num_prach_fd_occasions = i;
|
|
|
|
|
if (cfg->prach_config.prach_sequence_length)
|
|
|
|
|
prach_fd_occasion->prach_root_sequence_index = rach_ConfigCommon->prach_RootSequenceIndex.choice.l139;
|
|
|
|
|
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,
|
|
|
|
|
frame_type,
|
|
|
|
|
mac->frequency_range);
|
|
|
|
|
//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,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
NR_ServingCellConfigCommonSIB_t *scc,
|
|
|
|
|
const NR_ServingCellConfig_t *spCellConfigDedicated)
|
|
|
|
@@ -720,6 +716,10 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
NR_BWP_t ul_genericParameters = {0};
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
if(mac->bwp_ulcommon)
|
|
|
|
|
ul_genericParameters = mac->bwp_ulcommon->genericParameters;
|
|
|
|
@@ -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);
|
|
|
|
|
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);
|
|
|
|
|
// 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)
|
|
|
|
@@ -899,15 +903,29 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
|
|
|
|
int cc_idP,
|
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
configure_scc(mac, NULL, reconfigurationWithSync->spCellConfigCommon);
|
|
|
|
|
mac->crnti = reconfigurationWithSync->newUE_Identity;
|
|
|
|
|
LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti);
|
|
|
|
|
config_common_ue(mac, reconfigurationWithSync->spCellConfigCommon, module_id, cc_idP);
|
|
|
|
|
if (reconfigurationWithSync->spCellConfigCommon) {
|
|
|
|
|
NR_ServingCellConfigCommon_t *scc = reconfigurationWithSync->spCellConfigCommon;
|
|
|
|
|
mac->bwp_dlcommon = scc->downlinkConfigCommon->initialDownlinkBWP;
|
|
|
|
|
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;
|
|
|
|
|
ra->ra_state = RA_UE_IDLE;
|
|
|
|
|