|
|
|
@@ -375,7 +375,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in
|
|
|
|
|
if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceSetId ==
|
|
|
|
|
*(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){
|
|
|
|
|
//We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig
|
|
|
|
|
nb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.count;
|
|
|
|
|
nb_resources = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.count;
|
|
|
|
|
csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_idx]->csi_SSB_ResourceList.list.array;
|
|
|
|
|
csi_report->CSI_Index_list = NULL;
|
|
|
|
|
break;
|
|
|
|
@@ -388,7 +388,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in
|
|
|
|
|
if (csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_ResourceSetId ==
|
|
|
|
|
*(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list.array[0])) {
|
|
|
|
|
//For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 for spec 38.212
|
|
|
|
|
nb_resources= csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.count;
|
|
|
|
|
nb_resources = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.count;
|
|
|
|
|
csi_report->CSI_Index_list = csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list.array[csi_idx]->nzp_CSI_RS_Resources.list.array;
|
|
|
|
|
csi_report->SSB_Index_list = NULL;
|
|
|
|
|
break;
|
|
|
|
@@ -850,16 +850,120 @@ void reverse_n_bits(uint8_t *value, uint16_t bitlen) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig,
|
|
|
|
|
const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu,
|
|
|
|
|
frame_t frame,
|
|
|
|
|
slot_t slot,
|
|
|
|
|
int UE_id,
|
|
|
|
|
module_id_t Mod_idP) {
|
|
|
|
|
|
|
|
|
|
void evaluate_rsrp_report(NR_UE_info_t *UE_info,
|
|
|
|
|
NR_UE_sched_ctrl_t *sched_ctrl,
|
|
|
|
|
int UE_id,
|
|
|
|
|
uint8_t csi_report_id,
|
|
|
|
|
uint8_t *payload,
|
|
|
|
|
NR_CSI_ReportConfig__reportQuantity_PR reportQuantity_type){
|
|
|
|
|
|
|
|
|
|
uint8_t cri_ssbri_bitlen = UE_info->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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int 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_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen.nb_ssbri_cri;
|
|
|
|
|
|
|
|
|
|
for (int 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_info->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_info->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_D(MAC,"SSB_index = %d\n",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 (int 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_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++;
|
|
|
|
|
LOG_D(MAC,"rsrp_id = %d rsrp = %d\n",
|
|
|
|
|
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP,
|
|
|
|
|
get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void evaluate_cri_report(uint8_t *payload,
|
|
|
|
|
uint8_t cri_bitlen,
|
|
|
|
|
NR_UE_sched_ctrl_t *sched_ctrl){
|
|
|
|
|
|
|
|
|
|
int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id?
|
|
|
|
|
|
|
|
|
|
uint8_t temp_cri = *payload & ((1<<cri_bitlen)-1);
|
|
|
|
|
reverse_n_bits(&temp_cri,cri_bitlen);
|
|
|
|
|
sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.cri = temp_cri;
|
|
|
|
|
*payload >>= cri_bitlen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void evaluate_ri_report(uint8_t *payload,
|
|
|
|
|
uint8_t ri_bitlen,
|
|
|
|
|
NR_UE_sched_ctrl_t *sched_ctrl){
|
|
|
|
|
|
|
|
|
|
AssertFatal(1==0,"Evaluation of RI report not yet implemented\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void evaluate_cqi_report(uint8_t *payload,
|
|
|
|
|
uint8_t cqi_bitlen,
|
|
|
|
|
NR_UE_sched_ctrl_t *sched_ctrl){
|
|
|
|
|
|
|
|
|
|
//TODO sub-band CQI report not yet implemented
|
|
|
|
|
int idx = 0; // FIXME not sure about this index. Should it be the same as csi_report_id?
|
|
|
|
|
uint8_t temp_cqi = *payload & ((1<<4)-1);
|
|
|
|
|
reverse_n_bits(&temp_cqi,4);
|
|
|
|
|
sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_1tb = temp_cqi;
|
|
|
|
|
*payload >>= 4;
|
|
|
|
|
LOG_I(MAC,"Wide-band CQI for the first TB %d\n", temp_cqi);
|
|
|
|
|
if (cqi_bitlen > 4) {
|
|
|
|
|
temp_cqi = *payload & ((1<<4)-1);
|
|
|
|
|
reverse_n_bits(&temp_cqi,4);
|
|
|
|
|
sched_ctrl->CSI_report[idx].choice.cri_ri_li_pmi_cqi_report.wb_cqi_2tb = temp_cqi;
|
|
|
|
|
*payload >>= 4;
|
|
|
|
|
LOG_D(MAC,"Wide-band CQI for the second TB %d\n", temp_cqi);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
|
|
|
|
|
const nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu,
|
|
|
|
|
frame_t frame,
|
|
|
|
|
slot_t slot,
|
|
|
|
|
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);
|
|
|
|
|
NR_ServingCellConfigCommon_t *scc =
|
|
|
|
|
RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
|
|
|
|
|
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
|
|
|
|
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);
|
|
|
|
@@ -867,75 +971,42 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig,
|
|
|
|
|
uint8_t csi_report_id = 0;
|
|
|
|
|
|
|
|
|
|
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++ ) {
|
|
|
|
|
//Has to implement according to reportSlotConfig type
|
|
|
|
|
/*reportQuantity must be considered according to the current scheduled
|
|
|
|
|
CSI-ReportConfig if multiple CSI-ReportConfigs present*/
|
|
|
|
|
reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type;
|
|
|
|
|
LOG_D(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_info->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_info->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_info->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_info->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_D(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]);
|
|
|
|
|
for (csi_report_id = 0; csi_report_id < csi_MeasConfig->csi_ReportConfigToAddModList->list.count; csi_report_id++ ) {
|
|
|
|
|
uint8_t cri_bitlen = 0;
|
|
|
|
|
uint8_t ri_bitlen = 0;
|
|
|
|
|
uint8_t cqi_bitlen = 0;
|
|
|
|
|
NR_CSI_ReportConfig_t *csirep = csi_MeasConfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
|
|
|
|
|
int period, offset;
|
|
|
|
|
csi_period_offset(csirep, NULL, &period, &offset);
|
|
|
|
|
// verify if report with current id has been scheduled for this frame and slot
|
|
|
|
|
// -1 because this is processed 1 slot after the reception
|
|
|
|
|
if ((n_slots_frame*frame + slot - offset - 1)%period == 0) {
|
|
|
|
|
reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type;
|
|
|
|
|
LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type);
|
|
|
|
|
switch(reportQuantity_type){
|
|
|
|
|
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP:
|
|
|
|
|
evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type);
|
|
|
|
|
break;
|
|
|
|
|
case NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP:
|
|
|
|
|
evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,reportQuantity_type);
|
|
|
|
|
break;
|
|
|
|
|
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_CQI:
|
|
|
|
|
cri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cri_bitlen;
|
|
|
|
|
if(cri_bitlen)
|
|
|
|
|
evaluate_cri_report(payload,cri_bitlen,sched_ctrl);
|
|
|
|
|
ri_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.ri_bitlen;
|
|
|
|
|
if(ri_bitlen)
|
|
|
|
|
evaluate_ri_report(payload,ri_bitlen,sched_ctrl);
|
|
|
|
|
//TODO add zero padding bits when needed
|
|
|
|
|
cqi_bitlen = UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen.cqi_bitlen;
|
|
|
|
|
if(cqi_bitlen)
|
|
|
|
|
evaluate_cqi_report(payload,ri_bitlen,sched_ctrl);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
AssertFatal(1==0, "Invalid or not supported CSI measurement report\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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_info->csi_report_template[UE_id][csi_report_id].nb_of_csi_ssb_report++;
|
|
|
|
|
LOG_I(MAC,"csi_payload size = %d, rsrp_id = %d rsrp = %d\n",
|
|
|
|
|
payload_size,
|
|
|
|
|
sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP,
|
|
|
|
|
get_measured_rsrp(sched_ctrl->CSI_report[idx].choice.ssb_cri_report.RSRP));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !(reportQuantity_type))
|
|
|
|
|
AssertFatal(reportQuantity_type, "reportQuantity is not configured");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void handle_nr_uci_pucch_0_1(module_id_t mod_id,
|
|
|
|
|