diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index c524d5c0d..3b3c16ff1 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -89,7 +89,8 @@ public: virtual int get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) = 0; virtual int get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_t* dl_sched_res) = 0; virtual int get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res) = 0; - + virtual void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0; + // Radio-Link status virtual void rl_failure(uint16_t rnti) = 0; virtual void rl_ok(uint16_t rnti) = 0; diff --git a/lib/include/srslte/interfaces/sched_interface.h b/lib/include/srslte/interfaces/sched_interface.h index 3f33f125d..b21d8b341 100644 --- a/lib/include/srslte/interfaces/sched_interface.h +++ b/lib/include/srslte/interfaces/sched_interface.h @@ -244,8 +244,10 @@ public: /* Run Scheduler for this tti */ virtual int dl_sched(uint32_t tti, dl_sched_res_t *sched_result) = 0; - virtual int ul_sched(uint32_t tti, ul_sched_res_t *sched_result) = 0; - + virtual int ul_sched(uint32_t tti, ul_sched_res_t *sched_result) = 0; + + /* Custom */ + virtual void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0; }; } diff --git a/srsenb/hdr/stack/enb_stack_lte.h b/srsenb/hdr/stack/enb_stack_lte.h index 75bc263e9..218f31e30 100644 --- a/srsenb/hdr/stack/enb_stack_lte.h +++ b/srsenb/hdr/stack/enb_stack_lte.h @@ -79,6 +79,10 @@ public: return mac.get_mch_sched(tti, is_mcch, dl_sched_res); } int get_ul_sched(uint32_t tti, ul_sched_t* ul_sched_res) final { return mac.get_ul_sched(tti, ul_sched_res); } + void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final + { + mac.set_sched_dl_tti_mask(tti_mask, nof_sfs); + } // Radio-Link status void rl_failure(uint16_t rnti) final { mac.rl_failure(rnti); } void rl_ok(uint16_t rnti) final { mac.rl_ok(rnti); } diff --git a/srsenb/hdr/stack/mac/mac.h b/srsenb/hdr/stack/mac/mac.h index db5022cd1..9569f37ba 100644 --- a/srsenb/hdr/stack/mac/mac.h +++ b/srsenb/hdr/stack/mac/mac.h @@ -79,6 +79,10 @@ public: int get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res); int get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res); int get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_t* dl_sched_res); + void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final + { + scheduler.set_dl_tti_mask(tti_mask, nof_sfs); + } void build_mch_sched(uint32_t tbs); void rl_failure(uint16_t rnti); void rl_ok(uint16_t rnti); diff --git a/srsenb/hdr/stack/mac/scheduler.h b/srsenb/hdr/stack/mac/scheduler.h index 88646cfde..40abdc4e3 100644 --- a/srsenb/hdr/stack/mac/scheduler.h +++ b/srsenb/hdr/stack/mac/scheduler.h @@ -137,8 +137,9 @@ public: int dl_sched(uint32_t tti, dl_sched_res_t* sched_result) final; int ul_sched(uint32_t tti, ul_sched_res_t* sched_result) final; - /* Custom TPC functions + /* Custom functions */ + void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) final; void tpc_inc(uint16_t rnti); void tpc_dec(uint16_t rnti); @@ -284,6 +285,7 @@ protected: const static uint32_t nof_sched_ttis = 10; tti_sched_t tti_scheds[nof_sched_ttis]; tti_sched_t* get_tti_sched(uint32_t tti_rx) { return &tti_scheds[tti_rx % nof_sched_ttis]; } + std::vector tti_dl_mask; tti_sched_t* new_tti(uint32_t tti_rx); void generate_phich(tti_sched_t* tti_sched); diff --git a/srsenb/src/phy/phy_common.cc b/srsenb/src/phy/phy_common.cc index 4d841751f..54e9bc6bc 100644 --- a/srsenb/src/phy/phy_common.cc +++ b/srsenb/src/phy/phy_common.cc @@ -264,10 +264,12 @@ void phy_common::build_mch_table() ZERO_OBJECT(mcch_table); // 40 element table represents 4 frames (40 subframes) + uint32_t nof_sfs = 10; if (mbsfn.mbsfn_subfr_cnfg.sf_alloc.type().value == mbsfn_sf_cfg_s::sf_alloc_c_::types::one_frame) { generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.one_frame().to_number(), 1); } else { generate_mch_table(&mch_table[0], (uint32_t)mbsfn.mbsfn_subfr_cnfg.sf_alloc.four_frames().to_number(), 4); + nof_sfs = 40; } // Debug std::stringstream ss; @@ -275,6 +277,8 @@ void phy_common::build_mch_table() for(uint32_t j=0; j<40; j++) { ss << (int) mch_table[j] << "|"; } + + stack->set_sched_dl_tti_mask(mch_table, nof_sfs); } void phy_common::build_mcch_table() diff --git a/srsenb/src/stack/mac/scheduler.cc b/srsenb/src/stack/mac/scheduler.cc index 442b7306f..c78b322c2 100644 --- a/srsenb/src/stack/mac/scheduler.cc +++ b/srsenb/src/stack/mac/scheduler.cc @@ -576,6 +576,7 @@ sched::sched() : bc_aggr_level(0), rar_aggr_level(0), P(0), si_n_rbg(0), rar_n_r bzero(&sched_cfg, sizeof(sched_cfg)); bzero(&common_locations, sizeof(common_locations)); bzero(&pdsch_re, sizeof(pdsch_re)); + tti_dl_mask.resize(10, 1); for (int i = 0; i < 3; i++) { bzero(rar_locations[i], sizeof(sched_ue::sched_dci_cce_t) * 10); @@ -1006,6 +1007,11 @@ int sched::ul_sr_info(uint32_t tti, uint16_t rnti) return ret; } +void sched::set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) +{ + tti_dl_mask.assign(tti_mask, tti_mask + nof_sfs); +} + void sched::tpc_inc(uint16_t rnti) { pthread_rwlock_rdlock(&rwlock); @@ -1051,7 +1057,9 @@ sched::tti_sched_t* sched::new_tti(uint32_t tti_rx) generate_phich(tti_sched); /* Schedule DL */ - generate_dl_sched(tti_sched); + if (tti_dl_mask[tti_rx % tti_dl_mask.size()] > 0) { + generate_dl_sched(tti_sched); + } /* Schedule UL */ generate_ul_sched(tti_sched);