Commit f2a686a0 authored by francescomani's avatar francescomani

copy RRC structures to MAC instead of passing pointer to RRC and some more cleanup

parent a62bdf36
...@@ -570,7 +570,7 @@ typedef struct NR_UE_DL_BWP { ...@@ -570,7 +570,7 @@ typedef struct NR_UE_DL_BWP {
NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList_Common; NR_PDSCH_TimeDomainResourceAllocationList_t *tdaList_Common;
NR_PDSCH_Config_t *pdsch_Config; NR_PDSCH_Config_t *pdsch_Config;
NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig; NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig;
long *pdsch_HARQ_ACK_Codebook; long pdsch_HARQ_ACK_Codebook;
uint8_t mcsTableIdx; uint8_t mcsTableIdx;
nr_dci_format_t dci_format; nr_dci_format_t dci_format;
} NR_UE_DL_BWP_t; } NR_UE_DL_BWP_t;
......
...@@ -3376,7 +3376,7 @@ uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, ...@@ -3376,7 +3376,7 @@ uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP,
size += 1; size += 1;
} }
// 1st DAI // 1st DAI
if (DL_BWP->pdsch_HARQ_ACK_Codebook && *DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) if (DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic)
dci_pdu->dai[0].nbits = 2; dci_pdu->dai[0].nbits = 2;
else else
dci_pdu->dai[0].nbits = 1; dci_pdu->dai[0].nbits = 1;
...@@ -3548,7 +3548,7 @@ uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP, ...@@ -3548,7 +3548,7 @@ uint16_t nr_dci_size(const NR_UE_DL_BWP_t *DL_BWP,
// HARQ PID // HARQ PID
size += 4; size += 4;
// DAI // DAI
if (DL_BWP->pdsch_HARQ_ACK_Codebook && *DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell if (DL_BWP->pdsch_HARQ_ACK_Codebook == NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) { // FIXME in case of more than one serving cell
dci_pdu->dai[0].nbits = 2; dci_pdu->dai[0].nbits = 2;
size += dci_pdu->dai[0].nbits; size += dci_pdu->dai[0].nbits;
} }
......
...@@ -134,6 +134,7 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -134,6 +134,7 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
} }
} }
AssertFatal(scc->uplinkConfigCommon, "Release of uplinkConfigCommon_SIB not handled\n");
NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL; NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL;
int UL_band_ind = frequencyInfoUL->frequencyBandList == NULL ? int UL_band_ind = frequencyInfoUL->frequencyBandList == NULL ?
*frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR : *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR :
...@@ -202,6 +203,11 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac, ...@@ -202,6 +203,11 @@ void config_common_ue_sa(NR_UE_MAC_INST_t *mac,
// PRACH configuration // PRACH configuration
uint8_t nb_preambles = 64; uint8_t nb_preambles = 64;
if (!scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon)
// Need M -> maintain current values
return;
AssertFatal(scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->present == NR_SetupRelease_RACH_ConfigCommon_PR_setup,
"Cannot handle release of RACH_ConfigCommon\n");
NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup;
if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) if(rach_ConfigCommon->totalNumberOfRA_Preambles != NULL)
nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles;
...@@ -572,7 +578,7 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac, ...@@ -572,7 +578,7 @@ void configure_current_BWP(NR_UE_MAC_INST_t *mac,
if(cell_group_config) { if(cell_group_config) {
if (cell_group_config->physicalCellGroupConfig) { if (cell_group_config->physicalCellGroupConfig) {
DL_BWP->pdsch_HARQ_ACK_Codebook = &cell_group_config->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook; DL_BWP->pdsch_HARQ_ACK_Codebook = cell_group_config->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook;
UL_BWP->harq_ACK_SpatialBundlingPUCCH = cell_group_config->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH; UL_BWP->harq_ACK_SpatialBundlingPUCCH = cell_group_config->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH;
} }
if (cell_group_config->spCellConfig && if (cell_group_config->spCellConfig &&
...@@ -704,16 +710,58 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, ...@@ -704,16 +710,58 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
cc_idP); cc_idP);
} }
void configure_tdd_configcommon(NR_UE_MAC_INST_t *mac, NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon)
{
if(tdd_UL_DL_ConfigurationCommon) {
if (!mac->tdd_UL_DL_ConfigurationCommon)
mac->tdd_UL_DL_ConfigurationCommon = malloc(sizeof(NR_CellGroupConfig_t));
memcpy(mac->tdd_UL_DL_ConfigurationCommon, tdd_UL_DL_ConfigurationCommon, sizeof(NR_TDD_UL_DL_ConfigCommon_t));
}
else if (mac->tdd_UL_DL_ConfigurationCommon) {
ASN_STRUCT_FREE(asn_DEF_NR_TDD_UL_DL_ConfigCommon, mac->tdd_UL_DL_ConfigurationCommon);
mac->tdd_UL_DL_ConfigurationCommon = NULL;
}
}
void configure_pmax(NR_UE_MAC_INST_t *mac, NR_P_Max_t *p_Max)
{
if (p_Max) {
if(!mac->p_Max)
mac->p_Max = malloc(sizeof(NR_P_Max_t));
memcpy(mac->p_Max, p_Max, sizeof(NR_P_Max_t));
}
else if (mac->p_Max) {
ASN_STRUCT_FREE(asn_DEF_NR_P_Max, mac->p_Max);
mac->p_Max = NULL;
}
}
void configure_sinfo(NR_UE_MAC_INST_t *mac, NR_SI_SchedulingInfo_t *si_Info)
{
if (si_Info) {
if(!mac->si_SchedulingInfo)
mac->si_SchedulingInfo = malloc(sizeof(NR_SI_SchedulingInfo_t));
memcpy(mac->si_SchedulingInfo, si_Info, sizeof(NR_SI_SchedulingInfo_t));
}
else if (mac->si_SchedulingInfo) {
ASN_STRUCT_FREE(asn_DEF_NR_SI_SchedulingInfo, mac->si_SchedulingInfo);
mac->si_SchedulingInfo = NULL;
}
}
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,
struct NR_SI_SchedulingInfo *si_SchedulingInfo, NR_SI_SchedulingInfo_t *si_SchedulingInfo,
NR_ServingCellConfigCommonSIB_t *scc) NR_ServingCellConfigCommonSIB_t *scc)
{ {
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");
mac->tdd_UL_DL_ConfigurationCommon = scc->tdd_UL_DL_ConfigurationCommon; configure_tdd_configcommon(mac, scc->tdd_UL_DL_ConfigurationCommon);
mac->p_Max = scc->uplinkConfigCommon->frequencyInfoUL.p_Max; NR_P_Max_t *p_Max = NULL;
mac->si_SchedulingInfo = si_SchedulingInfo; if (scc->uplinkConfigCommon)
p_Max = scc->uplinkConfigCommon->frequencyInfoUL.p_Max;
configure_pmax(mac, p_Max);
configure_sinfo(mac, si_SchedulingInfo);
mac->nr_band = *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR; mac->nr_band = *scc->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list.array[0]->freqBandIndicatorNR;
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)
...@@ -741,8 +789,9 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, ...@@ -741,8 +789,9 @@ void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
mac->bwp_dlcommon = scc->downlinkConfigCommon->initialDownlinkBWP; mac->bwp_dlcommon = scc->downlinkConfigCommon->initialDownlinkBWP;
mac->bwp_ulcommon = scc->uplinkConfigCommon->initialUplinkBWP; mac->bwp_ulcommon = scc->uplinkConfigCommon->initialUplinkBWP;
mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position; mac->dmrs_TypeA_Position = scc->dmrs_TypeA_Position;
mac->tdd_UL_DL_ConfigurationCommon = scc->tdd_UL_DL_ConfigurationCommon; configure_tdd_configcommon(mac, scc->tdd_UL_DL_ConfigurationCommon);
mac->p_Max = scc->uplinkConfigCommon->frequencyInfoUL->p_Max; if (scc->uplinkConfigCommon && scc->uplinkConfigCommon->frequencyInfoUL)
configure_pmax(mac, scc->uplinkConfigCommon->frequencyInfoUL->p_Max);
mac->nr_band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; mac->nr_band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
mac->physCellId = *scc->physCellId; mac->physCellId = *scc->physCellId;
mac->crnti = reconfigurationWithSync->newUE_Identity; mac->crnti = reconfigurationWithSync->newUE_Identity;
...@@ -757,7 +806,10 @@ void nr_rrc_mac_config_req_mcg(module_id_t module_id, ...@@ -757,7 +806,10 @@ void nr_rrc_mac_config_req_mcg(module_id_t module_id,
LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n"); LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n");
AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n"); AssertFatal(cell_group_config, "CellGroupConfig should not be NULL\n");
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
mac->cg = cell_group_config; if (!mac->cg)
mac->cg = malloc(sizeof(NR_CellGroupConfig_t));
memcpy(mac->cg, cell_group_config, sizeof(NR_CellGroupConfig_t));
if (cell_group_config->spCellConfig) if (cell_group_config->spCellConfig)
mac->servCellIndex = cell_group_config->spCellConfig->servCellIndex ? *cell_group_config->spCellConfig->servCellIndex : 0; mac->servCellIndex = cell_group_config->spCellConfig->servCellIndex ? *cell_group_config->spCellConfig->servCellIndex : 0;
else else
...@@ -801,7 +853,9 @@ void nr_rrc_mac_config_req_scg(module_id_t module_id, ...@@ -801,7 +853,9 @@ void nr_rrc_mac_config_req_scg(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(scell_group_config, "scell_group_config cannot be NULL\n"); AssertFatal(scell_group_config, "scell_group_config cannot be NULL\n");
mac->cg = scell_group_config; if (!mac->cg)
mac->cg = malloc(sizeof(NR_CellGroupConfig_t));
memcpy(mac->cg, scell_group_config, sizeof(NR_CellGroupConfig_t));
mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex; mac->servCellIndex = *scell_group_config->spCellConfig->servCellIndex;
if (scell_group_config->spCellConfig->reconfigurationWithSync) if (scell_group_config->spCellConfig->reconfigurationWithSync)
handle_reconfiguration_with_sync(mac, module_id, cc_idP, scell_group_config->spCellConfig->reconfigurationWithSync); handle_reconfiguration_with_sync(mac, module_id, cc_idP, scell_group_config->spCellConfig->reconfigurationWithSync);
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include "NR_ServingCellConfig.h" #include "NR_ServingCellConfig.h"
#include "NR_MeasConfig.h" #include "NR_MeasConfig.h"
#include "NR_ServingCellConfigCommonSIB.h" #include "NR_ServingCellConfigCommonSIB.h"
#include "NR_SI-SchedulingInfo.h"
// ========== // ==========
...@@ -435,7 +436,7 @@ typedef struct { ...@@ -435,7 +436,7 @@ typedef struct {
NR_PHR_Config_t *phr_Config; NR_PHR_Config_t *phr_Config;
NR_RNTI_Value_t *cs_RNTI; NR_RNTI_Value_t *cs_RNTI;
NR_MIB_t *mib; NR_MIB_t *mib;
struct NR_SI_SchedulingInfo *si_SchedulingInfo; NR_SI_SchedulingInfo_t *si_SchedulingInfo;
int si_window_start; int si_window_start;
ssb_list_info_t ssb_list; ssb_list_info_t ssb_list;
......
...@@ -82,7 +82,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, ...@@ -82,7 +82,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
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,
struct NR_SI_SchedulingInfo *si_SchedulingInfo, NR_SI_SchedulingInfo_t *si_SchedulingInfo,
NR_ServingCellConfigCommonSIB_t *scc); NR_ServingCellConfigCommonSIB_t *scc);
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ /**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
......
...@@ -58,7 +58,7 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs, ...@@ -58,7 +58,7 @@ int nr_get_Pcmax(NR_UE_MAC_INST_t *mac, int Qm, bool powerBoostPi2BPSK, int scs,
//TODO configure P-MAX from the upper layers according to 38.331 //TODO configure P-MAX from the upper layers according to 38.331
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 p_emax = mac->p_Max ? *mac->p_Max : p_powerclass;
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(mac->p_Max && 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;
......
...@@ -1352,7 +1352,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac, ...@@ -1352,7 +1352,8 @@ void nr_ue_configure_pucch(NR_UE_MAC_INST_t *mac,
NR_PUCCH_Resource_t *pucchres = pucch->pucch_resource; NR_PUCCH_Resource_t *pucchres = pucch->pucch_resource;
if (current_UL_BWP->harq_ACK_SpatialBundlingPUCCH != NULL || *current_DL_BWP->pdsch_HARQ_ACK_Codebook != 1) { if (current_UL_BWP->harq_ACK_SpatialBundlingPUCCH != NULL ||
current_DL_BWP->pdsch_HARQ_ACK_Codebook != NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic) {
LOG_E(MAC,"PUCCH Unsupported cell group configuration\n"); LOG_E(MAC,"PUCCH Unsupported cell group configuration\n");
return; return;
} else if (current_DL_BWP && current_DL_BWP->pdsch_servingcellconfig && current_DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission != NULL) { } else if (current_DL_BWP && current_DL_BWP->pdsch_servingcellconfig && current_DL_BWP->pdsch_servingcellconfig->codeBlockGroupTransmission != NULL) {
......
...@@ -2023,7 +2023,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, ...@@ -2023,7 +2023,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac,
int target_ss; int target_ss;
if (CellGroup && CellGroup->physicalCellGroupConfig) if (CellGroup && CellGroup->physicalCellGroupConfig)
DL_BWP->pdsch_HARQ_ACK_Codebook = &CellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook; DL_BWP->pdsch_HARQ_ACK_Codebook = CellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook;
if (CellGroup && if (CellGroup &&
CellGroup->spCellConfig && CellGroup->spCellConfig &&
......
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