get SSB ARFCN at RRC UE (needed to update k_gnb key according to 33.501)

This commit is contained in:
francescomani
2024-03-13 17:59:11 +01:00
parent 72e10a0ee6
commit 37d3e5bb58
18 changed files with 143 additions and 153 deletions
@@ -153,15 +153,7 @@ int nr_pbch_detection(const UE_nr_rxtx_proc_t *proc,
stop_meas(&ue->dlsch_channel_estimation_stats);
fapiPbch_t result = {0};
ret = nr_rx_pbch(ue,
proc,
estimateSz,
dl_ch_estimates,
frame_parms,
temp_ptr->i_ssb,
SISO,
&result,
rxdataF);
ret = nr_rx_pbch(ue, proc, estimateSz, dl_ch_estimates, frame_parms, temp_ptr->i_ssb, &result, rxdataF);
if (DUMP_PBCH_CH_ESTIMATES && (ret == 0)) {
write_output("pbch_ch_estimates.m", "pbch_ch_estimates", dl_ch_estimates, frame_parms->nb_antennas_rx*estimateSz, 1, 1);
+1 -10
View File
@@ -361,7 +361,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct complex16 dl_ch_estimates[][estimateSz],
NR_DL_FRAME_PARMS *frame_parms,
uint8_t i_ssb,
MIMO_mode_t mimo_mode,
fapiPbch_t *result,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
{
@@ -414,7 +413,7 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
symbol_offset,
frame_parms);
#ifdef DEBUG_PBCH
LOG_I(PHY,"[PHY] PBCH Symbol %d ofdm size %d\n",symbol, frame_parms->ofdm_symbol_size );
LOG_I(PHY,"[PHY] PBCH Symbol %d ofdm size %d\n",symbol, frame_parms->ofdm_symbol_size);
LOG_I(PHY,"[PHY] PBCH starting channel_level\n");
#endif
@@ -441,14 +440,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
rxdataF_comp,
symbol);*/
/*
if (mimo_mode == ALAMOUTI) {
nr_pbch_alamouti(frame_parms,rxdataF_comp,symbol);
} else if (mimo_mode != SISO) {
LOG_I(PHY,"[PBCH][RX] Unsupported MIMO mode\n");
return(-1);
}
*/
int nb=symbol==2 ? 144 : 360;
nr_pbch_quantize(pbch_e_rx+pbch_e_rx_idx,
(short *)rxdataF_comp[0],
@@ -294,7 +294,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
struct complex16 dl_ch_estimates[][estimateSz],
NR_DL_FRAME_PARMS *frame_parms,
uint8_t i_ssb,
MIMO_mode_t mimo_mode,
fapiPbch_t *result,
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
+9 -1
View File
@@ -109,6 +109,14 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
}
}
static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms)
{
uint32_t band_size_hz = frame_parms->N_RB_DL * 12 * frame_parms->subcarrier_spacing;
int ssb_center_sc = frame_parms->ssb_start_subcarrier + 120; // ssb is 20 PRBs -> 240 sub-carriers
uint64_t ssb_freq = frame_parms->dl_CarrierFreq - (band_size_hz / 2) + frame_parms->subcarrier_spacing * ssb_center_sc;
return to_nrarfcn(frame_parms->nr_band, ssb_freq, frame_parms->numerology_index, band_size_hz);
}
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
uint8_t pdu_type,
PHY_VARS_NR_UE *ue,
@@ -168,6 +176,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
ssb_pdu->cell_id = frame_parms->Nid_cell;
ssb_pdu->ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
ssb_pdu->rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index];
ssb_pdu->arfcn = get_ssb_arfcn(frame_parms);
ssb_pdu->radiolink_monitoring = RLM_in_sync; // TODO to be removed from here
ssb_pdu->decoded_pdu = true;
}
@@ -384,7 +393,6 @@ static int nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
dl_ch_estimates,
&ue->frame_parms,
(ue->frame_parms.ssb_index)&7,
SISO,
&result,
rxdataF);
@@ -49,6 +49,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const int slot,
const rnti_t rnti,
const uint32_t cellid,
const long arfcn,
const channel_t channel,
const uint8_t* pduP,
const sdu_size_t pdu_len) { return 0; }
+1 -9
View File
@@ -797,15 +797,7 @@ int main(int argc, char **argv)
}
fapiPbch_t result;
ret = nr_rx_pbch(UE,
&proc,
estimateSz,
dl_ch_estimates,
frame_parms,
ssb_index%8,
SISO,
&result,
rxdataF);
ret = nr_rx_pbch(UE, &proc, estimateSz, dl_ch_estimates, frame_parms, ssb_index % 8, &result, rxdataF);
if (ret==0) {
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically