diff --git a/srsenb/hdr/phy/phy_ue_db.h b/srsenb/hdr/phy/phy_ue_db.h index cccab579b..5f5921cab 100644 --- a/srsenb/hdr/phy/phy_ue_db.h +++ b/srsenb/hdr/phy/phy_ue_db.h @@ -25,6 +25,7 @@ #include "phy_interfaces.h" #include #include +#include #include #include @@ -84,18 +85,19 @@ private: cell_state_t state = cell_state_none; ///< Configuration state uint32_t enb_cc_idx = 0; ///< Corresponding eNb cell/carrier index uint8_t last_ri = 0; ///< Last reported rank indicator - std::array last_tb = {}; ///< Stores last PUSCH Resource allocation + srslte::circular_array last_tb = + {}; ///< Stores last PUSCH Resource allocation srslte::phy_cfg_t phy_cfg; ///< Configuration, it has a default constructor - std::array is_grant_available; ///< Indicates whether there is an available grant + srslte::circular_array is_grant_available; ///< Indicates whether there is an available grant } cell_info_t; /** * UE object stored in the PHY common database */ struct common_ue { - std::array pdsch_ack = {}; ///< Pending acknowledgements for this Cell - std::array cell_info = {}; ///< Cell information, indexed by ue_cell_idx - srslte::phy_cfg_t pcell_cfg_stash = {}; ///< Stashed Cell information + srslte::circular_array pdsch_ack = {}; ///< Pending acknowledgements for this Cell + std::array cell_info = {}; ///< Cell information, indexed by ue_cell_idx + srslte::phy_cfg_t pcell_cfg_stash = {}; ///< Stashed Cell information }; /** diff --git a/srsenb/src/phy/phy_ue_db.cc b/srsenb/src/phy/phy_ue_db.cc index 7702849db..353dac7c0 100644 --- a/srsenb/src/phy/phy_ue_db.cc +++ b/srsenb/src/phy/phy_ue_db.cc @@ -125,7 +125,7 @@ uint32_t phy_ue_db::_get_uci_enb_cc_idx(uint32_t tti, uint16_t rnti) const { // Find the lowest index available PUSCH grant for (const cell_info_t& cell_info : ue_db.at(rnti).cell_info) { - if (cell_info.is_grant_available[TTIMOD(tti)]) { + if (cell_info.is_grant_available[tti]) { return cell_info.enb_cc_idx; } } @@ -657,7 +657,7 @@ void phy_ue_db::set_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid, } // Save resource allocation - ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid % SRSLTE_FDD_NOF_HARQ] = tb; + ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid] = tb; } srslte_ra_tb_t phy_ue_db::get_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid) const @@ -670,7 +670,7 @@ srslte_ra_tb_t phy_ue_db::get_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uin } // Returns the latest stored UL transmission grant - return ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid % SRSLTE_FDD_NOF_HARQ]; + return ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid]; } void phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_lte::ul_sched_list_t& ul_sched_list) @@ -680,7 +680,7 @@ void phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_l // Reset all available grants flags for the given TTI for (auto& ue : ue_db) { for (cell_info_t& cell_info : ue.second.cell_info) { - cell_info.is_grant_available[TTIMOD(tti)] = false; + cell_info.is_grant_available[tti] = false; } } @@ -693,7 +693,7 @@ void phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_l // Check that eNb Cell/Carrier is active for the given RNTI if (_assert_active_enb_cc(rnti, enb_cc_idx) == SRSLTE_SUCCESS) { // Rise Grant available flag - ue_db[rnti].cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].is_grant_available[TTIMOD(tti)] = true; + ue_db[rnti].cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].is_grant_available[tti] = true; } } }