srsLTE/srsue/hdr/phy/lte/cc_worker.h

117 lines
3.9 KiB
C
Raw Normal View History

/**
2019-04-23 01:53:11 -07:00
*
* \section COPYRIGHT
2019-04-23 01:53:11 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2019-04-23 01:53:11 -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-04-23 01:53:11 -07:00
*
*/
#ifndef SRSUE_LTE_CC_WORKER_H
#define SRSUE_LTE_CC_WORKER_H
2019-04-23 01:53:11 -07:00
2021-03-19 03:45:56 -07:00
#include "srsran/interfaces/ue_interfaces.h"
#include "srsran/srsran.h"
#include "srsue/hdr/phy/phy_common.h"
2019-04-23 01:53:11 -07:00
namespace srsue {
namespace lte {
2019-04-23 01:53:11 -07:00
class cc_worker
{
public:
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
cc_worker(uint32_t cc_idx, uint32_t max_prb, phy_common* phy, srslog::basic_logger& logger);
2019-04-23 01:53:11 -07:00
~cc_worker();
/* Functions used by main PHY thread */
cf_t* get_rx_buffer(uint32_t antenna_idx);
cf_t* get_tx_buffer(uint32_t antenna_idx);
uint32_t get_buffer_len();
2019-04-23 01:53:11 -07:00
void set_tti(uint32_t tti);
void set_cfo_nolock(float cfo);
float get_ref_cfo() const;
// Functions to set configuration.
// Warning: all these functions are unlocked and must be called while the worker is not processing data
void reset_cell_nolock();
bool set_cell_nolock(srsran_cell_t cell_);
void set_tdd_config_nolock(srsran_tdd_config_t config);
void set_config_nolock(const srsran::phy_cfg_t& phy_cfg);
void upd_config_dci_nolock(const srsran_dci_cfg_t& dci_cfg);
2019-04-23 01:53:11 -07:00
2021-03-19 03:45:56 -07:00
void set_uci_periodic_cqi(srsran_uci_data_t* uci_data);
2019-04-23 01:53:11 -07:00
bool work_dl_regular();
2021-03-19 03:45:56 -07:00
bool work_dl_mbsfn(srsran_mbsfn_cfg_t mbsfn_cfg);
bool work_ul(srsran_uci_data_t* uci_data);
2019-04-23 01:53:11 -07:00
int read_ce_abs(float* ce_abs, uint32_t tx_antenna, uint32_t rx_antenna);
int read_pdsch_d(cf_t* pdsch_d);
void update_measurements(std::vector<phy_meas_t>& serving_cells, cf_t* rssi_power_buffer = nullptr);
2019-04-23 01:53:11 -07:00
private:
void reset();
2021-03-19 03:45:56 -07:00
void dl_phy_to_mac_grant(srsran_pdsch_grant_t* phy_grant,
srsran_dci_dl_t* dl_dci,
mac_interface_phy_lte::mac_grant_dl_t* mac_grant);
2021-03-19 03:45:56 -07:00
void ul_phy_to_mac_grant(srsran_pusch_grant_t* phy_grant,
srsran_dci_ul_t* ul_dci,
uint32_t pid,
bool ul_grant_available,
mac_interface_phy_lte::mac_grant_ul_t* mac_grant);
2019-04-23 01:53:11 -07:00
/* Methods for DL... */
int decode_pdcch_ul();
int decode_pdcch_dl();
void decode_phich();
2021-03-19 03:45:56 -07:00
int decode_pdsch(srsran_pdsch_ack_resource_t ack_resource,
mac_interface_phy_lte::tb_action_dl_t* action,
2021-03-19 03:45:56 -07:00
bool acks[SRSRAN_MAX_CODEWORDS]);
int decode_pmch(mac_interface_phy_lte::tb_action_dl_t* action, srsran_mbsfn_cfg_t* mbsfn_cfg);
2019-04-23 01:53:11 -07:00
/* Methods for UL */
2021-03-19 03:45:56 -07:00
bool encode_uplink(mac_interface_phy_lte::tb_action_ul_t* action, srsran_uci_data_t* uci_data);
void set_uci_sr(srsran_uci_data_t* uci_data);
void set_uci_aperiodic_cqi(srsran_uci_data_t* uci_data);
void set_uci_ack(srsran_uci_data_t* uci_data, bool is_grant_available, uint32_t dai_ul, bool is_pusch_available);
2019-04-23 01:53:11 -07:00
uint32_t get_wideband_cqi();
/* Common objects */
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
phy_common* phy = nullptr;
srslog::basic_logger& logger;
2019-04-23 01:53:11 -07:00
2021-03-19 03:45:56 -07:00
srsran_cell_t cell = {};
srsran_dl_sf_cfg_t sf_cfg_dl = {};
srsran_ul_sf_cfg_t sf_cfg_ul = {};
2019-04-23 01:53:11 -07:00
uint32_t cc_idx = 0;
bool cell_initiated = false;
2021-03-19 03:45:56 -07:00
cf_t* signal_buffer_rx[SRSRAN_MAX_PORTS] = {};
cf_t* signal_buffer_tx[SRSRAN_MAX_PORTS] = {};
uint32_t signal_buffer_max_samples = 0;
2019-04-23 01:53:11 -07:00
/* Objects for DL */
2021-03-19 03:45:56 -07:00
srsran_ue_dl_t ue_dl = {};
srsran_ue_dl_cfg_t ue_dl_cfg = {};
srsran_pmch_cfg_t pmch_cfg = {};
2019-04-23 01:53:11 -07:00
2021-03-19 03:45:56 -07:00
srsran_chest_dl_cfg_t chest_mbsfn_cfg = {};
srsran_chest_dl_cfg_t chest_default_cfg = {};
2019-04-23 01:53:11 -07:00
/* Objects for UL */
2021-03-19 03:45:56 -07:00
srsran_ue_ul_t ue_ul = {};
srsran_ue_ul_cfg_t ue_ul_cfg = {};
2019-04-23 01:53:11 -07:00
};
} // namespace lte
2019-04-23 01:53:11 -07:00
} // namespace srsue
#endif // SRSUE_LTE_CC_WORKER_H