clean-up: fix code repetition
This commit is contained in:
committed by
francescomani
parent
dc70b621a5
commit
84aa1f8ff5
@@ -2696,6 +2696,18 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
}
|
||||
}
|
||||
|
||||
static void get_pusch_frame_slot(const int current_frame,
|
||||
const int current_slot,
|
||||
const int k2,
|
||||
const int delta,
|
||||
const int slots_per_frame,
|
||||
frame_t *frame_tx,
|
||||
int *slot_tx)
|
||||
{
|
||||
*slot_tx = (current_slot + k2 + delta) % slots_per_frame;
|
||||
*frame_tx = (current_frame + (current_slot + k2 + delta) / slots_per_frame) % MAX_FRAME_NUMBER;
|
||||
}
|
||||
|
||||
// PUSCH scheduler:
|
||||
// - Calculate the slot in which ULSCH should be scheduled. This is current slot + K2,
|
||||
// - where K2 is the offset between the slot in which UL DCI is received and the slot
|
||||
@@ -2734,8 +2746,7 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
|
||||
GET_DURATION_RX_TO_TX(&mac->phy_config.config_req.ntn_config, mu));
|
||||
|
||||
|
||||
*slot_tx = (current_slot + k2 + delta) % slots_per_frame;
|
||||
*frame_tx = (current_frame + (current_slot + k2 + delta) / slots_per_frame) % MAX_FRAME_NUMBER;
|
||||
get_pusch_frame_slot(current_frame, current_slot, k2, delta, slots_per_frame, frame_tx, slot_tx);
|
||||
} else {
|
||||
AssertFatal(k2 >= GET_DURATION_RX_TO_TX(&mac->phy_config.config_req.ntn_config, mu),
|
||||
"Slot offset K2 (%ld) needs to be higher than DURATION_RX_TO_TX (%ld). Please set min_rxtxtime at least to %ld in "
|
||||
@@ -2752,8 +2763,7 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
// Calculate TX slot and frame
|
||||
*slot_tx = (current_slot + k2) % slots_per_frame;
|
||||
*frame_tx = (current_frame + (current_slot + k2) / slots_per_frame) % MAX_FRAME_NUMBER;
|
||||
get_pusch_frame_slot(current_frame, current_slot, k2, 0, slots_per_frame, frame_tx, slot_tx);
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "[%04d.%02d] UL transmission in [%04d.%02d] (k2 %ld delta %d)\n", current_frame, current_slot, *frame_tx, *slot_tx, k2, delta);
|
||||
|
||||
Reference in New Issue
Block a user