From 8892d00693c186fc0cec47d9e2d5b10985c28a3f Mon Sep 17 00:00:00 2001 From: Francesco Mani <francesco.mani@eurecom.fr> Date: Sat, 4 Apr 2020 10:32:07 +0200 Subject: [PATCH] flag do_ra alternative to phy_test to perform RA procedures --- executables/nr-softmodem-common.h | 1 + executables/nr-softmodem.c | 3 +++ executables/nr-uesoftmodem.c | 8 +++---- executables/softmodem-common.h | 4 ++++ openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 26 ++++++++++----------- openair1/SIMULATION/NR_PHY/ulsim.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 11 +++++---- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 9 files changed, 34 insertions(+), 26 deletions(-) diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index ccb3f28d98..305e4c4fc8 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -57,6 +57,7 @@ #define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" +#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n" #define CONFIG_HLP_EXCCLK "tells hardware to use a clock reference (0:internal(default), 1:external, 2:gpsdo)\n" #define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 659ce056c0..f0efdff39c 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -822,6 +822,9 @@ int main( int argc, char **argv ) openair0_cfg[0].threequarter_fs = threequarter_fs; + if (get_softmodem_params()->do_ra) + AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); + #if T_TRACER T_Config_Init(); #endif diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 89f2ee8509..d5c34fc728 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -716,6 +716,9 @@ int main( int argc, char **argv ) { PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs); + if (get_softmodem_params()->do_ra) + AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); + for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { printf("frame_parms %d\n",frame_parms[CC_id]->ofdm_symbol_size); frame_parms[CC_id]->nb_antennas_tx = nb_antenna_tx; @@ -742,11 +745,6 @@ int main( int argc, char **argv ) { init_nr_ue_vars(UE[CC_id],frame_parms[CC_id],0,abstraction_flag); - if (get_softmodem_params()->phy_test==1) - UE[CC_id]->mac_enabled = 0; - else - UE[CC_id]->mac_enabled = 1; - UE[CC_id]->mac_enabled = 1; UE[CC_id]->if_inst = nr_ue_if_module_init(0); UE[CC_id]->UE_scan = UE_scan; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index cfed951469..7684dad948 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -50,6 +50,7 @@ extern "C" #define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n" #define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n" #define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n" +#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n" #define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n" #define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0" #define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n" @@ -89,6 +90,7 @@ extern "C" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ #define RF_CONFIG_FILE softmodem_params.rf_config_file #define PHY_TEST softmodem_params.phy_test +#define DO_RA softmodem_params.do_ra #define WAIT_FOR_SYNC softmodem_params.wait_for_sync #define SINGLE_THREAD_FLAG softmodem_params.single_thread_flag #define CHAIN_OFFSET softmodem_params.chain_offset @@ -104,6 +106,7 @@ extern "C" #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\ {"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \ + {"do-ra", CONFIG_HLP_DORA, PARAMFLAG_BOOL, iptr:&DO_RA, defintval:0, TYPE_INT, 0}, \ {"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \ {"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \ @@ -192,6 +195,7 @@ typedef struct { //THREAD_STRUCT thread_struct; char rf_config_file[1024]; int phy_test; + int do_ra; uint8_t usim_test; int emulate_rf; int wait_for_sync; //eNodeB only diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 16dfb40134..9be9fe8424 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -53,7 +53,7 @@ #ifdef EMOS #include "SCHED/phy_procedures_emos.h" #endif - +#include "executables/softmodem-common.h" //#define DEBUG_PHY_PROC #define NR_PDCCH_SCHED @@ -2255,24 +2255,24 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, } // UE_mode==PUSCH */ - - nr_ue_pusch_common_procedures(ue, - harq_pid, - slot_tx, - thread_id, - gNB_id, - &ue->frame_parms); + nr_ue_pusch_common_procedures(ue, + harq_pid, + slot_tx, + thread_id, + gNB_id, + &ue->frame_parms); } /* RACH */ - if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) { + if (get_softmodem_params()->do_ra==1) { + if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) { nr_ue_prach_procedures(ue, proc, gNB_id, mode); + } + else { + ue->prach_resources[gNB_id]->generate_nr_prach = 0; + } } - else { - ue->prach_resources[gNB_id]->generate_nr_prach = 0; - } - LOG_I(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index ce26c91ae8..94d3416aec 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -353,7 +353,8 @@ int main(int argc, char **argv) T_stdout = 1; get_softmodem_params()->phy_test = 1; - + get_softmodem_params()->do_ra = 0; + if (snr1set == 0) snr1 = snr0 + 10; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index c586a03fe0..d7771fbfa9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -360,7 +360,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, gNB->ta_len = 2; } - nr_schedule_RA(module_idP, frame_txP, slot_txP); + if (get_softmodem_params()->phy_test == 0) + nr_schedule_RA(module_idP, frame_txP, slot_txP); // Phytest scheduling if (get_softmodem_params()->phy_test && slot_txP==1){ @@ -380,10 +381,10 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if (is_nr_UL_slot(cc->ServingCellConfigCommon,slot_rxP)) { - schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP); - - nr_schedule_reception_msg3(module_idP, 0, frame_rxP, slot_rxP); - + if (get_softmodem_params()->phy_test == 0) { + schedule_nr_prach(module_idP, (frame_rxP+1)&1023, slot_rxP); + nr_schedule_reception_msg3(module_idP, 0, frame_rxP, slot_rxP); + } if (get_softmodem_params()->phy_test && slot_rxP==8){ nr_schedule_uss_ulsch_phytest(module_idP, frame_rxP, slot_rxP); } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 22351feb2b..6cf48411cc 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -204,7 +204,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc) { ); - if (get_softmodem_params()->phy_test > 0) { + if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { // This is for phytest only, emulate first X2 message if uecap.raw file is present FILE *fd; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 7ddfc6054b..44215df218 100755 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -319,7 +319,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){ RRC_LIST_INIT(NR_UE_rrc_inst->CSI_ResourceConfig_list, NR_maxNrofCSI_ResourceConfigurations); RRC_LIST_INIT(NR_UE_rrc_inst->CSI_ReportConfig_list, NR_maxNrofCSI_ReportConfigurations); - if (get_softmodem_params()->phy_test==1) { + if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1) { // read in files for RRCReconfiguration and RBconfig FILE *fd; char filename[1024]; -- 2.26.2