From 8b2514ded35e591f469565602dc750a77e6d2ff3 Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Thu, 23 Sep 2021 19:19:59 +0200 Subject: [PATCH] Added NZP-CSI-RS signals in gNb --- lib/include/srsran/phy/gnb/gnb_dl.h | 5 +++++ lib/src/phy/gnb/gnb_dl.c | 16 ++++++++++++++++ srsenb/src/phy/nr/slot_worker.cc | 7 +++++-- test/phy/dummy_gnb_stack.h | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/lib/include/srsran/phy/gnb/gnb_dl.h b/lib/include/srsran/phy/gnb/gnb_dl.h index 77f0b07d0..909a42a03 100644 --- a/lib/include/srsran/phy/gnb/gnb_dl.h +++ b/lib/include/srsran/phy/gnb/gnb_dl.h @@ -13,6 +13,7 @@ #ifndef SRSRAN_GNB_DL_H #define SRSRAN_GNB_DL_H +#include "srsran/phy/ch_estimation/csi_rs.h" #include "srsran/phy/common/phy_common_nr.h" #include "srsran/phy/dft/ofdm.h" #include "srsran/phy/phch/pdcch_cfg_nr.h" @@ -78,4 +79,8 @@ srsran_gnb_dl_pdcch_dl_info(const srsran_gnb_dl_t* q, const srsran_dci_dl_nr_t* SRSRAN_API int srsran_gnb_dl_pdcch_ul_info(const srsran_gnb_dl_t* q, const srsran_dci_ul_nr_t* dci, char* str, uint32_t str_len); +SRSRAN_API int srsran_gnb_dl_nzp_csi_rs_put(srsran_gnb_dl_t* q, + const srsran_slot_cfg_t* slot_cfg, + const srsran_csi_rs_nzp_resource_t* resource); + #endif // SRSRAN_GNB_DL_H diff --git a/lib/src/phy/gnb/gnb_dl.c b/lib/src/phy/gnb/gnb_dl.c index e977007f1..f9554dac1 100644 --- a/lib/src/phy/gnb/gnb_dl.c +++ b/lib/src/phy/gnb/gnb_dl.c @@ -309,3 +309,19 @@ int srsran_gnb_dl_pdcch_ul_info(const srsran_gnb_dl_t* q, const srsran_dci_ul_nr return len; } + +int srsran_gnb_dl_nzp_csi_rs_put(srsran_gnb_dl_t* q, + const srsran_slot_cfg_t* slot_cfg, + const srsran_csi_rs_nzp_resource_t* resource) +{ + if (q == NULL) { + return SRSRAN_ERROR_INVALID_INPUTS; + } + + if (srsran_csi_rs_nzp_put_resource(&q->carrier, slot_cfg, resource, q->sf_symbols[0]) < SRSRAN_SUCCESS) { + ERROR("Error putting NZP-CSI-RS resource"); + return SRSRAN_ERROR; + } + + return SRSRAN_SUCCESS; +} diff --git a/srsenb/src/phy/nr/slot_worker.cc b/srsenb/src/phy/nr/slot_worker.cc index 2600940c0..cf49708f2 100644 --- a/srsenb/src/phy/nr/slot_worker.cc +++ b/srsenb/src/phy/nr/slot_worker.cc @@ -330,8 +330,11 @@ bool slot_worker::work_dl() } // Put NZP-CSI-RS - for (srsran_csi_rs_nzp_resource_t& pdsch : dl_sched.nzp_csi_rs) { - // ... + for (srsran_csi_rs_nzp_resource_t& nzp_csi_rs : dl_sched.nzp_csi_rs) { + if (srsran_gnb_dl_nzp_csi_rs_put(&gnb_dl, &dl_slot_cfg, &nzp_csi_rs) < SRSRAN_SUCCESS) { + logger.error("NZP-CSI-RS: Error putting signal"); + return false; + } } // Generate baseband signal diff --git a/test/phy/dummy_gnb_stack.h b/test/phy/dummy_gnb_stack.h index 50adf8dfe..a71b5589a 100644 --- a/test/phy/dummy_gnb_stack.h +++ b/test/phy/dummy_gnb_stack.h @@ -484,6 +484,20 @@ public: return SRSRAN_ERROR; } + // Schedule NZP-CSI-RS, iterate all NZP-CSI-RS sets + for (const srsran_csi_rs_nzp_set_t& set : phy_cfg.pdsch.nzp_csi_rs_sets) { + // For each NZP-CSI-RS resource available in the set + for (uint32_t i = 0; i < set.count; i++) { + // Select resource + const srsran_csi_rs_nzp_resource_t& nzp_csi_resource = set.data[i]; + + // Check if the resource is scheduled for this slot + if (srsran_csi_rs_send(&nzp_csi_resource.periodicity, &slot_cfg)) { + dl_sched.nzp_csi_rs.push_back(nzp_csi_resource); + } + } + } + return SRSRAN_SUCCESS; }