clean-up: rename functions
Rename few functions and array related to beam index storing and allocation. Reduce code duplication in function to get ssb index bitmap.
This commit is contained in:
@@ -885,7 +885,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c
|
||||
LOG_D(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n");
|
||||
|
||||
config_common(nrmac, config, scc);
|
||||
fapi_beam_index_allocation(scc, config, nrmac);
|
||||
fill_beam_index_list(scc, config, nrmac);
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MONOLITHIC) {
|
||||
// nothing to be sent in the other cases
|
||||
|
||||
@@ -421,7 +421,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP)
|
||||
// ordered ssb number
|
||||
int n_ssb = (int) (prach_occasion_id / (int)(1 / num_ssb_per_RO)) % cc->num_active_ssb;
|
||||
// fapi beam index
|
||||
beam_index = get_fapi_beamforming_index(gNB, cc->ssb_index[n_ssb]);
|
||||
beam_index = get_beam_from_ssbidx(gNB, cc->ssb_index[n_ssb]);
|
||||
// multi-beam allocation structure
|
||||
beam = beam_allocation_procedure(&gNB->beam_info, frameP, slotP, beam_index, slots_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate PRACH corresponding to %d SSB transmitted in any available beam\n", n_ssb + 1);
|
||||
@@ -429,7 +429,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP)
|
||||
int first_ssb_index = (prach_occasion_id * (int)num_ssb_per_RO) % cc->num_active_ssb;
|
||||
for(int j = first_ssb_index; j < first_ssb_index + num_ssb_per_RO; j++) {
|
||||
// fapi beam index
|
||||
beam_index = get_fapi_beamforming_index(gNB, cc->ssb_index[j]);
|
||||
beam_index = get_beam_from_ssbidx(gNB, cc->ssb_index[j]);
|
||||
// multi-beam allocation structure
|
||||
beam = beam_allocation_procedure(&gNB->beam_info, frameP, slotP, beam_index, slots_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate PRACH corresponding to SSB %d in any available beam\n", j);
|
||||
@@ -763,7 +763,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
configure_UE_BWP(nr_mac, scc, UE, true, NR_SearchSpace__searchSpaceType_PR_common, -1, -1);
|
||||
// return current SSB order in the list of tranmitted SSBs
|
||||
int n_ssb = ssb_index_from_prach(module_idP, frame, slot, preamble_index, freq_index, symbol);
|
||||
UE->UE_beam_index = get_fapi_beamforming_index(nr_mac, cc->ssb_index[n_ssb]);
|
||||
UE->UE_beam_index = get_beam_from_ssbidx(nr_mac, cc->ssb_index[n_ssb]);
|
||||
LOG_I(NR_MAC, "UE %04x: Sync beam index %d\n", UE->rnti, UE->UE_beam_index);
|
||||
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
|
||||
|
||||
@@ -137,7 +137,7 @@ static void schedule_one_ssb(gNB_MAC_INST *gNB,
|
||||
|
||||
uint16_t ssb_start_symbol = get_ssb_start_symbol(band, scs, i_ssb);
|
||||
NR_beam_alloc_t beam =
|
||||
beam_allocation_procedure(&gNB->beam_info, frameP, slotP, get_fapi_beamforming_index(gNB, i_ssb), slots_per_frame);
|
||||
beam_allocation_procedure(&gNB->beam_info, frameP, slotP, get_beam_from_ssbidx(gNB, i_ssb), slots_per_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate SSB %d in any available beam\n", i_ssb);
|
||||
const uint16_t beam_index =
|
||||
convert_to_fapi_beam(get_allocated_beam(&gNB->beam_info, frameP, slotP, slots_per_frame, beam.idx), gNB->beam_info.beam_mode);
|
||||
@@ -509,7 +509,7 @@ void schedule_nr_sib1(module_id_t module_idP,
|
||||
"Trying to schedule SIB1 in slot %d which is not DL. Check searchSpaceZero configuration.\n",
|
||||
slotP);
|
||||
const int n_slots_frame = gNB_mac->frame_structure.numb_slots_frame;
|
||||
int beam_index = get_fapi_beamforming_index(gNB_mac, i);
|
||||
int beam_index = get_beam_from_ssbidx(gNB_mac, i);
|
||||
NR_beam_alloc_t beam = beam_allocation_procedure(&gNB_mac->beam_info, frameP, slotP, beam_index, n_slots_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate SIB1 corresponding to SSB %d in any available beam\n", i);
|
||||
LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index);
|
||||
@@ -617,7 +617,7 @@ static void other_sib_sched_control(module_id_t module_idP,
|
||||
slot);
|
||||
NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[0].ServingCellConfigCommon;
|
||||
int n_slots_frame = gNB_mac->frame_structure.numb_slots_frame;
|
||||
beam_index = get_fapi_beamforming_index(gNB_mac, beam_index);
|
||||
beam_index = get_beam_from_ssbidx(gNB_mac, beam_index);
|
||||
NR_beam_alloc_t beam = beam_allocation_procedure(&gNB_mac->beam_info, frame, slot, beam_index, n_slots_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate otherSIB corresponding for SSB number %d in any available beam\n", beam_index);
|
||||
LOG_D(NR_MAC, "(%d.%d) otherSIB payload %d transmission for ssb number %d\n", frame, slot, payload_idx, beam_index);
|
||||
|
||||
@@ -95,25 +95,11 @@ void nr_preprocessor_phytest(gNB_MAC_INST *mac, post_process_pdsch_t *pp_pdsch)
|
||||
/* This is a primitive beam allocation procedure for PDSCH in phytest mode which is
|
||||
intended to be used to verify the beamformed signal in VSA. The beam allocation of PDSCH
|
||||
slots follows the SSB slots even in slots that don't have SSB. */
|
||||
int num_ssb = 0;
|
||||
BIT_STRING_t *ssbBitmap = NULL;
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case 1:
|
||||
num_ssb = 4;
|
||||
ssbBitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
num_ssb = 8;
|
||||
ssbBitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap;
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(0, "SSB burst len in burst not supported\n");
|
||||
}
|
||||
uint8_t num_ssb = 0;
|
||||
const uint64_t ssbBitmap = get_ssb_bitmap_and_len(scc, &num_ssb);
|
||||
int ssb_idx_beam = 0;
|
||||
for (int i_ssb = 0; i_ssb < num_ssb; i_ssb++) {
|
||||
if (IS_BIT_SET(ssbBitmap->buf[0], (7 - i_ssb))) {
|
||||
if (IS_BIT_SET(ssbBitmap, (63 - i_ssb))) {
|
||||
NR_SubcarrierSpacing_t scs = *scc->ssbSubcarrierSpacing;
|
||||
const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
|
||||
uint16_t ssb_start_symbol = get_ssb_start_symbol(band, scs, i_ssb);
|
||||
@@ -124,7 +110,7 @@ void nr_preprocessor_phytest(gNB_MAC_INST *mac, post_process_pdsch_t *pp_pdsch)
|
||||
}
|
||||
}
|
||||
}
|
||||
int beam_idx = get_fapi_beamforming_index(mac, ssb_idx_beam);
|
||||
int beam_idx = get_beam_from_ssbidx(mac, ssb_idx_beam);
|
||||
NR_beam_alloc_t beam = beam_allocation_procedure(&mac->beam_info, frame, slot, beam_idx, mac->frame_structure.numb_slots_frame);
|
||||
AssertFatal(beam.idx > -1, "Can't allocate beam %d in phytest scheduler\n", beam_idx);
|
||||
UE->UE_beam_index = get_allocated_beam(&mac->beam_info, frame, slot, mac->frame_structure.numb_slots_frame, beam.idx);
|
||||
|
||||
@@ -3622,45 +3622,48 @@ void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t
|
||||
}
|
||||
}
|
||||
|
||||
int get_fapi_beamforming_index(gNB_MAC_INST *mac, int ssb_idx)
|
||||
int get_beam_from_ssbidx(gNB_MAC_INST *mac, int ssb_idx)
|
||||
{
|
||||
int beam_idx = mac->fapi_beam_index[ssb_idx];
|
||||
int beam_idx = mac->beam_index_list[ssb_idx];
|
||||
AssertFatal(beam_idx >= 0, "Invalid beamforming index %d\n", beam_idx);
|
||||
return beam_idx;
|
||||
}
|
||||
|
||||
// TODO this is a placeholder for a possibly more complex function
|
||||
// for now the fapi beam index is the number of SSBs transmitted before ssb_index i
|
||||
void fapi_beam_index_allocation(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac)
|
||||
uint64_t get_ssb_bitmap_and_len(const NR_ServingCellConfigCommon_t *scc, uint8_t *len)
|
||||
{
|
||||
if (mac->beam_info.beam_mode == NO_BEAM_MODE)
|
||||
return;
|
||||
int len = 0;
|
||||
uint8_t* buf = NULL;
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap:
|
||||
len = 4;
|
||||
buf = scc->ssb_PositionsInBurst->choice.shortBitmap.buf;
|
||||
*len = 4;
|
||||
break;
|
||||
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap:
|
||||
len = 8;
|
||||
buf = scc->ssb_PositionsInBurst->choice.mediumBitmap.buf;
|
||||
*len = 8;
|
||||
break;
|
||||
case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap:
|
||||
len = 64;
|
||||
buf = scc->ssb_PositionsInBurst->choice.longBitmap.buf;
|
||||
*len = 64;
|
||||
break;
|
||||
default :
|
||||
AssertFatal(false, "Invalid configuration\n");
|
||||
}
|
||||
return get_ssb_bitmap(scc);
|
||||
}
|
||||
|
||||
// TODO this is a placeholder for a possibly more complex function
|
||||
// for now the fapi beam index is the number of SSBs transmitted before ssb_index i
|
||||
void fill_beam_index_list(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac)
|
||||
{
|
||||
if (mac->beam_info.beam_mode == NO_BEAM_MODE)
|
||||
return;
|
||||
|
||||
uint8_t len = 0;
|
||||
const uint64_t ssbBitmap = get_ssb_bitmap_and_len(scc, &len);
|
||||
int index = 0;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if ((buf[i / 8] >> (7 - i % 8)) & 0x1) {
|
||||
if (IS_BIT_SET(ssbBitmap, (63 - i))) {
|
||||
int fapi_index = mac->beam_info.beam_mode == LOPHY_BEAM_IDX ? config->bw_list[index] : index;
|
||||
mac->fapi_beam_index[i] = fapi_index;
|
||||
mac->beam_index_list[i] = fapi_index;
|
||||
index++;
|
||||
} else
|
||||
mac->fapi_beam_index[i] = -1;
|
||||
mac->beam_index_list[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3726,7 +3729,7 @@ void beam_selection_procedures(gNB_MAC_INST *mac, NR_UE_info_t *UE)
|
||||
return;
|
||||
RSRP_report_t *rsrp_report = &UE->UE_sched_ctrl.CSI_report.ssb_rsrp_report;
|
||||
// simple beam switching algorithm -> we select beam with highest RSRP from CSI report
|
||||
int new_bf_index = get_fapi_beamforming_index(mac, rsrp_report->resource_id[0]);
|
||||
int new_bf_index = get_beam_from_ssbidx(mac, rsrp_report->resource_id[0]);
|
||||
if (UE->UE_beam_index == new_bf_index)
|
||||
return; // no beam change needed
|
||||
|
||||
|
||||
@@ -447,8 +447,10 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
|
||||
|
||||
int ul_buffer_index(int frame, int slot, int slots_per_frame, int size);
|
||||
void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t frameP, int slotP);
|
||||
void fapi_beam_index_allocation(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac);
|
||||
int get_fapi_beamforming_index(gNB_MAC_INST *mac, int ssb_idx);
|
||||
uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc);
|
||||
uint64_t get_ssb_bitmap_and_len(const NR_ServingCellConfigCommon_t *scc, uint8_t *len);
|
||||
void fill_beam_index_list(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac);
|
||||
int get_beam_from_ssbidx(gNB_MAC_INST *mac, int ssb_idx);
|
||||
int16_t get_allocated_beam(const NR_beam_info_t *beam_info, int frame, int slot, int slots_per_frame, int beam_number_in_period);
|
||||
uint16_t convert_to_fapi_beam(const uint16_t beam_idx, const nr_beam_mode_t mode);
|
||||
NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int16_t beam_index, int slots_per_frame);
|
||||
|
||||
@@ -993,7 +993,7 @@ typedef struct gNB_MAC_INST_s {
|
||||
uint16_t min_grant_prb;
|
||||
bool identity_pm;
|
||||
int precoding_matrix_size[NR_MAX_NB_LAYERS];
|
||||
int fapi_beam_index[MAX_NUM_OF_SSB];
|
||||
int beam_index_list[MAX_NUM_OF_SSB];
|
||||
|
||||
/// dedicate UL TDA, common for all UEs
|
||||
seq_arr_t ul_tda;
|
||||
|
||||
@@ -309,7 +309,7 @@ static NR_ControlResourceSet_t *get_coreset_config(int bwp_id, int curr_bwp, uin
|
||||
return coreset;
|
||||
}
|
||||
|
||||
static uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc)
|
||||
uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc)
|
||||
{
|
||||
uint64_t bitmap=0;
|
||||
switch (scc->ssb_PositionsInBurst->present) {
|
||||
|
||||
Reference in New Issue
Block a user