srsLTE/srsue/test/ttcn3/hdr/lte_ttcn3_phy.h

139 lines
3.9 KiB
C
Raw Normal View History

/**
2019-09-16 12:17:21 -07:00
*
* \section COPYRIGHT
2019-09-16 12:17:21 -07:00
*
* Copyright 2013-2020 Software Radio Systems Limited
2019-09-16 12:17:21 -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.
2019-09-16 12:17:21 -07:00
*
*/
#ifndef SRSUE_TTCN3_LTE_PHY_H
#define SRSUE_TTCN3_LTE_PHY_H
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/interfaces/ue_phy_interfaces.h"
2019-09-16 12:17:21 -07:00
#include "srsue/hdr/phy/ue_lte_phy_base.h"
#include "srsue/hdr/ue.h"
#include "ttcn3_interfaces.h"
#include <srslte/phy/phch/dci.h>
using namespace srsue;
using namespace srslte;
namespace srsue {
class lte_ttcn3_phy : public ue_lte_phy_base
{
public:
2020-01-29 03:04:05 -08:00
void set_cells_to_meas(uint32_t earfcn, const std::set<uint32_t>& pci) override;
2019-09-16 12:17:21 -07:00
typedef struct {
srslte_cell_t info;
float power;
uint32_t earfcn;
} cell_t;
typedef std::vector<cell_t> cell_list_t;
Upgrade loggers in srsue (#2163) * Replaced UE logger in the ue class. * Replaced loggers in the main phy class and prach. * Replaced loggers in phy common and ta_control. * Replace loggers in cc and sf workers. * Replaced loggers in intra_measure, scell_recv, search, sfn_sync, sync. * Remove last uses of the old loggers in the main phy class. * Remove stray newline in logs. * Replaced loggers in ue gw. * - Started to replace loggers in the ue stack. - Replaced loggers in usim and pcsc. - Adapted nas and usim tests. * Replace loggers in nas. * Added missing log init calls in two previously modified tests. * Replaced logger in nas idle procs. * Replaced loggers in nas emm state. * Replaced loggers in tft packet filter and adapted tft test. * Replaced loggers in main RRC class. * Replaced loggers in RRC cell. * Replaced loggers in RRC meas. * Replaced loggers in rrc procedures. * Started logger replacement in MAC layer, more precisely in demux and dl_harq classes. Been unable to inject loggers in construction for dl_tb_process due to very weird static assertions in the std::vector code being the type not constructible which is not true, so instead use the main MAC logger directly. * Replaced loggers in mac mux class. * Replaced loggers in mac pro_bsr. * Replaced loggers in mac proc phr. * Replaced loggers in mac proc SR and RA. * Replace loggers in mac UL HARQ. * Replaced loggers in main ue stack class. * Fixed nas test crashing due to a null string. * Ported mac_test to use the new loggers. * Removed TTI reporting for the PHY log as the old logger did. * Replaced loggers in UE phy tests. * Configure loggers in nas_test. * Replaced loggers in rrc_meas_test. * Replaced loggers in rrc_reconfig_test. * Added missing newline in tft_test. * Fix compilation errors in TTCN3 tests. * Fix linker error detected in CI and warning. * Replaced loggers in TTCN3 tests. * Fix a text replace error in some log messages. * Remove trailing newlines from log entries. * Remove old logger from rrc. * Flush backend before printing the test status. * - Fix compilation error from previous rebase. - Remove trailing newlines from some missing log entries.
2021-01-28 08:17:43 -08:00
lte_ttcn3_phy();
~lte_ttcn3_phy() = default;
2019-09-16 12:17:21 -07:00
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, syssim_interface_phy* syssim_);
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) override;
2019-09-16 12:17:21 -07:00
// ue_phy_base interface
int init(const phy_args_t& args_) override;
void stop() override;
void wait_initialize() override;
void start_plot() override;
void get_metrics(phy_metrics_t* m) override;
std::string get_type() override;
2019-09-16 12:17:21 -07:00
// The interface for the SS
void set_cell_map(const cell_list_t& cells_);
// phy_interface_rrc_lte
void enable_pregen_signals(bool enable) override;
void deactivate_scells() override;
void set_activation_deactivation_scell(uint32_t cmd, uint32_t tti) override;
bool set_config(srslte::phy_cfg_t config, uint32_t cc_idx = 0) override;
bool set_scell(srslte_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override;
void set_config_tdd(srslte_tdd_config_t& tdd_config) override;
void set_config_mbsfn_sib2(srslte::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override{};
void set_config_mbsfn_sib13(const srslte::sib13_t& sib13) override{};
void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch) override{};
2019-09-16 12:17:21 -07:00
// Measurements interface
void meas_stop() override;
2019-09-16 12:17:21 -07:00
// phy_interface_mac_lte
void set_mch_period_stop(uint32_t stop) override{};
2019-09-16 12:17:21 -07:00
// Cell search and selection procedures
bool cell_search() override;
bool cell_select(phy_cell_t cell) override;
bool cell_is_camping() override;
2019-09-16 12:17:21 -07:00
// phy_interface_mac_lte
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec) override;
prach_info_t prach_get_info() override;
void sr_send() override;
int sr_last_tx_tti() override;
2019-09-16 12:17:21 -07:00
// phy_interface_mac_common
void set_timeadv_rar(uint32_t ta_cmd) override;
void set_timeadv(uint32_t ta_cmd) override;
void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti) override;
uint32_t get_current_tti() override;
float get_phr() override;
float get_pathloss_db() override;
2019-09-16 12:17:21 -07:00
// phy_interface_syssim
void set_current_tti(uint32_t tti);
void new_grant_ul(mac_interface_phy_lte::mac_grant_ul_t ul_mac_grant);
void new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t, const uint8_t* data);
// Radio interface
void radio_overflow() override;
void radio_failure() override;
2019-09-16 12:17:21 -07:00
void run_tti();
private:
Upgrade loggers in srsue (#2163) * Replaced UE logger in the ue class. * Replaced loggers in the main phy class and prach. * Replaced loggers in phy common and ta_control. * Replace loggers in cc and sf workers. * Replaced loggers in intra_measure, scell_recv, search, sfn_sync, sync. * Remove last uses of the old loggers in the main phy class. * Remove stray newline in logs. * Replaced loggers in ue gw. * - Started to replace loggers in the ue stack. - Replaced loggers in usim and pcsc. - Adapted nas and usim tests. * Replace loggers in nas. * Added missing log init calls in two previously modified tests. * Replaced logger in nas idle procs. * Replaced loggers in nas emm state. * Replaced loggers in tft packet filter and adapted tft test. * Replaced loggers in main RRC class. * Replaced loggers in RRC cell. * Replaced loggers in RRC meas. * Replaced loggers in rrc procedures. * Started logger replacement in MAC layer, more precisely in demux and dl_harq classes. Been unable to inject loggers in construction for dl_tb_process due to very weird static assertions in the std::vector code being the type not constructible which is not true, so instead use the main MAC logger directly. * Replaced loggers in mac mux class. * Replaced loggers in mac pro_bsr. * Replaced loggers in mac proc phr. * Replaced loggers in mac proc SR and RA. * Replace loggers in mac UL HARQ. * Replaced loggers in main ue stack class. * Fixed nas test crashing due to a null string. * Ported mac_test to use the new loggers. * Removed TTI reporting for the PHY log as the old logger did. * Replaced loggers in UE phy tests. * Configure loggers in nas_test. * Replaced loggers in rrc_meas_test. * Replaced loggers in rrc_reconfig_test. * Added missing newline in tft_test. * Fix compilation errors in TTCN3 tests. * Fix linker error detected in CI and warning. * Replaced loggers in TTCN3 tests. * Fix a text replace error in some log messages. * Remove trailing newlines from log entries. * Remove old logger from rrc. * Flush backend before printing the test status. * - Fix compilation error from previous rebase. - Remove trailing newlines from some missing log entries.
2021-01-28 08:17:43 -08:00
srslog::basic_logger& logger;
2019-09-16 12:17:21 -07:00
// All available cells
2019-09-16 12:17:21 -07:00
cell_list_t cells;
uint32_t cell_idx = 0;
// The current PCell
cell_t pcell = {};
bool pcell_set = false;
2019-09-16 12:17:21 -07:00
srslte::phy_cfg_t phy_cfg = {};
2019-09-16 12:17:21 -07:00
uint32_t current_tti = 0;
uint32_t cc_idx = 0;
2019-09-16 12:17:21 -07:00
int prach_tti_tx = -1;
int sr_tx_tti = -1;
bool sr_pending = false;
2019-09-30 03:48:35 -07:00
std::mutex mutex;
srslte::task_scheduler task_sched;
2019-09-16 12:17:21 -07:00
uint32_t ra_trans_cnt = 0;
stack_interface_phy_lte* stack = nullptr;
syssim_interface_phy* syssim = nullptr;
};
} // namespace srsue
#endif