mirror of https://github.com/pvnis/srsRAN_4G.git
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.
122 lines
3.6 KiB
C
122 lines
3.6 KiB
C
4 years ago
|
/**
|
||
5 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
5 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2020 Software Radio Systems Limited
|
||
5 years ago
|
*
|
||
4 years ago
|
* 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.
|
||
5 years ago
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef SRSENB_CC_WORKER_H
|
||
|
#define SRSENB_CC_WORKER_H
|
||
|
|
||
|
#include <string.h>
|
||
|
|
||
4 years ago
|
#include "../phy_common.h"
|
||
5 years ago
|
|
||
|
#define LOG_EXECTIME
|
||
|
|
||
|
namespace srsenb {
|
||
4 years ago
|
namespace lte {
|
||
5 years ago
|
|
||
|
class cc_worker
|
||
|
{
|
||
|
public:
|
||
|
cc_worker();
|
||
5 years ago
|
~cc_worker();
|
||
5 years ago
|
void init(phy_common* phy, srslte::log* log_h, uint32_t cc_idx);
|
||
|
void reset();
|
||
|
|
||
|
cf_t* get_buffer_rx(uint32_t antenna_idx);
|
||
|
cf_t* get_buffer_tx(uint32_t antenna_idx);
|
||
|
void set_tti(uint32_t tti);
|
||
|
|
||
5 years ago
|
int add_rnti(uint16_t rnti);
|
||
5 years ago
|
void rem_rnti(uint16_t rnti);
|
||
5 years ago
|
int pregen_sequences(uint16_t rnti);
|
||
5 years ago
|
uint32_t get_nof_rnti();
|
||
|
|
||
|
/* These are used by the GUI plotting tools */
|
||
|
int read_ce_abs(float* ce_abs);
|
||
|
int read_ce_arg(float* ce_abs);
|
||
|
int read_pusch_d(cf_t* pusch_d);
|
||
|
int read_pucch_d(cf_t* pusch_d);
|
||
|
void start_plot();
|
||
|
|
||
5 years ago
|
void work_ul(const srslte_ul_sf_cfg_t& ul_sf, stack_interface_phy_lte::ul_sched_t& ul_grants);
|
||
|
void work_dl(const srslte_dl_sf_cfg_t& dl_sf_cfg,
|
||
|
stack_interface_phy_lte::dl_sched_t& dl_grants,
|
||
|
stack_interface_phy_lte::ul_sched_t& ul_grants,
|
||
5 years ago
|
srslte_mbsfn_cfg_t* mbsfn_cfg);
|
||
|
|
||
4 years ago
|
uint32_t get_metrics(std::vector<phy_metrics_t>& metrics);
|
||
5 years ago
|
|
||
|
private:
|
||
|
constexpr static float PUSCH_RL_SNR_DB_TH = 1.0f;
|
||
|
constexpr static float PUCCH_RL_CORR_TH = 0.15f;
|
||
|
|
||
5 years ago
|
int encode_pdsch(stack_interface_phy_lte::dl_sched_grant_t* grants, uint32_t nof_grants);
|
||
|
int encode_pmch(stack_interface_phy_lte::dl_sched_grant_t* grant, srslte_mbsfn_cfg_t* mbsfn_cfg);
|
||
|
void decode_pusch_rnti(stack_interface_phy_lte::ul_sched_grant_t& ul_grant,
|
||
|
srslte_ul_cfg_t& ul_cfg,
|
||
|
srslte_pusch_res_t& pusch_res);
|
||
|
void decode_pusch(stack_interface_phy_lte::ul_sched_grant_t* grants, uint32_t nof_pusch);
|
||
|
int encode_phich(stack_interface_phy_lte::ul_sched_ack_t* acks, uint32_t nof_acks);
|
||
|
int encode_pdcch_dl(stack_interface_phy_lte::dl_sched_grant_t* grants, uint32_t nof_grants);
|
||
|
int encode_pdcch_ul(stack_interface_phy_lte::ul_sched_grant_t* grants, uint32_t nof_grants);
|
||
|
int decode_pucch();
|
||
5 years ago
|
|
||
|
/* Common objects */
|
||
|
srslte::log* log_h = nullptr;
|
||
|
phy_common* phy = nullptr;
|
||
|
bool initiated = false;
|
||
|
|
||
|
cf_t* signal_buffer_rx[SRSLTE_MAX_PORTS] = {};
|
||
|
cf_t* signal_buffer_tx[SRSLTE_MAX_PORTS] = {};
|
||
|
uint32_t tti_rx = 0, tti_tx_dl = 0, tti_tx_ul = 0;
|
||
|
|
||
|
srslte_enb_dl_t enb_dl = {};
|
||
|
srslte_enb_ul_t enb_ul = {};
|
||
|
|
||
|
srslte_dl_sf_cfg_t dl_sf = {};
|
||
|
srslte_ul_sf_cfg_t ul_sf = {};
|
||
|
|
||
|
srslte_softbuffer_tx_t temp_mbsfn_softbuffer = {};
|
||
|
|
||
|
// Class to store user information
|
||
|
class ue
|
||
|
{
|
||
|
public:
|
||
5 years ago
|
explicit ue(uint16_t rnti_) : rnti(rnti_)
|
||
5 years ago
|
{
|
||
5 years ago
|
// Do nothing
|
||
5 years ago
|
}
|
||
|
|
||
5 years ago
|
srslte_phich_grant_t phich_grant = {};
|
||
5 years ago
|
|
||
5 years ago
|
void metrics_read(phy_metrics_t* metrics);
|
||
|
void metrics_dl(uint32_t mcs);
|
||
|
void metrics_ul(uint32_t mcs, float rssi, float sinr, float turbo_iters);
|
||
5 years ago
|
uint32_t get_rnti() const { return rnti; }
|
||
5 years ago
|
|
||
|
private:
|
||
|
uint32_t rnti = 0;
|
||
|
phy_metrics_t metrics = {};
|
||
|
};
|
||
|
|
||
|
// Component carrier index
|
||
|
uint32_t cc_idx = 0;
|
||
|
|
||
|
// Each worker keeps a local copy of the user database. Uses more memory but more efficient to manage concurrency
|
||
|
std::map<uint16_t, ue*> ue_db;
|
||
5 years ago
|
std::mutex mutex;
|
||
5 years ago
|
};
|
||
|
|
||
4 years ago
|
} // namespace lte
|
||
5 years ago
|
} // namespace srsenb
|
||
|
|
||
|
#endif // SRSENB_CC_WORKER_H
|