Commit 40b07ec4 authored by francescomani's avatar francescomani

remove scc and scc_SIB from mac structure

parent b6780803
...@@ -306,10 +306,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -306,10 +306,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
process_queued_nr_nfapi_msgs(mac, sfn_slot); process_queued_nr_nfapi_msgs(mac, sfn_slot);
} }
bool only_dl = false;
if (mac->scc == NULL && mac->scc_SIB == NULL)
only_dl = true;
int CC_id = 0; int CC_id = 0;
uint8_t gNB_id = 0; uint8_t gNB_id = 0;
nr_uplink_indication_t ul_info; nr_uplink_indication_t ul_info;
...@@ -332,10 +328,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -332,10 +328,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
free_and_zero(ch_info); free_and_zero(ch_info);
} }
if (only_dl || bool default_dl = mac->tdd_UL_DL_ConfigurationCommon ? false : true;
is_nr_DL_slot(get_softmodem_params()->nsa ? if (default_dl ||
mac->scc->tdd_UL_DL_ConfigurationCommon : is_nr_DL_slot(mac->tdd_UL_DL_ConfigurationCommon,
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_rx)) { ul_info.slot_rx)) {
memset(&mac->dl_info, 0, sizeof(mac->dl_info)); memset(&mac->dl_info, 0, sizeof(mac->dl_info));
mac->dl_info.cc_id = CC_id; mac->dl_info.cc_id = CC_id;
...@@ -350,10 +345,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -350,10 +345,8 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort();
if (!only_dl && if (!default_dl &&
is_nr_UL_slot(get_softmodem_params()->nsa ? is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon,
mac->scc->tdd_UL_DL_ConfigurationCommon :
mac->scc_SIB->tdd_UL_DL_ConfigurationCommon,
ul_info.slot_tx, mac->frame_type)) { ul_info.slot_tx, mac->frame_type)) {
LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot_tx); LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind()\n", ul_info.slot_tx);
nr_ue_ul_scheduler(&ul_info); nr_ue_ul_scheduler(&ul_info);
...@@ -517,16 +510,8 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) { ...@@ -517,16 +510,8 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD) {
!get_softmodem_params()->continuous_tx) { !get_softmodem_params()->continuous_tx) {
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
int nrofUplinkSlots, nrofUplinkSymbols; int nrofUplinkSlots = mac->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
if (mac->scc) { int nrofUplinkSymbols = mac->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
nrofUplinkSymbols = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
}
else {
nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
nrofUplinkSymbols = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
}
int slot_tx_usrp = proc->nr_slot_tx; int slot_tx_usrp = proc->nr_slot_tx;
uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0); uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0);
uint8_t first_tx_slot = tdd_period - num_UL_slots; uint8_t first_tx_slot = tdd_period - num_UL_slots;
......
...@@ -528,8 +528,7 @@ int main( int argc, char **argv ) { ...@@ -528,8 +528,7 @@ int main( int argc, char **argv ) {
mac->phy_config_request_sent = true; mac->phy_config_request_sent = true;
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, mac->nr_band);
*mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
} }
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
......
This diff is collapsed.
...@@ -422,8 +422,6 @@ typedef struct ssb_list_info { ...@@ -422,8 +422,6 @@ typedef struct ssb_list_info {
/*!\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;
NR_ServingCellConfigCommon_t *scc;
NR_ServingCellConfigCommonSIB_t *scc_SIB;
NR_CellGroupConfig_t *cg; NR_CellGroupConfig_t *cg;
int servCellIndex; int servCellIndex;
NR_CSI_ReportConfig_t *csirc; NR_CSI_ReportConfig_t *csirc;
...@@ -445,6 +443,9 @@ typedef struct { ...@@ -445,6 +443,9 @@ typedef struct {
NR_UE_DL_BWP_t current_DL_BWP; NR_UE_DL_BWP_t current_DL_BWP;
NR_UE_UL_BWP_t current_UL_BWP; NR_UE_UL_BWP_t current_UL_BWP;
NR_BWP_DownlinkCommon_t *bwp_dlcommon;
NR_BWP_UplinkCommon_t *bwp_ulcommon;
NR_UL_TIME_ALIGNMENT_t ul_time_alignment; NR_UL_TIME_ALIGNMENT_t ul_time_alignment;
NR_SearchSpace_t *otherSI_SS; NR_SearchSpace_t *otherSI_SS;
...@@ -455,6 +456,8 @@ typedef struct { ...@@ -455,6 +456,8 @@ typedef struct {
NR_SearchSpace_t *BWP_searchspaces[FAPI_NR_MAX_SS]; NR_SearchSpace_t *BWP_searchspaces[FAPI_NR_MAX_SS];
NR_SearchSpace_t *search_space_zero; NR_SearchSpace_t *search_space_zero;
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon;
bool phy_config_request_sent; bool phy_config_request_sent;
frame_type_t frame_type; frame_type_t frame_type;
...@@ -508,6 +511,9 @@ typedef struct { ...@@ -508,6 +511,9 @@ typedef struct {
/// PHR /// PHR
uint8_t PHR_reporting_active; uint8_t PHR_reporting_active;
int dmrs_TypeA_Position;
NR_P_Max_t *p_Max;
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config;
frequency_range_t frequency_range; frequency_range_t frequency_range;
uint16_t nr_band; uint16_t nr_band;
......
...@@ -238,8 +238,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, ...@@ -238,8 +238,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot); void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, const frame_t frame, const int slot);
NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id);
uint8_t nr_ue_get_sdu(module_id_t module_idP, uint8_t nr_ue_get_sdu(module_id_t module_idP,
int cc_id, int cc_id,
frame_t frameP, frame_t frameP,
......
...@@ -72,14 +72,14 @@ void init_RA(module_id_t mod_id, ...@@ -72,14 +72,14 @@ void init_RA(module_id_t mod_id,
ra->starting_preamble_nb = 0; ra->starting_preamble_nb = 0;
ra->RA_backoff_cnt = 0; ra->RA_backoff_cnt = 0;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
prach_resources->RA_PREAMBLE_BACKOFF = 0; prach_resources->RA_PREAMBLE_BACKOFF = 0;
NR_SubcarrierSpacing_t prach_scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing; NR_SubcarrierSpacing_t prach_scs = *nr_rach_ConfigCommon->msg1_SubcarrierSpacing;
int n_prbs = get_N_RA_RB (prach_scs, mac->current_UL_BWP.scs); int n_prbs = get_N_RA_RB (prach_scs, mac->current_UL_BWP.scs);
int start_prb = rach_ConfigGeneric->msg1_FrequencyStart + mac->current_UL_BWP.BWPStart; int start_prb = rach_ConfigGeneric->msg1_FrequencyStart + mac->current_UL_BWP.BWPStart;
int carrier_bandwidth = mac->scc_SIB ? mac->scc_SIB->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list.array[0]->carrierBandwidth :
mac->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
// PRACH shall be as specified for QPSK modulated DFT-s-OFDM of equivalent RB allocation (38.101-1) // PRACH shall be as specified for QPSK modulated DFT-s-OFDM of equivalent RB allocation (38.101-1)
prach_resources->RA_PCMAX = nr_get_Pcmax(mac, 2, false, prach_scs, carrier_bandwidth, true, n_prbs, start_prb); prach_resources->RA_PCMAX = nr_get_Pcmax(mac, 2, false, prach_scs, cfg->carrier_config.dl_grid_size[prach_scs], true, n_prbs, start_prb);
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1; prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER = 1;
prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1; prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER = 1;
prach_resources->POWER_OFFSET_2STEP_RA = 0; prach_resources->POWER_OFFSET_2STEP_RA = 0;
...@@ -810,25 +810,17 @@ uint8_t nr_ue_get_rach(module_id_t mod_id, ...@@ -810,25 +810,17 @@ uint8_t nr_ue_get_rach(module_id_t mod_id,
return ra->ra_state; return ra->ra_state;
} }
void nr_get_RA_window(NR_UE_MAC_INST_t *mac){ void nr_get_RA_window(NR_UE_MAC_INST_t *mac)
{
uint8_t mu, ra_ResponseWindow;
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon;
AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__); AssertFatal(&setup->rach_ConfigGeneric != NULL, "In %s: FATAL! rach_ConfigGeneric is NULL...\n", __FUNCTION__);
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
long scs = (mac->scc) ?
mac->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing :
mac->scc_SIB->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow; int ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow;
int mu = mac->current_DL_BWP.scs;
if (setup->msg1_SubcarrierSpacing)
mu = *setup->msg1_SubcarrierSpacing;
else
mu = scs;
ra->RA_window_cnt = ra->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB ra->RA_window_cnt = ra->RA_offset * nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB
switch (ra_ResponseWindow) { switch (ra_ResponseWindow) {
case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1: case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1:
......
...@@ -57,12 +57,11 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs, ...@@ -57,12 +57,11 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs,
if(mac->frequency_range == FR1) { if(mac->frequency_range == FR1) {
//TODO configure P-MAX from the upper layers according to 38.331 //TODO configure P-MAX from the upper layers according to 38.331
long *p_emax = (mac->scc!=NULL) ? mac->scc->uplinkConfigCommon->frequencyInfoUL->p_Max : mac->scc_SIB->uplinkConfigCommon->frequencyInfoUL.p_Max;
int p_powerclass = 23; // dBm assuming poweclass 3 UE int p_powerclass = 23; // dBm assuming poweclass 3 UE
int p_emax = mac->p_Max ? *mac->p_Max : 0;
int delta_P_powerclass = 0; // for powerclass 2 needs to be changed int delta_P_powerclass = 0; // for powerclass 2 needs to be changed
if(p_emax && Qm == 1 && powerBoostPi2BPSK && (nr_band == 40 || nr_band == 41 || nr_band == 77 || nr_band == 78 || nr_band == 79)) { if(mac->p_Max && Qm == 1 && powerBoostPi2BPSK && (nr_band == 40 || nr_band == 41 || nr_band == 77 || nr_band == 78 || nr_band == 79)) {
*p_emax += 3; p_emax += 3;
delta_P_powerclass -= 3; delta_P_powerclass -= 3;
} }
...@@ -137,10 +136,10 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs, ...@@ -137,10 +136,10 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs,
if (P_MPR > total_reduction) if (P_MPR > total_reduction)
total_reduction = P_MPR; total_reduction = P_MPR;
int pcmax_high, pcmax_low; int pcmax_high, pcmax_low;
if(p_emax) { if(mac->p_Max) {
pcmax_high = *p_emax < (p_powerclass - delta_P_powerclass) ? *p_emax : (p_powerclass - delta_P_powerclass); pcmax_high = p_emax < (p_powerclass - delta_P_powerclass) ? p_emax : (p_powerclass - delta_P_powerclass);
pcmax_low = (*p_emax - delta_TC) < (p_powerclass - delta_P_powerclass - total_reduction) ? pcmax_low = (p_emax - delta_TC) < (p_powerclass - delta_P_powerclass - total_reduction) ?
(*p_emax - delta_TC) : (p_powerclass - delta_P_powerclass - total_reduction); (p_emax - delta_TC) : (p_powerclass - delta_P_powerclass - total_reduction);
} }
else { else {
pcmax_high = p_powerclass - delta_P_powerclass; pcmax_high = p_powerclass - delta_P_powerclass;
......
...@@ -207,18 +207,6 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) ...@@ -207,18 +207,6 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment));
} }
NR_BWP_DownlinkCommon_t *get_bwp_downlink_common(NR_UE_MAC_INST_t *mac, NR_BWP_Id_t dl_bwp_id) {
NR_BWP_DownlinkCommon_t *bwp_Common = NULL;
if (dl_bwp_id > 0 && mac->cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList) {
bwp_Common = mac->cg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[dl_bwp_id-1]->bwp_Common;
} else if (mac->scc) {
bwp_Common = mac->scc->downlinkConfigCommon->initialDownlinkBWP;
} else if (mac->scc_SIB) {
bwp_Common = &mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP;
}
return bwp_Common;
}
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti) int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti)
{ {
...@@ -288,6 +276,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id, ...@@ -288,6 +276,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
#endif #endif
mac->ssb_subcarrier_offset = ssb_subcarrier_offset; mac->ssb_subcarrier_offset = ssb_subcarrier_offset;
mac->dmrs_TypeA_Position = mac->mib->dmrs_TypeA_Position;
if (mac->first_sync_frame == -1) if (mac->first_sync_frame == -1)
mac->first_sync_frame = frame; mac->first_sync_frame = frame;
...@@ -647,7 +636,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -647,7 +636,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
dlsch_config_pdu_1_0->rb_offset -= dlsch_config_pdu_1_0->BWPStart; dlsch_config_pdu_1_0->rb_offset -= dlsch_config_pdu_1_0->BWPStart;
/* TIME_DOM_RESOURCE_ASSIGNMENT */ /* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val, NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val,
dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, mac->get_sib1); dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, mac->get_sib1);
...@@ -669,7 +658,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -669,7 +658,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
/* dmrs symbol positions*/ /* dmrs symbol positions*/
dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config,
NR_DL_DCI_FORMAT_1_0, NR_DL_DCI_FORMAT_1_0,
mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position, mac->dmrs_TypeA_Position,
dlsch_config_pdu_1_0->number_symbols, dlsch_config_pdu_1_0->number_symbols,
dlsch_config_pdu_1_0->start_symbol, dlsch_config_pdu_1_0->start_symbol,
tda_info.mapping_type, tda_info.mapping_type,
...@@ -868,7 +857,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -868,7 +857,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
} }
dlsch_config_pdu_1_1->rb_offset = dlsch_config_pdu_1_1->start_rb + dlsch_config_pdu_1_1->BWPStart; dlsch_config_pdu_1_1->rb_offset = dlsch_config_pdu_1_1->start_rb + dlsch_config_pdu_1_1->BWPStart;
/* TIME_DOM_RESOURCE_ASSIGNMENT */ /* TIME_DOM_RESOURCE_ASSIGNMENT */
int dmrs_typeA_pos = (mac->scc != NULL) ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position; int dmrs_typeA_pos = mac->dmrs_TypeA_Position;
NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val, NR_tda_info_t tda_info = get_dl_tda_info(current_DL_BWP, dci_ind->ss_type, dci->time_domain_assignment.val,
dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, false); dmrs_typeA_pos, mux_pattern, get_rnti_type(mac, rnti), coreset_type, false);
...@@ -1059,7 +1048,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr ...@@ -1059,7 +1048,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
/* dmrs symbol positions*/ /* dmrs symbol positions*/
dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config, dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_Config,
NR_DL_DCI_FORMAT_1_1, NR_DL_DCI_FORMAT_1_1,
mac->scc? mac->scc->dmrs_TypeA_Position:mac->mib->dmrs_TypeA_Position, mac->dmrs_TypeA_Position,
dlsch_config_pdu_1_1->number_symbols, dlsch_config_pdu_1_1->number_symbols,
dlsch_config_pdu_1_1->start_symbol, dlsch_config_pdu_1_1->start_symbol,
tda_info.mapping_type, tda_info.mapping_type,
...@@ -4138,17 +4127,13 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id) ...@@ -4138,17 +4127,13 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, int pdu_id)
// - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm) // - referenceSignalPower: dBm/RE (average EPRE of the resources elements that carry secondary synchronization signals in dBm)
int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm) int16_t compute_nr_SSB_PL(NR_UE_MAC_INST_t *mac, short ssb_rsrp_dBm)
{ {
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
long referenceSignalPower; int referenceSignalPower = cfg->ssb_config.ss_pbch_power;
//TODO improve PL measurements. Probably not correct as it is. //TODO improve PL measurements. Probably not correct as it is.
if (mac->scc)
referenceSignalPower = mac->scc->ss_PBCH_BlockPower;
else
referenceSignalPower = mac->scc_SIB->ss_PBCH_BlockPower;
int16_t pathloss = (int16_t)(referenceSignalPower - ssb_rsrp_dBm); int16_t pathloss = (int16_t)(referenceSignalPower - ssb_rsrp_dBm);
LOG_D(NR_MAC, "pathloss %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n", LOG_D(NR_MAC, "pathloss %d dB, referenceSignalPower %d dBm/RE (%f mW), RSRP %d dBm (%f mW)\n",
pathloss, pathloss,
referenceSignalPower, referenceSignalPower,
pow(10, referenceSignalPower/10), pow(10, referenceSignalPower/10),
......
...@@ -111,7 +111,7 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response, ...@@ -111,7 +111,7 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time) fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot, int fb_time)
{ {
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon; NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
//Check if requested on the right slot //Check if requested on the right slot
AssertFatal(is_nr_UL_slot(tdd_config, slot, mac->frame_type) != 0, "UL config_request called at wrong slot %d\n", slot); AssertFatal(is_nr_UL_slot(tdd_config, slot, mac->frame_type) != 0, "UL config_request called at wrong slot %d\n", slot);
...@@ -483,8 +483,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -483,8 +483,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->start_symbol_index = tda_info->startSymbolIndex; pusch_config_pdu->start_symbol_index = tda_info->startSymbolIndex;
pusch_config_pdu->nr_of_symbols = tda_info->nrOfSymbols; pusch_config_pdu->nr_of_symbols = tda_info->nrOfSymbols;
l_prime_mask = l_prime_mask = get_l_prime(tda_info->nrOfSymbols,
get_l_prime(tda_info->nrOfSymbols, tda_info->mapping_type, add_pos, dmrslength, tda_info->startSymbolIndex, mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position); tda_info->mapping_type,
add_pos,
dmrslength,
tda_info->startSymbolIndex,
mac->dmrs_TypeA_Position);
LOG_D(NR_MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d, DMRS_MASK:%x\n", pusch_config_pdu->start_symbol_index, pusch_config_pdu->nr_of_symbols, tda_info->mapping_type, l_prime_mask); LOG_D(NR_MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d, DMRS_MASK:%x\n", pusch_config_pdu->start_symbol_index, pusch_config_pdu->nr_of_symbols, tda_info->mapping_type, l_prime_mask);
#ifdef DEBUG_MSG3 #ifdef DEBUG_MSG3
...@@ -655,7 +659,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -655,7 +659,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols,
mappingtype, add_pos, dmrslength, mappingtype, add_pos, dmrslength,
pusch_config_pdu->start_symbol_index, pusch_config_pdu->start_symbol_index,
mac->scc ? mac->scc->dmrs_TypeA_Position : mac->mib->dmrs_TypeA_Position); mac->dmrs_TypeA_Position);
// Num PRB Overhead from PUSCH-ServingCellConfig // Num PRB Overhead from PUSCH-ServingCellConfig
if (current_UL_BWP->pusch_servingcellconfig && current_UL_BWP->pusch_servingcellconfig->xOverhead) if (current_UL_BWP->pusch_servingcellconfig && current_UL_BWP->pusch_servingcellconfig->xOverhead)
...@@ -859,7 +863,7 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger ...@@ -859,7 +863,7 @@ void nr_ue_aperiodic_srs_scheduling(NR_UE_MAC_INST_t *mac, long resource_trigger
slot_offset, DURATION_RX_TO_TX); slot_offset, DURATION_RX_TO_TX);
int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs]; int n_slots_frame = nr_slots_per_frame[current_UL_BWP->scs];
int sched_slot = (slot + slot_offset) % n_slots_frame; int sched_slot = (slot + slot_offset) % n_slots_frame;
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->scc==NULL ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : mac->scc->tdd_UL_DL_ConfigurationCommon; NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
if (!is_nr_UL_slot(tdd_config, sched_slot, mac->frame_type)) { if (!is_nr_UL_slot(tdd_config, sched_slot, mac->frame_type)) {
LOG_E(NR_MAC, "Slot for scheduling aperiodic SRS %d is not an UL slot\n", sched_slot); LOG_E(NR_MAC, "Slot for scheduling aperiodic SRS %d is not an UL slot\n", sched_slot);
return; return;
...@@ -1655,84 +1659,20 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) { ...@@ -1655,84 +1659,20 @@ static void build_ssb_list(NR_UE_MAC_INST_t *mac) {
// Create the list of transmitted SSBs // Create the list of transmitted SSBs
// =================================== // ===================================
BIT_STRING_t *ssb_bitmap;
uint64_t ssb_positionsInBurst;
uint8_t ssb_idx = 0;
ssb_list_info_t *ssb_list = &mac->ssb_list; ssb_list_info_t *ssb_list = &mac->ssb_list;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
ssb_list->nb_tx_ssb = 0;
if (mac->scc) { for(int ssb_index = 0; ssb_index < 64; ssb_index++) {
NR_ServingCellConfigCommon_t *scc = mac->scc; uint32_t curr_mask = cfg->ssb_table.ssb_mask_list[ssb_index / 32].ssb_mask;
switch (scc->ssb_PositionsInBurst->present) { // check if if current SSB is transmitted
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap: if ((curr_mask >> (31 - (ssb_index % 32))) & 0x01) {
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap; ssb_list->nb_tx_ssb++;
ssb_list->tx_ssb[ssb_index].transmitted = true;
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap); LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_index);
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
for (uint8_t bit_nb=3; bit_nb<=3; bit_nb--) {
// If SSB is transmitted
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
ssb_list->nb_tx_ssb++;
ssb_list->tx_ssb[ssb_idx].transmitted = true;
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
}
ssb_idx++;
}
break;
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap:
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap;
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap);
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) {
// If SSB is transmitted
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
ssb_list->nb_tx_ssb++;
ssb_list->tx_ssb[ssb_idx].transmitted = true;
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
}
ssb_idx++;
}
break;
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap:
ssb_bitmap = &scc->ssb_PositionsInBurst->choice.longBitmap;
ssb_positionsInBurst = BIT_STRING_to_uint64(ssb_bitmap);
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
for (uint8_t bit_nb=63; bit_nb<=63; bit_nb--) {
// If SSB is transmitted
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
ssb_list->nb_tx_ssb++;
ssb_list->tx_ssb[ssb_idx].transmitted = true;
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
}
ssb_idx++;
}
break;
default:
AssertFatal(false,"ssb_PositionsInBurst not present\n");
break;
}
} else { // This is configuration from SIB1
AssertFatal(mac->scc_SIB->ssb_PositionsInBurst.groupPresence == NULL, "Handle case for >8 SSBs\n");
ssb_bitmap = &mac->scc_SIB->ssb_PositionsInBurst.inOneGroup;
ssb_positionsInBurst = BIT_STRING_to_uint8(ssb_bitmap);
LOG_D(NR_MAC,"SSB config: SSB_positions_in_burst 0x%lx\n", ssb_positionsInBurst);
for (uint8_t bit_nb=7; bit_nb<=7; bit_nb--) {
// If SSB is transmitted
if ((ssb_positionsInBurst>>bit_nb) & 0x01) {
ssb_list->nb_tx_ssb++;
ssb_list->tx_ssb[ssb_idx].transmitted = true;
LOG_D(NR_MAC,"SSB idx %d transmitted\n", ssb_idx);
}
ssb_idx++;
} }
else
ssb_list->tx_ssb[ssb_index].transmitted = false;
} }
} }
...@@ -2512,12 +2452,10 @@ static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_fr ...@@ -2512,12 +2452,10 @@ static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_fr
fapi_nr_prach_config_t *prach_config = &cfg->prach_config; fapi_nr_prach_config_t *prach_config = &cfg->prach_config;
nr_scheduled_response_t scheduled_response; nr_scheduled_response_t scheduled_response;
NR_ServingCellConfigCommon_t *scc = mac->scc;
NR_ServingCellConfigCommonSIB_t *scc_SIB = mac->scc_SIB;
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon;
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
NR_TDD_UL_DL_ConfigCommon_t *tdd_config = scc==NULL ? scc_SIB->tdd_UL_DL_ConfigurationCommon : scc->tdd_UL_DL_ConfigurationCommon; NR_TDD_UL_DL_ConfigCommon_t *tdd_config = mac->tdd_UL_DL_ConfigurationCommon;
if (is_nr_UL_slot(tdd_config, slotP, mac->frame_type)) { if (is_nr_UL_slot(tdd_config, slotP, mac->frame_type)) {
......
...@@ -346,7 +346,7 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu ...@@ -346,7 +346,7 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu
if (get_softmodem_params()->sa) { if (get_softmodem_params()->sa) {
if (mac->state == UE_NOT_SYNC) if (mac->state == UE_NOT_SYNC)
return false; return false;
if (received_pdu->RNTI == 0xFFFF && mac->scc_SIB) if (received_pdu->RNTI == 0xFFFF && mac->phy_config_request_sent)
return false; return false;
if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED) if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED)
return false; return false;
...@@ -742,8 +742,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -742,8 +742,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
int slots_per_frame = 20; //30 kHZ subcarrier spacing int slots_per_frame = 20; //30 kHZ subcarrier spacing
int slot_ahead = 2; // TODO: Make this dynamic int slot_ahead = 2; // TODO: Make this dynamic
if (mac->scc || mac->scc_SIB) { if (mac->tdd_UL_DL_ConfigurationCommon) {
if (is_nr_UL_slot(mac->scc ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon,
(slot + slot_ahead) % slots_per_frame, (slot + slot_ahead) % slots_per_frame,
mac->frame_type) mac->frame_type)
&& mac->ra.ra_state != RA_SUCCEEDED) { && mac->ra.ra_state != RA_SUCCEEDED) {
...@@ -1133,10 +1133,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info) ...@@ -1133,10 +1133,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info)
LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n", LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n",
__FUNCTION__, __LINE__, mac->ra.ra_state); __FUNCTION__, __LINE__, mac->ra.ra_state);
NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = if (mac->phy_config_request_sent && is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type))
mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon
: (mac->scc_SIB ? mac->scc_SIB->tdd_UL_DL_ConfigurationCommon : NULL);
if (mac->phy_config_request_sent && is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type))
nr_ue_ul_scheduler(ul_info); nr_ue_ul_scheduler(ul_info);
pthread_mutex_unlock(&mac_IF_mutex); pthread_mutex_unlock(&mac_IF_mutex);
......
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