From fab5987754e971c876298df812ac1921398fcdaf Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 2 Nov 2022 17:24:48 +0100 Subject: [PATCH] remove ue mode --- executables/nr-ue.c | 6 +- .../PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c | 11 +--- .../PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 1 - openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 1 + openair1/PHY/defs_nr_UE.h | 5 +- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 9 ++- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 61 +++++-------------- openair1/SIMULATION/NR_PHY/dlsim.c | 6 +- 8 files changed, 28 insertions(+), 72 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 2e0dde6c67..03517a8688 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -154,17 +154,13 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t abstraction_flag) { - int nb_connected_gNB = 1, gNB_id; + int nb_connected_gNB = 1; ue->Mod_id = UE_id; ue->mac_enabled = 1; ue->if_inst = nr_ue_if_module_init(0); ue->dci_thres = 0; - // Setting UE mode to NOT_SYNCHED by default - for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++) - ue->UE_mode[gNB_id] = NOT_SYNCHED; - // initialize all signal buffers init_nr_ue_signal(ue, nb_connected_gNB); diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c index 983366e35e..feed70b854 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c @@ -101,18 +101,9 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, //printf("adjust sync count_max_pos_ok = %d\n",count_max_pos_ok); - if(count_max_pos_ok > 10 && first_time == 1) - { + if(count_max_pos_ok > 10 && first_time == 1) { first_time = 0; ue->time_sync_cell = 1; - if (get_softmodem_params()->do_ra || get_softmodem_params()->sa) { - LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); - //mac_resynch(); - //dl_phy_sync_success(ue->Mod_id,frame,0,1);//ue->common_vars.eNb_id); - ue->UE_mode[0] = PRACH; - } else { - ue->UE_mode[0] = PUSCH; - } } #ifdef DEBUG_PHY diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index e87062de55..f58dbc3e81 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -464,7 +464,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, frame_parms->Nid_cell,frame_parms->frame_type); #endif - ue->UE_mode[0] = NOT_SYNCHED; 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++; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index e5e0e44b6b..59051d07b8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -515,6 +515,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t LOG_M("Prach_txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][prach_start]), 2*(prach_start+prach_len), 1, 1) #endif + ue->prach_vars[gNB_id]->active = false; return signal_energy((int*)prach, 256); } diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 2b96f1582c..7989c0e7a5 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -421,6 +421,7 @@ typedef struct { typedef struct { int16_t amp; + bool active; fapi_nr_ul_config_prach_pdu prach_pdu; } NR_UE_PRACH; @@ -548,10 +549,6 @@ typedef struct { uint32_t PF; uint32_t PO; - UE_MODE_t UE_mode[NUMBER_OF_CONNECTED_gNB_MAX]; - /// cell-specific reference symbols - //uint32_t lte_gold_table[7][20][2][14]; - #if defined(UPGRADE_RAT_NR) /// demodulation reference signal for NR PBCH diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 9c9e7a249b..2ab1040cdb 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -481,6 +481,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // prach config pdu prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu; memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu)); + PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->active = true; ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more pdu_done++; LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus); @@ -533,11 +534,9 @@ int8_t nr_ue_phy_config_request(nr_phy_config_t *phy_config){ fapi_nr_config_request_t *nrUE_config = &PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->nrUE_config; - if(phy_config != NULL) { - memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t)); - if (PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] == NOT_SYNCHED) - PHY_vars_UE_g[phy_config->Mod_id][phy_config->CC_id]->UE_mode[0] = PRACH; - } + if(phy_config != NULL) + memcpy(nrUE_config,&phy_config->config_req,sizeof(fapi_nr_config_request_t)); + return 0; } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index b69c413358..96bc542a99 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -76,8 +76,6 @@ fifo_dump_emos_UE emos_dump_UE; #include "intertask_interface.h" #include "T.h" -char nr_mode_string[NUM_UE_MODE][20] = {"NOT SYNCHED","PRACH","RAR","RA_WAIT_CR", "PUSCH", "RESYNCH"}; - #if defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706) extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; #endif @@ -287,24 +285,17 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, start_meas(&ue->phy_proc_tx); - if (ue->UE_mode[gNB_id] <= PUSCH){ - - for (uint8_t harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) { - if (ue->ul_harq_processes[harq_pid].status == ACTIVE) - nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id, phy_data); - } + for (uint8_t harq_pid = 0; harq_pid < NR_MAX_ULSCH_HARQ_PROCESSES; harq_pid++) { + if (ue->ul_harq_processes[harq_pid].status == ACTIVE) + nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, gNB_id, phy_data); } - if (ue->UE_mode[gNB_id] == PUSCH) { - ue_srs_procedures_nr(ue, proc, gNB_id); - } + ue_srs_procedures_nr(ue, proc, gNB_id); - if (ue->UE_mode[gNB_id] <= PUSCH) { - pucch_procedures_ue_nr(ue, - gNB_id, - proc, - phy_data); - } + pucch_procedures_ue_nr(ue, + gNB_id, + proc, + phy_data); LOG_D(PHY, "Sending Uplink data \n"); nr_ue_pusch_common_procedures(ue, @@ -312,8 +303,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, &ue->frame_parms, ue->frame_parms.nb_antennas_tx); - if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) - nr_ue_prach_procedures(ue, proc, proc->gNB_id); + nr_ue_prach_procedures(ue, proc, proc->gNB_id); LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); @@ -405,15 +395,6 @@ static void nr_ue_pbch_procedures(uint8_t gNB_id, ue->pbch_vars[gNB_id]->pdu_errors_conseq = 0; - // Switch to PRACH state if it is first PBCH after initial synch and no timing correction is performed - if (ue->UE_mode[gNB_id] == NOT_SYNCHED && ue->no_timing_correction == 1){ - if (get_softmodem_params()->do_ra) { - ue->UE_mode[gNB_id] = PRACH; - } else { - ue->UE_mode[gNB_id] = PUSCH; - } - } - #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", @@ -545,12 +526,12 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, //LOG_D(PHY,"[UE %d][PUSCH] Frame %d nr_slot_rx %d PHICH RX\n",ue->Mod_id,frame_rx,nr_slot_rx); for (int i=0; i rnti %x : format %d\n", - ue->Mod_id,frame_rx%1024,nr_slot_rx,nr_mode_string[ue->UE_mode[gNB_id]], - i + 1, - dci_cnt, - dci_ind.dci_list[i].rnti, - dci_ind.dci_list[i].dci_format); + LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d: DCI %i of %d total DCIs found --> rnti %x : format %d\n", + ue->Mod_id,frame_rx%1024,nr_slot_rx, + i + 1, + dci_cnt, + dci_ind.dci_list[i].rnti, + dci_ind.dci_list[i].dci_format); } dci_ind.number_of_dcis = dci_cnt; @@ -1317,7 +1298,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t nr_prach = nr_ue_get_rach(&ue->prach_vars[gNB_id]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx); LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach); - if (nr_prach == GENERATE_PREAMBLE) { + if (ue->prach_vars[gNB_id]->active) { fapi_nr_ul_config_prach_pdu *prach_pdu = &ue->prach_vars[gNB_id]->prach_pdu; ue->tx_power_dBm[nr_slot_tx] = prach_pdu->prach_tx_power; @@ -1346,16 +1327,6 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->tx_power_dBm[nr_slot_tx], dB_fixed(prach_power), ue->prach_vars[gNB_id]->amp); - - } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { - LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = RA_WAIT_CR; - } else if (nr_prach == RA_SUCCEEDED) { - LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PUSCH; - } else if(nr_prach == RA_FAILED){ - LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PRACH; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b9deeadfd8..1429270ee5 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -958,8 +958,10 @@ int main(int argc, char **argv) UE->frame_parms.nb_antennas_rx = n_rx; UE->max_ldpc_iterations = max_ldpc_iterations; - if (run_initial_sync==1) UE->is_synchronized = 0; - else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;} + if (run_initial_sync==1) + UE->is_synchronized = 0; + else + UE->is_synchronized = 1; if (init_nr_ue_signal(UE, 1) != 0) {