diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e821229cab..2d054afbd9 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -395,31 +395,11 @@ void processSlotRX(void *arg) { res = pullTpool(UE->txFifo,&(get_nrUE_params()->Tpool)); processingData_t *curMsg=(processingData_t *)NotifiedFifoData(res); *curMsg = *rxtxD; - res->key = proc->nr_slot_rx; + res->key = 1; pushTpool(&(get_nrUE_params()->Tpool), res); } -/*! - * \brief This is the UE thread for RX subframe n and TX subframe n+4. - * This thread performs the phy_procedures_UE_RX() on every received slot. - * then, if TX is enabled it performs TX for n+4. - * \param arg is a pointer to a \ref PHY_VARS_NR_UE structure. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ - -//void UE_processing(void *arg) { -// processingData_t *rxtxD = (processingData_t *) arg; -// UE_nr_rxtx_proc_t *proc = &rxtxD->proc; -// PHY_VARS_NR_UE *UE = rxtxD->UE; -// int slot_tx = proc->nr_slot_tx; -// int frame_tx = proc->frame_tx; -// -// processSlotRX(UE, proc); -// processSlotTX(UE, proc); -// -//} - void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { void *dummy_tx[UE->frame_parms.nb_antennas_tx]; @@ -534,6 +514,8 @@ void *UE_thread(void *arg) { int start_rx_stream = 0; AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); UE->rfdevice.host_type = RAU_HOST; + UE->lost_sync = 0; + UE->is_synchronized = 0; AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n"); notifiedFIFO_t nf; @@ -542,12 +524,12 @@ void *UE_thread(void *arg) { notifiedFIFO_t rxFifo; UE->rxFifo = &rxFifo; initNotifiedFIFO(&rxFifo); - pushNotifiedFIFO_nothreadSafe(&rxFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 0,&rxFifo,processSlotRX)); + pushNotifiedFIFO_nothreadSafe(&rxFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 1,&rxFifo,processSlotRX)); notifiedFIFO_t txFifo; UE->txFifo = &txFifo; initNotifiedFIFO(&txFifo); - pushNotifiedFIFO_nothreadSafe(&txFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 0,&txFifo,processSlotTX)); + pushNotifiedFIFO_nothreadSafe(&txFifo, newNotifiedFIFO_elt(sizeof(processingData_t), 1,&txFifo,processSlotTX)); int nbSlotProcessing=0; int thread_idx=0; @@ -559,6 +541,12 @@ void *UE_thread(void *arg) { int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; while (!oai_exit) { + if (UE->lost_sync) { + abortTpool(&(get_nrUE_params()->Tpool),0); + UE->is_synchronized = 0; + UE->lost_sync = 0; + } + if (syncRunning) { notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool)); @@ -571,6 +559,7 @@ void *UE_thread(void *arg) { decoded_frame_rx=(decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER; } delNotifiedFIFO_elt(res); + start_rx_stream=0; } else { readFrame(UE, ×tamp, true); trashed_frames+=2; @@ -734,7 +723,7 @@ void *UE_thread(void *arg) { memset(txp[i], 0, writeBlockSize); nbSlotProcessing++; - msgToPush->key=slot_nr; + msgToPush->key=1; pushTpool(&(get_nrUE_params()->Tpool), msgToPush); } // while !oai_exit diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 60a761c732..dbe46e8264 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -73,6 +73,7 @@ extern "C" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_256QAM "Use the 256 QAM mcs table for PDSCH\n" +#define CONFIG_HLP_NONSTOP "Go back to frame sync mode after 100 consecutive PBCH failures\n" //#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" #define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" @@ -114,6 +115,7 @@ extern "C" #define USIM_TEST softmodem_params.usim_test #define USE_256QAM_TABLE softmodem_params.use_256qam_table #define NFAPI softmodem_params.nfapi +#define NON_STOP softmodem_params.non_stop #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; @@ -145,6 +147,7 @@ extern "C" {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ + {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ } @@ -233,6 +236,7 @@ typedef struct { uint32_t send_dmrs_sync; int use_256qam_table; uint8_t nfapi; + int non_stop; } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index e0b2c2e13e..2d1c952da8 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -764,6 +764,8 @@ typedef struct { int is_synchronized; /// \brief Indicates on which frame is synchronized in a two frame synchronization int is_synchronized_on_frame; + /// \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 diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index f516ad8639..2d1f061694 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -459,8 +459,13 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ue->pbch_vars[gNB_id]->pdu_errors++; if (ue->pbch_vars[gNB_id]->pdu_errors_conseq>=100) { - LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n"); - exit_fun("More that 100 consecutive PBCH errors! Exiting!\n"); + 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"); + } } }