Commit a05baa3c authored by francescomani's avatar francescomani

fixes to avoid double synchronization call

parent 82597e7e
......@@ -367,7 +367,7 @@ static void UE_synch(void *arg) {
PHY_VARS_NR_UE *UE = syncD->UE;
sync_mode_t sync_mode = pbch;
//int CC_id = UE->CC_id;
static int freq_offset=0;
static int freq_offset = 0;
UE->is_synchronized = 0;
if (UE->UE_scan == 0) {
......@@ -460,15 +460,10 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].tx_freq[0]);
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0]);
if (UE->UE_scan_carrier == 1) {
if (UE->UE_scan_carrier == 1)
UE->UE_scan_carrier = 0;
} else {
else
UE->is_synchronized = 1;
}
if (UE->synch_request.received_synch_request == 1) {
UE->is_synchronized = 0;
UE->synch_request.received_synch_request = 0;
}
} else {
if (UE->UE_scan_carrier == 1) {
......@@ -590,13 +585,11 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc)
if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) {
// Start synchronization with a target gNB
if (UE->synch_request.received_synch_request == 1 && UE->target_Nid_cell == -1) {
if (UE->synch_request.received_synch_request == 1) {
UE->is_synchronized = 0;
UE->target_Nid_cell = UE->synch_request.synch_req.target_Nid_cell;
clean_UE_ulsch(UE, proc->gNB_id);
} else if (UE->synch_request.received_synch_request == 1 && UE->target_Nid_cell != -1) {
clean_UE_harq(UE);
UE->synch_request.received_synch_request = 0;
UE->target_Nid_cell = -1;
}
/* send tick to RLC and PDCP every ms */
......@@ -810,7 +803,7 @@ void *UE_thread(void *arg)
}
}
AssertFatal( !syncRunning, "At this point synchronization can't be running\n");
AssertFatal(!syncRunning, "At this point synchronization can't be running\n");
if (!UE->is_synchronized) {
readFrame(UE, &timestamp, false);
......
......@@ -629,6 +629,23 @@ void init_nr_ue_transport(PHY_VARS_NR_UE *ue) {
ue->dl_stats[i] = 0;
}
void clean_UE_harq(PHY_VARS_NR_UE *UE)
{
for (int harq_pid = 0; harq_pid < NR_MAX_DLSCH_HARQ_PROCESSES; harq_pid++) {
for (int i = 0; i < 2; i++) {
NR_DL_UE_HARQ_t *dl_harq_process = &UE->dl_harq_processes[i][harq_pid];
init_downlink_harq_status(dl_harq_process);
}
}
for (int harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) {
NR_UL_UE_HARQ_t *ul_harq_process = &UE->ul_harq_processes[harq_pid];
ul_harq_process->tx_status = NEW_TRANSMISSION_HARQ;
ul_harq_process->status = SCH_IDLE;
ul_harq_process->round = 0;
ul_harq_process->first_tx = 1;
}
}
void init_N_TA_offset(PHY_VARS_NR_UE *ue){
......
......@@ -258,7 +258,7 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
const uint8_t n_antenna_ports,
c16_t **txdataF);
int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id);
void clean_UE_harq(PHY_VARS_NR_UE *UE);
void nr_dlsch_unscrambling(int16_t* llr,
uint32_t size,
......
......@@ -639,15 +639,3 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
////////////////////////////////////////////////////
return 0;
}
int8_t clean_UE_ulsch(PHY_VARS_NR_UE *UE, uint8_t gNB_id)
{
for (int harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) {
NR_UL_UE_HARQ_t *ul_harq_process = &UE->ul_harq_processes[harq_pid];
ul_harq_process->tx_status = NEW_TRANSMISSION_HARQ;
ul_harq_process->status = SCH_IDLE;
ul_harq_process->round = 0;
ul_harq_process->first_tx = 1;
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment