move radio link failure detection on pbch at MAC
This commit is contained in:
@@ -202,7 +202,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
// create shortcuts
|
||||
NR_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
||||
NR_UE_COMMON *const common_vars = &ue->common_vars;
|
||||
NR_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
||||
NR_UE_PRACH **const prach_vars = ue->prach_vars;
|
||||
NR_UE_CSI_IM **const csiim_vars = ue->csiim_vars;
|
||||
NR_UE_CSI_RS **const csirs_vars = ue->csirs_vars;
|
||||
@@ -357,7 +356,6 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
// DLSCH
|
||||
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
|
||||
prach_vars[gNB_id] = (NR_UE_PRACH *)malloc16_clear(sizeof(NR_UE_PRACH));
|
||||
pbch_vars[gNB_id] = (NR_UE_PBCH *)malloc16_clear(sizeof(NR_UE_PBCH));
|
||||
csiim_vars[gNB_id] = (NR_UE_CSI_IM *)malloc16_clear(sizeof(NR_UE_CSI_IM));
|
||||
csirs_vars[gNB_id] = (NR_UE_CSI_RS *)malloc16_clear(sizeof(NR_UE_CSI_RS));
|
||||
srs_vars[gNB_id] = (NR_UE_SRS *)malloc16_clear(sizeof(NR_UE_SRS));
|
||||
@@ -476,7 +474,6 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
free_and_zero(ue->csirs_vars[gNB_id]);
|
||||
free_and_zero(ue->srs_vars[gNB_id]);
|
||||
|
||||
free_and_zero(ue->pbch_vars[gNB_id]);
|
||||
free_and_zero(ue->prach_vars[gNB_id]);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,12 +155,11 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
proc,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf,rxdataF);
|
||||
|
||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||
fapiPbch_t result;
|
||||
fapiPbch_t result = {0};
|
||||
ret = nr_rx_pbch(ue,
|
||||
proc,
|
||||
estimateSz,
|
||||
dl_ch_estimates,
|
||||
ue->pbch_vars[0],
|
||||
frame_parms,
|
||||
temp_ptr->i_ssb,
|
||||
SISO,
|
||||
@@ -188,11 +187,6 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
// openair_daq_vars.dlsch_transmission_mode = (pbch_tx_ant>1) ? 2 : 1;
|
||||
|
||||
|
||||
// flip byte endian on 24-bits for MIB
|
||||
// dummy = ue->pbch_vars[0]->decoded_output[0];
|
||||
// ue->pbch_vars[0]->decoded_output[0] = ue->pbch_vars[0]->decoded_output[2];
|
||||
// ue->pbch_vars[0]->decoded_output[2] = dummy;
|
||||
|
||||
#ifdef DEBUG_INITIAL_SYNCH
|
||||
LOG_I(PHY,"[UE%d] Initial sync: pbch decoded sucessfully\n",ue->Mod_id);
|
||||
#endif
|
||||
@@ -447,8 +441,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
|
||||
// send sync status to higher layers later when timing offset converge to target timing
|
||||
|
||||
ue->pbch_vars[0]->pdu_errors_conseq=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -466,10 +458,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
frame_parms->Nid_cell,frame_parms->frame_type);
|
||||
#endif
|
||||
|
||||
ue->pbch_vars[0]->pdu_errors_last=ue->pbch_vars[0]->pdu_errors;
|
||||
ue->pbch_vars[0]->pdu_errors++;
|
||||
ue->pbch_vars[0]->pdu_errors_conseq++;
|
||||
|
||||
}
|
||||
|
||||
// gain control
|
||||
|
||||
@@ -302,8 +302,7 @@ void nr_pbch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
|
||||
int16_t *demod_pbch_e,
|
||||
static void nr_pbch_unscrambling(int16_t *demod_pbch_e,
|
||||
uint16_t Nid,
|
||||
uint8_t nushift,
|
||||
uint16_t M,
|
||||
@@ -311,7 +310,8 @@ static void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
|
||||
uint8_t bitwise,
|
||||
uint32_t unscrambling_mask,
|
||||
uint32_t pbch_a_prime,
|
||||
uint32_t *pbch_a_interleaved) {
|
||||
uint32_t *pbch_a_interleaved)
|
||||
{
|
||||
uint8_t reset, offset;
|
||||
uint32_t x1 = 0, x2 = 0, s = 0;
|
||||
uint8_t k=0;
|
||||
@@ -384,17 +384,17 @@ unsigned char sign(int8_t x) {
|
||||
|
||||
uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11,12,13,1,4,3,14,15,16,17,2,26,18,19,20,21,22,6,23};
|
||||
|
||||
int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int estimateSz, struct complex16 dl_ch_estimates [][estimateSz],
|
||||
NR_UE_PBCH *nr_ue_pbch_vars,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t i_ssb,
|
||||
MIMO_mode_t mimo_mode,
|
||||
nr_phy_data_t *phy_data,
|
||||
fapiPbch_t *result,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]) {
|
||||
|
||||
int nr_rx_pbch(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
int estimateSz,
|
||||
struct complex16 dl_ch_estimates [][estimateSz],
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t i_ssb,
|
||||
MIMO_mode_t mimo_mode,
|
||||
nr_phy_data_t *phy_data,
|
||||
fapiPbch_t *result,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
|
||||
{
|
||||
int max_h=0;
|
||||
int symbol;
|
||||
//uint8_t pbch_a[64];
|
||||
@@ -456,7 +456,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
LOG_I(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n",nr_ue_pbch_vars->log2_maxh,max_h);
|
||||
LOG_I(PHY,"[PHY] PBCH log2_maxh = %d (%d)\n", log2_maxh, max_h);
|
||||
#endif
|
||||
__attribute__ ((aligned(32))) struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][PBCH_MAX_RE_PER_SYMBOL];
|
||||
nr_pbch_channel_compensation(rxdataF_ext,
|
||||
@@ -464,7 +464,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
nb_re,
|
||||
rxdataF_comp,
|
||||
frame_parms,
|
||||
log2_maxh); // log2_maxh+I0_shift
|
||||
log2_maxh); // log2_maxh+I0_shift
|
||||
|
||||
/*if (frame_parms->nb_antennas_rx > 1)
|
||||
pbch_detection_mrc(frame_parms,
|
||||
@@ -504,16 +504,27 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041;
|
||||
uint32_t pbch_a_interleaved=0;
|
||||
uint32_t pbch_a_prime=0;
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_E,
|
||||
nr_pbch_unscrambling(pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_E,
|
||||
0, 0, pbch_a_prime, &pbch_a_interleaved);
|
||||
//polar decoding de-rate matching
|
||||
uint64_t tmp=0;
|
||||
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&tmp,0,
|
||||
NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL);
|
||||
pbch_a_prime=tmp;
|
||||
if(decoderState)
|
||||
return(decoderState);
|
||||
pbch_a_prime = tmp;
|
||||
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t *rx_ind = calloc(sizeof(*rx_ind), 1);
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
if(decoderState) {
|
||||
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, phy_data);
|
||||
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, NULL, NULL, number_pdus, proc, NULL);
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
else
|
||||
free(rx_ind); // dl_indication would free(), so free() here if not called
|
||||
return(decoderState);
|
||||
}
|
||||
// printf("polar decoder output 0x%08x\n",pbch_a_prime);
|
||||
// Decoder reversal
|
||||
uint32_t a_reversed=0;
|
||||
@@ -526,7 +537,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3);
|
||||
nushift = ((pbch_a_prime>>24)&1) ^ (((pbch_a_prime>>6)&1)<<1);
|
||||
pbch_a_interleaved=0;
|
||||
nr_pbch_unscrambling(nr_ue_pbch_vars, pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS,
|
||||
nr_pbch_unscrambling(pbch_e_rx, frame_parms->Nid_cell, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS,
|
||||
1, unscrambling_mask, pbch_a_prime, &pbch_a_interleaved);
|
||||
//printf("nushift %d sfn 3rd %d 2nd %d", nushift,((pbch_a_prime>>6)&1), ((pbch_a_prime>>24)&1) );
|
||||
//payload deinterleaving
|
||||
@@ -577,10 +588,6 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
#endif
|
||||
nr_downlink_indication_t dl_indication;
|
||||
fapi_nr_rx_indication_t *rx_ind=calloc(sizeof(*rx_ind),1);
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, NULL, rx_ind, proc, ue, phy_data);
|
||||
nr_fill_rx_indication(rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, ue, NULL, NULL, number_pdus, proc,(void *)result);
|
||||
|
||||
|
||||
@@ -285,7 +285,6 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
const int estimateSz,
|
||||
struct complex16 dl_ch_estimates[][estimateSz],
|
||||
NR_UE_PBCH *nr_ue_pbch_vars,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t i_ssb,
|
||||
MIMO_mode_t mimo_mode,
|
||||
|
||||
@@ -316,17 +316,6 @@ typedef struct {
|
||||
|
||||
#define PBCH_A 24
|
||||
|
||||
typedef struct {
|
||||
/// \brief Total number of PDU errors.
|
||||
uint32_t pdu_errors;
|
||||
/// \brief Total number of PDU errors 128 frames ago.
|
||||
uint32_t pdu_errors_last;
|
||||
/// \brief Total number of consecutive PDU errors.
|
||||
uint32_t pdu_errors_conseq;
|
||||
/// \brief FER (in percent) .
|
||||
//uint32_t pdu_fer;
|
||||
} NR_UE_PBCH;
|
||||
|
||||
typedef struct {
|
||||
int16_t amp;
|
||||
bool active;
|
||||
@@ -402,8 +391,6 @@ typedef struct {
|
||||
int is_synchronized;
|
||||
/// \brief Target gNB Nid_cell when UE is resynchronizing
|
||||
int target_Nid_cell;
|
||||
/// \brief Indicator that UE lost frame synchronization
|
||||
int lost_sync;
|
||||
/// Data structure for UE process scheduling
|
||||
UE_nr_proc_t proc;
|
||||
/// Flag to indicate the UE shouldn't do timing correction at all
|
||||
@@ -444,7 +431,6 @@ typedef struct {
|
||||
fapi_nr_config_request_t nrUE_config;
|
||||
nr_synch_request_t synch_request;
|
||||
|
||||
NR_UE_PBCH *pbch_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_PRACH *prach_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_CSI_IM *csiim_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
NR_UE_CSI_RS *csirs_vars[NUMBER_OF_CONNECTED_gNB_MAX];
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t decoded_output[64];
|
||||
uint8_t decoded_output[3]; // PBCH paylod not larger than 3B
|
||||
uint8_t xtra_byte;
|
||||
} fapiPbch_t;
|
||||
|
||||
|
||||
@@ -118,10 +118,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
NR_UE_DLSCH_t *dlsch1,
|
||||
uint16_t n_pdus,
|
||||
UE_nr_rxtx_proc_t *proc,
|
||||
void *typeSpecific){
|
||||
|
||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
|
||||
void *typeSpecific)
|
||||
{
|
||||
if (n_pdus > 1){
|
||||
LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__);
|
||||
}
|
||||
@@ -154,17 +152,23 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
AssertFatal(1==0,"Second codeword currently not supported\n");
|
||||
}
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB:
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu=malloc(sizeof(((fapiPbch_t*)typeSpecific)->decoded_output));
|
||||
memcpy(rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu,
|
||||
((fapiPbch_t*)typeSpecific)->decoded_output,
|
||||
sizeof(((fapiPbch_t*)typeSpecific)->decoded_output));
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ((fapiPbch_t*)typeSpecific)->xtra_byte;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = (frame_parms->ssb_index)&0x7;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.rsrp_dBm = ue->measurements.ssb_rsrp_dBm[frame_parms->ssb_index];
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB: {
|
||||
fapi_nr_ssb_pdu_t *ssb_pdu = &rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu;
|
||||
if(typeSpecific) {
|
||||
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
fapiPbch_t *pbch = (fapiPbch_t *)typeSpecific;
|
||||
memcpy(ssb_pdu->pdu, pbch->decoded_output, sizeof(pbch->decoded_output));
|
||||
ssb_pdu->additional_bits = pbch->xtra_byte;
|
||||
ssb_pdu->ssb_index = (frame_parms->ssb_index)&0x7;
|
||||
ssb_pdu->ssb_length = frame_parms->Lmax;
|
||||
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->decoded_pdu = true;
|
||||
}
|
||||
else
|
||||
ssb_pdu->decoded_pdu = false;
|
||||
}
|
||||
break;
|
||||
case FAPI_NR_CSIRS_IND:
|
||||
memcpy(&rx_ind->rx_indication_body[n_pdus - 1].csirs_measurements,
|
||||
@@ -382,7 +386,6 @@ static void nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
|
||||
proc,
|
||||
estimateSz,
|
||||
dl_ch_estimates,
|
||||
ue->pbch_vars[gNB_id],
|
||||
&ue->frame_parms,
|
||||
(ue->frame_parms.ssb_index)&7,
|
||||
SISO,
|
||||
@@ -392,8 +395,6 @@ static void nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
|
||||
|
||||
if (ret==0) {
|
||||
|
||||
ue->pbch_vars[gNB_id]->pdu_errors_conseq = 0;
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
uint16_t frame_tx;
|
||||
LOG_D(PHY,"[UE %d] frame %d, nr_slot_rx %d, Received PBCH (MIB): frame_tx %d. N_RB_DL %d\n",
|
||||
@@ -426,36 +427,12 @@ static void nr_ue_pbch_procedures(PHY_VARS_NR_UE *ue,
|
||||
write_output("H10.m","h10",&(ue->common_vars.dl_ch_estimates[0][2][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
|
||||
|
||||
write_output("rxsigF0.m","rxsF0", ue->common_vars.rxdataF[0],8*ue->frame_parms.ofdm_symbol_size,1,1);
|
||||
write_output("PBCH_rxF0_ext.m","pbch0_ext",ue->pbch_vars[0]->rxdataF_ext[0],12*4*6,1,1);
|
||||
write_output("PBCH_rxF0_comp.m","pbch0_comp",ue->pbch_vars[0]->rxdataF_comp[0],12*4*6,1,1);
|
||||
write_output("PBCH_rxF_llr.m","pbch_llr",ue->pbch_vars[0]->llr,(ue->frame_parms.Ncp==0) ? 1920 : 1728,1,4);
|
||||
exit(-1);
|
||||
*/
|
||||
|
||||
ue->pbch_vars[gNB_id]->pdu_errors_conseq++;
|
||||
ue->pbch_vars[gNB_id]->pdu_errors++;
|
||||
|
||||
if (ue->pbch_vars[gNB_id]->pdu_errors_conseq>=100) {
|
||||
if (get_softmodem_params()->non_stop) {
|
||||
LOG_E(PHY,"More that 100 consecutive PBCH errors! Going back to Sync mode!\n");
|
||||
ue->lost_sync = 1;
|
||||
} else {
|
||||
LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n");
|
||||
exit_fun("More that 100 consecutive PBCH errors! Exiting!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (frame_rx % 100 == 0) {
|
||||
ue->pbch_vars[gNB_id]->pdu_errors_last = ue->pbch_vars[gNB_id]->pdu_errors;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHY_PROC
|
||||
LOG_D(PHY,"[UE %d] frame %d, slot %d, PBCH errors = %d, consecutive errors = %d!\n",
|
||||
ue->Mod_id,frame_rx, nr_slot_rx,
|
||||
ue->pbch_vars[gNB_id]->pdu_errors,
|
||||
ue->pbch_vars[gNB_id]->pdu_errors_conseq);
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT);
|
||||
}
|
||||
|
||||
|
||||
@@ -793,8 +793,8 @@ int main(int argc, char **argv)
|
||||
fapiPbch_t result;
|
||||
ret = nr_rx_pbch(UE,
|
||||
&proc,
|
||||
estimateSz, dl_ch_estimates,
|
||||
UE->pbch_vars[0],
|
||||
estimateSz,
|
||||
dl_ch_estimates,
|
||||
frame_parms,
|
||||
ssb_index%8,
|
||||
SISO,
|
||||
@@ -813,7 +813,6 @@ int main(int argc, char **argv)
|
||||
for (i=0;i<3;i++){
|
||||
payload_ret += (result.decoded_output[i] == ((msgDataTx.ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
|
||||
}
|
||||
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
|
||||
//printf("ret %d\n", payload_ret);
|
||||
if (payload_ret!=4)
|
||||
n_errors_payload++;
|
||||
|
||||
Reference in New Issue
Block a user