srsLTE/srsenb/hdr/enb.h

165 lines
3.9 KiB
C
Raw Normal View History

/**
2017-06-02 03:46:06 -07:00
*
* \section COPYRIGHT
2017-06-02 03:46:06 -07:00
*
* Copyright 2013-2020 Software Radio Systems Limited
2017-06-02 03:46:06 -07:00
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
2017-06-02 03:46:06 -07:00
*
*/
2017-06-01 03:25:57 -07:00
/******************************************************************************
* File: enb.h
* Description: Top-level eNodeB class. Creates and links all
* layers and helpers.
*****************************************************************************/
2018-03-31 10:04:04 -07:00
#ifndef SRSENB_ENB_H
#define SRSENB_ENB_H
2017-06-01 03:25:57 -07:00
#include <pthread.h>
2017-06-01 03:25:57 -07:00
#include <stdarg.h>
#include <string>
#include "phy/phy.h"
#include "srslte/radio/radio.h"
2017-06-01 03:25:57 -07:00
#include "srsenb/hdr/phy/enb_phy_base.h"
#include "srsenb/hdr/stack/enb_stack_base.h"
#include "srsenb/hdr/stack/rrc/rrc_config.h"
2017-06-01 03:25:57 -07:00
#include "srslte/common/bcd_helpers.h"
#include "srslte/common/buffer_pool.h"
#include "srslte/common/interfaces_common.h"
2017-06-01 03:25:57 -07:00
#include "srslte/common/log_filter.h"
#include "srslte/common/mac_pcap.h"
#include "srslte/common/security.h"
#include "srslte/interfaces/enb_command_interface.h"
2017-06-01 03:25:57 -07:00
#include "srslte/interfaces/enb_metrics_interface.h"
#include "srslte/interfaces/sched_interface.h"
#include "srslte/interfaces/ue_interfaces.h"
2017-06-01 03:25:57 -07:00
namespace srsenb {
/*******************************************************************************
eNodeB Parameters
*******************************************************************************/
struct enb_args_t {
uint32_t enb_id;
uint32_t dl_earfcn; // By default the EARFCN from rr.conf's cell list are used but this value can be used for single
// cell eNB
uint32_t n_prb;
uint32_t nof_ports;
uint32_t transmission_mode;
float p_a;
};
2017-06-01 03:25:57 -07:00
struct enb_files_t {
2017-06-01 03:25:57 -07:00
std::string sib_config;
std::string rr_config;
std::string drb_config;
};
2017-06-01 03:25:57 -07:00
struct log_args_t {
std::string all_level;
int phy_hex_limit;
int all_hex_limit;
int file_max_size;
std::string filename;
};
2017-06-01 03:25:57 -07:00
struct gui_args_t {
bool enable;
};
2017-06-01 03:25:57 -07:00
struct general_args_t {
uint32_t rrc_inactivity_timer;
2018-11-20 02:59:04 -08:00
float metrics_period_secs;
bool metrics_csv_enable;
std::string metrics_csv_filename;
bool report_json_enable;
std::string report_json_filename;
bool alarms_log_enable;
std::string alarms_filename;
2018-11-20 02:59:04 -08:00
bool print_buffer_state;
2019-02-15 04:45:00 -08:00
std::string eia_pref_list;
std::string eea_pref_list;
};
2017-06-01 03:25:57 -07:00
struct all_args_t {
enb_args_t enb;
enb_files_t enb_files;
srslte::rf_args_t rf;
log_args_t log;
gui_args_t gui;
general_args_t general;
phy_args_t phy;
stack_args_t stack;
};
2017-06-01 03:25:57 -07:00
struct rrc_cfg_t;
2017-06-01 03:25:57 -07:00
/*******************************************************************************
Main eNB class
2017-06-01 03:25:57 -07:00
*******************************************************************************/
class enb : public enb_metrics_interface, enb_command_interface
{
2017-06-01 03:25:57 -07:00
public:
enb();
2017-09-05 07:51:44 -07:00
virtual ~enb();
2017-06-01 03:25:57 -07:00
int init(const all_args_t& args_, srslte::logger* logger_);
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
void stop();
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
void start_plot();
2017-09-05 07:51:44 -07:00
2018-05-10 07:40:37 -07:00
void print_pool();
2017-06-01 03:25:57 -07:00
// eNodeB metrics interface
bool get_metrics(enb_metrics_t* m) override;
// eNodeB command interface
void cmd_cell_gain(uint32_t cell_id, float gain) override;
2017-06-01 03:25:57 -07:00
private:
const static int ENB_POOL_SIZE = 1024 * 10;
2018-07-06 06:30:51 -07:00
int parse_args(const all_args_t& args_, rrc_cfg_t& rrc_cfg);
srslte::logger* logger = nullptr;
srslte::log_ref log; // Own logger for eNB
srslte::log_filter pool_log;
2017-06-01 03:25:57 -07:00
srslte::byte_buffer_pool* pool = nullptr;
all_args_t args = {};
bool started = false;
2017-06-01 03:25:57 -07:00
phy_cfg_t phy_cfg = {};
rrc_cfg_t rrc_cfg = {};
// eNB components
std::unique_ptr<enb_stack_base> stack = nullptr;
std::unique_ptr<srslte::radio_base> radio = nullptr;
std::unique_ptr<enb_phy_base> phy = nullptr;
2017-06-01 03:25:57 -07:00
srslte::LOG_LEVEL_ENUM level(std::string l);
2019-01-17 03:42:01 -08:00
2018-10-01 12:43:42 -07:00
std::string get_build_mode();
std::string get_build_info();
std::string get_build_string();
2017-06-01 03:25:57 -07:00
};
} // namespace srsenb
2018-03-31 10:04:04 -07:00
#endif // SRSENB_ENB_H