use double precission for frequency in srsue and srsenb

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent 834a081c09
commit 5af89513eb

@ -402,9 +402,9 @@ struct cell_cfg_t {
uint32_t pci;
uint16_t root_seq_idx;
uint32_t dl_earfcn;
float dl_freq_hz;
double dl_freq_hz;
uint32_t ul_earfcn;
float ul_freq_hz;
double ul_freq_hz;
uint32_t initial_dl_cqi;
std::vector<scell_cfg_t> scell_list;
};

@ -406,9 +406,9 @@ SRSLTE_API uint8_t srslte_band_get_band(uint32_t dl_earfcn);
SRSLTE_API bool srslte_band_is_tdd(uint32_t band);
SRSLTE_API float srslte_band_fd(uint32_t dl_earfcn);
SRSLTE_API double srslte_band_fd(uint32_t dl_earfcn);
SRSLTE_API float srslte_band_fu(uint32_t ul_earfcn);
SRSLTE_API double srslte_band_fu(uint32_t ul_earfcn);
SRSLTE_API uint32_t srslte_band_ul_earfcn(uint32_t dl_earfcn);

@ -484,10 +484,10 @@ uint32_t srslte_re_x_prb(uint32_t ns, uint32_t symbol, uint32_t nof_ports, uint3
struct lte_band {
uint8_t band;
float fd_low_mhz;
double fd_low_mhz;
uint32_t dl_earfcn_offset;
uint32_t ul_earfcn_offset;
float duplex_mhz;
double duplex_mhz;
enum band_geographical_area area;
};
@ -588,7 +588,7 @@ char* srslte_mimotype2str(srslte_tx_scheme_t mimo_type)
}
}
float get_fd(struct lte_band* band, uint32_t dl_earfcn)
static double get_fd(struct lte_band* band, uint32_t dl_earfcn)
{
if (dl_earfcn >= band->dl_earfcn_offset) {
return band->fd_low_mhz + 0.1 * (dl_earfcn - band->dl_earfcn_offset);
@ -597,7 +597,7 @@ float get_fd(struct lte_band* band, uint32_t dl_earfcn)
}
}
float get_fu(struct lte_band* band, uint32_t ul_earfcn)
static double get_fu(struct lte_band* band, uint32_t ul_earfcn)
{
if (ul_earfcn >= band->ul_earfcn_offset) {
return band->fd_low_mhz - band->duplex_mhz + 0.1 * (ul_earfcn - band->ul_earfcn_offset);
@ -632,7 +632,7 @@ uint8_t srslte_band_get_band(uint32_t dl_earfcn)
return lte_bands[i].band;
}
float srslte_band_fd(uint32_t dl_earfcn)
double srslte_band_fd(uint32_t dl_earfcn)
{
uint32_t i = SRSLTE_NOF_LTE_BANDS - 1;
if (dl_earfcn > lte_bands[i].dl_earfcn_offset) {
@ -645,7 +645,7 @@ float srslte_band_fd(uint32_t dl_earfcn)
return get_fd(&lte_bands[i], dl_earfcn);
}
float srslte_band_fu(uint32_t ul_earfcn)
double srslte_band_fu(uint32_t ul_earfcn)
{
uint32_t i = SRSLTE_NOF_LTE_BANDS - 1;
if (ul_earfcn > lte_bands[i].ul_earfcn_offset) {

@ -89,9 +89,9 @@ public:
return ret;
};
float get_ul_freq_hz(uint32_t cc_idx)
double get_ul_freq_hz(uint32_t cc_idx)
{
float ret = 0.0f;
double ret = 0.0f;
if (cc_idx < cell_list.size()) {
ret = cell_list[cc_idx].ul_freq_hz;
@ -99,9 +99,9 @@ public:
return ret;
};
float get_dl_freq_hz(uint32_t cc_idx)
double get_dl_freq_hz(uint32_t cc_idx)
{
float ret = 0.0f;
double ret = 0.0;
if (cc_idx < cell_list.size()) {
ret = cell_list[cc_idx].dl_freq_hz;

@ -34,8 +34,8 @@ struct phy_cell_cfg_t {
srslte_cell_t cell;
uint32_t rf_port;
uint32_t cell_id;
float dl_freq_hz;
float ul_freq_hz;
double dl_freq_hz;
double ul_freq_hz;
uint32_t root_seq_idx;
};

@ -911,7 +911,7 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_
if (cfg.dl_freq_hz > 0) {
phy_cell_cfg.dl_freq_hz = cfg.dl_freq_hz;
} else {
phy_cell_cfg.dl_freq_hz = 1e6f * srslte_band_fd(cfg.dl_earfcn);
phy_cell_cfg.dl_freq_hz = 1e6 * srslte_band_fd(cfg.dl_earfcn);
}
if (cfg.ul_freq_hz > 0) {
@ -920,7 +920,7 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_
if (cfg.ul_earfcn == 0) {
cfg.ul_earfcn = srslte_band_ul_earfcn(cfg.dl_earfcn);
}
phy_cell_cfg.ul_freq_hz = 1e6f * srslte_band_fu(cfg.ul_earfcn);
phy_cell_cfg.ul_freq_hz = 1e6 * srslte_band_fu(cfg.ul_earfcn);
}
phy_cfg_->phy_cell_cfg.push_back(phy_cell_cfg);
}

@ -98,8 +98,8 @@ void txrx::run_thread()
// Set Tx/Rx frequencies
for (uint32_t cc_idx = 0; cc_idx < worker_com->get_nof_carriers(); cc_idx++) {
float tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx);
float rx_freq_hz = worker_com->get_ul_freq_hz(cc_idx);
double tx_freq_hz = worker_com->get_dl_freq_hz(cc_idx);
double rx_freq_hz = worker_com->get_ul_freq_hz(cc_idx);
uint32_t rf_port = worker_com->get_rf_port(cc_idx);
log_h->console(
"Setting frequency: DL=%.1f Mhz, UL=%.1f MHz for cc_idx=%d\n", tx_freq_hz / 1e6f, rx_freq_hz / 1e6f, cc_idx);

@ -454,8 +454,8 @@ void phy::set_config(srslte::phy_cfg_t& config_, uint32_t cc_idx, uint32_t earfc
} else if (cell_info) {
// Change frequency only if the earfcn was modified
if (common.scell_cfg[cc_idx].earfcn != earfcn) {
float dl_freq = srslte_band_fd(earfcn) * 1e6f;
float ul_freq = srslte_band_fu(srslte_band_ul_earfcn(earfcn)) * 1e6f;
double dl_freq = srslte_band_fd(earfcn) * 1e6;
double ul_freq = srslte_band_fu(srslte_band_ul_earfcn(earfcn)) * 1e6;
radio->set_rx_freq(cc_idx, dl_freq);
radio->set_tx_freq(cc_idx, ul_freq);
}

Loading…
Cancel
Save