Isolate gNb PHY init

master
Xavier Arteaga 3 years ago committed by Xavier Arteaga
parent cdd33795ed
commit 2d737016be

@ -25,7 +25,10 @@
namespace srsenb {
class phy final : public enb_phy_base, public phy_interface_stack_lte, public srsran::phy_interface_radio
class phy final : public enb_phy_base,
public phy_interface_stack_lte,
public phy_interface_stack_nr,
public srsran::phy_interface_radio
{
public:
phy(srslog::sink& log_sink);
@ -61,6 +64,9 @@ public:
void srsran_phy_logger(phy_logger_level_t log_level, char* str);
int init_nr(const phy_cfg_t& cfg, stack_interface_phy_nr& stack);
int set_common_cfg(const common_cfg_t& common_cfg) override;
private:
srsran::phy_cfg_mbsfn_t mbsfn_config = {};
uint32_t nof_workers = 0;

@ -31,10 +31,10 @@ public:
bool init(stack_interface_phy_lte* stack_,
srsran::radio_interface_phy* radio_handler,
lte::worker_pool* lte_workers_,
nr::worker_pool* nr_workers_,
phy_common* worker_com,
prach_worker_pool* prach_,
uint32_t prio);
bool set_nr_workers(nr::worker_pool* nr_workers_);
void stop();
private:

@ -130,12 +130,6 @@ int phy::init(const phy_args_t& args,
if (not cfg.phy_cell_cfg.empty()) {
lte_workers.init(args, &workers_common, log_sink, WORKERS_THREAD_PRIO);
}
if (not cfg.phy_cell_cfg_nr.empty()) {
// Not implemented
// nr_workers = std::unique_ptr<nr::worker_pool>(
// new nr::worker_pool(cfg.phy_cell_cfg_nr, workers_common, stack_, log_sink, MAX_WORKERS,
// WORKERS_THREAD_PRIO));
}
// For each carrier, initialise PRACH worker
for (uint32_t cc = 0; cc < cfg.phy_cell_cfg.size(); cc++) {
@ -146,7 +140,7 @@ int phy::init(const phy_args_t& args,
prach.set_max_prach_offset_us(args.max_prach_offset_us);
// Warning this must be initialized after all workers have been added to the pool
tx_rx.init(stack_, radio, &lte_workers, nr_workers.get(), &workers_common, &prach, SF_RECV_THREAD_PRIO);
tx_rx.init(stack_, radio, &lte_workers, &workers_common, &prach, SF_RECV_THREAD_PRIO);
initialized = true;
@ -300,4 +294,32 @@ void phy::start_plot()
lte_workers[0]->start_plot();
}
int phy::init_nr(const phy_cfg_t& cfg, stack_interface_phy_nr& stack)
{
if (cfg.phy_cell_cfg_nr.empty()) {
return SRSRAN_SUCCESS;
}
nr_workers = std::unique_ptr<nr::worker_pool>(new nr::worker_pool(workers_common, stack, log_sink, MAX_WORKERS));
nr::worker_pool::args_t args = {};
if (not nr_workers->init(args, cfg.phy_cell_cfg_nr)) {
return SRSRAN_ERROR;
}
tx_rx.set_nr_workers(nr_workers.get());
return SRSRAN_SUCCESS;
}
int phy::set_common_cfg(const phy_interface_rrc_nr::common_cfg_t& common_cfg)
{
if (nr_workers.get() == nullptr) {
return SRSRAN_ERROR;
}
return nr_workers->set_common_cfg(common_cfg);
}
} // namespace srsenb

@ -42,7 +42,6 @@ txrx::txrx(srslog::basic_logger& logger) : thread("TXRX"), logger(logger), runni
bool txrx::init(stack_interface_phy_lte* stack_,
srsran::radio_interface_phy* radio_h_,
lte::worker_pool* lte_workers_,
nr::worker_pool* nr_workers_,
phy_common* worker_com_,
prach_worker_pool* prach_,
uint32_t prio_)
@ -50,7 +49,6 @@ bool txrx::init(stack_interface_phy_lte* stack_,
stack = stack_;
radio_h = radio_h_;
lte_workers = lte_workers_;
nr_workers = nr_workers_;
worker_com = worker_com_;
prach = prach_;
running = true;
@ -65,6 +63,12 @@ bool txrx::init(stack_interface_phy_lte* stack_,
return true;
}
bool txrx::set_nr_workers(nr::worker_pool* nr_workers_)
{
nr_workers = nr_workers_;
return true;
}
void txrx::stop()
{
if (running) {
@ -125,7 +129,7 @@ void txrx::run_thread()
}
nr::slot_worker* nr_worker = nullptr;
if (worker_com->get_nof_carriers_nr() > 0) {
if (nr_workers != nullptr and worker_com->get_nof_carriers_nr() > 0) {
nr_worker = nr_workers->wait_worker(tti);
if (nr_worker == nullptr) {
running = false;

Loading…
Cancel
Save