Commit 15822a0a authored by francescomani's avatar francescomani

rework nr_rrc_mac_config_req

parent 6022fe5a
......@@ -888,7 +888,8 @@ int main(int argc, char **argv)
//Configure UE
NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc);
nr_rrc_mac_config_req_ue(0, 0, 0, mib->message.choice.mib, NULL, NULL, secondaryCellGroup);
nr_rrc_mac_config_req_mib(0, 0, 0, mib, false);
nr_rrc_mac_config_req_scg(0, 0, 0, secondaryCellGroup);
nr_dcireq_t dcireq;
nr_scheduled_response_t scheduled_response;
......
......@@ -744,11 +744,8 @@ int main(int argc, char **argv)
UE_mac->if_module = nr_ue_if_module_init(0);
// nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
nr_ue_phy_config_request(&UE_mac->phy_config);
unsigned char harq_pid = 0;
NR_gNB_ULSCH_t *ulsch_gNB = &gNB->ulsch[UE_id];
......
This diff is collapsed.
......@@ -399,7 +399,7 @@ typedef struct {
long physCellId;
//// MAC config
int first_sync_frame;
bool sib1_decoded;
bool get_sib1;
NR_DRX_Config_t *drx_Config;
NR_SchedulingRequestConfig_t *schedulingRequestConfig;
NR_BSR_Config_t *bsr_Config;
......
......@@ -91,22 +91,26 @@ int nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
long logicalChannelIdentity,
bool status);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
\param module_id module id
\param cc_id component carrier id
\param gNB_index gNB index
\param mibP pointer to RRC message MIB
\param sccP pointer to ServingCellConfigCommon structure,
\param spcell_configP pointer to RRC message serving cell config*/
int nr_rrc_mac_config_req_ue(
module_id_t module_id,
int cc_idP,
uint8_t gNB_index,
NR_MIB_t *mibP,
NR_ServingCellConfigCommonSIB_t *sccP,
NR_CellGroupConfig_t *cell_group_config,
NR_CellGroupConfig_t *scell_group_config
);
void nr_rrc_mac_config_req_scg(module_id_t module_id,
int cc_idP,
uint8_t gNB_index,
NR_CellGroupConfig_t *scell_group_config);
void nr_rrc_mac_config_req_mcg(module_id_t module_id,
int cc_idP,
uint8_t gNB_index,
NR_CellGroupConfig_t *scell_group_config);
void nr_rrc_mac_config_req_mib(module_id_t module_id,
uint8_t gNB_index,
int cc_idP,
NR_MIB_t *mibP,
bool sched_sib1);
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
int cc_idP,
uint8_t gNB_index,
NR_ServingCellConfigCommonSIB_t *scc);
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst);
......
......@@ -58,7 +58,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
if (rrc_inst && rrc_inst->scell_group_config) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config);
nr_rrc_mac_config_req_scg(0, 0, 0, rrc_inst->scell_group_config);
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
if (IS_SOFTMODEM_NOS1){
// get default noS1 configuration
......@@ -95,7 +95,6 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
}
else {
LOG_I(MAC,"Running without CellGroupConfig\n");
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL);
if(get_softmodem_params()->sa == 1) {
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
}
......
......@@ -200,7 +200,7 @@ void nr_ue_init_mac(module_id_t module_idP)
}
mac->first_sync_frame = -1;
mac->sib1_decoded = false;
mac->get_sib1 = false;
mac->phy_config_request_sent = false;
mac->state = UE_NOT_SYNC;
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
......@@ -323,7 +323,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
else
ssb_sc_offset_norm = ssb_subcarrier_offset;
if (!mac->sib1_decoded) {
if (mac->get_sib1) {
nr_ue_sib1_scheduler(module_id,
cc_id,
ssb_start_symbol,
......@@ -361,8 +361,6 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id,
uint32_t pdu_len) {
if(ack_nack) {
LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n");
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->sib1_decoded = true;
nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len);
}
else
......@@ -672,7 +670,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = mac->type0_PDCCH_CSS_config;
mux_pattern = type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH;
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if(mac->frequency_range == FR1)
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
else
dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
if (pdsch_config) pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2'
} else {
dlsch_config_pdu_1_0->SubcarrierSpacing = current_DL_BWP->scs;
......
......@@ -285,6 +285,10 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
NR_UE_rrc_inst[module_id].cell_group_config = cellGroupConfig;
nr_rrc_ue_process_scg_config(module_id,cellGroupConfig);
}
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_scg(0, 0, 0, cellGroupConfig);
LOG_D(NR_RRC, "Filled scc now \n");
}
}
else
nr_rrc_ue_decode_secondary_cellgroup_config(module_id,
......@@ -312,7 +316,6 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR
default:
break;
}
//nr_rrc_mac_config_req_ue();
return 0;
}
......@@ -340,10 +343,6 @@ int8_t nr_rrc_ue_process_scg_config(const module_id_t module_id, NR_CellGroupCon
}else{
// maintain list
if(cell_group_config->spCellConfig != NULL){
if (get_softmodem_params()->nsa) {
nr_rrc_mac_config_req_ue(0, 0, 0, NULL, NULL, cell_group_config, NULL);
LOG_D(NR_RRC, "Filled scc now \n");
}
if(cell_group_config->spCellConfig->spCellConfigDedicated != NULL){
// process element of list to be add by RRC message
if(cell_group_config->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList != NULL){
......@@ -600,7 +599,10 @@ int8_t nr_rrc_ue_decode_NR_BCCH_BCH_Message(const module_id_t module_id, const u
NR_UE_rrc_inst[module_id].mib = bcch_message->message.choice.mib;
bcch_message->message.choice.mib = NULL;
nr_rrc_mac_config_req_ue(0, 0, 0, NR_UE_rrc_inst[module_id].mib, NULL, NULL, NULL);
NR_SIB1_t *sib1 = NR_UE_rrc_inst[module_id].sib1[gNB_index];
// if no sib1 because not acquired yet or expired, get a new one
bool get_sib1 = sib1 ? false : true;
nr_rrc_mac_config_req_mib(module_id, gNB_index, 0, NR_UE_rrc_inst[module_id].mib, get_sib1);
ret = 0;
}
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message);
......@@ -1210,8 +1212,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
}
// take ServingCellConfigCommon and configure L1/L2
NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon;
nr_rrc_mac_config_req_ue(module_id,0,0,NULL,sib1->servingCellConfigCommon,NULL,NULL);
nr_rrc_ue_generate_ra_msg(module_id,gNB_index);
nr_rrc_mac_config_req_sib1(module_id, 0, gNB_index, sib1->servingCellConfigCommon);
nr_rrc_ue_generate_ra_msg(module_id, gNB_index);
} else {
LOG_E(NR_RRC, "SIB1 not decoded\n");
}
......@@ -1256,12 +1258,9 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id,
}
//-----------------------------------------------------------------------------
void
nr_rrc_ue_process_masterCellGroup(
const protocol_ctxt_t *const ctxt_pP,
uint8_t gNB_index,
OCTET_STRING_t *masterCellGroup
)
void nr_rrc_ue_process_masterCellGroup(const protocol_ctxt_t *const ctxt_pP,
uint8_t gNB_index,
OCTET_STRING_t *masterCellGroup)
//-----------------------------------------------------------------------------
{
NR_CellGroupConfig_t *cellGroupConfig=NULL;
......@@ -1358,7 +1357,7 @@ nr_rrc_ue_process_masterCellGroup(
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = cellGroupConfig;
}
LOG_D(RRC,"Sending CellGroupConfig to MAC\n");
nr_rrc_mac_config_req_ue(ctxt_pP->module_id,0,0,NULL,NULL,cellGroupConfig,NULL);
nr_rrc_mac_config_req_mcg(ctxt_pP->module_id, 0, 0, cellGroupConfig);
//TODO (configure the SpCell as specified in 5.3.5.5.7)
}
......@@ -2136,12 +2135,9 @@ nr_rrc_ue_establish_srb2(
}
//-----------------------------------------------------------------------------
static void
rrc_ue_process_rrcReconfiguration(
const protocol_ctxt_t *const ctxt_pP,
NR_RRCReconfiguration_t *rrcReconfiguration,
uint8_t gNB_index
)
static void rrc_ue_process_rrcReconfiguration(const protocol_ctxt_t *const ctxt_pP,
NR_RRCReconfiguration_t *rrcReconfiguration,
uint8_t gNB_index)
//-----------------------------------------------------------------------------
{
LOG_I(NR_RRC, "[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCReconfiguration (gNB %d)\n",
......
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