mirror of https://github.com/pvnis/srsRAN_4G.git
created separate cell ctxt common list
parent
94b8dd39a9
commit
4b525127c9
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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 SRSLTE_RRC_CELL_CFG_H
|
||||
#define SRSLTE_RRC_CELL_CFG_H
|
||||
|
||||
#include "rrc_config.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
struct cell_ctxt_common {
|
||||
uint32_t enb_cc_idx = 0;
|
||||
asn1::rrc::mib_s mib;
|
||||
asn1::rrc::sib_type1_s sib1;
|
||||
asn1::rrc::sib_type2_s sib2;
|
||||
const cell_cfg_t& cell_cfg;
|
||||
std::vector<std::vector<uint8_t> > sib_buffer; ///< Packed SIBs for given CC
|
||||
|
||||
cell_ctxt_common(uint32_t idx_, const cell_cfg_t& cfg) : enb_cc_idx(idx_), cell_cfg(cfg) {}
|
||||
};
|
||||
|
||||
class cell_ctxt_common_list
|
||||
{
|
||||
public:
|
||||
explicit cell_ctxt_common_list(const rrc_cfg_t& cfg_);
|
||||
|
||||
cell_ctxt_common* get_cc_idx(uint32_t enb_cc_idx) { return &cell_list[enb_cc_idx]; }
|
||||
cell_ctxt_common* get_cell_id(uint32_t cell_id);
|
||||
cell_ctxt_common* get_pci(uint32_t pci);
|
||||
size_t nof_cells() const { return cell_list.size(); }
|
||||
|
||||
private:
|
||||
const rrc_cfg_t& cfg;
|
||||
std::vector<cell_ctxt_common> cell_list;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_RRC_CELL_CFG_H
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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 SRSLTE_RRC_CONFIG_H
|
||||
#define SRSLTE_RRC_CONFIG_H
|
||||
|
||||
#include "srslte/asn1/rrc_asn1.h"
|
||||
#include "srslte/common/security.h"
|
||||
#include "srslte/interfaces/enb_rrc_interface_types.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
struct rrc_cfg_sr_t {
|
||||
uint32_t period;
|
||||
asn1::rrc::sched_request_cfg_c::setup_s_::dsr_trans_max_e_ dsr_max;
|
||||
uint32_t nof_prb;
|
||||
uint32_t sf_mapping[80];
|
||||
uint32_t nof_subframes;
|
||||
};
|
||||
|
||||
enum rrc_cfg_cqi_mode_t { RRC_CFG_CQI_MODE_PERIODIC = 0, RRC_CFG_CQI_MODE_APERIODIC, RRC_CFG_CQI_MODE_N_ITEMS };
|
||||
|
||||
static const char rrc_cfg_cqi_mode_text[RRC_CFG_CQI_MODE_N_ITEMS][20] = {"periodic", "aperiodic"};
|
||||
|
||||
typedef struct {
|
||||
uint32_t sf_mapping[80];
|
||||
uint32_t nof_subframes;
|
||||
uint32_t nof_prb;
|
||||
uint32_t period;
|
||||
uint32_t m_ri;
|
||||
bool simultaneousAckCQI;
|
||||
rrc_cfg_cqi_mode_t mode;
|
||||
} rrc_cfg_cqi_t;
|
||||
|
||||
typedef struct {
|
||||
bool configured;
|
||||
asn1::rrc::lc_ch_cfg_s::ul_specific_params_s_ lc_cfg;
|
||||
asn1::rrc::pdcp_cfg_s pdcp_cfg;
|
||||
asn1::rrc::rlc_cfg_c rlc_cfg;
|
||||
} rrc_cfg_qci_t;
|
||||
|
||||
#define MAX_NOF_QCI 10
|
||||
|
||||
struct rrc_cfg_t {
|
||||
uint32_t enb_id; ///< Required to pack SIB1
|
||||
// Per eNB SIBs
|
||||
asn1::rrc::sib_type1_s sib1;
|
||||
asn1::rrc::sib_info_item_c sibs[ASN1_RRC_MAX_SIB];
|
||||
asn1::rrc::mac_main_cfg_s mac_cnfg;
|
||||
|
||||
asn1::rrc::pusch_cfg_ded_s pusch_cfg;
|
||||
asn1::rrc::ant_info_ded_s antenna_info;
|
||||
asn1::rrc::pdsch_cfg_ded_s::p_a_e_ pdsch_cfg;
|
||||
rrc_cfg_sr_t sr_cfg;
|
||||
rrc_cfg_cqi_t cqi_cfg;
|
||||
rrc_cfg_qci_t qci_cfg[MAX_NOF_QCI];
|
||||
bool enable_mbsfn;
|
||||
uint32_t inactivity_timeout_ms;
|
||||
srslte::CIPHERING_ALGORITHM_ID_ENUM eea_preference_list[srslte::CIPHERING_ALGORITHM_ID_N_ITEMS];
|
||||
srslte::INTEGRITY_ALGORITHM_ID_ENUM eia_preference_list[srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS];
|
||||
bool meas_cfg_present = false;
|
||||
srslte_cell_t cell;
|
||||
cell_list_t cell_list;
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSLTE_RRC_CONFIG_H
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srsenb/hdr/stack/rrc/rrc_cell_cfg.h"
|
||||
|
||||
using namespace asn1::rrc;
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
cell_ctxt_common_list::cell_ctxt_common_list(const rrc_cfg_t& cfg_) : cfg(cfg_)
|
||||
{
|
||||
cell_list.reserve(cfg.cell_list.size());
|
||||
|
||||
// Store the SIB cfg of each carrier
|
||||
for (size_t ccidx = 0; ccidx < cfg.cell_list.size(); ++ccidx) {
|
||||
cell_list.emplace_back(ccidx, cfg.cell_list[ccidx]);
|
||||
auto& cell_ctxt = cell_list.back();
|
||||
|
||||
// Set Cell MIB
|
||||
asn1::number_to_enum(cell_ctxt.mib.dl_bw, cfg.cell.nof_prb);
|
||||
cell_ctxt.mib.phich_cfg.phich_res.value = (phich_cfg_s::phich_res_opts::options)cfg.cell.phich_resources;
|
||||
cell_ctxt.mib.phich_cfg.phich_dur.value = (phich_cfg_s::phich_dur_opts::options)cfg.cell.phich_length;
|
||||
|
||||
// Set Cell SIB1
|
||||
cell_ctxt.sib1 = cfg.sib1;
|
||||
// Update cellId
|
||||
sib_type1_s::cell_access_related_info_s_* cell_access = &cell_ctxt.sib1.cell_access_related_info;
|
||||
cell_access->cell_id.from_number((cfg.enb_id << 8u) + cell_ctxt.cell_cfg.cell_id);
|
||||
cell_access->tac.from_number(cell_ctxt.cell_cfg.tac);
|
||||
// Update DL EARFCN
|
||||
cell_ctxt.sib1.freq_band_ind = (uint8_t)srslte_band_get_band(cell_ctxt.cell_cfg.dl_earfcn);
|
||||
|
||||
// Set Cell SIB2
|
||||
// update PRACH root seq index for this cell
|
||||
cell_ctxt.sib2 = cfg.sibs[1].sib2();
|
||||
cell_ctxt.sib2.rr_cfg_common.prach_cfg.root_seq_idx = cell_ctxt.cell_cfg.root_seq_idx;
|
||||
// update carrier freq
|
||||
if (cell_ctxt.sib2.freq_info.ul_carrier_freq_present) {
|
||||
cell_ctxt.sib2.freq_info.ul_carrier_freq = cell_ctxt.cell_cfg.ul_earfcn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cell_ctxt_common* cell_ctxt_common_list::get_cell_id(uint32_t cell_id)
|
||||
{
|
||||
auto it = std::find_if(cell_list.begin(), cell_list.end(), [cell_id](const cell_ctxt_common& c) {
|
||||
return c.cell_cfg.cell_id == cell_id;
|
||||
});
|
||||
return it == cell_list.end() ? nullptr : &(*it);
|
||||
}
|
||||
|
||||
cell_ctxt_common* cell_ctxt_common_list::get_pci(uint32_t pci)
|
||||
{
|
||||
auto it = std::find_if(
|
||||
cell_list.begin(), cell_list.end(), [pci](const cell_ctxt_common& c) { return c.cell_cfg.pci == pci; });
|
||||
return it == cell_list.end() ? nullptr : &(*it);
|
||||
}
|
||||
|
||||
} // namespace srsenb
|
Loading…
Reference in New Issue