srsLTE/srsenb/hdr/enb.h

181 lines
4.4 KiB
C
Raw Normal View History

2019-04-26 12:27:38 -07:00
/*
* Copyright 2013-2019 Software Radio Systems Limited
2017-06-02 03:46:06 -07:00
*
* This file is part of srsLTE.
*
2019-04-26 12:27:38 -07:00
* srsLTE is free software: you can redistribute it and/or modify
2017-06-02 03:46:06 -07:00
* 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.
*
2019-04-26 12:27:38 -07:00
* srsLTE is distributed in the hope that it will be useful,
2017-06-02 03:46:06 -07:00
* 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/.
*
*/
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 "srsenb/hdr/stack/rrc/rrc.h"
2017-06-01 03:25:57 -07:00
#include "srslte/radio/radio_base.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/enb_stack_lte.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/logger_file.h"
2017-06-01 03:25:57 -07:00
#include "srslte/common/mac_pcap.h"
#include "srslte/common/security.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 dl_earfcn;
uint32_t ul_earfcn;
uint32_t n_prb;
uint32_t pci;
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 {
2018-11-20 02:59:04 -08:00
uint32_t rrc_inactivity_timer;
float metrics_period_secs;
bool metrics_csv_enable;
std::string metrics_csv_filename;
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
/*******************************************************************************
Main eNB class
2017-06-01 03:25:57 -07:00
*******************************************************************************/
class enb : public enb_metrics_interface
{
2017-06-01 03:25:57 -07:00
public:
static enb* get_instance(void);
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
static void cleanup(void);
int init(const all_args_t& args_);
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
static void rf_msg(srslte_rf_error_t error);
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
void handle_rf_msg(srslte_rf_error_t error);
// eNodeB metrics interface
bool get_metrics(enb_metrics_t* m);
2017-06-01 03:25:57 -07:00
private:
static enb* instance;
2017-09-05 07:51:44 -07:00
const static int ENB_POOL_SIZE = 1024 * 10;
2018-07-06 06:30:51 -07:00
2017-06-01 03:25:57 -07:00
enb();
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
virtual ~enb();
int parse_args(const all_args_t& args_);
// 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-09-05 07:51:44 -07:00
srslte::logger_stdout logger_stdout;
srslte::logger_file logger_file;
srslte::logger* logger = nullptr;
srslte::log_filter 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 = {};
2017-06-01 03:25:57 -07:00
srslte::LOG_LEVEL_ENUM level(std::string l);
2019-01-17 03:42:01 -08:00
// bool check_srslte_version();
int parse_cell_cfg(all_args_t* args, srslte_cell_t* cell);
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