|
|
@ -57,7 +57,8 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
|
|
|
|
static const uint32_t PRACH_RAR_OFFSET = 3;
|
|
|
|
static const uint32_t PRACH_RAR_OFFSET = 3;
|
|
|
|
slot_point pdcch_slot = slot_grid.get_pdcch_tti();
|
|
|
|
slot_point pdcch_slot = slot_grid.get_pdcch_tti();
|
|
|
|
slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay;
|
|
|
|
slot_point msg3_slot = pdcch_slot + bwp_cfg->pusch_ra_list[0].msg3_delay;
|
|
|
|
if (not slot_grid.res_grid()[msg3_slot].is_ul) {
|
|
|
|
if (not slot_grid.res_grid()[pdcch_slot].is_dl or not slot_grid.res_grid()[msg3_slot].is_ul) {
|
|
|
|
|
|
|
|
// RAR only allowed if respective Msg3 slot is available for UL
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -113,24 +114,27 @@ void ra_sched::run_slot(bwp_slot_allocator& slot_grid, slot_ue_map_t& slot_ues)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// See TS 38.321, 5.1.3 - RAP transmission
|
|
|
|
int ra_sched::dl_rach_info(const dl_sched_rar_info_t& rar_info)
|
|
|
|
int ra_sched::dl_rach_info(const dl_sched_rar_info_t& rar_info)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
logger.info("SCHED: New PRACH tti=%d, preamble=%d, temp_crnti=0x%x, ta_cmd=%d, msg3_size=%d",
|
|
|
|
logger.info("SCHED: New PRACH slot=%d, preamble=%d, temp_crnti=0x%x, ta_cmd=%d, msg3_size=%d",
|
|
|
|
rar_info.prach_slot,
|
|
|
|
rar_info.prach_slot.to_uint(),
|
|
|
|
rar_info.preamble_idx,
|
|
|
|
rar_info.preamble_idx,
|
|
|
|
rar_info.temp_crnti,
|
|
|
|
rar_info.temp_crnti,
|
|
|
|
rar_info.ta_cmd,
|
|
|
|
rar_info.ta_cmd,
|
|
|
|
rar_info.msg3_size);
|
|
|
|
rar_info.msg3_size);
|
|
|
|
|
|
|
|
|
|
|
|
// RA-RNTI = 1 + t_id + f_id
|
|
|
|
// RA-RNTI = 1 + s_id + 14 × t_id + 14 × 80 × f_id + 14 × 80 × 8 × ul_carrier_id
|
|
|
|
// t_id = index of first subframe specified by PRACH (0<=t_id<10)
|
|
|
|
// s_id = index of the first OFDM symbol (0 <= s_id < 14)
|
|
|
|
// f_id = index of the PRACH within subframe, in ascending order of freq domain (0<=f_id<6) (for FDD, f_id=0)
|
|
|
|
// t_id = index of first slot of the PRACH (0 <= t_id < 80)
|
|
|
|
uint16_t ra_rnti = 1 + (uint16_t)(rar_info.prach_slot % 10u);
|
|
|
|
// f_id = index of the PRACH in the freq domain (0 <= f_id < 8) (for FDD, f_id=0)
|
|
|
|
|
|
|
|
// ul_carrier_id = 0 for NUL and 1 for SUL carrier
|
|
|
|
|
|
|
|
uint16_t ra_rnti = 1 + rar_info.ofdm_symbol_idx + 14 * rar_info.prach_slot.slot_idx() + 14 * 80 * rar_info.freq_idx;
|
|
|
|
|
|
|
|
|
|
|
|
// find pending rar with same RA-RNTI
|
|
|
|
// find pending rar with same RA-RNTI
|
|
|
|
for (pending_rar_t& r : pending_rars) {
|
|
|
|
for (pending_rar_t& r : pending_rars) {
|
|
|
|
if (r.prach_slot.to_uint() == rar_info.prach_slot and ra_rnti == r.ra_rnti) {
|
|
|
|
if (r.prach_slot == rar_info.prach_slot and ra_rnti == r.ra_rnti) {
|
|
|
|
if (r.msg3_grant.size() >= sched_interface::MAX_RAR_LIST) {
|
|
|
|
if (r.msg3_grant.full()) {
|
|
|
|
logger.warning("PRACH ignored, as the the maximum number of RAR grants per tti has been reached");
|
|
|
|
logger.warning("PRACH ignored, as the the maximum number of RAR grants per tti has been reached");
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -142,7 +146,7 @@ int ra_sched::dl_rach_info(const dl_sched_rar_info_t& rar_info)
|
|
|
|
// create new RAR
|
|
|
|
// create new RAR
|
|
|
|
pending_rar_t p;
|
|
|
|
pending_rar_t p;
|
|
|
|
p.ra_rnti = ra_rnti;
|
|
|
|
p.ra_rnti = ra_rnti;
|
|
|
|
p.prach_slot = slot_point{0, rar_info.prach_slot};
|
|
|
|
p.prach_slot = rar_info.prach_slot;
|
|
|
|
p.msg3_grant.push_back(rar_info);
|
|
|
|
p.msg3_grant.push_back(rar_info);
|
|
|
|
pending_rars.push_back(p);
|
|
|
|
pending_rars.push_back(p);
|
|
|
|
|
|
|
|
|
|
|
|