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 <stdarg.h>
|
|
|
|
#include <string>
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#include "phy/phy.h"
|
2019-06-06 07:52:37 -07:00
|
|
|
#include "srsenb/hdr/stack/rrc/rrc.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-05 07:47:39 -07:00
|
|
|
#include "srslte/radio/radio_base.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-05 07:47:39 -07:00
|
|
|
#include "srsenb/hdr/phy/enb_phy_base.h"
|
2019-06-06 07:52:37 -07:00
|
|
|
#include "srsenb/hdr/stack/enb_stack_base.h"
|
2019-07-05 07:47:39 -07:00
|
|
|
#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"
|
2019-07-05 07:47:39 -07:00
|
|
|
#include "srslte/common/interfaces_common.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
#include "srslte/common/log_filter.h"
|
2019-06-06 07:52:37 -07:00
|
|
|
#include "srslte/common/logger_file.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
#include "srslte/common/mac_pcap.h"
|
2019-06-06 07:52:37 -07:00
|
|
|
#include "srslte/common/security.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
#include "srslte/interfaces/enb_metrics_interface.h"
|
2019-06-06 07:52:37 -07:00
|
|
|
#include "srslte/interfaces/sched_interface.h"
|
|
|
|
#include "srslte/interfaces/ue_interfaces.h"
|
2017-06-01 03:25:57 -07:00
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
eNodeB Parameters
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
struct enb_args_t {
|
2019-07-05 07:47:39 -07:00
|
|
|
uint32_t dl_earfcn;
|
|
|
|
uint32_t ul_earfcn;
|
2019-06-06 07:52:37 -07:00
|
|
|
uint32_t n_prb;
|
|
|
|
uint32_t pci;
|
2017-10-10 04:24:23 -07:00
|
|
|
uint32_t nof_ports;
|
|
|
|
uint32_t transmission_mode;
|
2017-11-22 09:01:13 -08:00
|
|
|
float p_a;
|
2019-06-06 07:52:37 -07:00
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
struct enb_files_t {
|
2017-06-01 03:25:57 -07:00
|
|
|
std::string sib_config;
|
2019-06-06 07:52:37 -07:00
|
|
|
std::string rr_config;
|
|
|
|
std::string drb_config;
|
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-16 13:43:36 -07:00
|
|
|
struct log_args_t {
|
2019-06-06 07:52:37 -07:00
|
|
|
std::string all_level;
|
|
|
|
int phy_hex_limit;
|
2019-07-05 07:47:39 -07:00
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
int all_hex_limit;
|
|
|
|
int file_max_size;
|
|
|
|
std::string filename;
|
2019-07-16 13:43:36 -07:00
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
struct gui_args_t {
|
|
|
|
bool enable;
|
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-16 13:43:36 -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;
|
2019-06-06 07:52:37 -07:00
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
struct all_args_t {
|
2019-07-16 13:43:36 -07:00
|
|
|
enb_args_t enb;
|
|
|
|
enb_files_t enb_files;
|
2019-07-05 07:47:39 -07:00
|
|
|
srslte::rf_args_t rf;
|
2019-07-16 13:43:36 -07:00
|
|
|
log_args_t log;
|
|
|
|
gui_args_t gui;
|
|
|
|
general_args_t general;
|
|
|
|
phy_args_t phy;
|
2019-07-05 07:47:39 -07:00
|
|
|
stack_args_t stack;
|
2019-06-06 07:52:37 -07:00
|
|
|
};
|
2017-06-01 03:25:57 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
2018-10-01 12:59:07 -07:00
|
|
|
Main eNB class
|
2017-06-01 03:25:57 -07:00
|
|
|
*******************************************************************************/
|
|
|
|
|
2019-06-06 07:52:37 -07:00
|
|
|
class enb : public enb_metrics_interface
|
|
|
|
{
|
2017-06-01 03:25:57 -07:00
|
|
|
public:
|
2017-09-05 07:51:44 -07:00
|
|
|
static enb *get_instance(void);
|
|
|
|
|
2017-06-01 03:25:57 -07:00
|
|
|
static void cleanup(void);
|
|
|
|
|
2019-07-05 07:47:39 -07:00
|
|
|
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
|
2019-05-07 01:11:57 -07:00
|
|
|
bool get_metrics(enb_metrics_t* m);
|
2017-06-01 03:25:57 -07:00
|
|
|
|
|
|
|
private:
|
2019-12-05 08:15:15 -08:00
|
|
|
static enb* instance;
|
2017-09-05 07:51:44 -07:00
|
|
|
|
2018-07-06 06:30:51 -07:00
|
|
|
const static int ENB_POOL_SIZE = 1024*10;
|
|
|
|
|
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();
|
|
|
|
|
2019-07-05 07:47:39 -07:00
|
|
|
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
|
|
|
|
2017-09-21 12:21:35 -07:00
|
|
|
srslte::logger_stdout logger_stdout;
|
|
|
|
srslte::logger_file logger_file;
|
2019-07-05 07:47:39 -07:00
|
|
|
srslte::logger* logger = nullptr;
|
|
|
|
srslte::log_filter log; // Own logger for eNB
|
2017-09-21 12:21:35 -07:00
|
|
|
|
2018-07-12 07:57:22 -07:00
|
|
|
srslte::log_filter pool_log;
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-05 07:47:39 -07:00
|
|
|
srslte::byte_buffer_pool* pool = nullptr;
|
|
|
|
|
|
|
|
all_args_t args = {};
|
|
|
|
bool started = false;
|
2017-06-01 03:25:57 -07:00
|
|
|
|
2019-07-05 07:47:39 -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();
|
2019-12-05 08:15:15 -08:00
|
|
|
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
|
2017-06-01 03:25:57 -07:00
|
|
|
|