|
|
@ -22,6 +22,7 @@
|
|
|
|
#ifndef SRSUE_PHY_H
|
|
|
|
#ifndef SRSUE_PHY_H
|
|
|
|
#define SRSUE_PHY_H
|
|
|
|
#define SRSUE_PHY_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "scell/async_scell_recv.h"
|
|
|
|
#include "phy_common.h"
|
|
|
|
#include "phy_common.h"
|
|
|
|
#include "phy_metrics.h"
|
|
|
|
#include "phy_metrics.h"
|
|
|
|
#include "prach.h"
|
|
|
|
#include "prach.h"
|
|
|
@ -31,7 +32,6 @@
|
|
|
|
#include "srslte/interfaces/ue_interfaces.h"
|
|
|
|
#include "srslte/interfaces/ue_interfaces.h"
|
|
|
|
#include "srslte/radio/radio.h"
|
|
|
|
#include "srslte/radio/radio.h"
|
|
|
|
#include "srslte/srslte.h"
|
|
|
|
#include "srslte/srslte.h"
|
|
|
|
#include "srsue/hdr/phy/scell/async_scell_recv.h"
|
|
|
|
|
|
|
|
#include "srsue/hdr/phy/ue_lte_phy_base.h"
|
|
|
|
#include "srsue/hdr/phy/ue_lte_phy_base.h"
|
|
|
|
#include "sync.h"
|
|
|
|
#include "sync.h"
|
|
|
|
|
|
|
|
|
|
|
@ -42,131 +42,130 @@ typedef _Complex float cf_t;
|
|
|
|
class phy : public ue_lte_phy_base, public thread
|
|
|
|
class phy : public ue_lte_phy_base, public thread
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
phy();
|
|
|
|
phy() : workers_pool(MAX_WORKERS), common(MAX_WORKERS), scell_sync(), thread("PHY"){};
|
|
|
|
~phy() = default;
|
|
|
|
~phy() override = default;
|
|
|
|
|
|
|
|
|
|
|
|
// Init defined in base class
|
|
|
|
// Init defined in base class
|
|
|
|
int init(const phy_args_t& args_, srslte::logger* logger_);
|
|
|
|
int init(const phy_args_t& args_, srslte::logger* logger_) final;
|
|
|
|
|
|
|
|
|
|
|
|
// Init for LTE PHYs
|
|
|
|
// Init for LTE PHYs
|
|
|
|
int init(const phy_args_t& args_,
|
|
|
|
int init(const phy_args_t& args_,
|
|
|
|
srslte::logger* logger_,
|
|
|
|
srslte::logger* logger_,
|
|
|
|
stack_interface_phy_lte* stack_,
|
|
|
|
stack_interface_phy_lte* stack_,
|
|
|
|
radio_interface_phy* radio_);
|
|
|
|
radio_interface_phy* radio_) final;
|
|
|
|
|
|
|
|
|
|
|
|
void stop();
|
|
|
|
void stop() final;
|
|
|
|
|
|
|
|
|
|
|
|
void wait_initialize();
|
|
|
|
void wait_initialize() final;
|
|
|
|
bool is_initiated();
|
|
|
|
bool is_initiated();
|
|
|
|
|
|
|
|
|
|
|
|
void get_metrics(phy_metrics_t* m);
|
|
|
|
void get_metrics(phy_metrics_t* m) final;
|
|
|
|
void srslte_phy_logger(phy_logger_level_t log_level, char *str);
|
|
|
|
void srslte_phy_logger(phy_logger_level_t log_level, char *str);
|
|
|
|
|
|
|
|
|
|
|
|
void enable_pregen_signals(bool enable);
|
|
|
|
void enable_pregen_signals(bool enable) final;
|
|
|
|
|
|
|
|
|
|
|
|
void set_earfcn(std::vector<uint32_t> earfcns);
|
|
|
|
void set_earfcn(std::vector<uint32_t> earfcns) final;
|
|
|
|
|
|
|
|
|
|
|
|
void radio_overflow();
|
|
|
|
void radio_overflow() final;
|
|
|
|
void radio_failure();
|
|
|
|
void radio_failure() final;
|
|
|
|
|
|
|
|
|
|
|
|
/********** RRC INTERFACE ********************/
|
|
|
|
/********** RRC INTERFACE ********************/
|
|
|
|
void reset();
|
|
|
|
void reset() final;
|
|
|
|
cell_search_ret_t cell_search(phy_cell_t *cell);
|
|
|
|
cell_search_ret_t cell_search(phy_cell_t* cell) final;
|
|
|
|
bool cell_select(phy_cell_t *cell);
|
|
|
|
bool cell_select(phy_cell_t* cell) final;
|
|
|
|
|
|
|
|
|
|
|
|
void meas_reset();
|
|
|
|
void meas_reset() final;
|
|
|
|
int meas_start(uint32_t earfcn, int pci);
|
|
|
|
int meas_start(uint32_t earfcn, int pci) final;
|
|
|
|
int meas_stop(uint32_t earfcn, int pci);
|
|
|
|
int meas_stop(uint32_t earfcn, int pci) final;
|
|
|
|
|
|
|
|
|
|
|
|
// also MAC interface
|
|
|
|
// also MAC interface
|
|
|
|
bool cell_is_camping();
|
|
|
|
bool cell_is_camping() final;
|
|
|
|
|
|
|
|
|
|
|
|
/********** MAC INTERFACE ********************/
|
|
|
|
/********** MAC INTERFACE ********************/
|
|
|
|
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
|
|
|
|
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
|
|
|
|
void set_crnti(uint16_t rnti);
|
|
|
|
void set_crnti(uint16_t rnti) final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Instructs the PHY to configure using the parameters written by set_param() */
|
|
|
|
/* Instructs the PHY to configure using the parameters written by set_param() */
|
|
|
|
void configure_prach_params();
|
|
|
|
void configure_prach_params() final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Transmits PRACH in the next opportunity */
|
|
|
|
/* Transmits PRACH in the next opportunity */
|
|
|
|
void prach_send(uint32_t preamble_idx, int allowed_subframe = -1, float target_power_dbm = 0.0);
|
|
|
|
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm) final;
|
|
|
|
prach_info_t prach_get_info();
|
|
|
|
prach_info_t prach_get_info() final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Indicates the transmission of a SR signal in the next opportunity */
|
|
|
|
/* Indicates the transmission of a SR signal in the next opportunity */
|
|
|
|
void sr_send();
|
|
|
|
void sr_send() final;
|
|
|
|
int sr_last_tx_tti();
|
|
|
|
int sr_last_tx_tti() final;
|
|
|
|
|
|
|
|
|
|
|
|
// Time advance commands
|
|
|
|
// Time advance commands
|
|
|
|
void set_timeadv_rar(uint32_t ta_cmd);
|
|
|
|
void set_timeadv_rar(uint32_t ta_cmd) final;
|
|
|
|
void set_timeadv(uint32_t ta_cmd);
|
|
|
|
void set_timeadv(uint32_t ta_cmd) final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Activate / Disactivate SCell*/
|
|
|
|
/* Activate / Disactivate SCell*/
|
|
|
|
void set_activation_deactivation_scell(uint32_t ta_cmd);
|
|
|
|
void set_activation_deactivation_scell(uint32_t ta_cmd) final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Sets RAR dci payload */
|
|
|
|
/* Sets RAR dci payload */
|
|
|
|
void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti);
|
|
|
|
void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) final;
|
|
|
|
|
|
|
|
|
|
|
|
/* Get/Set PHY parameters interface from RRC */
|
|
|
|
/* Get/Set PHY parameters interface from RRC */
|
|
|
|
void set_config(phy_cfg_t *phy_cfg);
|
|
|
|
void set_config(phy_cfg_t* phy_cfg) final;
|
|
|
|
void set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config);
|
|
|
|
void set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config) final;
|
|
|
|
void set_config_tdd(asn1::rrc::tdd_cfg_s* tdd);
|
|
|
|
void set_config_tdd(asn1::rrc::tdd_cfg_s* tdd) final;
|
|
|
|
void set_config_mbsfn_sib2(asn1::rrc::sib_type2_s* sib2);
|
|
|
|
void set_config_mbsfn_sib2(asn1::rrc::sib_type2_s* sib2) final;
|
|
|
|
void set_config_mbsfn_sib13(asn1::rrc::sib_type13_r9_s* sib13);
|
|
|
|
void set_config_mbsfn_sib13(asn1::rrc::sib_type13_r9_s* sib13) final;
|
|
|
|
void set_config_mbsfn_mcch(asn1::rrc::mcch_msg_s* mcch);
|
|
|
|
void set_config_mbsfn_mcch(asn1::rrc::mcch_msg_s* mcch) final;
|
|
|
|
|
|
|
|
|
|
|
|
/*Set MAC->PHY MCH period stopping point*/
|
|
|
|
/*Set MAC->PHY MCH period stopping point*/
|
|
|
|
void set_mch_period_stop(uint32_t stop);
|
|
|
|
void set_mch_period_stop(uint32_t stop) final;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float get_phr() final;
|
|
|
|
|
|
|
|
float get_pathloss_db() final;
|
|
|
|
|
|
|
|
|
|
|
|
float get_phr();
|
|
|
|
uint32_t get_current_tti() final;
|
|
|
|
float get_pathloss_db();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t get_current_tti();
|
|
|
|
void get_current_cell(srslte_cell_t* cell, uint32_t* current_earfcn) final;
|
|
|
|
|
|
|
|
uint32_t get_current_earfcn() final;
|
|
|
|
|
|
|
|
uint32_t get_current_pci() final;
|
|
|
|
|
|
|
|
|
|
|
|
void get_current_cell(srslte_cell_t *cell, uint32_t *current_earfcn = NULL);
|
|
|
|
void start_plot() final;
|
|
|
|
uint32_t get_current_earfcn();
|
|
|
|
|
|
|
|
uint32_t get_current_pci();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void start_plot();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const static int MAX_WORKERS = 4;
|
|
|
|
const static int MAX_WORKERS = 4;
|
|
|
|
const static int DEFAULT_WORKERS = 4;
|
|
|
|
const static int DEFAULT_WORKERS = 4;
|
|
|
|
|
|
|
|
|
|
|
|
std::string get_type() { return "lte_soft"; }
|
|
|
|
std::string get_type() final { return "lte_soft"; }
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
void run_thread();
|
|
|
|
void run_thread() final;
|
|
|
|
|
|
|
|
|
|
|
|
bool initiated;
|
|
|
|
bool initiated = false;
|
|
|
|
uint32_t nof_workers;
|
|
|
|
uint32_t nof_workers = 0;
|
|
|
|
|
|
|
|
|
|
|
|
const static int SF_RECV_THREAD_PRIO = 1;
|
|
|
|
const static int SF_RECV_THREAD_PRIO = 1;
|
|
|
|
const static int WORKERS_THREAD_PRIO = 2;
|
|
|
|
const static int WORKERS_THREAD_PRIO = 2;
|
|
|
|
|
|
|
|
|
|
|
|
radio_interface_phy* radio;
|
|
|
|
radio_interface_phy* radio = nullptr;
|
|
|
|
std::vector<srslte::log_filter*> log_vec;
|
|
|
|
std::vector<srslte::log_filter*> log_vec;
|
|
|
|
srslte::logger* logger;
|
|
|
|
srslte::logger* logger = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
srslte::log* log_h;
|
|
|
|
srslte::log* log_h = nullptr;
|
|
|
|
srslte::log *log_phy_lib_h;
|
|
|
|
srslte::log* log_phy_lib_h = nullptr;
|
|
|
|
srsue::stack_interface_phy_lte* stack;
|
|
|
|
srsue::stack_interface_phy_lte* stack = nullptr;
|
|
|
|
|
|
|
|
|
|
|
|
srslte::thread_pool workers_pool;
|
|
|
|
srslte::thread_pool workers_pool;
|
|
|
|
std::vector<sf_worker*> workers;
|
|
|
|
std::vector<std::unique_ptr<sf_worker> > workers;
|
|
|
|
phy_common common;
|
|
|
|
phy_common common;
|
|
|
|
sync sfsync;
|
|
|
|
sync sfsync;
|
|
|
|
scell::async_recv_vector scell_sync;
|
|
|
|
scell::async_recv_vector scell_sync;
|
|
|
|
uint32_t scell_earfcn[SRSLTE_MAX_CARRIERS - 1];
|
|
|
|
uint32_t scell_earfcn[SRSLTE_MAX_CARRIERS - 1] = {};
|
|
|
|
prach prach_buffer;
|
|
|
|
prach prach_buffer;
|
|
|
|
|
|
|
|
|
|
|
|
srslte_prach_cfg_t prach_cfg;
|
|
|
|
srslte_prach_cfg_t prach_cfg = {};
|
|
|
|
srslte_tdd_config_t tdd_config;
|
|
|
|
srslte_tdd_config_t tdd_config = {};
|
|
|
|
|
|
|
|
|
|
|
|
phy_interface_rrc_lte::phy_cfg_t config;
|
|
|
|
phy_interface_rrc_lte::phy_cfg_t config = {};
|
|
|
|
phy_args_t args;
|
|
|
|
phy_args_t args = {};
|
|
|
|
|
|
|
|
|
|
|
|
/* Current time advance */
|
|
|
|
/* Current time advance */
|
|
|
|
uint32_t n_ta;
|
|
|
|
uint32_t n_ta = 0;
|
|
|
|
|
|
|
|
|
|
|
|
void set_default_args(phy_args_t *args);
|
|
|
|
void set_default_args(phy_args_t *args);
|
|
|
|
bool check_args(const phy_args_t& args);
|
|
|
|
bool check_args(const phy_args_t& args);
|
|
|
|