Added UL EARFCN map and UE PHY interface cleanup

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 7291a5db91
commit 58803d1b3e

@ -460,8 +460,10 @@ typedef struct {
std::string type = "lte";
srslte::phy_log_args_t log;
std::string dl_earfcn = "3400"; // comma-separated list of EARFCNs
std::vector<uint32_t> earfcn_list = {3400}; // vectorized version of dl_earfcn that gets populated during init
std::string dl_earfcn = "3400"; // comma-separated list of DL EARFCNs
std::string ul_earfcn = ""; // comma-separated list of UL EARFCNs
std::vector<uint32_t> dl_earfcn_list = {3400}; // vectorized version of dl_earfcn that gets populated during init
std::map<uint32_t, uint32_t> ul_earfcn_map; // Map linking DL EARFCN and UL EARFCN
float dl_freq = -1.0f;
float ul_freq = -1.0f;

@ -61,8 +61,6 @@ public:
void enable_pregen_signals(bool enable) final;
void set_earfcn(std::vector<uint32_t> earfcns) final;
void radio_overflow() final;
void radio_failure() final;

@ -168,6 +168,15 @@ public:
bool is_mbsfn_sf(srslte_mbsfn_cfg_t* cfg, uint32_t tti);
void set_mch_period_stop(uint32_t stop);
/**
* Deduces the UL EARFCN from a DL EARFCN. If the UL-EARFCN was defined in the UE PHY arguments it will use the
* corresponding UL-EARFCN to the DL-EARFCN. Otherwise, it will use default.
*
* @param dl_earfcn
* @return the deduced UL EARFCN
*/
uint32_t get_ul_earfcn(uint32_t dl_earfcn);
private:
bool have_mtch_stop = false;
std::mutex mtch_mutex;

@ -83,7 +83,6 @@ public:
// From UE configuration
void set_agc_enable(bool enable);
void set_earfcn(std::vector<uint32_t> earfcn);
void force_freq(float dl_freq, float ul_freq);
// Other functions
@ -155,8 +154,6 @@ private:
* measurements offline using sync object and finding multiple cells for each N_id_2
*/
std::vector<uint32_t> earfcn;
void reset();
void radio_error();
void set_ue_sync_opts(srslte_ue_sync_t* q, float cfo);

@ -45,8 +45,6 @@ public:
virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
virtual void wait_initialize() = 0;
virtual void start_plot() = 0;

@ -45,8 +45,6 @@ public:
virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;
virtual void wait_initialize() = 0;
virtual void start_plot() = 0;

@ -72,6 +72,7 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
("ue.stack", bpo::value<string>(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte]")
("rf.dl_earfcn", bpo::value<string>(&args->phy.dl_earfcn)->default_value("3400"), "Downlink EARFCN list")
("rf.ul_earfcn", bpo::value<string>(&args->phy.ul_earfcn), "Uplink EARFCN list. Optional.")
("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset")
("rf.dl_freq", bpo::value<float>(&args->phy.dl_freq)->default_value(-1), "Downlink Frequency (if positive overrides EARFCN)")
("rf.ul_freq", bpo::value<float>(&args->phy.ul_freq)->default_value(-1), "Uplink Frequency (if positive overrides EARFCN)")

@ -126,8 +126,6 @@ int phy::init(const phy_args_t& args_)
args = args_;
set_earfcn(args.earfcn_list);
// Force frequency if given as argument
if (args.dl_freq > 0 && args.ul_freq > 0) {
sfsync.force_freq(args.dl_freq, args.ul_freq);
@ -382,11 +380,6 @@ int phy::sr_last_tx_tti()
return common.sr_last_tx_tti;
}
void phy::set_earfcn(vector<uint32_t> earfcns)
{
sfsync.set_earfcn(earfcns);
}
void phy::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti)
{
common.set_rar_grant(grant_payload, rnti, tdd_config);
@ -454,7 +447,7 @@ void phy::set_config(srslte::phy_cfg_t& config_, uint32_t cc_idx, uint32_t earfc
// Change frequency only if the earfcn was modified
if (common.scell_cfg[cc_idx].earfcn != earfcn) {
double dl_freq = srslte_band_fd(earfcn) * 1e6;
double ul_freq = srslte_band_fu(srslte_band_ul_earfcn(earfcn)) * 1e6;
double ul_freq = srslte_band_fu(common.get_ul_earfcn(earfcn)) * 1e6;
radio->set_rx_freq(cc_idx, dl_freq);
radio->set_tx_freq(cc_idx, ul_freq);
}

@ -742,6 +742,21 @@ void phy_common::set_mch_period_stop(uint32_t stop)
mtch_cvar.notify_one();
}
uint32_t phy_common::get_ul_earfcn(uint32_t dl_earfcn)
{
// Set default UL-EARFCN
uint32_t ul_earfcn = srslte_band_ul_earfcn(dl_earfcn);
// Try to find current DL-EARFCN in the map
auto it = args->ul_earfcn_map.find(dl_earfcn);
if (it != args->ul_earfcn_map.end()) {
// If found UL EARFCN in the map, use it
ul_earfcn = it->second;
}
return ul_earfcn;
}
bool phy_common::is_mch_subframe(srslte_mbsfn_cfg_t* cfg, uint32_t phy_tti)
{
uint32_t sfn; // System Frame Number

@ -185,7 +185,7 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS;
// Move state to IDLE
Info("Cell Search: Start EARFCN index=%u/%zd\n", cellsearch_earfcn_index, earfcn.size());
Info("Cell Search: Start EARFCN index=%u/%zd\n", cellsearch_earfcn_index, worker_com->args->dl_earfcn_list.size());
phy_state.go_idle();
worker_com->reset();
@ -200,8 +200,8 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
}
try {
if (current_earfcn != (int)earfcn.at(cellsearch_earfcn_index)) {
current_earfcn = (int)earfcn[cellsearch_earfcn_index];
if (current_earfcn != (int)worker_com->args->dl_earfcn_list.at(cellsearch_earfcn_index)) {
current_earfcn = (int)worker_com->args->dl_earfcn_list[cellsearch_earfcn_index];
Info("Cell Search: changing frequency to EARFCN=%d\n", current_earfcn);
set_frequency();
}
@ -236,7 +236,7 @@ phy_interface_rrc_lte::cell_search_ret_t sync::cell_search(phy_interface_rrc_lte
}
cellsearch_earfcn_index++;
if (cellsearch_earfcn_index >= earfcn.size()) {
if (cellsearch_earfcn_index >= worker_com->args->dl_earfcn_list.size()) {
Info("Cell Search: No more frequencies in the current EARFCN set\n");
cellsearch_earfcn_index = 0;
ret.last_freq = phy_interface_rrc_lte::cell_search_ret_t::NO_MORE_FREQS;
@ -735,11 +735,6 @@ bool sync::set_cell(float cfo)
return true;
}
void sync::set_earfcn(std::vector<uint32_t> earfcn_)
{
earfcn = earfcn_;
}
void sync::force_freq(float dl_freq_, float ul_freq_)
{
dl_freq = dl_freq_;
@ -759,7 +754,7 @@ bool sync::set_frequency()
if (srslte_band_is_tdd(srslte_band_get_band(current_earfcn))) {
set_ul_freq = set_dl_freq;
} else {
set_ul_freq = 1e6 * srslte_band_fu(srslte_band_ul_earfcn(current_earfcn));
set_ul_freq = 1e6 * srslte_band_fu(worker_com->get_ul_earfcn(current_earfcn));
}
}
if (set_dl_freq > 0 && set_ul_freq > 0) {

@ -173,18 +173,18 @@ int ue::parse_args(const all_args_t& args_)
args.phy.nof_rx_ant = args.rf.nof_antennas;
args.phy.agc_enable = args.rf.rx_gain < 0.0f;
// populate EARFCN list
// populate DL EARFCN list
if (!args.phy.dl_earfcn.empty()) {
args.phy.earfcn_list.clear();
args.phy.dl_earfcn_list.clear();
std::stringstream ss(args.phy.dl_earfcn);
uint32_t idx = 0;
while (ss.good()) {
std::string substr;
getline(ss, substr, ',');
auto earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10);
uint32_t earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10);
args.stack.rrc.supported_bands[idx] = srslte_band_get_band(earfcn);
args.stack.rrc.nof_supported_bands = ++idx;
args.phy.earfcn_list.push_back(earfcn);
args.phy.dl_earfcn_list.push_back(earfcn);
}
} else {
log.error("Error: dl_earfcn list is empty\n");
@ -192,6 +192,25 @@ int ue::parse_args(const all_args_t& args_)
return SRSLTE_ERROR;
}
// populate UL EARFCN list
if (!args.phy.ul_earfcn.empty()) {
args.phy.ul_earfcn_map.clear();
std::stringstream ss(args.phy.ul_earfcn);
uint32_t idx = 0;
while (ss.good()) {
std::string substr;
getline(ss, substr, ',');
uint32_t ul_earfcn = (uint32_t)strtoul(substr.c_str(), nullptr, 10);
if (idx < args.phy.dl_earfcn_list.size()) {
// If it can be matched with a DL EARFCN, otherwise ignore entry
uint32_t dl_earfcn = args.phy.dl_earfcn_list[idx];
args.phy.ul_earfcn_map[dl_earfcn] = ul_earfcn;
idx++;
}
}
}
// Set UE category
args.stack.rrc.ue_category = (uint32_t)strtoul(args.stack.rrc.ue_category_str.c_str(), nullptr, 10);

@ -49,63 +49,58 @@ public:
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_, radio_interface_phy* radio_);
int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) override;
// ue_phy_base interface
int init(const phy_args_t& args_);
void stop();
void set_earfcn(std::vector<uint32_t> earfcns);
void force_freq(float dl_freq, float ul_freq);
void wait_initialize();
void start_plot();
void get_metrics(phy_metrics_t* m);
std::string get_type();
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;
// The interface for the SS
void set_cell_map(const cell_list_t& cells_);
// phy_interface_rrc_lte
uint32_t get_current_earfcn();
uint32_t get_current_pci();
void set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config);
void enable_pregen_signals(bool enable);
void set_activation_deactivation_scell(uint32_t cmd);
void
set_config(srslte::phy_cfg_t& config, uint32_t cc_idx = 0, uint32_t earfcn = 0, srslte_cell_t* cell_info = nullptr);
void set_config_tdd(srslte_tdd_config_t& tdd_config);
void set_config_mbsfn_sib2(srslte::mbsfn_sf_cfg_t* cfg_list, uint32_t nof_cfgs){};
void set_config_mbsfn_sib13(const srslte::sib13_t& sib13){};
void set_config_mbsfn_mcch(const srslte::mcch_msg_t& mcch){};
void enable_pregen_signals(bool enable) override;
void set_activation_deactivation_scell(uint32_t cmd) override;
void set_config(srslte::phy_cfg_t& config,
uint32_t cc_idx = 0,
uint32_t earfcn = 0,
srslte_cell_t* cell_info = nullptr) 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{};
// Measurements interface
void meas_stop();
int meas_start(uint32_t earfcn, int pci = -1);
int meas_stop(uint32_t earfcn, int pci = -1);
void meas_stop() override;
// phy_interface_mac_lte
void set_mch_period_stop(uint32_t stop){};
void set_mch_period_stop(uint32_t stop) override{};
// Cell search and selection procedures
cell_search_ret_t cell_search(phy_cell_t* found_cell);
cell_search_ret_t cell_search(phy_cell_t* found_cell) override;
bool cell_select(const phy_cell_t* cell) override;
bool cell_is_camping();
void reset();
bool cell_is_camping() override;
void reset() override;
// phy_interface_mac_lte
void configure_prach_params();
void prach_send(uint32_t preamble_idx, int allowed_subframe, float target_power_dbm, float ta_base_sec);
prach_info_t prach_get_info();
void sr_send();
int sr_last_tx_tti();
void configure_prach_params() override;
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_crnti(uint16_t rnti);
void set_timeadv_rar(uint32_t ta_cmd);
void set_timeadv(uint32_t ta_cmd);
void set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti);
uint32_t get_current_tti();
float get_phr();
float get_pathloss_db();
void set_crnti(uint16_t rnti) override;
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;
// phy_interface_syssim
void set_current_tti(uint32_t tti);
@ -114,14 +109,12 @@ public:
void new_tb(const srsue::mac_interface_phy_lte::mac_grant_dl_t, const uint8_t* data);
// Radio interface
void radio_overflow();
void radio_failure();
void radio_overflow() override;
void radio_failure() override;
void run_tti();
private:
void select_pcell();
srslte::logger* logger = nullptr;
srslte::log_filter log;
@ -130,13 +123,12 @@ private:
uint32_t cell_idx = 0;
// The current PCell
cell_t pcell = {};
bool pcell_set = false;
cell_t pcell = {};
bool pcell_set = false;
phy_cfg_t phy_cfg = {};
srslte::phy_cfg_t phy_cfg = {};
uint32_t current_tti = 0;
uint16_t current_temp_rnti = 0;
uint32_t cc_idx = 0;
int prach_tti_tx = -1;

