From 0e61b612ba3d30b36e4455bfc053bedb5bf8ccba Mon Sep 17 00:00:00 2001 From: rangaswamy <r.karey@globaledgesoft.com> Date: Fri, 22 Jan 2021 10:09:48 +0530 Subject: [PATCH] fixed warnings --- openair2/LAYER2/NR_MAC_gNB/config.c | 37 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 18 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 4 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 109 ------ openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 336 ------------------ 7 files changed, 29 insertions(+), 481 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index bf912f97c6..253dc686d8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -310,23 +310,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } } - -//! Calculating number of bits set -uint8_t number_of_bits_set (uint8_t buf,uint8_t * max_ri){ - uint8_t nb_of_bits_set = 0; - uint8_t mask = 0xff; - uint8_t index = 0; - - for (index=7; (buf & mask) && (index>=0) ; index--){ - if (buf & (1<<index)) - nb_of_bits_set++; - - mask>>=1; - } - *max_ri = 8-index; - return nb_of_bits_set; -} - +#if 0 //!TODO : smae function can be written to handle csi_resources void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_list, int UE_id, module_id_t Mod_idP) { uint8_t csi_report_id = 0; @@ -341,6 +325,8 @@ void update_csi_bitlen (NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_list_t *UE_li csi_ResourceConfigId=csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement; reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present; UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type = reportQuantity_type; + p_and_o = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.present; + switch(p_and_o){ case NR_CSI_ReportPeriodicityAndOffset_PR_slots4: period = 4; @@ -734,11 +720,24 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, if (secondaryCellGroup) { - RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); + UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; + compute_csi_bitlen (secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, Mod_idP); + struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = + secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList; + AssertFatal(bwpList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + bwpList->list.count); + const int bwp_id = 1; + UE_info->UE_sched_ctrl[UE_id].active_bwp = bwpList->list.array[bwp_id - 1]; + struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = + secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList; + AssertFatal(ubwpList->list.count == 1, + "uplinkBWP_ToAddModList has %d BWP!\n", + ubwpList->list.count); + UE_info->UE_sched_ctrl[UE_id].active_ubwp = ubwpList->list.array[bwp_id - 1]; LOG_I(PHY,"Added new UE_id %d/%x with initial secondaryCellGroup\n",UE_id,rnti); } else if (add_ue == 1 && !get_softmodem_params()->phy_test) { const int CC_id = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index fbdc6cb519..ac3a4e77d2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -190,7 +190,6 @@ void find_SSB_and_RO_available(module_id_t module_idP) { // prach is scheduled according to configuration index and tables 6.3.3.2.2 to 6.3.3.2.4 get_nr_prach_occasion_info_from_index(config_index, -<<<<<<< HEAD scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, mu, cc->frame_type, @@ -247,7 +246,6 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; if (is_nr_UL_slot(scc,slotP)) { -<<<<<<< HEAD uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint16_t RA_sfn_index = -1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 09ae7689e9..bb7be52af6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -87,8 +87,8 @@ void nr_fill_nfapi_pucch(module_id_t mod_id, //#define L1_DIFF_RSRP_STEP_SIZE 2 void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats); int ssb_index_sorted[MAX_NUM_SSB] = {0}; @@ -692,7 +692,6 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, sched_ctrl->sr_req.nr_of_srs = uci_234->sr.sr_bit_len; } // TODO - int max_harq_rounds = 4; // TODO define macro if ((uci_234->pduBitmap >> 1) & 0x01) { // iterate over received harq bits for (int harq_bit = 0; harq_bit < uci_234->harq.harq_bit_len; harq_bit++) { @@ -741,8 +740,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, } void nr_rx_acknack(nfapi_nr_uci_pusch_pdu_t *uci_pusch, - nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, + const nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_01, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_234, NR_UL_IND_t *UL_info, NR_UE_sched_ctrl_t *sched_ctrl, NR_mac_stats_t *stats) { // TODO @@ -1414,7 +1413,7 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) { } void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, @@ -1424,14 +1423,11 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ uint8_t idx = 0; uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); - uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); + uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; NR_UE_info_t *UE_info = &(RC.nrmac[Mod_idP]->UE_info); uint8_t csi_report_id = 0; - memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - - UE_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig @@ -1501,8 +1497,6 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, if ( !(reportQuantity_type)) AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - free(payload); - payload = NULL; #if 0 if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 938ba17165..027fac773a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -474,6 +474,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, continue; } const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); + UE_info->secondaryCellGroup[UE_id] = ra->secondaryCellGroup; + compute_csi_bitlen (ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup, UE_info, UE_id, gnb_mod_idP); UE_info->UE_beam_index[UE_id] = ra->beam_id; LOG_I(MAC, "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " @@ -1132,4 +1134,4 @@ void nr_schedule_ulsch(module_id_t module_id, memset(sched_pusch, 0, sizeof(*sched_pusch)); } -} \ No newline at end of file +} diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index dde4c3c713..24a93040c4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -205,7 +205,7 @@ int get_measured_rsrp(uint8_t index); int get_diff_rsrp(uint8_t index, int strongest_rsrp); void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, + const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, NR_UE_sched_ctrl_t *sched_ctrl, frame_t frame, slot_t slot, @@ -346,7 +346,7 @@ uint16_t compute_pucch_prb_size(uint8_t format, uint8_t n_symb, uint8_t n_re_ctrl); -void compute_csi_bitlen (NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_info_t *UE_info, int UE_id); +void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP); int get_dlscs(nfapi_nr_config_request_t *cfg); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 29ef5f8cfa..a21b2fdb46 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -469,115 +469,6 @@ typedef struct NR_UE_ul_harq { NR_sched_pusch_t sched_pusch; } NR_UE_ul_harq_t; - -typedef struct { - uint8_t nb_ssbri_cri; - uint8_t cri_ssbri_bitlen; - uint8_t rsrp_bitlen; - uint8_t diff_rsrp_bitlen; -}L1_RSRP_bitlen_t; - -typedef struct{ - uint8_t cri_bitlen; - uint8_t ri_bitlen; - uint8_t li_bitlen; - uint8_t pmi_x1_bitlen; - uint8_t pmi_x2_bitlen; - uint8_t cqi_bitlen; -} CSI_Meas_bitlen_t; - - -#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 -typedef struct nr_csi_report { - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type; - uint8_t nb_of_nzp_csi_report; - uint8_t nb_of_csi_ssb_report; - L1_RSRP_bitlen_t CSI_report_bitlen; - CSI_Meas_bitlen_t csi_meas_bitlen; -} nr_csi_report_t; - -//! fixme : need to enhace for the multiple TB CQI report - - -// -/*! As per spec 38.214 section 5.2.1.4.2 - * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. - * - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter -*/ -#define MAX_NR_OF_REPORTED_RS 4 - -typedef enum NR_CSI_Report_Config { - CSI_Report_PR_cri_ri_li_pmi_cqi_report, - CSI_Report_PR_ssb_cri_report -} NR_CSI_Report_Config_PR; -struct CRI_RI_LI_PMI_CQI { - uint8_t cri; - uint8_t ri; - uint8_t li; - uint8_t pmi_x1; - uint8_t pmi_x2; - uint8_t cqi; -}; - -typedef struct CRI_SSB_RSRP { - uint8_t nr_ssbri_cri; - uint8_t CRI_SSBRI[MAX_NR_OF_REPORTED_RS]; - uint8_t RSRP; - uint8_t diff_RSRP[MAX_NR_OF_REPORTED_RS - 1]; -} CRI_SSB_RSRP_t; - -struct CSI_Report { - NR_CSI_Report_Config_PR present; - union Config_CSI_Report { - struct CRI_RI_LI_PMI_CQI cri_ri_li_pmi_cqi_report; - struct CRI_SSB_RSRP ssb_cri_report; - } choice; -}; - -#define MAX_SR_BITLEN 8 -typedef struct NR_UE_sr { - uint8_t nr_of_srs; - bool ul_SR [MAX_SR_BITLEN]; -} NR_UE_sr_t; - -typedef struct { - uint8_t nb_ssbri_cri; - uint8_t cri_ssbri_bitlen; - uint8_t rsrp_bitlen; - uint8_t diff_rsrp_bitlen; -}L1_RSRP_bitlen_t; - -typedef struct{ - uint8_t cri_bitlen; - uint8_t ri_bitlen; - uint8_t li_bitlen; - uint8_t pmi_x1_bitlen; - uint8_t pmi_x2_bitlen; - uint8_t cqi_bitlen; -} CSI_Meas_bitlen_t; - -typedef struct nr_csi_report { - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type; - long periodicity; - uint16_t offset; - long ** SSB_Index_list; - long ** CSI_Index_list; -// uint8_t nb_of_nzp_csi_report; - uint8_t nb_of_csi_ssb_report; - L1_RSRP_bitlen_t CSI_report_bitlen; - CSI_Meas_bitlen_t csi_meas_bitlen; -} nr_csi_report_t; - -/*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ /*! \brief scheduling control information set through an API */ #define MAX_CSI_REPORTS 48 typedef struct { diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 8ff10db318..a7ca7909bf 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -77,342 +77,6 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) { } } - else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; - - } else { - //TODO: find the CSI_RS IM resources - } - } else { - AssertFatal(csi_ResourceConfigId, "csi_ResourceConfigId is not configured"); - } - } - - return -1; -} -#if 0 -//!TODO : smae function can be written to handle csi_resources -uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig, - NR_CSI_ResourceConfigId_t csi_ResourceConfigId, - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type, - uint8_t *nb_resource_sets) { - uint8_t idx = 0; - uint8_t csi_ssb_idx =0; - - for ( idx = 0; idx < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; idx++) { - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_ResourceConfigId == csi_ResourceConfigId) { - //Finding the CSI_RS or SSB Resources - if ( csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ){ - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count; - - for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { - if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == - *(csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])) { - return csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; - } else { - //handle error condition - AssertFatal(csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId, "csi_SSB_ResourcesSetId is not configured"); - } - } - } - - else if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) - *nb_resource_sets=csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[idx]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.count; - -void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, - frame_t frame, - slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, - module_id_t Mod_idP - ) { - - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - uint8_t idx = 0; - uint8_t *payload = uci_pdu->csi_part1.csi_part1_payload; - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); - long periodicity; - uint8_t csi_report_id = 0; - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //Has to implement according to reportSlotConfig type - periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) - continue; - - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { - uint8_t csi_ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - - /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ - - /** from 38.214 sec 5.2.1.4.2 - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is - not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting - - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not - required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter - */ - - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - - for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - - *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); - } - - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC," rsrp_id = %d\n", sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - } - } - - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - -#if 0 - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - // Handling of extracting cri - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); - *payload >>= bitlen_cri; - - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; - } else { - //Handling for the ri for multiple csi ports - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; - else { - //Handle for li for multiple CSI ports - } - } - - //TODO: check for zero padding if available shift payload to the number of zero padding bits - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; - } - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; - *(payload) >>= 4; - } - -#endif -} - -void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig, - nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu, - NR_UE_sched_ctrl_t *sched_ctrl, - frame_t frame, - slot_t slot, - NR_SubcarrierSpacing_t scs, int UE_id, - module_id_t Mod_idP - ) { - - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - uint8_t idx = 0; - uint8_t payload_size = ceil(((double)uci_pdu->csi_part1.csi_part1_bit_len)/8); - uint8_t *payload = calloc (payload_size, sizeof(uint8_t)); - NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING; - NR_UE_list_t *UE_list = &(RC.nrmac[Mod_idP]->UE_list); - long periodicity; - uint8_t csi_report_id = 0; - - memcpy ( payload, uci_pdu->csi_part1.csi_part1_payload, payload_size); - - - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report = 0; - for ( csi_report_id =0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) { - //Assuming in periodic reporting for one slot can be configured with only one CSI-ReportConfig - // if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) { - //Has to implement according to reportSlotConfig type - periodicity = UE_list->csi_report_template[UE_id][csi_report_id].periodicity; - LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot); - /* if (((NR_SubcarrierSpacing_kHz30 == scs) && (((((frame & 0xf)+1)*20 + slot) & periodicity) == periodicity)) - ||((NR_SubcarrierSpacing_kHz120 == scs)&&(((((frame & 0xf)+1)*80 + slot) & periodicity) == periodicity))) {*/ - if (((slots_per_frame[scs]*frame + slot -UE_list->csi_report_template[UE_id][csi_report_id].offset)%periodicity)!=0) - continue; - - reportQuantity_type = UE_list->csi_report_template[UE_id][csi_report_id].reportQuantity_type; - LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - - if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { - uint8_t csi_ssb_idx = 0; - uint8_t diff_rsrp_idx = 0; - uint8_t cri_ssbri_bitlen = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.cri_ssbri_bitlen; - - LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set); - /*! As per the spec 38.212 and table: 6.3.1.1.2-12 in a single UCI sequence we can have multiple CSI_report - * the number of CSI_report will depend on number of CSI resource sets that are configured in CSI-ResourceConfig RRC IE - * From spec 38.331 from the IE CSI-ResourceConfig for SSB RSRP reporting we can configure only one resource set - * From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 - */ - - /** from 38.214 sec 5.2.1.4.2 - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is - not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in - a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting - - - if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'enabled', the UE is not - required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a - single reporting instance two different CRI or SSBRI for each report setting, where CSI-RS and/or SSB - resources can be received simultaneously by the UE either with a single spatial domain receive filter, or with - multiple simultaneous spatial domain receive filter - */ - - idx = 0; //Since for SSB RSRP reporting in RRC can configure only one ssb resource set per one report config - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri; - - for (csi_ssb_idx = 0; csi_ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; csi_ssb_idx++) { - if(cri_ssbri_bitlen > 1) - reverse_n_bits(payload, cri_ssbri_bitlen); - - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = - *(UE_list->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - - *payload >>= cri_ssbri_bitlen; - LOG_I(PHY,"SSB_index = %d",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); - } - - reverse_n_bits(payload, 7); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f; - *payload >>= 7; - - for ( diff_rsrp_idx =0; diff_rsrp_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) { - reverse_n_bits(payload,4); - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f; - *payload >>= 4; - } - UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++; - LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d\n",payload_size, sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP); - } - } - - if ( !(reportQuantity_type)) - AssertFatal(reportQuantity_type, "reportQuantity is not configured"); - - -#if 0 - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1 == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - // Handling of extracting cri - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri = calloc ( 1, ceil(bitlen_cri/8)); - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report.cri) = *((uint32_t *)payload) & ~(~1<<(bitlen_cri-1)); - *payload >>= bitlen_cri; - - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->ri = NULL; - } else { - //Handling for the ri for multiple csi ports - } - } - - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->li = NULL; - else { - //Handle for li for multiple CSI ports - } - } - - //TODO: check for zero padding if available shift payload to the number of zero padding bits - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - if ( 1 == RC.nrrrc[gnb_mod_idP]->carrier.pdsch_AntennaPorts ) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x1 = NULL; - sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->pmi_x2 = NULL; - } - } - - if ( NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_i1_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI == reportQuantity_type || - NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI== reportQuantity_type) { - /** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */ - *(sched_ctrl->CSI_report[UE_id][cqi_idx].choice.cri_ri_li_pmi_cqi_report->cqi) = *(payload) & 0x0f; - *(payload) >>= 4; - } - -#endif -} void handle_nr_uci(NR_UL_IND_t *UL_info) { -- 2.26.2