|
|
|
@ -192,32 +192,16 @@ void cc_worker::decode_pdcch_ul()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool cc_worker::work_dl()
|
|
|
|
|
bool cc_worker::decode_pdsch_dl()
|
|
|
|
|
{
|
|
|
|
|
// Do NOT process any DL if it is not configured
|
|
|
|
|
if (not configured) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if it is a DL slot, if not skip
|
|
|
|
|
if (!srsran_tdd_nr_is_dl(&phy->cfg.tdd, 0, dl_slot_cfg.idx)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run FFT
|
|
|
|
|
srsran_ue_dl_nr_estimate_fft(&ue_dl, &dl_slot_cfg);
|
|
|
|
|
|
|
|
|
|
// Decode PDCCH DL first
|
|
|
|
|
decode_pdcch_dl();
|
|
|
|
|
|
|
|
|
|
// Decode PDCCH UL after
|
|
|
|
|
decode_pdcch_ul();
|
|
|
|
|
|
|
|
|
|
// Get DL grant for this TTI, if available
|
|
|
|
|
uint32_t pid = 0;
|
|
|
|
|
srsran_sch_cfg_nr_t pdsch_cfg = {};
|
|
|
|
|
srsran_pdsch_ack_resource_nr_t ack_resource = {};
|
|
|
|
|
if (phy->get_dl_pending_grant(dl_slot_cfg.idx, pdsch_cfg, ack_resource, pid)) {
|
|
|
|
|
if (not phy->get_dl_pending_grant(dl_slot_cfg.idx, pdsch_cfg, ack_resource, pid)) {
|
|
|
|
|
// Early return if no grant was available
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Notify MAC about PDSCH grant
|
|
|
|
|
mac_interface_phy_nr::tb_action_dl_t dl_action = {};
|
|
|
|
|
mac_interface_phy_nr::mac_nr_grant_dl_t mac_dl_grant = {};
|
|
|
|
@ -321,6 +305,64 @@ bool cc_worker::work_dl()
|
|
|
|
|
ch_m.sync_err = ue_dl.chest.sync_error;
|
|
|
|
|
phy->set_channel_metrics(ch_m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool cc_worker::measure()
|
|
|
|
|
{
|
|
|
|
|
// Iterate all NZP-CSI-RS and perform channel measurements
|
|
|
|
|
for (uint32_t resource_set_id = 0; resource_set_id < SRSRAN_PHCH_CFG_MAX_NOF_CSI_RS_SETS; resource_set_id++) {
|
|
|
|
|
// Select NZP-CSI-RS set
|
|
|
|
|
const srsran_csi_rs_nzp_set_t& nzp_set = phy->cfg.pdsch.nzp_csi_rs_sets[resource_set_id];
|
|
|
|
|
|
|
|
|
|
srsran_csi_measurements_t measurements = {};
|
|
|
|
|
int n = srsran_ue_dl_nr_csi_measure(&ue_dl, &dl_slot_cfg, &nzp_set, &measurements);
|
|
|
|
|
if (n < SRSRAN_SUCCESS) {
|
|
|
|
|
logger.error("Error measuring CSI-RS");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Report new measurement to the PHY state
|
|
|
|
|
if (n > 0) {
|
|
|
|
|
phy->new_nzp_csi_rs_channel_measurement(measurements, resource_set_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool cc_worker::work_dl()
|
|
|
|
|
{
|
|
|
|
|
// Do NOT process any DL if it is not configured
|
|
|
|
|
if (not configured) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if it is a DL slot, if not skip
|
|
|
|
|
if (!srsran_tdd_nr_is_dl(&phy->cfg.tdd, 0, dl_slot_cfg.idx)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Run FFT
|
|
|
|
|
srsran_ue_dl_nr_estimate_fft(&ue_dl, &dl_slot_cfg);
|
|
|
|
|
|
|
|
|
|
// Decode PDCCH DL first
|
|
|
|
|
decode_pdcch_dl();
|
|
|
|
|
|
|
|
|
|
// Decode PDCCH UL after
|
|
|
|
|
decode_pdcch_ul();
|
|
|
|
|
|
|
|
|
|
// Decode PDSCH
|
|
|
|
|
if (not decode_pdsch_dl()) {
|
|
|
|
|
logger.error("Error decoding PDSCH, aborting work DL");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Measure CSI-RS
|
|
|
|
|
if (not measure()) {
|
|
|
|
|
logger.error("Error measuring CSI-RS, aborting work DL");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|