diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 67f65b6848..6cf6f7128e 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2120,6 +2120,7 @@ set (MAC_NR_SRC ${NR_GNB_MAC_DIR}/gNB_scheduler_phytest.c ${NR_GNB_MAC_DIR}/gNB_scheduler_uci.c ${NR_GNB_MAC_DIR}/gNB_scheduler_RA.c + ${NR_GNB_MAC_DIR}/gNB_scheduler_SRS.c ) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 32bbae1f5f..d59ddf9d82 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -346,7 +346,7 @@ typedef struct { uint8_t time_start_position; // Starting position in the time domain l_0 [3GPP TS 38.211, Sec 6.4.1.4.1], Note: the MAC undertakes the translation from startPosition to l_0, Value: 0 --> 13 uint8_t config_index; // SRS bandwidth config index C_SRS [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 63 uint16_t sequence_id; // SRS sequence ID n_SRS_ID [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 --> 1023 - uint8_t bandwidth_index; // SRS bandwidth index B_SRS [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 3 + uint8_t bandwidth_index; // SRS bandwidth index B_SRS [3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 3 uint8_t comb_size; // Transmission comb size K_TC [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 = comb size 2, 1 = comb size 4, 2 = comb size 8 (Rel16) uint8_t comb_offset; // Transmission comb offset K'_TC[3GPP TS 38.211, Sec 6.4.1.4.3], Value: 0 --> 1 (combSize = 0), Value: 0 --> 3 (combSize = 1), Value: 0 --> 7 (combSize = 2) uint8_t cyclic_chift; // Cyclic shift n_CS_SRS [3GPP TS 38.211, Sec 6.4.1.4.2], Value: 0 --> 7 (combSize = 0), Value: 0 --> 11 (combSize = 1), Value: 0 --> 5 (combSize = 2) @@ -367,7 +367,7 @@ typedef struct { fapi_nr_ul_config_prach_pdu prach_config_pdu; fapi_nr_ul_config_pucch_pdu pucch_config_pdu; nfapi_nr_ue_pusch_pdu_t pusch_config_pdu; - fapi_nr_ul_config_srs_pdu srs_config_pdu; + fapi_nr_ul_config_srs_pdu srs_config_pdu; }; } fapi_nr_ul_config_request_pdu_t; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index b62f8e0282..90664770fa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -397,6 +397,8 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_schedule_pucch(module_idP, frame, slot); + nr_schedule_srs(module_idP, frame, slot); + stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_SRS.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_SRS.c new file mode 100644 index 0000000000..f1123e582b --- /dev/null +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_SRS.c @@ -0,0 +1,93 @@ +/* + * 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 gNB_scheduler_SRS.c + * \brief primitives used for sounding reference signal + * \date 2021 + */ + +#include "platform_types.h" + +/* MAC */ +#include "nr_mac_gNB.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" + +/* Utils */ +#include "common/utils/LOG/vcd_signal_dumper.h" + +void nr_schedule_srs_aperiodic(module_id_t module_idP, + frame_t frameP, + sub_frame_t slotP, + NR_SRS_ResourceSet_t *srs_resource_set) { + LOG_W(NR_PHY, "Aperiodic SRS scheduling is not implemented yet!\n"); +} + +void nr_schedule_srs_semi_persistent(module_id_t module_idP, + frame_t frameP, + sub_frame_t slotP, + NR_SRS_ResourceSet_t *srs_resource_set) { + LOG_W(NR_PHY, "Semi-persistent SRS scheduling is not implemented yet!\n"); +} + +void nr_schedule_srs_periodic(module_id_t module_idP, + frame_t frameP, + sub_frame_t slotP, + NR_SRS_ResourceSet_t *srs_resource_set) { + LOG_W(NR_PHY, "Periodic SRS scheduling is not implemented yet!\n"); +} + +void nr_schedule_srs(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { + + gNB_MAC_INST *mac = RC.nrmac[module_idP]; + + for (int UE_id = 0; UE_id < MAX_MOBILES_PER_GNB; UE_id++) { + NR_CellGroupConfig_t *cg = mac->UE_info.CellGroup[UE_id]; + NR_BWP_UplinkDedicated_t *ubwpd = NULL; + if (cg && + cg->spCellConfig && + cg->spCellConfig->spCellConfigDedicated && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig && + cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP) { + ubwpd = cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; + } else { + continue; + } + + NR_SRS_Config_t *srs_Config = ubwpd->srs_Config->choice.setup; + + for(int rs = 0; rs < srs_Config->srs_ResourceSetToAddModList->list.count; rs++) { + NR_SRS_ResourceSet_t *srs_resource_set = srs_Config->srs_ResourceSetToAddModList->list.array[rs]; + switch (srs_resource_set->resourceType.present) { + case NR_SRS_ResourceSet__resourceType_PR_aperiodic: + nr_schedule_srs_aperiodic(module_idP, frameP, slotP, srs_resource_set); + break; + case NR_SRS_ResourceSet__resourceType_PR_semi_persistent: + nr_schedule_srs_semi_persistent(module_idP, frameP, slotP, srs_resource_set); + break; + case NR_SRS_ResourceSet__resourceType_PR_periodic: + nr_schedule_srs_periodic(module_idP, frameP, slotP, srs_resource_set); + break; + default: + break; + } + } + } +} \ No newline at end of file diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3b275ca8a0..065b885a98 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -190,6 +190,8 @@ void nr_schedule_pucch(int Mod_idP, frame_t frameP, sub_frame_t slotP); +void nr_schedule_srs(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); + void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot,