mirror of https://github.com/pvnis/srsRAN_4G.git
added vnf phy nr
parent
b05ce2fe57
commit
27e5d98ef9
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSGNB_NR_VNF_PHY_H
|
||||
#define SRSGNB_NR_VNF_PHY_H
|
||||
|
||||
#include "srsenb/hdr/phy/enb_phy_base.h"
|
||||
#include "srsenb/hdr/phy/phy_common.h"
|
||||
#include "srslte/common/basic_vnf.h"
|
||||
#include "srslte/common/log.h"
|
||||
#include "srslte/common/log_filter.h"
|
||||
#include "srslte/interfaces/enb_metrics_interface.h"
|
||||
#include "srslte/interfaces/gnb_interfaces.h"
|
||||
#include "srslte/interfaces/radio_interfaces.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
struct nr_phy_cfg_t {
|
||||
// TODO: add cell and RRC configs
|
||||
};
|
||||
|
||||
class vnf_phy_nr : public srsenb::enb_phy_base, public srsenb::phy_interface_stack_nr
|
||||
{
|
||||
public:
|
||||
vnf_phy_nr(srslte::logger* logger_);
|
||||
~vnf_phy_nr();
|
||||
|
||||
int init(const srsenb::phy_args_t& args, const nr_phy_cfg_t& cfg, srsenb::stack_interface_phy_nr* stack_);
|
||||
void stop();
|
||||
|
||||
std::string get_type() { return "vnf"; };
|
||||
|
||||
void start_plot();
|
||||
|
||||
void get_metrics(srsenb::phy_metrics_t metrics[ENB_METRICS_MAX_USERS]);
|
||||
|
||||
// MAC interface
|
||||
int dl_config_request(const dl_config_request_t& request);
|
||||
int tx_request(const tx_request_t& request);
|
||||
|
||||
private:
|
||||
srslte::logger* logger = nullptr;
|
||||
|
||||
std::unique_ptr<srslte::srslte_basic_vnf> vnf = nullptr;
|
||||
|
||||
bool initialized = false;
|
||||
|
||||
void parse_config(const nr_phy_cfg_t& cfg);
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSGNB_NR_VNF_PHY_H
|
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <strings.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "srsenb/hdr/phy/vnf_phy_nr.h"
|
||||
#include "srslte/common/basic_vnf_api.h"
|
||||
#include "srslte/common/log.h"
|
||||
#include "srslte/common/threads.h"
|
||||
|
||||
#define Error(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->error(fmt, ##__VA_ARGS__)
|
||||
#define Warning(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->warning(fmt, ##__VA_ARGS__)
|
||||
#define Info(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->info(fmt, ##__VA_ARGS__)
|
||||
#define Debug(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->debug(fmt, ##__VA_ARGS__)
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
vnf_phy_nr::vnf_phy_nr(srslte::logger* logger_) : logger(logger_) {}
|
||||
|
||||
vnf_phy_nr::~vnf_phy_nr()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
void vnf_phy_nr::parse_config(const nr_phy_cfg_t& cfg) {}
|
||||
|
||||
int vnf_phy_nr::init(const srsenb::phy_args_t& args, const nr_phy_cfg_t& cfg, srsenb::stack_interface_phy_nr* stack_)
|
||||
{
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
// create VNF
|
||||
vnf = std::unique_ptr<srslte::srslte_basic_vnf>(new srslte::srslte_basic_vnf(args.vnf_args, logger, stack_));
|
||||
|
||||
initialized = true;
|
||||
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
void vnf_phy_nr::stop()
|
||||
{
|
||||
if (initialized) {
|
||||
vnf->stop();
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Start GUI
|
||||
void vnf_phy_nr::start_plot() {}
|
||||
|
||||
void vnf_phy_nr::get_metrics(srsenb::phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) {}
|
||||
|
||||
int vnf_phy_nr::dl_config_request(const dl_config_request_t& request)
|
||||
{
|
||||
// prepare DL config request over basic API and send
|
||||
return vnf->dl_config_request(request);
|
||||
}
|
||||
|
||||
int vnf_phy_nr::tx_request(const tx_request_t& request)
|
||||
{
|
||||
// send Tx request over basic API
|
||||
return vnf->tx_request(request);
|
||||
}
|
||||
|
||||
} // namespace srsenb
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* File: ue_nr_phy_base.h
|
||||
* Description: Base class for UE NR PHYs.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SRSUE_UE_NR_PHY_BASE_H
|
||||
#define SRSUE_UE_NR_PHY_BASE_H
|
||||
|
||||
#include "srslte/common/log_filter.h"
|
||||
#include "srslte/interfaces/radio_interfaces.h"
|
||||
#include "srslte/interfaces/ue_nr_interfaces.h"
|
||||
#include "srsue/hdr/phy/ue_phy_base.h"
|
||||
|
||||
namespace srsue {
|
||||
|
||||
class ue_nr_phy_base : public ue_phy_base, public phy_interface_stack_nr, public srslte::phy_interface_radio
|
||||
{
|
||||
public:
|
||||
ue_nr_phy_base(){};
|
||||
virtual ~ue_nr_phy_base() {}
|
||||
|
||||
virtual std::string get_type() = 0;
|
||||
|
||||
virtual int init(const phy_args_t& args_) = 0;
|
||||
virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
|
||||
|
||||
virtual void wait_initialize() = 0;
|
||||
virtual void start_plot() = 0;
|
||||
|
||||
virtual void get_metrics(phy_metrics_t* m) = 0;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
||||
#endif // SRSUE_UE_NR_PHY_BASE_H
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSUE_VNF_PHY_NR_H
|
||||
#define SRSUE_VNF_PHY_NR_H
|
||||
|
||||
#include "srsenb/hdr/phy/phy_common.h"
|
||||
#include "srslte/common/basic_vnf.h"
|
||||
#include "srslte/common/log.h"
|
||||
#include "srslte/common/log_filter.h"
|
||||
#include "srslte/interfaces/enb_metrics_interface.h"
|
||||
#include "srslte/interfaces/radio_interfaces.h"
|
||||
#include "srslte/interfaces/ue_interfaces.h"
|
||||
#include "srslte/interfaces/ue_nr_interfaces.h"
|
||||
#include "srsue/hdr/phy/ue_nr_phy_base.h"
|
||||
|
||||
namespace srsue {
|
||||
|
||||
class vnf_phy_nr : public srsue::ue_phy_base, public srsue::phy_interface_stack_nr
|
||||
{
|
||||
public:
|
||||
vnf_phy_nr(srslte::logger* logger_);
|
||||
~vnf_phy_nr();
|
||||
|
||||
int init(const srsue::phy_args_t& args, srsue::stack_interface_phy_nr* stack_);
|
||||
|
||||
int init(const srsue::phy_args_t& args_);
|
||||
|
||||
void set_earfcn(std::vector<uint32_t> earfcns);
|
||||
|
||||
void stop();
|
||||
|
||||
void wait_initialize();
|
||||
void get_metrics(phy_metrics_t* m);
|
||||
|
||||
std::string get_type() { return "vnf_nr"; };
|
||||
|
||||
void start_plot();
|
||||
|
||||
// MAC interface
|
||||
int tx_request(const tx_request_t& request);
|
||||
|
||||
private:
|
||||
srslte::logger* logger = nullptr;
|
||||
|
||||
std::unique_ptr<srslte::srslte_basic_vnf> vnf;
|
||||
|
||||
srsue::stack_interface_phy_nr* stack = nullptr;
|
||||
|
||||
bool initialized = false;
|
||||
};
|
||||
|
||||
} // namespace srsue
|
||||
|
||||
#endif // SRSUE_VNF_PHY_NR_H
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Software Radio Systems Limited
|
||||
*
|
||||
* This file is part of srsLTE.
|
||||
*
|
||||
* srsLTE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* srsLTE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* A copy of the GNU Affero General Public License can be found in
|
||||
* the LICENSE file in the top-level directory of this distribution
|
||||
* and at http://www.gnu.org/licenses/.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <strings.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "srslte/common/basic_vnf_api.h"
|
||||
#include "srslte/common/log.h"
|
||||
#include "srslte/common/threads.h"
|
||||
#include "srsue/hdr/phy/vnf_phy_nr.h"
|
||||
|
||||
#define Error(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->error(fmt, ##__VA_ARGS__)
|
||||
#define Warning(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->warning(fmt, ##__VA_ARGS__)
|
||||
#define Info(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->info(fmt, ##__VA_ARGS__)
|
||||
#define Debug(fmt, ...) \
|
||||
if (SRSLTE_DEBUG_ENABLED) \
|
||||
log_h->debug(fmt, ##__VA_ARGS__)
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace srsue {
|
||||
|
||||
vnf_phy_nr::vnf_phy_nr(srslte::logger* logger_) : logger(logger_) {}
|
||||
|
||||
vnf_phy_nr::~vnf_phy_nr()
|
||||
{
|
||||
stop();
|
||||
}
|
||||
|
||||
int vnf_phy_nr::init(const srsue::phy_args_t& args_, srsue::stack_interface_phy_nr* stack_)
|
||||
{
|
||||
stack = stack_;
|
||||
return init(args_);
|
||||
}
|
||||
|
||||
int vnf_phy_nr::init(const srsue::phy_args_t& args_)
|
||||
{
|
||||
// create VNF
|
||||
vnf = std::unique_ptr<srslte::srslte_basic_vnf>(new srslte::srslte_basic_vnf(args_.vnf_args, logger, stack));
|
||||
initialized = true;
|
||||
return SRSLTE_SUCCESS;
|
||||
}
|
||||
|
||||
void vnf_phy_nr::set_earfcn(std::vector<uint32_t> earfcns) {}
|
||||
|
||||
void vnf_phy_nr::stop()
|
||||
{
|
||||
if (initialized) {
|
||||
vnf->stop();
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Start GUI
|
||||
void vnf_phy_nr::start_plot() {}
|
||||
|
||||
void vnf_phy_nr::wait_initialize() {}
|
||||
|
||||
void vnf_phy_nr::get_metrics(phy_metrics_t* m) {}
|
||||
|
||||
int vnf_phy_nr::tx_request(const tx_request_t& request)
|
||||
{
|
||||
// send Tx request over basic API
|
||||
return vnf->tx_request(request);
|
||||
}
|
||||
|
||||
} // namespace srsue
|
Loading…
Reference in New Issue