sched,nr: address comments in PR (code formatting)

Signed-off-by: Carlo Galiotto <carlo@srs.io>
master
Carlo Galiotto 3 years ago committed by Andre Puschmann
parent bc7c21b8c3
commit d18af603aa

@ -24,6 +24,21 @@ void sched_nzp_csi_rs(srsran::const_span<srsran_csi_rs_nzp_set_t> nzp_csi_rs_set
const srsran_slot_cfg_t& slot_cfg,
nzp_csi_rs_list& csi_rs_list);
/**
* @brief Schedule grant for SSB.
*
* The functions schedules the SSB according to a given periodicity. This function is a simplified version of an
* SSB scheduler and has several hard-coded parameters.
*
* @param[out] sl_point Slot point carrying information about current slot.
* @param[in] ssb_periodicity Periodicity of SSB in ms.
* @param[in] ssb_list List of SSB messages to be sent to PHY.
*
* @remark This function a is basic scheduling function that uses the following simplified assumption:
* 1) Subcarrier spacing: 15kHz
* 2) Frequency below 3GHz
* 3) Position in Burst is 1000, i.e., Only the first SSB of the 4 opportunities gets scheduled
*/
void sched_ssb_basic(const slot_point& sl_point, uint32_t ssb_periodicity, ssb_list& ssb_list);
/// For a given BWP and slot, schedule SSB, NZP CSI RS and SIBs

@ -42,83 +42,29 @@ void sched_nzp_csi_rs(srsran::const_span<srsran_csi_rs_nzp_set_t> nzp_csi_rs_set
void sched_ssb_basic(const slot_point& sl_point, uint32_t ssb_periodicity, ssb_list& ssb_list)
{
/* This function is extremely simplified.
* It works based on the following assumptions (hard-coded parameters)
* 1) 15kHz subcarrier spacing
* 2) Below 3GHz
* 3) Position in Burst 1000
* */
// If the periodicity is 0, it means that the parameter was not passed by the upper layers.
// In that case, we use default value of 5ms (see Clause 4.1, TS 38.213)
if (ssb_periodicity == 0)
ssb_periodicity = DEFAULT_SSB_PERIODICITY;
uint32_t sl_idx = sl_point.to_uint();
uint32_t ssb_sf_idx = sl_point.to_uint() % ssb_periodicity;
// mod operation of slot index by ssb_periodicity. With current subcarrier spacing, 1 slot = 1ms
uint32_t sl_point_mod = sl_point.to_uint() % ssb_periodicity;
// code below is simplified
if (ssb_sf_idx == 0)
{
if (sl_point_mod == 0) {
ssb_t ssb_msg = {};
srsran_mib_nr_t mib_msg = {};
mib_msg.sfn = sl_point.sfn();
mib_msg.hrf = (sl_idx % SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) < SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) / 2);
mib_msg.ssb_idx = 0; // This corresponds to "Position in Burst" = 1000
mib_msg.hrf = (sl_idx % SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) <
SRSRAN_NSLOTS_PER_FRAME_NR(srsran_subcarrier_spacing_15kHz) / 2);
// This corresponds to "Position in Burst" = 1000
mib_msg.ssb_idx = 0;
// Pack mib message to be sent to PHY
srsran_pbch_msg_nr_mib_pack(&mib_msg, &ssb_msg.pbch_msg);
ssb_list.push_back(ssb_msg);
}
}
#if 0
void sched_ssb(int slot_idx, int ssb_periodicity, srsran::bounded_bitset<4>& pos_in_burst)
{
/* Input needed:
* - slot_idx: slot index
* - ssb_periodicity: Periodicity of SSB in ms
* - pos_in_burst: position in Burst (bit map indicating in which SSB opportunities gNB needs to tx
*
* Parameters that could be passed but are currently hard-coded
* - Subcarrier spacing: 15kHz
* - Frequency (info on whether carrier is above or below 3GHz)
*
* NOTE: this function is hard coded for frequency < 3GHz,
* and SubCarrierSpacing 15kHz. Therefore, we assume
* 1 slot = 1ms
* */
// NOTE: This
// This function only implements SSB for frequency < 3GHz, and SubCarrierSpacing 15kHz
// In this case, 1 slot = 1ms
int ssb_sf_idx = slot_idx % ssb_periodicity;
// if slot falls into the correct periodicity, continue with further checks
// check if slot is
// code below will be simplified, depending on struct used
if (ssb_sf_idx == 0)
{
// check first two bit in bitmap (position in burst)
// and pack corresponding SSB for slot 0
if ( pos_in_burst.test(POS_IN_BURST_FIRST_BIT_IDX) )
printf("Pack first SSB in slot 0 ");
if ( pos_in_burst.test(POS_IN_BURST_SECOND_BIT_IDX) )
printf("Pack second SSB in slot 0 ");
}
else if (ssb_sf_idx == 1)
{
// check second two bit in bitmap (position in burst)
// and pack corresponding SSB for slot 1
if ( pos_in_burst.test(POS_IN_BURST_FIRST_BIT_IDX) )
printf("Pack first SSB in slot 1 ");
if ( pos_in_burst.test(POS_IN_BURST_SECOND_BIT_IDX) )
printf("Pack second SSB in slot 1 ");
}
else
// nothing to do here
return;
}
#endif
void sched_dl_signalling(const bwp_params& bwp_params,
slot_point sl_pdcch,

@ -127,13 +127,12 @@ void sched_nr_cfg_serialized_test()
}
/*
* This test runs the scheduler and verify that the SSB grant is present
* with the required periodicity
* @brief Test whether the SSB grant gets scheduled with the correct periodicity.
*
*/
void sched_nr_ssb_test()
{
const uint32_t ssb_periodicity = 5;
int tmp = 0;
uint32_t max_nof_ttis = 1000, nof_sectors = 4;
task_job_manager tasks;
@ -167,9 +166,9 @@ void sched_nr_ssb_test()
sched_tester.update(out);
tasks.finish_cc(slot_rx, dl_res, ul_res);
/*
* Verify that with SSB periodicity, dl_res has:
* Verify that, with correct SSB periodicity, dl_res has:
* 1) SSB grant
* 2) 4 LSB of SFN in packed MIB message is correct
* 2) 4 LSBs of SFN in packed MIB message are correct
* 3) SSB index is 0
*/
if (slot_tx.to_uint() % ssb_periodicity == 0) {
@ -178,9 +177,7 @@ void sched_nr_ssb_test()
TESTASSERT(ssb_item.pbch_msg.sfn_4lsb == ((uint8_t)slot_tx.sfn() & 0b1111));
TESTASSERT(ssb_item.pbch_msg.ssb_idx == 0);
}
/*
* Verify that, outside SSB periodicity, dl_res HAS NO SSB grant
*/
/// Verify that, outside SSB periodicity, dl_res HAS NO SSB grant
else
TESTASSERT(dl_res.dl_sched.ssb.size() == 0);
}

Loading…
Cancel
Save