You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
4.5 KiB
C

/**
* Copyright 2013-2021 Software Radio Systems Limited
*
* This file is part of srsLTE.
*
* srsLTE is free software: you can redistribute it and/or modify
* 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.
*
* srsLTE is distributed in the hope that it will be useful,
* 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/.
*
*/
#ifndef SRSUE_TTCN3_LTE_PHY_H
#define SRSUE_TTCN3_LTE_PHY_H
#include "srsran/interfaces/ue_interfaces.h"
#include "srsran/interfaces/ue_phy_interfaces.h"
#include "srsue/hdr/phy/ue_lte_phy_base.h"
#include "srsue/hdr/ue.h"
#include "ttcn3_interfaces.h"
#include <srsran/phy/phch/dci.h>
using namespace srsue;
using namespace srsran;
namespace srsue {
class lte_ttcn3_phy : public ue_lte_phy_base
{
public:
void set_cells_to_meas(uint32_t earfcn, const std::set<uint32_t>& pci) override;
typedef struct {
srsran_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.
4 years ago
lte_ttcn3_phy();
~lte_ttcn3_phy() = default;
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_, srsran::radio_interface_phy* radio_) override;
// 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(const srsran::srsran_rat_t& rat, phy_metrics_t* m) override;
std::string get_type() override;
// 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(srsran::phy_cfg_t config, uint32_t cc_idx = 0) override;
bool set_scell(srsran_cell_t cell_info, uint32_t cc_idx, uint32_t earfcn) override;
void set_config_tdd(srsran_tdd_config_t& tdd_config) override;
void set_config_mbsfn_sib2(srsran::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs) override{};
void set_config_mbsfn_sib13(const srsran::sib13_t& sib13) override{};
void set_config_mbsfn_mcch(const srsran::mcch_msg_t& mcch) override{};
// Measurements interface
void meas_stop() override;
// phy_interface_mac_lte
void set_mch_period_stop(uint32_t stop) override{};
// Cell search and selection procedures
bool cell_search() override;
bool cell_select(phy_cell_t cell) override;
bool cell_is_camping() override;
// 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;
// phy_interface_mac_common
void set_timeadv_rar(uint32_t tti, uint32_t ta_cmd) override;
void set_timeadv(uint32_t tti, uint32_t ta_cmd) override;
void set_rar_grant(uint8_t grant_payload[SRSRAN_RAR_GRANT_LEN], uint16_t rnti) override;
uint32_t get_current_tti() override;
float get_phr() override;
float get_pathloss_db() override;
// 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;
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.
4 years ago
srslog::basic_logger& logger;
// All available cells
cell_list_t cells;
uint32_t cell_idx = 0;
// The current PCell
cell_t pcell = {};
bool pcell_set = false;
srsran::phy_cfg_t phy_cfg = {};
uint32_t current_tti = 0;
uint32_t cc_idx = 0;
int prach_tti_tx = -1;
int sr_tx_tti = -1;
bool sr_pending = false;
std::mutex mutex;
srsran::task_scheduler task_sched;
uint32_t ra_trans_cnt = 0;
stack_interface_phy_lte* stack = nullptr;
syssim_interface_phy* syssim = nullptr;
};
} // namespace srsue
#endif