@ -36,7 +36,7 @@ int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_
return init(args_);
}
int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, radio_interface_phy* radio_)
int lte_ttcn3_phy::init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_)
{
return init(args_);
@ -53,10 +53,6 @@ int lte_ttcn3_phy::init(const phy_args_t& args_)
void lte_ttcn3_phy::stop(){};
void lte_ttcn3_phy::set_earfcn(std::vector<uint32_t> earfcns) {}
void lte_ttcn3_phy::force_freq(float dl_freq, float ul_freq) {}
void lte_ttcn3_phy::wait_initialize() {}
void lte_ttcn3_phy::start_plot() {}
@ -70,23 +66,8 @@ void lte_ttcn3_phy::set_cell_map(const cell_list_t& cells_)
cells = cells_;
}
uint32_t lte_ttcn3_phy::get_current_earfcn()
{
return pcell.earfcn;
}
uint32_t lte_ttcn3_phy::get_current_pci()
{
return pcell.info.id;
}
void lte_ttcn3_phy::set_config_tdd(srslte_tdd_config_t& tdd_config) {}
void lte_ttcn3_phy::set_config_scell(asn1::rrc::scell_to_add_mod_r10_s* scell_config)
{
log.debug("%s not implemented.\n", __FUNCTION__);
}
void lte_ttcn3_phy::enable_pregen_signals(bool enable)
{
log.debug("%s not implemented.\n", __FUNCTION__);
@ -105,16 +86,6 @@ void lte_ttcn3_phy::set_config(srslte::phy_cfg_t& config, uint32_t cc_idx, uint3
// Measurements interface
void lte_ttcn3_phy::meas_stop(){};
int lte_ttcn3_phy::meas_start(uint32_t earfcn, int pci)
{
return 0;
}
int lte_ttcn3_phy::meas_stop(uint32_t earfcn, int pci)
{
return 0;
};
/* Cell search and selection procedures */
phy_interface_rrc_lte::cell_search_ret_t lte_ttcn3_phy::cell_search(phy_cell_t* found_cell)
{
@ -236,7 +207,6 @@ int lte_ttcn3_phy::sr_last_tx_tti()
/* Sets a C-RNTI allowing the PHY to pregenerate signals if necessary */
void lte_ttcn3_phy::set_crnti(uint16_t rnti)
{
current_temp_rnti = rnti;
log.info("Set Temp-RNTI=%d\n", rnti);
}

Loading…
Cancel
Save