Implement CSI-RS resource mapping validation

master
Xavier Arteaga 3 years ago committed by Andre Puschmann
parent fb294c8b34
commit 7ba5099bee

@ -128,4 +128,6 @@ typedef struct SRSRAN_API {
uint32_t count; ///< Number of resources in the set
} srsran_csi_rs_zp_set_t;
SRSRAN_API bool srsran_csi_rs_resource_mapping_is_valid(const srsran_csi_rs_resource_mapping_t *res);
#endif // SRSRAN_CSI_RS_CFG_H

@ -1070,6 +1070,15 @@ bool make_phy_zp_csi_rs_resource(const asn1::rrc_nr::zp_csi_rs_res_s& zp_csi_rs_
}
zp_csi_rs_resource.resource_mapping.freq_band.nof_rb = zp_csi_rs_res.res_map.freq_band.nrof_rbs;
zp_csi_rs_resource.resource_mapping.freq_band.start_rb = zp_csi_rs_res.res_map.freq_band.start_rb;
// Validate CSI-RS resource mapping
if (not srsran_csi_rs_resource_mapping_is_valid(&zp_csi_rs_resource.resource_mapping)) {
asn1::json_writer json_writer;
zp_csi_rs_res.res_map.to_json(json_writer);
asn1::log_error("Resource mapping is invalid or not implemented: %s", json_writer.to_string());
return false;
}
if (zp_csi_rs_res.periodicity_and_offset_present) {
switch (zp_csi_rs_res.periodicity_and_offset.type()) {
case csi_res_periodicity_and_offset_c::types_opts::options::slots4:
@ -1228,6 +1237,14 @@ bool make_phy_nzp_csi_rs_resource(const asn1::rrc_nr::nzp_csi_rs_res_s& asn1_nzp
csi_rs_nzp_resource.resource_mapping.freq_band.nof_rb = asn1_nzp_csi_rs_res.res_map.freq_band.nrof_rbs;
csi_rs_nzp_resource.resource_mapping.freq_band.start_rb = asn1_nzp_csi_rs_res.res_map.freq_band.start_rb;
// Validate CSI-RS resource mapping
if (not srsran_csi_rs_resource_mapping_is_valid(&csi_rs_nzp_resource.resource_mapping)) {
asn1::json_writer json_writer;
asn1_nzp_csi_rs_res.res_map.to_json(json_writer);
asn1::log_error("Resource mapping is invalid or not implemented: %s", json_writer.to_string());
return false;
}
csi_rs_nzp_resource.power_control_offset = asn1_nzp_csi_rs_res.pwr_ctrl_offset;
if (asn1_nzp_csi_rs_res.pwr_ctrl_offset_ss_present) {
csi_rs_nzp_resource.power_control_offset_ss = asn1_nzp_csi_rs_res.pwr_ctrl_offset_ss.to_number();

@ -232,6 +232,29 @@ static int csi_rs_nof_cdm_groups(const srsran_csi_rs_resource_mapping_t* resourc
return SRSRAN_ERROR;
}
bool srsran_csi_rs_resource_mapping_is_valid(const srsran_csi_rs_resource_mapping_t* res)
{
if (res == NULL) {
return false;
}
if (csi_rs_nof_cdm_groups(res) < 1) {
return false;
}
uint32_t l_list[CSI_RS_MAX_SYMBOLS_SLOT] = {};
if (csi_rs_location_get_l_list(res, 0, l_list) < SRSRAN_SUCCESS) {
return false;
}
uint32_t k_list[CSI_RS_MAX_SUBC_PRB] = {};
if (csi_rs_location_get_k_list(res, 0, k_list) < SRSRAN_SUCCESS) {
return false;
}
return true;
}
uint32_t csi_rs_count(srsran_csi_rs_density_t density, uint32_t nprb)
{
switch (density) {

Loading…
Cancel
Save