From 73e96220fb6333b8366404401cc717ef71cd5467 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 10 Mar 2025 17:31:04 +0100 Subject: [PATCH] remove unused frame config ue phy unit test and all nr ue phy test folder --- CMakeLists.txt | 1 - doc/Doxyfile | 2 - executables/nr-ue.c | 33 +- openair1/PHY/defs_nr_common.h | 6 - openair1/SCHED_NR/phy_frame_config_nr.c | 205 ------------ openair1/SCHED_NR/phy_frame_config_nr.h | 35 -- openair1/SCHED_NR_UE/phy_frame_config_nr.h | 90 ----- openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c | 136 -------- .../NR_UE_PHY/unit_tests/build/CMakeLists.txt | 68 ---- .../build/reflogs/frame_config_test.txt | 180 ---------- .../NR_UE_PHY/unit_tests/build/run_tests.sh | 239 ------------- .../NR_UE_PHY/unit_tests/readme.txt | 122 ------- .../unit_tests/src/dummy_functions.c | 218 ------------ .../unit_tests/src/frame_config_test.c | 314 ------------------ .../LAYER2/NR_MAC_UE/nr_ue_scheduler_sl.c | 64 ++++ 15 files changed, 96 insertions(+), 1617 deletions(-) delete mode 100644 openair1/SCHED_NR_UE/phy_frame_config_nr.h delete mode 100644 openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c delete mode 100644 openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt delete mode 100644 openair1/SIMULATION/NR_UE_PHY/unit_tests/build/reflogs/frame_config_test.txt delete mode 100755 openair1/SIMULATION/NR_UE_PHY/unit_tests/build/run_tests.sh delete mode 100644 openair1/SIMULATION/NR_UE_PHY/unit_tests/readme.txt delete mode 100644 openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c delete mode 100644 openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c diff --git a/CMakeLists.txt b/CMakeLists.txt index b4ea5a77eb..6ef21e2e0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -682,7 +682,6 @@ set(SCHED_SRC_NR_UE ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue.c ${OPENAIR1_DIR}/SCHED_NR_UE/phy_procedures_nr_ue_sl.c ${OPENAIR1_DIR}/SCHED_NR_UE/fapi_nr_ue_l1.c - ${OPENAIR1_DIR}/SCHED_NR_UE/phy_frame_config_nr_ue.c ${OPENAIR1_DIR}/SCHED_NR_UE/harq_nr.c ${OPENAIR1_DIR}/SCHED_NR_UE/pucch_uci_ue_nr.c ) diff --git a/doc/Doxyfile b/doc/Doxyfile index 59a984e79f..9a88e375ef 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -2286,10 +2286,8 @@ INPUT = \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/TOOLS/phase_noise.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/TOOLS/channel_sim.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SIMULATION/TOOLS/sim.h \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/phy_frame_config_nr.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/harq_nr.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/fapi_nr_ue_l1.c \ -@CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/pucch_uci_ue_nr.c \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/harq_nr.h \ @CMAKE_CURRENT_SOURCE_DIR@/../openair1/SCHED_NR_UE/phy_procedures_nr_ue.c \ diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a5c4f69ed5..3ba40d061e 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -28,7 +28,6 @@ #include "NR_MAC_UE/mac_proto.h" #include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/L2_interface_ue.h" -#include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "executables/softmodem-common.h" @@ -448,6 +447,38 @@ static void UE_synch(void *arg) { } } +static int nr_ue_slot_select(const fapi_nr_config_request_t *cfg, int nr_slot) +{ + if (cfg->cell_config.frame_duplex_type == FDD) + return NR_UPLINK_SLOT | NR_DOWNLINK_SLOT; + + const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table; + int rel_slot = nr_slot % tdd_table->tdd_period_in_slots; + + if (tdd_table->max_tdd_periodicity_list == NULL) // this happens before receiving TDD configuration + return NR_DOWNLINK_SLOT; + + const fapi_nr_max_tdd_periodicity_t *current_slot = &tdd_table->max_tdd_periodicity_list[rel_slot]; + + // if the 1st symbol is UL the whole slot is UL + if (current_slot->max_num_of_symbol_per_slot_list[0].slot_config == 1) + return NR_UPLINK_SLOT; + + // if the 1st symbol is flexible the whole slot is mixed + if (current_slot->max_num_of_symbol_per_slot_list[0].slot_config == 2) + return NR_MIXED_SLOT; + + for (int i = 1; i < NR_NUMBER_OF_SYMBOLS_PER_SLOT; i++) { + // if the 1st symbol is DL and any other is not, the slot is mixed + if (current_slot->max_num_of_symbol_per_slot_list[i].slot_config != 0) { + return NR_MIXED_SLOT; + } + } + + // if here, all the symbols where DL + return NR_DOWNLINK_SLOT; +} + static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action) { PHY_VARS_NR_UE *UE = rxtxD->UE; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index f6f1de2330..7a3f59504d 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -220,12 +220,6 @@ struct NR_DL_FRAME_PARMS { c16_t delay_table128[2 * MAX_DELAY_COMP + 1][128]; /// Power used by SSB in order to estimate signal strength and path loss int ss_PBCH_BlockPower; - /// for NR TDD management - TDD_UL_DL_configCommon_t *p_tdd_UL_DL_Configuration; - - TDD_UL_DL_configCommon_t *p_tdd_UL_DL_ConfigurationCommon2; - - TDD_UL_DL_SlotConfig_t *p_TDD_UL_DL_ConfigDedicated; /// TDD configuration uint16_t tdd_uplink_nr[2*NR_MAX_SLOTS_PER_FRAME]; /* this is a bitmap of symbol of each slot given for 2 frames */ diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index 63fd570b4c..085ce8e087 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -152,147 +152,6 @@ void set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, frame_structure_t *fs } } -/******************************************************************* -* -* NAME : add_tdd_dedicated_configuration_nr -* -* PARAMETERS : pointer to frame configuration -* -* OUTPUT: table of uplink symbol for each slot for several frames -* -* RETURN : 0 if tdd has been properly configurated -* -1 tdd configuration can not be done -* -* DESCRIPTION : generate bit map for uplink symbol for each slot for several frames -* see TS 38.213 11.1 Slot configuration -* -*********************************************************************/ - -void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slotIndex, int nrofDownlinkSymbols, int nrofUplinkSymbols) { - TDD_UL_DL_SlotConfig_t *p_TDD_UL_DL_ConfigDedicated = frame_parms->p_TDD_UL_DL_ConfigDedicated; - TDD_UL_DL_SlotConfig_t *p_previous_TDD_UL_DL_ConfigDedicated=NULL; - int next = 0; - - while (p_TDD_UL_DL_ConfigDedicated != NULL) { - p_previous_TDD_UL_DL_ConfigDedicated = p_TDD_UL_DL_ConfigDedicated; - p_TDD_UL_DL_ConfigDedicated = (TDD_UL_DL_SlotConfig_t *)(p_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig); - next = 1; - } - - p_TDD_UL_DL_ConfigDedicated = calloc( 1, sizeof(TDD_UL_DL_SlotConfig_t)); - - //printf("allocate pt %p \n", p_TDD_UL_DL_ConfigDedicated); - if (p_TDD_UL_DL_ConfigDedicated == NULL) { - printf("Error test_frame_configuration: memory allocation problem \n"); - assert(0); - } - - if (next == 0) { - frame_parms->p_TDD_UL_DL_ConfigDedicated = p_TDD_UL_DL_ConfigDedicated; - } else { - p_previous_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig = (TDD_UL_DL_SlotConfig_t *)p_TDD_UL_DL_ConfigDedicated; - } - - p_TDD_UL_DL_ConfigDedicated->slotIndex = slotIndex; - p_TDD_UL_DL_ConfigDedicated->nrofDownlinkSymbols = nrofDownlinkSymbols; - p_TDD_UL_DL_ConfigDedicated->nrofUplinkSymbols = nrofUplinkSymbols; -} - -/******************************************************************* -* -* NAME : set_tdd_configuration_dedicated_nr -* -* PARAMETERS : pointer to frame configuration -* -* OUTPUT: table of uplink symbol for each slot for several frames -* -* RETURN : 0 if tdd has been properly configurated -* -1 tdd configuration can not be done -* -* DESCRIPTION : generate bit map for uplink symbol for each slot for several frames -* see TS 38.213 11.1 Slot configuration -* -*********************************************************************/ - -int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { - TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_SlotConfig; - p_current_TDD_UL_DL_SlotConfig = frame_parms->p_TDD_UL_DL_ConfigDedicated; - NR_TST_PHY_PRINTF("\nSet tdd dedicated configuration\n "); - - while(p_current_TDD_UL_DL_SlotConfig != NULL) { - int slot_index = p_current_TDD_UL_DL_SlotConfig->slotIndex; - - if (slot_index < frame_parms->slots_per_frame) { - if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols != 0) { - if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols == NR_TDD_SET_ALL_SYMBOLS) { - if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == 0) { - frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_DOWNLINK_SLOT; - NR_TST_PHY_PRINTF(" DL[%d] ", slot_index); - } else { - LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink & uplink symbol configuration is not supported \n"); - return (-1); - } - } else { - LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink symbol configuration is not supported \n"); - return (-1); - } - } else if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols != 0) { - if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == NR_TDD_SET_ALL_SYMBOLS) { - frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_UPLINK_SLOT; - NR_TST_PHY_PRINTF(" UL[%d] ", slot_index); - } else { - LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd uplink symbol configuration is not supported \n"); - return (-1); - } - } else { - LOG_E(PHY,"set_tdd_configuration_dedicated_nr: no tdd symbol configuration is specified \n"); - return (-1); - } - } else { - LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd slot index exceeds maximum value \n"); - return (-1); - } - - p_current_TDD_UL_DL_SlotConfig = (TDD_UL_DL_SlotConfig_t *)(p_current_TDD_UL_DL_SlotConfig->p_next_TDD_UL_DL_SlotConfig); - } - - NR_TST_PHY_PRINTF("\n"); - return (0); -} - -/******************************************************************* -* -* NAME : set_tdd_configuration -* -* PARAMETERS : pointer to tdd common configuration -* pointer to tdd common configuration2 -* pointer to tdd dedicated configuration -* -* OUTPUT: table of uplink symbol for each slot for 2 frames -* -* RETURN : 0 if srs sequence has been successfully generated -* -1 if sequence can not be properly generated -* -* DESCRIPTION : generate bit map for uplink symbol for each slot for 2 frames -* see TS 38.213 11.1 Slot configuration -* -*********************************************************************/ - -int get_next_downlink_slot(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot) { - - int slot = nr_slot; - int frame = nr_frame; - int slots_per_frame = gNB->frame_parms.slots_per_frame; - while (true) { - slot++; - if (slot/slots_per_frame) frame++; - slot %= slots_per_frame; - int slot_type = nr_slot_select(cfg, frame, slot); - if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) return slot; - AssertFatal(frame < (nr_frame+2), "Something went worng. This shouldn't happen\n"); - } -} - int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot) { (void) nr_frame; @@ -329,70 +188,6 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot } } -/******************************************************************* -* -* NAME : free_tdd_configuration_nr -* -* PARAMETERS : pointer to frame configuration -* -* RETURN : none -* -* DESCRIPTION : free structure related to tdd configuration -* -*********************************************************************/ - -void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms) { - TDD_UL_DL_configCommon_t *p_tdd_UL_DL_Configuration = frame_parms->p_tdd_UL_DL_Configuration; - free_tdd_configuration_dedicated_nr(frame_parms); - - if (p_tdd_UL_DL_Configuration != NULL) { - frame_parms->p_tdd_UL_DL_Configuration = NULL; - free(p_tdd_UL_DL_Configuration); - } - - for (int number_of_slot = 0; number_of_slot < NR_MAX_SLOTS_PER_FRAME; number_of_slot++) { - frame_parms->tdd_uplink_nr[number_of_slot] = NR_TDD_DOWNLINK_SLOT; - } -} - -/******************************************************************* -* -* NAME : free_tdd_configuration_dedicated_nr -* -* PARAMETERS : pointer to frame configuration -* -* RETURN : none -* -* DESCRIPTION : free structure related to tdd dedicated configuration -* -*********************************************************************/ - -void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { - TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_ConfigDedicated = frame_parms->p_TDD_UL_DL_ConfigDedicated; - TDD_UL_DL_SlotConfig_t *p_next_TDD_UL_DL_ConfigDedicated; - int next = 0; - - if (p_current_TDD_UL_DL_ConfigDedicated != NULL) { - do { - if (p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig != NULL) { - next = 1; - p_next_TDD_UL_DL_ConfigDedicated = (TDD_UL_DL_SlotConfig_t *)(p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig); - p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig = NULL; - //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated); - free(p_current_TDD_UL_DL_ConfigDedicated); - p_current_TDD_UL_DL_ConfigDedicated = p_next_TDD_UL_DL_ConfigDedicated; - } else { - if (p_current_TDD_UL_DL_ConfigDedicated != NULL) { - frame_parms->p_TDD_UL_DL_ConfigDedicated = NULL; - //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated); - free(p_current_TDD_UL_DL_ConfigDedicated); - next = 0; - } - } - } while (next); - } -} - void do_tdd_config_sim(PHY_VARS_gNB *gNB, int mu) { frame_structure_t fs = {.frame_type = TDD}; diff --git a/openair1/SCHED_NR/phy_frame_config_nr.h b/openair1/SCHED_NR/phy_frame_config_nr.h index 0caf612f37..11ae4bf5c6 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.h +++ b/openair1/SCHED_NR/phy_frame_config_nr.h @@ -47,27 +47,6 @@ */ void set_tdd_config_nr(nfapi_nr_config_request_scf_t *cfg, frame_structure_t *fs); -/** \brief This function adds a slot configuration to current dedicated configuration for nr - * @param frame_parms NR DL Frame parameters - * @param slotIndex - * @param nrofDownlinkSymbols - * @param nrofUplinkSymbols - @returns none */ - -void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slotIndex, - int nrofDownlinkSymbols, int nrofUplinkSymbols); - -/** \brief This function processes tdd dedicated configuration for nr - * @param frame_parms nr frame parameters - * @param dl_UL_TransmissionPeriodicity periodicity - * @param nrofDownlinkSlots number of downlink slots - * @param nrofDownlinkSymbols number of downlink symbols - * @param nrofUplinkSlots number of uplink slots - * @param nrofUplinkSymbols number of uplink symbols - @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ - -int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); - /** \brief This function checks nr slot direction : downlink or uplink * @param frame_parms NR DL Frame parameters * @param nr_frame : frame number @@ -76,20 +55,6 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot); -/** \brief This function frees tdd configuration for nr - * @param frame_parms NR DL Frame parameters - @returns none */ - -void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms); - -/** \brief This function frees tdd dedicated configuration for nr - * @param frame_parms NR DL Frame parameters - @returns none */ - -void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); - -int get_next_downlink_slot(PHY_VARS_gNB *gNB, nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_slot); - void do_tdd_config_sim(PHY_VARS_gNB *gNB, int mu); #endif /* PHY_FRAME_CONFIG_NR_H */ diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr.h b/openair1/SCHED_NR_UE/phy_frame_config_nr.h deleted file mode 100644 index 359722a7be..0000000000 --- a/openair1/SCHED_NR_UE/phy_frame_config_nr.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*********************************************************************** -* -* FILENAME : phy_frame_configuration_nr.h -* -* DESCRIPTION : functions related to FDD/TDD configuration for NR -* see TS 38.213 11.1 Slot configuration -* and TS 38.331 for RRC configuration -* -************************************************************************/ - -#ifndef PHY_FRAME_CONFIG_NR_UE_H -#define PHY_FRAME_CONFIG_NR_UE_H - -/************** DEFINE ********************************************/ - -/*************** FUNCTIONS *****************************************/ - - -/** \brief This function adds a slot configuration to current dedicated configuration for nr - * @param frame_parms NR DL Frame parameters - * @param slotIndex - * @param nrofDownlinkSymbols - * @param nrofUplinkSymbols - @returns none */ - -void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slotIndex, - int nrofDownlinkSymbols, int nrofUplinkSymbols); - -/** \brief This function processes tdd dedicated configuration for nr - * @param frame_parms nr frame parameters - * @param dl_UL_TransmissionPeriodicity periodicity - * @param nrofDownlinkSlots number of downlink slots - * @param nrofDownlinkSymbols number of downlink symbols - * @param nrofUplinkSlots number of uplink slots - * @param nrofUplinkSymbols number of uplink symbols - @returns 0 if tdd dedicated configuration has been properly set or -1 on error with message */ - -int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); - -/** \brief This function checks nr slot direction : downlink or uplink - * @param frame_parms NR DL Frame parameters - * @param nr_frame : frame number - * @param nr_slot : slot number - @returns int : downlink or uplink */ - -int slot_select_nr(NR_DL_FRAME_PARMS *frame_parms, int nr_frame, int nr_slot); - -/** \brief This function checks nr UE slot direction : downlink or uplink - * @param cfg : FAPI Config Request - * @param nr_frame : frame number - * @param nr_slot : slot number - @returns int : downlink, uplink or mixed slot type */ - -int nr_ue_slot_select(const fapi_nr_config_request_t *cfg, int nr_slot); - -/** \brief This function frees tdd configuration for nr - * @param frame_parms NR DL Frame parameters - @returns none */ - -void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms); - -/** \brief This function frees tdd dedicated configuration for nr - * @param frame_parms NR DL Frame parameters - @returns none */ - -void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms); - -#endif /* PHY_FRAME_CONFIG_NR_H */ - diff --git a/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c b/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c deleted file mode 100644 index 6f7391bd68..0000000000 --- a/openair1/SCHED_NR_UE/phy_frame_config_nr_ue.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*********************************************************************** -* -* FILENAME : phy_frame_configuration_nr_ue.c -* -* DESCRIPTION : functions related to FDD/TDD configuration for NR -* see TS 38.213 11.1 Slot configuration -* and TS 38.331 for RRC configuration -* -************************************************************************/ - -#include "PHY/defs_nr_UE.h" - -/******************************************************************* -* -* NAME : nr_ue_slot_select -* -* DESCRIPTION : function for the UE equivalent to nr_slot_select -* -*********************************************************************/ - -int nr_ue_slot_select(const fapi_nr_config_request_t *cfg, int nr_slot) -{ - if (cfg->cell_config.frame_duplex_type == FDD) - return NR_UPLINK_SLOT | NR_DOWNLINK_SLOT; - - const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table; - int rel_slot = nr_slot % tdd_table->tdd_period_in_slots; - - if (tdd_table->max_tdd_periodicity_list == NULL) // this happens before receiving TDD configuration - return NR_DOWNLINK_SLOT; - - const fapi_nr_max_tdd_periodicity_t *current_slot = &tdd_table->max_tdd_periodicity_list[rel_slot]; - - // if the 1st symbol is UL the whole slot is UL - if (current_slot->max_num_of_symbol_per_slot_list[0].slot_config == 1) - return NR_UPLINK_SLOT; - - // if the 1st symbol is flexible the whole slot is mixed - if (current_slot->max_num_of_symbol_per_slot_list[0].slot_config == 2) - return NR_MIXED_SLOT; - - for (int i = 1; i < NR_NUMBER_OF_SYMBOLS_PER_SLOT; i++) { - // if the 1st symbol is DL and any other is not, the slot is mixed - if (current_slot->max_num_of_symbol_per_slot_list[i].slot_config != 0) { - return NR_MIXED_SLOT; - } - } - - // if here, all the symbols where DL - return NR_DOWNLINK_SLOT; -} - -/* - * This function determines if the mixed slot is a Sidelink slot - */ -uint8_t sl_determine_if_sidelink_slot(uint8_t sl_startsym, uint8_t sl_lensym, uint8_t num_ulsym) -{ - uint8_t ul_startsym = NR_NUMBER_OF_SYMBOLS_PER_SLOT - num_ulsym; - - if ((sl_startsym >= ul_startsym) && (sl_lensym <= NR_NUMBER_OF_SYMBOLS_PER_SLOT)) { - LOG_D(MAC, - "MIXED SLOT is a SIDELINK SLOT. Sidelink Symbols: %d-%d, Uplink Symbols: %d-%d\n", - sl_startsym, - sl_lensym - 1, - ul_startsym, - ul_startsym + num_ulsym - 1); - return NR_SIDELINK_SLOT; - } else { - LOG_D(MAC, - "MIXED SLOT is NOT SIDELINK SLOT. Sidelink Symbols: %d-%d, Uplink Symbols: %d-%d\n", - sl_startsym, - sl_lensym - 1, - ul_startsym, - ul_startsym + num_ulsym - 1); - return 0; - } -} - -/* - * This function determines if the Slot is a SIDELINK SLOT - * Every Uplink Slot is a Sidelink slot - * Mixed Slot is a sidelink slot if the uplink symbols in Mixed slot - * overlaps with Sidelink start symbol and number of symbols. - */ -int sl_nr_ue_slot_select(const sl_nr_phy_config_request_t *cfg, int slot, uint8_t frame_duplex_type) -{ - int ul_sym = 0, slot_type = 0; - - // All PC5 bands are TDD bands , hence handling only TDD in this function. - AssertFatal(frame_duplex_type == TDD, "No Sidelink operation defined for FDD in 3GPP rel16\n"); - - if (cfg->tdd_table.max_tdd_periodicity_list == NULL) { // this happens before receiving TDD configuration - return slot_type; - } - - int period = cfg->tdd_table.tdd_period_in_slots; - int rel_slot = slot % period; - const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table; - - const fapi_nr_max_tdd_periodicity_t *current_slot = &tdd_table->max_tdd_periodicity_list[rel_slot]; - - for (int symbol_count = 0; symbol_count < NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { - if (current_slot->max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) { - ul_sym++; - } - } - - if (ul_sym == NR_NUMBER_OF_SYMBOLS_PER_SLOT) { - slot_type = NR_SIDELINK_SLOT; - } else if (ul_sym) { - slot_type = sl_determine_if_sidelink_slot(cfg->sl_bwp_config.sl_start_symbol, cfg->sl_bwp_config.sl_num_symbols, ul_sym); - } - - return slot_type; -} diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt b/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt deleted file mode 100644 index 0551bc7b8a..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt +++ /dev/null @@ -1,68 +0,0 @@ -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ - -cmake_minimum_required(VERSION 2.8) - -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -O0 -g -Wextra -march=native" -) - -add_definitions("-DUPGRADE_RAT_NR") -add_definitions("-DDEBUG_PSS_NR") -add_definitions("-DDEBUG_SSS_NR") -add_definitions("-DNR_UNIT_TEST") - -set(PACKAGE_NAME "Testbench for unitary tests") -set(PHYSIM True) -set(RF_BOARD None) -set(XFORMS False) -set(ENABLE_ITTI False) -set(DEBUG_PHY False) -set(DEBUG_PSS True) -set(DEBUG_PHY True) -set(DEBUG_PHY_PROC False) -set(DEBUG_DLSCH True) -set(T_TRACER False) - -# standard cmake file for nr ue build -include(../../../../../CMakeLists.txt) - - -set(SRC_UNIT_TESTS - ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c - ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c - ) - -set(INC_UNIT_TESTS - ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h - ) - -add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} ) -target_link_libraries(frame_config_test - -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group - pthread m ${ATLAS_LIBRARIES} - ) - -add_executable(pbch_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c ${SRC_UNIT_TESTS} ) -target_link_libraries(pbch_test - -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group - pthread m ${ATLAS_LIBRARIES} - ) diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/reflogs/frame_config_test.txt b/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/reflogs/frame_config_test.txt deleted file mode 100644 index f9e5da9a4e..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/reflogs/frame_config_test.txt +++ /dev/null @@ -1,180 +0,0 @@ - FRAME CONFIGURATION TEST --------------------------- -log init done -Start lte_param_init, frame_type 0, extended_prefix 0 -[PHY][I][nr_init_frame_parms_ue] Initializing frame parms for mu 1, N_RB 106, Ncp 0 -Initializing UE vars (abstraction 0) for eNB TXant 1, UE RXant 1 -[PHY][E][set_tdd_config_nr] set_tdd_configuration_nr: given period is inconsistent with current tdd configuration - -Tdd configuration tti 2 downlink 5 uplink 1 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] D - -[PHY][E][set_tdd_config_nr] set_tdd_configuration_nr: given period is inconsistent with current tdd configuration - -Tdd configuration tti 2 downlink 4 uplink 2 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] D - -[PHY][E][set_tdd_config_nr] set_tdd_configuration_nr: given period is inconsistent with current tdd configuration - -Tdd configuration tti 2 downlink 4 uplink 1 period 500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] D - - -Tdd configuration tti 1 downlink 1 uplink 1 period 2000 - [ 0] D [ 1] U [ 2] D [ 3] U [ 4] D [ 5] U [ 6] D [ 7] U [ 8] D [ 9] U [ 10] D [ 11] U [ 12] D [ 13] U [ 14] D [ 15] U [ 16] D [ 17] U [ 18] D [ 19] U - - -Tdd configuration tti 1 downlink 4 uplink 1 period 5000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - - -Tdd configuration tti 1 downlink 9 uplink 1 period 10000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - - -Tdd configuration tti 2 downlink 1 uplink 1 period 1000 - [ 0] D [ 1] U [ 2] D [ 3] U [ 4] D [ 5] U [ 6] D [ 7] U [ 8] D [ 9] U [ 10] D [ 11] U [ 12] D [ 13] U [ 14] D [ 15] U [ 16] D [ 17] U [ 18] D [ 19] U - [ 20] D [ 21] U [ 22] D [ 23] U [ 24] D [ 25] U [ 26] D [ 27] U [ 28] D [ 29] U [ 30] D [ 31] U [ 32] D [ 33] U [ 34] D [ 35] U [ 36] D [ 37] U [ 38] D [ 39] U - - -Tdd configuration tti 2 downlink 3 uplink 1 period 2000 - [ 0] D [ 1] D [ 2] D [ 3] U [ 4] D [ 5] D [ 6] D [ 7] U [ 8] D [ 9] D [ 10] D [ 11] U [ 12] D [ 13] D [ 14] D [ 15] U [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] U [ 24] D [ 25] D [ 26] D [ 27] U [ 28] D [ 29] D [ 30] D [ 31] U [ 32] D [ 33] D [ 34] D [ 35] U [ 36] D [ 37] D [ 38] D [ 39] U - - -Tdd configuration tti 2 downlink 4 uplink 1 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] U [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] U [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - - -Tdd configuration tti 2 downlink 9 uplink 1 period 5000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - - -Tdd configuration tti 2 downlink 19 uplink 1 period 10000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - - -Tdd configuration tti 4 downlink 1 uplink 1 period 500 - [ 0] D [ 1] U [ 2] D [ 3] U [ 4] D [ 5] U [ 6] D [ 7] U [ 8] D [ 9] U [ 10] D [ 11] U [ 12] D [ 13] U [ 14] D [ 15] U [ 16] D [ 17] U [ 18] D [ 19] U - [ 20] D [ 21] U [ 22] D [ 23] U [ 24] D [ 25] U [ 26] D [ 27] U [ 28] D [ 29] U [ 30] D [ 31] U [ 32] D [ 33] U [ 34] D [ 35] U [ 36] D [ 37] U [ 38] D [ 39] U - [ 40] D [ 41] U [ 42] D [ 43] U [ 44] D [ 45] U [ 46] D [ 47] U [ 48] D [ 49] U [ 50] D [ 51] U [ 52] D [ 53] U [ 54] D [ 55] U [ 56] D [ 57] U [ 58] D [ 59] U - [ 60] D [ 61] U [ 62] D [ 63] U [ 64] D [ 65] U [ 66] D [ 67] U [ 68] D [ 69] U [ 70] D [ 71] U [ 72] D [ 73] U [ 74] D [ 75] U [ 76] D [ 77] U [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 3 uplink 1 period 1000 - [ 0] D [ 1] D [ 2] D [ 3] U [ 4] D [ 5] D [ 6] D [ 7] U [ 8] D [ 9] D [ 10] D [ 11] U [ 12] D [ 13] D [ 14] D [ 15] U [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] U [ 24] D [ 25] D [ 26] D [ 27] U [ 28] D [ 29] D [ 30] D [ 31] U [ 32] D [ 33] D [ 34] D [ 35] U [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] U [ 44] D [ 45] D [ 46] D [ 47] U [ 48] D [ 49] D [ 50] D [ 51] U [ 52] D [ 53] D [ 54] D [ 55] U [ 56] D [ 57] D [ 58] D [ 59] U - [ 60] D [ 61] D [ 62] D [ 63] U [ 64] D [ 65] D [ 66] D [ 67] U [ 68] D [ 69] D [ 70] D [ 71] U [ 72] D [ 73] D [ 74] D [ 75] U [ 76] D [ 77] D [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 4 uplink 1 period 1250 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] U [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] U [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] U [ 45] D [ 46] D [ 47] D [ 48] D [ 49] U [ 50] D [ 51] D [ 52] D [ 53] D [ 54] U [ 55] D [ 56] D [ 57] D [ 58] D [ 59] U - [ 60] D [ 61] D [ 62] D [ 63] D [ 64] U [ 65] D [ 66] D [ 67] D [ 68] D [ 69] U [ 70] D [ 71] D [ 72] D [ 73] D [ 74] U [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 7 uplink 1 period 2000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] U [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] U [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] U [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] U [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] D [ 45] D [ 46] D [ 47] U [ 48] D [ 49] D [ 50] D [ 51] D [ 52] D [ 53] D [ 54] D [ 55] U [ 56] D [ 57] D [ 58] D [ 59] D - [ 60] D [ 61] D [ 62] D [ 63] U [ 64] D [ 65] D [ 66] D [ 67] D [ 68] D [ 69] D [ 70] D [ 71] U [ 72] D [ 73] D [ 74] D [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 9 uplink 1 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] D [ 45] D [ 46] D [ 47] D [ 48] D [ 49] U [ 50] D [ 51] D [ 52] D [ 53] D [ 54] D [ 55] D [ 56] D [ 57] D [ 58] D [ 59] U - [ 60] D [ 61] D [ 62] D [ 63] D [ 64] D [ 65] D [ 66] D [ 67] D [ 68] D [ 69] U [ 70] D [ 71] D [ 72] D [ 73] D [ 74] D [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 19 uplink 1 period 5000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] D [ 45] D [ 46] D [ 47] D [ 48] D [ 49] D [ 50] D [ 51] D [ 52] D [ 53] D [ 54] D [ 55] D [ 56] D [ 57] D [ 58] D [ 59] U - [ 60] D [ 61] D [ 62] D [ 63] D [ 64] D [ 65] D [ 66] D [ 67] D [ 68] D [ 69] D [ 70] D [ 71] D [ 72] D [ 73] D [ 74] D [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - - -Tdd configuration tti 4 downlink 38 uplink 2 period 10000 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] D [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] D [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] D [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] U [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] D [ 45] D [ 46] D [ 47] D [ 48] D [ 49] D [ 50] D [ 51] D [ 52] D [ 53] D [ 54] D [ 55] D [ 56] D [ 57] D [ 58] D [ 59] D - [ 60] D [ 61] D [ 62] D [ 63] D [ 64] D [ 65] D [ 66] D [ 67] D [ 68] D [ 69] D [ 70] D [ 71] D [ 72] D [ 73] D [ 74] D [ 75] D [ 76] D [ 77] D [ 78] U [ 79] U - - -Tdd configuration tti 8 downlink 4 uplink 1 period 625 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] U [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] U [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] U [ 45] D [ 46] D [ 47] D [ 48] D [ 49] U [ 50] D [ 51] D [ 52] D [ 53] D [ 54] U [ 55] D [ 56] D [ 57] D [ 58] D [ 59] U - [ 60] D [ 61] D [ 62] D [ 63] D [ 64] U [ 65] D [ 66] D [ 67] D [ 68] D [ 69] U [ 70] D [ 71] D [ 72] D [ 73] D [ 74] U [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - [ 80] D [ 81] D [ 82] D [ 83] D [ 84] U [ 85] D [ 86] D [ 87] D [ 88] D [ 89] U [ 90] D [ 91] D [ 92] D [ 93] D [ 94] U [ 95] D [ 96] D [ 97] D [ 98] D [ 99] U - [100] D [101] D [102] D [103] D [104] U [105] D [106] D [107] D [108] D [109] U [110] D [111] D [112] D [113] D [114] U [115] D [116] D [117] D [118] D [119] U - [120] D [121] D [122] D [123] D [124] U [125] D [126] D [127] D [128] D [129] U [130] D [131] D [132] D [133] D [134] U [135] D [136] D [137] D [138] D [139] U - [140] D [141] D [142] D [143] D [144] U [145] D [146] D [147] D [148] D [149] U [150] D [151] D [152] D [153] D [154] U [155] D [156] D [157] D [158] D [159] U - - -Tdd configuration tti 16 downlink 7 uplink 1 period 500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] D [ 5] D [ 6] D [ 7] U [ 8] D [ 9] D [ 10] D [ 11] D [ 12] D [ 13] D [ 14] D [ 15] U [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] D [ 21] D [ 22] D [ 23] U [ 24] D [ 25] D [ 26] D [ 27] D [ 28] D [ 29] D [ 30] D [ 31] U [ 32] D [ 33] D [ 34] D [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - [ 40] D [ 41] D [ 42] D [ 43] D [ 44] D [ 45] D [ 46] D [ 47] U [ 48] D [ 49] D [ 50] D [ 51] D [ 52] D [ 53] D [ 54] D [ 55] U [ 56] D [ 57] D [ 58] D [ 59] D - [ 60] D [ 61] D [ 62] D [ 63] U [ 64] D [ 65] D [ 66] D [ 67] D [ 68] D [ 69] D [ 70] D [ 71] U [ 72] D [ 73] D [ 74] D [ 75] D [ 76] D [ 77] D [ 78] D [ 79] U - [ 80] D [ 81] D [ 82] D [ 83] D [ 84] D [ 85] D [ 86] D [ 87] U [ 88] D [ 89] D [ 90] D [ 91] D [ 92] D [ 93] D [ 94] D [ 95] U [ 96] D [ 97] D [ 98] D [ 99] D - [100] D [101] D [102] D [103] U [104] D [105] D [106] D [107] D [108] D [109] D [110] D [111] U [112] D [113] D [114] D [115] D [116] D [117] D [118] D [119] U - [120] D [121] D [122] D [123] D [124] D [125] D [126] D [127] U [128] D [129] D [130] D [131] D [132] D [133] D [134] D [135] U [136] D [137] D [138] D [139] D - [140] D [141] D [142] D [143] U [144] D [145] D [146] D [147] D [148] D [149] D [150] D [151] U [152] D [153] D [154] D [155] D [156] D [157] D [158] D [159] U - [160] D [161] D [162] D [163] D [164] D [165] D [166] D [167] U [168] D [169] D [170] D [171] D [172] D [173] D [174] D [175] U [176] D [177] D [178] D [179] D - [180] D [181] D [182] D [183] U [184] D [185] D [186] D [187] D [188] D [189] D [190] D [191] U [192] D [193] D [194] D [195] D [196] D [197] D [198] D [199] U - [200] D [201] D [202] D [203] D [204] D [205] D [206] D [207] U [208] D [209] D [210] D [211] D [212] D [213] D [214] D [215] U [216] D [217] D [218] D [219] D - [220] D [221] D [222] D [223] U [224] D [225] D [226] D [227] D [228] D [229] D [230] D [231] U [232] D [233] D [234] D [235] D [236] D [237] D [238] D [239] U - [240] D [241] D [242] D [243] D [244] D [245] D [246] D [247] U [248] D [249] D [250] D [251] D [252] D [253] D [254] D [255] U [256] D [257] D [258] D [259] D - [260] D [261] D [262] D [263] U [264] D [265] D [266] D [267] D [268] D [269] D [270] D [271] U [272] D [273] D [274] D [275] D [276] D [277] D [278] D [279] U - [280] D [281] D [282] D [283] D [284] D [285] D [286] D [287] U [288] D [289] D [290] D [291] D [292] D [293] D [294] D [295] U [296] D [297] D [298] D [299] D - [300] D [301] D [302] D [303] U [304] D [305] D [306] D [307] D [308] D [309] D [310] D [311] U [312] D [313] D [314] D [315] D [316] D [317] D [318] D [319] U - - -Tdd configuration tti 2 downlink 4 uplink 1 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] U [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] U [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - - -Set tdd dedicated configuration - [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: tdd downlink symbol configuration is not supported - -Set tdd dedicated configuration - [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: tdd uplink symbol configuration is not supported - -Set tdd dedicated configuration - [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: tdd slot index exceeds maximum value - -Set tdd dedicated configuration - [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: tdd downlink & uplink symbol configuration is not supported - -Set tdd dedicated configuration - [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: no tdd symbol configuration is specified - -Set tdd dedicated configuration - UL[0] [PHY][E][set_tdd_configuration_dedicated_nr] set_tdd_configuration_dedicated_nr: no tdd symbol configuration is specified - -Set tdd dedicated configuration - DL[0] - -Tdd configuration tti 2 downlink 4 uplink 1 period 2500 - [ 0] D [ 1] D [ 2] D [ 3] D [ 4] U [ 5] D [ 6] D [ 7] D [ 8] D [ 9] U [ 10] D [ 11] D [ 12] D [ 13] D [ 14] U [ 15] D [ 16] D [ 17] D [ 18] D [ 19] U - [ 20] D [ 21] D [ 22] D [ 23] D [ 24] U [ 25] D [ 26] D [ 27] D [ 28] D [ 29] U [ 30] D [ 31] D [ 32] D [ 33] D [ 34] U [ 35] D [ 36] D [ 37] D [ 38] D [ 39] U - - -Set tdd dedicated configuration - UL[0] UL[5] UL[10] UL[15] UL[20] UL[25] UL[30] UL[35] DL[4] DL[9] DL[14] DL[19] DL[19] DL[24] DL[29] DL[34] DL[39] - -Tdd configuration tti 2 downlink 4 uplink 1 period 2500 - [ 0] U [ 1] D [ 2] D [ 3] D [ 4] D [ 5] U [ 6] D [ 7] D [ 8] D [ 9] D [ 10] U [ 11] D [ 12] D [ 13] D [ 14] D [ 15] U [ 16] D [ 17] D [ 18] D [ 19] D - [ 20] U [ 21] D [ 22] D [ 23] D [ 24] D [ 25] U [ 26] D [ 27] D [ 28] D [ 29] D [ 30] U [ 31] D [ 32] D [ 33] D [ 34] D [ 35] U [ 36] D [ 37] D [ 38] D [ 39] D - -Test NR FRAME CONFIGURATION is pass diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/run_tests.sh b/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/run_tests.sh deleted file mode 100755 index 2b794fd2e8..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/run_tests.sh +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/bash -# -# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The OpenAirInterface Software Alliance licenses this file to You under -# the OAI Public License, Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.openairinterface.org/?page_id=698 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#------------------------------------------------------------------------------- -# For more information about the OpenAirInterface (OAI) Software Alliance: -# contact@openairinterface.org -# -#---------------------- -# File: run_tests.sh -#---------------------- -# Description: script batch for: -# - building tests -# - executing tests -# - checking output files with reference files. -# ./run_test to build/run and check all tests -# -b no build -# -e no execution -# -c no check -# -m no run of meld -# an alone specific test can be executed ./run_tests test_name -#---------------------------------------------------------------------------- -# CONFIGURATION -# files and directories - -WORK_DIR="openair1/SIMULATION/NR_UE_PHY/unit_tests/build" -OAIENV_DIR="../../../../.." -EXECUTABLE_DIR="." -REFERENCE_DIR="./reflogs" -RESULT_TEST_FILE="" -RESULT_DIR="./testlogs" -BROWSER="firefox" - -#---------------------------------------------------------------------------- -# For building and executing test application - -BUILD_TEST="yes" -CHECK_TEST="yes" -EXECUTE_TEST="yes" -SINGLE_TEST="no" -RUN_MELD="yes" -# for removing files -REMOVE="rm -f" -COMPARE="cmp" -TESTS_RUN=0 -TESTS_PASS=0 -TESTS_FAIL=0 - -#---------------------------------------------------------------------------- -# List of tests - -tst_files=" - frame_config_test" - -#--------------------------------------------------------------------------- -# manage input parameters - -while [ $# != "0" ] -do - case $1 in - -b) - echo "No build of unit test" - BUILD_TEST="no" - ;; - -e) - echo "No execution of unit test" - EXECUTE_TEST="no" - ;; - -c) - echo "No check of unit test" - CHECK_TEST="no" - ;; - -m) - echo "No run of meld tool" - RUN_MELD="no" - ;; - -h) - echo "Option of run_test script" - echo "-b : No Build of unit tests" - echo "-c : No check for unit test" - echo "-e : No run of unit tests" - echo "-m : No run of meld tool" - exit - BUILD_TEST="no" - CHECK_TEST="no" - EXECUTE_TEST="no" - ;; - *) - for file in $tst_files - do - if [ $file == $1 ] - then - SINGLE_TEST="yes" - TEST=$1 - echo "Single test $TEST" - fi - done - if [ $SINGLE_TEST == "no" ] - then - echo "Unknown parameter $1" - BUILD_TEST="no" - CHECK_TEST="no" - EXECUTE_TEST="no" - exit - fi - ;; - esac - # shift of input parameter (excluding $0 ) $1 <- $2 <- $3 ... - # $# is decrement by shift - shift -done - -#-------------------------------------------------------------------------------------------- -# RUN AND CHECK RESULTS - -numberDisplayFilesDifferencies=0 -let MAX_NUMBER_DISPLAY_FILES_DIFFERENCES=8 -num_diff=0 - -if [ $EXECUTE_TEST == "yes" ] -then - mkdir $RESULT_DIR -fi - -if [ $BUILD_TEST == "yes" ] -then - if [ $SINGLE_TEST == "no" ] - then - echo "cd $OAIENV_DIR" - cd $OAIENV_DIR - echo "source oaienv" - source oaienv - echo "cd $WORK_DIR" - cd $WORK_DIR - echo "cmake CMakeLists.txt" - cmake CMakeLists.txt - echo -e "make clean\n" - #make clean - fi -fi - -if [ $CHECK_TEST == "yes" ] -then - echo "Display differencies for a maximum of "$MAX_NUMBER_DISPLAY_FILES_DIFFERENCES" files" -fi - -for file in $tst_files - do - - if [ $SINGLE_TEST == "yes" ] - then - file=$TEST - fi - - echo "Test : $file" - RESULT_TEST_FILE="$file.txt" - - # build executable - if [ $BUILD_TEST == "yes" ] - then - echo -e "make $file\n" - make $file - fi - - if [ $EXECUTE_TEST == "yes" ] - then - echo "rm $RESULT_DIR/$RESULT_TEST_FILE" - rm $RESULT_DIR/$RESULT_TEST_FILE - echo "$EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE" - $EXECUTABLE_DIR/$file > $RESULT_DIR/$RESULT_TEST_FILE - TESTS_RUN=$((TESTS_RUN+1)) - fi - - if [ $CHECK_TEST == "yes" ] - then - # check if there is already a reference file - if [ -f "$REFERENCE_DIR/$RESULT_TEST_FILE" ] - then - - echo File "$REFERENCE_DIR/$RESULT_TEST_FILE" exists - - $COMPARE $RESULT_DIR/$RESULT_TEST_FILE $REFERENCE_DIR/$RESULT_TEST_FILE > /dev/null 2>&1 - - if [ $? == 0 ] - then - echo "Test $file is PASS" - echo "Same logging file for $file" - TESTS_PASS=$((TESTS_PASS+1)) - else - echo "Test $file is FAIL" - TESTS_FAIL=$((TESTS_FAIL+1)) - echo "Difference of logging file for scenario $file" - let "num_diff=$num_diff + 1" - if [ $RUN_MELD == "yes" ] - then - meld $RESULT_DIR/$RESULT_TEST_FILE $REFERENCE_DIR/$RESULT_TEST_FILE & - let "numberDisplayFilesDifferencies=$numberDisplayFilesDifferencies + 1" - echo "Meld number "$numberDisplayFilesDifferencies - if [ $numberDisplayFilesDifferencies = $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES ] - then - echo "###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ###### ERROR ######" - echo "=> ERROR Test aborted because there are already $MAX_NUMBER_DISPLAY_FILES_DIFFERENCES detected logging files which are different" - break - fi - fi - fi - else - echo "No reference file for test $file" - fi - fi - - if [ $SINGLE_TEST == "yes" ] - then - echo "Test $file has been executed" - break - fi - done - -if [ $CHECK_TEST == "yes" ] -then - echo "There are $num_diff result files which are different" -fi - - echo " tests run : $TESTS_RUN pass : $TESTS_PASS fail : $TESTS_FAIL" - -# end of script diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/readme.txt b/openair1/SIMULATION/NR_UE_PHY/unit_tests/readme.txt deleted file mode 100644 index d41bf2eb1c..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/readme.txt +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -File: /home/jacques/workspace/oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/README.txt - -This directory contains testbenchs for 5G NR physical layers. - -Before building unit tests, full UE build should be done before (maily for asn1 dependencies): - -Initialise environment: -- under openairinterface5g enter >source oaienv -Install tools: -- under openairinterface5g/cmake_targets/build -I -Build NR UE: -- under openairinterface5g/cmake_targets/build --nrUE - -Specific test files -==================== - -frame_config_test.c : test of frame configurations (FDD/TDD). - -How to build & run tests -======================== - -Before building, oai environment should be set by entering under directory openairinterface5g "source oaienv". - -A script "run_tests.sh" allows to build, to run and to check all tests. -To run a complete non regression of unit tests, go under directory NR_UE_PHY/unit_tests/build and execute: -./run_tests.sh - -This script "run_tests.sh" list all available unit tests. - -build is based on cmake tool. - -cmake file is "/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeList.txt". - -CMakeList.txt lists different build. - -How to build: in directory "oai_openairinterface/openairinterface5g/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/", below commands should be entered: - -First command to do: -cmake CMakeList.txt -> it generates makefiles to build all projects. - -Then build of test: -make frame_config_test -> build frame_config_test: NR FDD/TDD configuration. -make clean -> clean all projects. - -And execution of tests: -./frame_config_test -> run NR frame configuration tests. - -There is a script in build/run_test.sh which allows: -- building/running/checking all tests - -What is test result? -==================== - -Test verdict consists in a comparaison of generated logging file at execution with a reference logging file which is stored under git for each test. -By default, tool "meld" is open each time there is a difference between reference file and logging file. -It is possible to disable execution of meld with option -m. - -Build/execute only one test: -=========================== - -The script "run_tests.sh" has different options: -"-b : No Build of unit tests" -"-c : No check for unit test" -"-e : No execution of unit tests" -"-m : No run of meld tool" - -./run_tests.sh -> run all unit tests (build, execute and compare for each test) -./run_tests.sh -m -> run all unit tests but meld is not used (verdict is based on system command "cmp"). -./run_tests.sh -b -c -r -m -> list all available unit tests -./run_tests.sh pss_test -> run only one test (here it is pss_test). -./run_tests.sh -c -e -m pss_test -> build only one test -./run_tests.sh -m pss_test -> run only one test but without execution of meld - -Which processing can be tuned? -============================= - -Decimation feature: - -By default pss processing uses samples from received buffer at input sampling frequency fs. -For saving processing time, it is possible that pss uses a decimation of input signal. -To enable decimation file openairinterface5g_bis/openairinterface5g/openair1/PHY/NR_REFSIG/pss_nr.h should be modified. -//#define PSS_DECIMATOR should be enable to get decimation. -By default, decimation uses a FIR filter. -It is possible to use a CIC (Cascaded Integrated Comb filter) for decimation by enabling line //#define CIC_DECIMATOR. - -Input received signal: - -Different waveforms can be generated for testing pss and sss detection. -By default, it uses a sinusoidal signals at different frequencies with an amplitude at the same level than pss or sss signals. -For modifying these waveforms, function "set_random_rx_buffer" in file pss_util_test.c has to be modified. -For wavecom type, line data_format = SINUSOIDAL_DATA should be changed with new format. -For amplitude of waveform, declaration have to be modified in the function. - -Status -====== - -NR synchronisation tests run successfully with default parameters. -Warning: Tests of PSS NR with decimation (based on FIR or CIC filter) does not run successfully at the moment. - - - diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c deleted file mode 100644 index b8a5c7a780..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/********************************************************************* -* -* FILENAME : dummy_functions.c -* -* MODULE : NR UE unit test -* -* DESCRIPTION : it allows to define unused functions for unit tests. -* -************************************************************************/ - -#include - -#include "../../unit_tests/src/pss_util_test.h" -#include "PHY/types.h" -#include "PHY/defs_gNB.h" -#include "../common/ran_context.h" -#include "../common/config/config_paramdesc.h" - - -/*****************variables****************************************/ - -RAN_CONTEXT_t RC; - -uint32_t (*p_nr_ue_get_SR)(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_id,uint16_t rnti, sub_frame_t subframe) = NULL; - -/*****************functions****************************************/ - -lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) -{ - return(0); -} - -PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, - frame_t frameP, uint8_t new_Msg3, - sub_frame_t subframe){ return(NULL);} - -void ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t subframe, uint8_t eNB_index, - uint8_t * ulsch_buffer, uint16_t buflen, - uint8_t * access_mode){} - -void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id, - frame_t frameP, uint8_t eNB_id){} - -void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, - frame_t frameP, uint8_t eNB_id){} - -uint32_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, - uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){ - - uint32_t value = 0; - if (p_nr_ue_get_SR != NULL) - { - value = (p_nr_ue_get_SR)(module_idP, CC_id, frameP, eNB_id, rnti, subframe); - } - return(value);} - -void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) -{} - -UE_L2_STATE_t ue_scheduler(const module_id_t module_idP, - const frame_t rxFrameP, - const sub_frame_t rxSubframe, - const frame_t txFrameP, - const sub_frame_t txSubframe, - const lte_subframe_t direction, - const uint8_t eNB_index, const int CC_id){ return(0);} - -void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame, - uint8_t CH_index, void *pdu, uint16_t len){} - -void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame, - uint8_t CH_index, void *pdu, uint16_t len){} - -void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame, - sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len, - uint8_t CH_index){} - -uint16_t -ue_process_rar(const module_id_t module_idP, - const int CC_id, - const frame_t frameP, - const rnti_t ra_rnti, - uint8_t * const dlsch_buffer, - rnti_t * const t_crnti, - const uint8_t preamble_index, - uint8_t * selected_rar_buffer){ return(0);} - -void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index, - uint8_t sync_area){} - -int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame, - sub_frame_t subframe, uint8_t eNB_index, - uint8_t * sync_area, uint8_t * mcch_active){ return(0);} - - -int ue_query_mch_fembms(module_id_t Mod_id, uint8_t CC_id, uint32_t frame, - sub_frame_t subframe, uint8_t eNB_index, - uint8_t * sync_area, uint8_t * mcch_active){ return(0);} - -void dl_phy_sync_success(module_id_t module_idP, - frame_t frameP, - unsigned char eNB_index, uint8_t first_sync){} - -uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn) { return(0);} - -int32_t get_uldl_offset(int nr_bandP) { return(0);} - -IF_Module_t *IF_Module_init(int Mod_id) { return(NULL);} - -int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id) { return(0);} - -int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id) { return(0);} - -void thread_top_init(char *thread_name, - int affinity, - uint64_t runtime, - uint64_t deadline, - uint64_t period) {} - -int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);} -int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } -int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } -int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } -int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } -int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } -int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { return(0); } -int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } -int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } -int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } -int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } - -int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } - -int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); } - -static int step_log = 0; -const char log_first[] = "debug"; -const char log_second[] = "full"; -const char log_default[] = " "; - -int config_get(paramdef_t *params,int numparams, char *prefix) -{ -#define MAX_STRING_SIZE (255) - - char *p_log; - - for (int i=0; i < numparams; i++) - { - switch(step_log) - { - case 1: - p_log = log_first; - params[i].strptr = calloc(1, MAX_STRING_SIZE); - *(params[i].strptr) = p_log; - break; - case 2: - p_log = log_first; - params[i].strptr = calloc(1, MAX_STRING_SIZE); - *(params[i].strptr) = p_log; - break; - case 3: - params[i].uptr = calloc(1, sizeof(int)); - *(params[i].uptr) = 0; - break; - default: - p_log = log_default; - params[i].strptr = calloc(1, MAX_STRING_SIZE); - *(params[i].strptr) = p_log; - break; - } - } - - step_log++; - - return(0); -} - -unsigned int taus(void) { return (0); } - -typedef int loader_shlibfunc_t; - -int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf) { return(0); } - -void * get_shlibmodule_fptr(char *modname, char *fname) { return(NULL) ; } - -/*void exit_fun (const char *s) { - VOID_PARAMETER s; - undefined_function(__FUNCTION__); -}*/ - -uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, - uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe){ - uint32_t value = 0; - return(value); -} diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c deleted file mode 100644 index 6e0f78d3ab..0000000000 --- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/********************************************************************** -* -* FILENAME : frame_config_test.c -* -* MODULE : UE test bench for tdd configuration -* -* DESCRIPTION : it allows unitary tests for tdd configuration -* -************************************************************************/ - -#include "../../unit_tests/src/pss_util_test.h" - -#include "PHY/defs_nr_UE.h" -#include "PHY/INIT/init_extern.h" -#include "PHY/phy_extern_nr_ue.h" - -#include "SCHED_NR_UE/phy_frame_config_nr.h" - -/******************************************************************* -* -* NAME : display_frame_configuration -* -* PARAMETERS : none -* -* RETURN : none -* -* DESCRIPTION : display uplink & downlink configuration -* -*********************************************************************/ - -void display_frame_configuration(NR_DL_FRAME_PARMS *frame_parms) { - - printf("\nTdd configuration tti %d downlink %d uplink %d period %d \n", frame_parms->slots_per_subframe, frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots, - frame_parms->p_tdd_UL_DL_Configuration->nrofUplinkSlots, frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity); - - int k = NR_NUMBER_OF_SUBFRAMES_PER_FRAME - 1; - int tti = 0; - for (int j = 0; j < frame_parms->slots_per_frame; j++) { - int frame = 0; - if (j != 0) { - frame = j / frame_parms->slots_per_frame; - tti = j % frame_parms->slots_per_frame; - } - else { - frame = 0; - tti = 0; - } - - if (slot_select_nr(frame_parms, frame, tti) & NR_DOWNLINK_SLOT) { - printf(" [%3d] D", j); - } - else { - if (slot_select_nr(frame_parms, frame, tti) & NR_UPLINK_SLOT) { - printf(" [%3d] U", j); - } - else { - printf("Error test_frame_configuration: unexpected value \n"); - assert(0); - } - } - if (j == k) { - printf("\n"); - k += NR_NUMBER_OF_SUBFRAMES_PER_FRAME; - } - } - printf("\n"); -} - -/******************************************************************* -* -* NAME : set_tti_test -* -* PARAMETERS : none -* -* RETURN : none -* -* DESCRIPTION : set tti -* -*********************************************************************/ - -void set_tti_test(NR_DL_FRAME_PARMS *frame_parms, int slots_per_subframe) -{ - frame_parms->slots_per_subframe = slots_per_subframe; - frame_parms->slots_per_frame = slots_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME; -} - -/******************************************************************* -* -* NAME : test_frame_configuration -* -* PARAMETERS : none -* -* RETURN : none -* -* DESCRIPTION : test of frame configuration feature -* -*********************************************************************/ - -int test_frame_configuration(PHY_VARS_NR_UE *PHY_vars_UE) -{ - NR_DL_FRAME_PARMS *frame_parms = &(PHY_vars_UE->frame_parms); - int v_return = 0; - - #define NO_DOWNLINK_SYMBOL (0) - #define NO_UPLINK_SYMBOL (0) - - #define TTI_DEFAULT (2) - #define DL_SLOT_DEFAULT (4) - #define UL_SLOT_DEFAULT (1) - #define TDD_PERIODICITY_DEFAULT (ms2p5) - - #define TDD_WRONG_CONFIG_TEST (3) - #define TDD_GOOD_CONFIG_TEST (18) - #define TDD_CONFIG_TEST (TDD_WRONG_CONFIG_TEST + TDD_GOOD_CONFIG_TEST) - - /* this array allows setting different tdd configurations */ - /* it defines number of tti (slot) per subframe, number of downlink slots, number of uplink slots */ - /* and a period of the configuration */ - /* first configurations (wrong) shall be fired error because they are not correct */ - /* other configurations (good) are correct and they do not generate any error */ - /* there is a tdd configuration for each line */ - - uint16_t TDD_configuration[TDD_CONFIG_TEST][4] = { - /* tti per subframe SLOT_DL SLOT_UL period */ - { 2, 4+1, 1, ms2p5 }, - { 2, 4, 1+1, ms2p5 }, - { 2, 4, 1, ms0p5 }, - { 1, 1, 1, ms2 }, - { 1, 4, 1, ms5 }, - { 1, 9, 1, ms10 }, - { 2, 1, 1, ms1 }, - { 2, 3, 1, ms2 }, - { 2, 4, 1, ms2p5 }, - { 2, 9, 1, ms5 }, - { 2, 19, 1, ms10 }, - { 4, 1, 1, ms0p5 }, - { 4, 3, 1, ms1 }, - { 4, 4, 1, ms1p25 }, - { 4, 7, 1, ms2 }, - { 4, 9, 1, ms2p5 }, - { 4, 19, 1, ms5 }, - { 4, 38, 2, ms10 }, - { 8, 4, 1, ms0p625 }, - { 16, 7, 1, ms0p5 }, - { TTI_DEFAULT, DL_SLOT_DEFAULT, UL_SLOT_DEFAULT, TDD_PERIODICITY_DEFAULT }, - }; - - #define TDD_WRONG_DEDICATED_CONFIG_TEST (7) - #define TDD_GOOD_DEDICATED_CONFIG_TEST (18) - #define TDD_DEDICATED_CONFIG_TEST (TDD_WRONG_DEDICATED_CONFIG_TEST + TDD_GOOD_DEDICATED_CONFIG_TEST) - - /* this array allows setting different tdd dedicated configurations */ - /* tdd dedicated configuration overwrite current tdd confirguration for specified slot number */ - /* it defines slot number to modify, then with a bit map number of downlink symbol, number of uplink symbols */ - /* if next slot is set to 0 means that there is no additional slot to modify with current dedicated configuration */ - /* if next slot is set to 1 means that there is an additional slot to mdofy with current dedicated configuration */ - /* so tdd dedicated configuration can be composed of only 1 lines (for 1 slot) or several lines for several slots */ - /* first dedictaed configurations (wrong) shall be fired errors because they are not correct */ - /* other dedicated configurations (good) are correct and they do not generate any error */ - - uint16_t TDD_dedicated_config[TDD_DEDICATED_CONFIG_TEST][4] = { - /* slot number SLOT_DL SLOT_UL next slot */ - { 0, 1, 1, 0 }, - { 0, 0, 1, 0 }, - { 40, 0, NR_TDD_SET_ALL_SYMBOLS, 0 }, - { 0, NR_TDD_SET_ALL_SYMBOLS, NR_TDD_SET_ALL_SYMBOLS, 0 }, - { 0, 0, 0, 0 }, - { 0, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 0, 0, 0, 0 }, - { 0, NR_TDD_SET_ALL_SYMBOLS, 0, 0 }, - { 0, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 5, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 10, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 15, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 20, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 25, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 30, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 35, 0, NR_TDD_SET_ALL_SYMBOLS, 1 }, - { 4, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 9, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 14, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 19, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 19, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 24, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 29, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 34, NR_TDD_SET_ALL_SYMBOLS, 0, 1 }, - { 39, NR_TDD_SET_ALL_SYMBOLS, 0, 0 }, - }; - - /* TEST wrong and good tdd configurations starting by wrong ones */ - int return_status = -1; - for (int i = 0; i < TDD_CONFIG_TEST; i++) { - if (i == TDD_WRONG_CONFIG_TEST) { - return_status = 0; /* status should be fine for fine configurations */ - } - - set_tti_test(frame_parms, TDD_configuration[i][0]); - - if (set_tdd_config_nr(frame_parms, TDD_configuration[i][3], TDD_configuration[i][1], NO_DOWNLINK_SYMBOL, - TDD_configuration[i][2], NO_UPLINK_SYMBOL) != return_status) { - v_return = (-1); - } - - display_frame_configuration(frame_parms); - - free_tdd_configuration_nr(frame_parms); - } - - /* set default configuration */ - set_tti_test(frame_parms, TTI_DEFAULT); - - if (set_tdd_config_nr(frame_parms, TDD_PERIODICITY_DEFAULT, DL_SLOT_DEFAULT, NO_DOWNLINK_SYMBOL, UL_SLOT_DEFAULT, NO_UPLINK_SYMBOL) != 0) { - v_return = (-1); - } - - /* TEST wrong and good tdd dedicated configurations starting by wrong ones */ - return_status = (-1); - for (int i = 0; i < TDD_DEDICATED_CONFIG_TEST; i++) { - - bool next = false; - do { - if (i == TDD_WRONG_DEDICATED_CONFIG_TEST) { - return_status = 0; /* status should be fine for fine configurations */ - } - - add_tdd_dedicated_configuration_nr( frame_parms, TDD_dedicated_config[i][0], TDD_dedicated_config[i][1], TDD_dedicated_config[i][2]); - - if (TDD_dedicated_config[i][3] == 1) { - next = true; - i = i + 1; - } - else { - next = false; - } - } while (next); - - if (set_tdd_configuration_dedicated_nr(frame_parms) != return_status) { - v_return = (-1); - } - - if (return_status == 0) { - display_frame_configuration(frame_parms); - } - - free_tdd_configuration_dedicated_nr(frame_parms); - } - - free_tdd_configuration_nr(frame_parms); - - return (v_return); -} - -/******************************************************************* -* -* NAME : main -* -* DESCRIPTION : test of tdd configuration -* -*********************************************************************/ - -int main(int argc, char *argv[]) -{ - uint8_t transmission_mode = 1; - uint8_t nb_antennas_tx = 1; - uint8_t nb_antennas_rx = 1; - uint8_t frame_type = FDD; - int N_RB_DL=100; - lte_prefix_type_t extended_prefix_flag = NORMAL; - int Nid_cell[] = {(3*0+0)}; - VOID_PARAMETER argc; - VOID_PARAMETER argv; - - printf(" FRAME CONFIGURATION TEST \n"); - printf("--------------------------\n"); - - if (init_test(nb_antennas_tx, nb_antennas_rx, transmission_mode, extended_prefix_flag, frame_type, Nid_cell[0], N_RB_DL) != 0) { - printf("Initialisation problem for frame configuration test \n"); - exit(-1);; - } - - if (test_frame_configuration(PHY_vars_UE) != 0) { - printf("Test NR FRAME CONFIGURATION is fail \n"); - } - else { - printf("Test NR FRAME CONFIGURATION is pass \n"); - } - - lte_sync_time_free(); - - free_context_synchro_nr(); - - return(0); -} diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler_sl.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler_sl.c index a27a464878..71e4c7fe25 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler_sl.c @@ -58,6 +58,70 @@ static uint8_t sl_get_elapsed_slots(uint32_t slot, uint32_t sl_slot_bitmap) return elapsed_slots; } +/* + * This function determines if the mixed slot is a Sidelink slot + */ +static uint8_t sl_determine_if_sidelink_slot(uint8_t sl_startsym, uint8_t sl_lensym, uint8_t num_ulsym) +{ + uint8_t ul_startsym = NR_NUMBER_OF_SYMBOLS_PER_SLOT - num_ulsym; + + if ((sl_startsym >= ul_startsym) && (sl_lensym <= NR_NUMBER_OF_SYMBOLS_PER_SLOT)) { + LOG_D(MAC, + "MIXED SLOT is a SIDELINK SLOT. Sidelink Symbols: %d-%d, Uplink Symbols: %d-%d\n", + sl_startsym, + sl_lensym - 1, + ul_startsym, + ul_startsym + num_ulsym - 1); + return NR_SIDELINK_SLOT; + } else { + LOG_D(MAC, + "MIXED SLOT is NOT SIDELINK SLOT. Sidelink Symbols: %d-%d, Uplink Symbols: %d-%d\n", + sl_startsym, + sl_lensym - 1, + ul_startsym, + ul_startsym + num_ulsym - 1); + return 0; + } +} + +/* + * This function determines if the Slot is a SIDELINK SLOT + * Every Uplink Slot is a Sidelink slot + * Mixed Slot is a sidelink slot if the uplink symbols in Mixed slot + * overlaps with Sidelink start symbol and number of symbols. + */ +int sl_nr_ue_slot_select(const sl_nr_phy_config_request_t *cfg, int slot, uint8_t frame_duplex_type) +{ + int ul_sym = 0, slot_type = 0; + + // All PC5 bands are TDD bands , hence handling only TDD in this function. + AssertFatal(frame_duplex_type == TDD, "No Sidelink operation defined for FDD in 3GPP rel16\n"); + + if (cfg->tdd_table.max_tdd_periodicity_list == NULL) { // this happens before receiving TDD configuration + return slot_type; + } + + int period = cfg->tdd_table.tdd_period_in_slots; + int rel_slot = slot % period; + const fapi_nr_tdd_table_t *tdd_table = &cfg->tdd_table; + + const fapi_nr_max_tdd_periodicity_t *current_slot = &tdd_table->max_tdd_periodicity_list[rel_slot]; + + for (int symbol_count = 0; symbol_count < NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { + if (current_slot->max_num_of_symbol_per_slot_list[symbol_count].slot_config == 1) { + ul_sym++; + } + } + + if (ul_sym == NR_NUMBER_OF_SYMBOLS_PER_SLOT) { + slot_type = NR_SIDELINK_SLOT; + } else if (ul_sym) { + slot_type = sl_determine_if_sidelink_slot(cfg->sl_bwp_config.sl_start_symbol, cfg->sl_bwp_config.sl_num_symbols, ul_sym); + } + + return slot_type; +} + static void sl_determine_slot_bitmap(sl_nr_ue_mac_params_t *sl_mac, int ue_id) {