Commit 751b5ebd authored by r.karey's avatar r.karey Committed by guhan

UCI bitlength calculation

parent 9ac5a104
......@@ -237,11 +237,11 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
//NR_COMMON_channels_t *cc = RC.nrmac[Mod_idP]->common_channels;
NR_CellGroupConfig_t *secondaryCellGroup = UE_list->secondaryCellGroup[UE_id];
NR_BWP_Downlink_t *bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
//NR_CSI_MeasConfig_t *csi_MeasConfig = UE_list->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
//bwp indicator
int n_dl_bwp = secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
uint8_t nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[UE_id][cqi_idx].choice.ssb_cri_report.nr_ssbri_cri;
uint8_t nb_resource_sets = sched_ctrl->nr_of_csi_report[UE_id];
uint8_t nb_ssb_resources_inEachSet = 0;
uint8_t nb_resource_sets = UE_list->csi_report_template[UE_id][cqi_idx].nb_of_csi_ssb_report;
//uint8_t bitlen_ssbri = log (nb_resource_sets)/log (2);
//uint8_t max_rsrp_reported = -1;
int better_rsrp_reported = -140-(-0); /*minimum_measured_RSRP_value - minimum_differntail_RSRP_value*///considering the minimum RSRP value as better RSRP initially
......@@ -264,16 +264,17 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
//for all reported SSB
for (idx = 0; idx < nb_resource_sets; idx++) {
nb_ssb_resources_inEachSet = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri;
//if group based beam Reporting is disabled
if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled ==
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {
/*if(NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled ==
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {*/
//extracting the ssb indexes
for (ssb_idx = 0; ssb_idx <= nb_ssb_resources_inEachSet; ssb_idx++) {
ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx];
for (ssb_idx = 0; ssb_idx < nb_ssb_resources_inEachSet; ssb_idx++) {
ssb_index[idx * nb_resource_sets + ssb_idx] = sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI[ssb_idx];
}
//if strongest measured RSRP is configured
strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP);
strongest_ssb_rsrp = get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP);
ssb_rsrp[idx * nb_resource_sets] = strongest_ssb_rsrp;
//if current ssb rsrp is greater than better rsrp
......@@ -283,7 +284,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
}
for(diff_rsrp_idx =1; diff_rsrp_idx < nb_ssb_resources_inEachSet; diff_rsrp_idx++) {
ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp);
ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] = get_diff_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx], strongest_ssb_rsrp);
//if current reported rsrp is greater than better rsrp
if(ssb_rsrp[idx * nb_resource_sets + diff_rsrp_idx] > better_rsrp_reported) {
......@@ -291,7 +292,8 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
target_ssb_beam_index = idx * nb_resource_sets + diff_rsrp_idx;
}
}
}
#if 0
//}
//if group based beam reporting is enabled
else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled !=
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {
......@@ -316,6 +318,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
target_ssb_beam_index = idx * nb_resource_sets + 1;
}
}
#endif
}
if(ssb_index[target_ssb_beam_index] != ssb_index[curr_ssb_beam_index] && ssb_rsrp[target_ssb_beam_index] > ssb_rsrp[curr_ssb_beam_index]) {
......@@ -427,6 +430,7 @@ void tci_handling(int Mod_idP, int UE_id, int CC_id, NR_UE_sched_ctrl_t *sched_c
}//tci_presentInDCI
}//is-triggering_beam_switch
}//tci handling
void clear_nr_nfapi_information(gNB_MAC_INST *gNB,
int CC_idP,
frame_t frameP,
......
......@@ -421,12 +421,14 @@ struct CRI_RI_LI_PMI_CQI {
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 {
......@@ -441,12 +443,28 @@ typedef struct NR_UE_sr {
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;
}CRI_SSBRI_RSRP_bitlen_t;
#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16
typedef struct nr_csi_report {
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type;
long periodicity;
NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR CSI_Resource_type;
uint8_t nb_of_nzp_csi_report;
uint8_t nb_of_csi_ssb_report;
CRI_SSBRI_RSRP_bitlen_t CSI_report_bitlen[MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG];
} 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
*/
#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16
/*! \brief scheduling control information set through an API */
#define MAX_CSI_REPORTS 48
typedef struct {
......
......@@ -131,7 +131,7 @@ uint8_t get_ssb_resources (NR_CSI_MeasConfig_t *csi_MeasConfig,
return -1;
}
#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,
......@@ -286,27 +286,29 @@ 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 bitlen_cri = (log(csi_MeasConfig->csi_ResourceConfigToAddModList->list.count)/log(2));
uint8_t idx = 0;
uint8_t payload_size = ceil(uci_pdu->csi_part1.csi_part1_bit_len/8);
uint16_t *payload = calloc (1, payload_size);
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type = NR_CSI_ReportConfig__reportQuantity_PR_NOTHING;
uint8_t UE_id = 0;
//uint8_t UE_id = 0;
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);
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) {
// if (csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.present == NR_CSI_ReportConfig__reportConfigType_PR_periodic) {
//considering 30khz scs and
//Has to implement according to reportSlotConfig type
LOG_I(PHY,"SFN/SF:%d%d \n", frame,slot);
if (((NR_SubcarrierSpacing_kHz30 == scs) &&
(0 == ((frame*20) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))
||((NR_SubcarrierSpacing_kHz120 == scs)&&
(0 == ((frame*80) + (slot+1)) % csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320))){
reportQuantity_type = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->reportQuantity.present;
LOG_I(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",
frame,slot,reportQuantity_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))) {
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);
break;
}
}
......@@ -314,23 +316,23 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig,
AssertFatal(reportQuantity_type, "reportQuantity is not configured");
if ( NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type ) {
uint8_t nb_ssb_resource_set=0;
uint8_t nb_ssb_resources = get_ssb_resources(csi_MeasConfig,
uint8_t nb_ssb_resource_set= UE_list->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report;
//uint8_t nb_ssb_resources = UE_list->csi_report_template[UE_id][csi_report_id].
/* get_ssb_resources(csi_MeasConfig,
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id]->resourcesForChannelMeasurement,
reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;
uint8_t idx = 0;
reportQuantity_type,&nb_ssb_resource_set);//csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->CSI_SSB_ResourceList.list.count;*/
uint8_t ssb_idx = 0;
uint8_t diff_rsrp_idx = 0;
uint8_t bitlen_ssbri = nb_ssb_resources>1 ?log (nb_ssb_resources)/log (2):1;
sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set;
uint8_t bitlen_ssbri = UE_list->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen[0].cri_ssbri_bitlen;
//sched_ctrl->nr_of_csi_report[UE_id] = nb_ssb_resource_set;
LOG_I(MAC,"csi_payload = %d, bitlen_ssbri = %d, nb_ssb_resource_set = %d,nb_ssb_resources = %d\n",payload_size, bitlen_ssbri, nb_ssb_resource_set,nb_ssb_resources);
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
*/
for (idx = 0; idx < nb_ssb_resource_set; idx++) {
// for (idx = 0; idx < nb_ssb_resource_set; idx++) {
/** 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
......@@ -344,30 +346,31 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig,
multiple simultaneous spatial domain receive filter
*/
if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled ==
/* if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled ==
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {
if ((NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS) &&
*(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS))
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS);
else
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1;
else */
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[0].nb_ssbri_cri;
for (ssb_idx = 0; ssb_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) {
for (ssb_idx = 0; ssb_idx < sched_ctrl->CSI_report[idx].choice.ssb_cri_report.nr_ssbri_cri ; ssb_idx++) {
/** From Table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel */
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1));
*payload >>= bitlen_ssbri;
}
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.RSRP = (*payload) & 0x7f;
*payload >>= 7;
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [ssb_idx] = (*payload) & ~(~1<<(bitlen_ssbri-1));
*payload >>= bitlen_ssbri;
}
for ( diff_rsrp_idx =0; diff_rsrp_idx <= sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri - 1; diff_rsrp_idx++ ) {
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f;
*payload >>= 4;
}
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++ ) {
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.diff_RSRP[diff_rsrp_idx] = (*payload) & 0x0f;
*payload >>= 4;
}
#if 0
} else if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled !=
csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.present ) {
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.nr_ssbri_cri = 2;
......@@ -383,7 +386,8 @@ void extract_pucch_csi_report ( NR_CSI_MeasConfig_t *csi_MeasConfig,
sched_ctrl->CSI_report[UE_id][idx].choice.ssb_cri_report.diff_RSRP[0] = (*payload) & 0x0f;
*payload >>= 4;
}
}
#endif
// }
}
#if 0
......
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