From ddb538a30eae31d514afcf7de3495a963edea178 Mon Sep 17 00:00:00 2001 From: rmagueta Date: Thu, 15 Oct 2020 11:55:28 +0100 Subject: [PATCH] MIB NR: pdcch_ConfigSIB1 selection and fill using the configuration file, and using a dynamic method. --- .../gnb.band78.tm1.106PRB.usrpn300.conf | 12 + openair2/GNB_APP/RRC_nr_paramsvalues.h | 16 ++ openair2/GNB_APP/gnb_config.c | 15 +- openair2/GNB_APP/gnb_paramdef.h | 1 - openair2/LAYER2/MAC/mac_vars.h | 15 -- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 70 ++++++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 34 +++ openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h | 61 +++++ openair2/LAYER2/NR_MAC_UE/mac_defs.h | 14 -- openair2/LAYER2/NR_MAC_UE/mac_extern.h | 52 ----- openair2/LAYER2/NR_MAC_UE/mac_vars.c | 58 ----- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 4 + openair2/RRC/NR/L2_nr_interface.c | 219 ++++++++++-------- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 +- openair2/RRC/NR/nr_rrc_defs.h | 1 + 16 files changed, 341 insertions(+), 247 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index aa03e91fd0..7ba3a438d8 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -2,6 +2,11 @@ Active_gNBs = ( "gNB-Eurecom-5GNRBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; +#pdcch-ConfigSIB1 +#controlResourceSetZero = 10; +#searchSpaceZero = 0; + + gNBs = ( { @@ -23,6 +28,13 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 10; + searchSpaceZero = 0; + } + ); servingCellConfigCommon = ( { diff --git a/openair2/GNB_APP/RRC_nr_paramsvalues.h b/openair2/GNB_APP/RRC_nr_paramsvalues.h index 231aeb34f4..1f1d076e9d 100644 --- a/openair2/GNB_APP/RRC_nr_paramsvalues.h +++ b/openair2/GNB_APP/RRC_nr_paramsvalues.h @@ -39,6 +39,7 @@ /* cell configuration section name */ #define GNB_CONFIG_STRING_GNB_LIST "gNBs" +#define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1" #define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON "servingCellConfigCommon" #define GNB_CONFIG_STRING_PHYSCELLID "physCellId" #define GNB_CONFIG_STRING_NTIMINGADVANCEOFFSET "n_TimingAdvanceOffset" @@ -210,6 +211,21 @@ #define CARRIERBANDWIDTH_OKVALUES {11,18,24,25,31,32,38,51,52,65,66,78,79,93,106,107,121,132,133,135,160,162,189,216,217,245,264,270,273} +/*--------------------------------------------------------------------------------------------------------------------*/ +/* pdcch_ConfigSIB1 parameters */ +/*--------------------------------------------------------------------------------------------------------------------*/ +#define CONTROL_RESOURCE_SET_ZERO "controlResourceSetZero" +#define SEARCH_SPACE_ZERO "searchSpaceZero" + +#define PDCCH_CONFIGSIB1PARAMS_DESC(pdcch_ConfigSIB1) { \ +{CONTROL_RESOURCE_SET_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->controlResourceSetZero, defintval:0, TYPE_INT64, 0}, \ +{SEARCH_SPACE_ZERO, NULL, 0, i64ptr:&pdcch_ConfigSIB1->searchSpaceZero, defintval:0, TYPE_INT64, 0} \ +} + +#define CONTROL_RESOURCE_SET_ZERO_IDX 0 +#define SEARCH_SPACE_ZERO_IDX 1 +/*--------------------------------------------------------------------------------------------------------------------*/ + /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Serving Cell Config Common configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 8c8e78bbd0..962e3544e7 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -572,6 +572,17 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); } + // pdcch_ConfigSIB1 + rrc->carrier.pdcch_ConfigSIB1 = calloc(1,sizeof(NR_PDCCH_ConfigSIB1_t)); + paramdef_t pdcch_ConfigSIB1[] = PDCCH_CONFIGSIB1PARAMS_DESC(rrc->carrier.pdcch_ConfigSIB1); + paramlist_def_t pdcch_ConfigSIB1ParamList = {GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0}; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + config_getlist(&pdcch_ConfigSIB1ParamList, NULL, 0, aprefix); + if (pdcch_ConfigSIB1ParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, 0); + config_get(pdcch_ConfigSIB1,sizeof(pdcch_ConfigSIB1)/sizeof(paramdef_t),aprefix); + } + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); config_getlist(&SCCsParamList, NULL, 0, aprefix); @@ -968,13 +979,9 @@ void NRRCConfig(void) { paramdef_t GNBSParams[] = GNBSPARAMS_DESC; /* get global parameters, defined outside any section in the config file */ - LOG_I(GNB_APP, "Getting GNBSParams\n"); - config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - - // Get num MACRLC instances config_getlist( &MACRLCParamList,NULL,0, NULL); RC.nb_macrlc_inst = MACRLCParamList.numelt; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 84da1de530..7bfd71c88f 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -78,7 +78,6 @@ typedef enum { #define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none" #define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying" #define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info" - /* global parameters, not under a specific section */ #define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity" diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h index bf735d3df6..bd25bd6047 100644 --- a/openair2/LAYER2/MAC/mac_vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -35,21 +35,6 @@ #include "mac.h" #include "COMMON/mac_rrc_primitives.h" - -#define table_38213_13_1_num_indexes 15 -#define table_38213_13_2_num_indexes 14 -#define table_38213_13_3_num_indexes 9 -#define table_38213_13_4_num_indexes 16 -#define table_38213_13_5_num_indexes 9 -#define table_38213_13_6_num_indexes 10 -#define table_38213_13_7_num_indexes 12 -#define table_38213_13_8_num_indexes 8 -#define table_38213_13_9_num_indexes 4 -#define table_38213_13_10_num_indexes 8 -#define table_38213_13_11_num_indexes 16 -#define table_38213_13_12_num_indexes 14 - - const uint32_t BSR_TABLE[BSR_TABLE_SIZE] = { 0, 10, 12, 14, 17, 19, 22, 26, 31, 36, 42, 49, 57, 67, 78, 91, 105, 125, 146, 171, 200, 234, 274, 321, 376, 440, 515, 603, 706, 826, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 8fe83dd40d..645f59ad91 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -33,6 +33,8 @@ #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include +#define reserved 0xffff + const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz @@ -48,6 +50,73 @@ uint16_t NCS_restricted_TypeB_delta_f_RA_5[14] = {36,57,60,63,65,68,71,77,81,8 // Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3} uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69}; + +// specification mapping talbe, table_38$x_$y_$z_c$a +// - $x: specification +// - $y: subclause-major +// - $z: subclause-minor +// - $a: ($a)th of column in table, start from zero +const int32_t table_38213_13_1_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved +const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved + +const int32_t table_38213_13_2_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved +const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved + +const int32_t table_38213_13_3_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_4_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; +const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; +const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; + +const int32_t table_38213_13_5_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved +const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved + +const int32_t table_38213_13_6_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved +const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved + +const int32_t table_38213_13_7_c1[16] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved +const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default + +const int32_t table_38213_13_8_c1[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c2[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c3[16] = { 2, 2, 1, 2, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved +const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default + +const int32_t table_38213_13_9_c1[16] = {1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved +const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved + +const int32_t table_38213_13_10_c1[16] = {1, 1, 1, 1, 2, 2, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved +const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default + +const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O +const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; +const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M +const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default + +const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved +const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved +const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved + +const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; + const char *prachfmt[]={"A1","A2","A3","B1","B2","B3","B4","C0","C2"}; const char *prachfmt03[]={"0","1","2","3"}; @@ -2519,3 +2588,4 @@ int binomial(int n, int k) { return c; } + diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index f19a46cb34..84457f077d 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -35,6 +35,20 @@ #include "NR_PDSCH-Config.h" #include "NR_CellGroupConfig.h" #include "nr_mac.h" +#include "openair1/PHY/impl_defs_nr.h" + +#define TABLE_38213_13_1_NUM_INDEXES 15 +#define TABLE_38213_13_2_NUM_INDEXES 14 +#define TABLE_38213_13_3_NUM_INDEXES 9 +#define TABLE_38213_13_4_NUM_INDEXES 16 +#define TABLE_38213_13_5_NUM_INDEXES 9 +#define TABLE_38213_13_6_NUM_INDEXES 10 +#define TABLE_38213_13_7_NUM_INDEXES 12 +#define TABLE_38213_13_8_NUM_INDEXES 8 +#define TABLE_38213_13_9_NUM_INDEXES 4 +#define TABLE_38213_13_10_NUM_INDEXES 8 +#define TABLE_38213_13_11_NUM_INDEXES 16 +#define TABLE_38213_13_12_NUM_INDEXES 14 typedef enum { NR_DL_DCI_FORMAT_1_0 = 0, @@ -64,6 +78,26 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; +typedef enum channel_bandwidth_e { + bw_5MHz = 0x1, + bw_10MHz = 0x2, + bw_20MHz = 0x4, + bw_40MHz = 0x8, + bw_80MHz = 0x16, + bw_100MHz = 0x32 +} channel_bandwidth_t; + +typedef enum frequency_range_e { + FR1 = 0, + FR2 +} frequency_range_t; + +typedef enum nr_ssb_and_cset_mux_pattern_type_e { + NR_SSB_AND_CSET_MUX_PATTERN_TYPE1=1, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE2, + NR_SSB_AND_CSET_MUX_PATTERN_TYPE3 +} nr_ssb_and_cset_mux_pattern_type_t; + uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 5c714e4a93..50918b2e76 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -75,5 +75,66 @@ extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; #endif*/ +// Type0-PDCCH search space +extern const int32_t table_38213_13_1_c1[16]; +extern const int32_t table_38213_13_1_c2[16]; +extern const int32_t table_38213_13_1_c3[16]; +extern const int32_t table_38213_13_1_c4[16]; + +extern const int32_t table_38213_13_2_c1[16]; +extern const int32_t table_38213_13_2_c2[16]; +extern const int32_t table_38213_13_2_c3[16]; +extern const int32_t table_38213_13_2_c4[16]; + +extern const int32_t table_38213_13_3_c1[16]; +extern const int32_t table_38213_13_3_c2[16]; +extern const int32_t table_38213_13_3_c3[16]; +extern const int32_t table_38213_13_3_c4[16]; + +extern const int32_t table_38213_13_4_c1[16]; +extern const int32_t table_38213_13_4_c2[16]; +extern const int32_t table_38213_13_4_c3[16]; +extern const int32_t table_38213_13_4_c4[16]; + +extern const int32_t table_38213_13_5_c1[16]; +extern const int32_t table_38213_13_5_c2[16]; +extern const int32_t table_38213_13_5_c3[16]; +extern const int32_t table_38213_13_5_c4[16]; + +extern const int32_t table_38213_13_6_c1[16]; +extern const int32_t table_38213_13_6_c2[16]; +extern const int32_t table_38213_13_6_c3[16]; +extern const int32_t table_38213_13_6_c4[16]; + +extern const int32_t table_38213_13_7_c1[16]; +extern const int32_t table_38213_13_7_c2[16]; +extern const int32_t table_38213_13_7_c3[16]; +extern const int32_t table_38213_13_7_c4[16]; + +extern const int32_t table_38213_13_8_c1[16]; +extern const int32_t table_38213_13_8_c2[16]; +extern const int32_t table_38213_13_8_c3[16]; +extern const int32_t table_38213_13_8_c4[16]; + +extern const int32_t table_38213_13_9_c1[16]; +extern const int32_t table_38213_13_9_c2[16]; +extern const int32_t table_38213_13_9_c3[16]; +extern const int32_t table_38213_13_9_c4[16]; + +extern const int32_t table_38213_13_10_c1[16]; +extern const int32_t table_38213_13_10_c2[16]; +extern const int32_t table_38213_13_10_c3[16]; +extern const int32_t table_38213_13_10_c4[16]; + +extern const float table_38213_13_11_c1[16]; +extern const int32_t table_38213_13_11_c2[16]; +extern const float table_38213_13_11_c3[16]; +extern const int32_t table_38213_13_11_c4[16]; + +extern const float table_38213_13_12_c1[16]; +extern const int32_t table_38213_13_12_c2[16]; +extern const float table_38213_13_12_c3[16]; + +extern const int32_t table_38213_10_1_1_c2[5]; #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 97c99b6050..2666354652 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -278,20 +278,6 @@ typedef enum subcarrier_spacing_e { scs_240kHz = 0x16 } subcarrier_spacing_t; -typedef enum channel_bandwidth_e { - bw_5MHz = 0x1, - bw_10MHz = 0x2, - bw_20MHz = 0x4, - bw_40MHz = 0x8, - bw_80MHz = 0x16, - bw_100MHz = 0x32 -} channel_bandwidth_t; - -typedef enum frequency_range_e { - FR1 = 0, - FR2 -} frequency_range_t; - typedef struct { uint8_t identifier_dci_formats ; // 0 IDENTIFIER_DCI_FORMATS: uint8_t carrier_ind ; // 1 CARRIER_IND: 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213] diff --git a/openair2/LAYER2/NR_MAC_UE/mac_extern.h b/openair2/LAYER2/NR_MAC_UE/mac_extern.h index 54cdc4d149..79d671b8fb 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_extern.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_extern.h @@ -34,58 +34,6 @@ //extern NR_UE_MAC_INST_t *UE_mac_inst; -// Type0-PDCCH search space -extern const int32_t table_38213_13_1_c2[16]; -extern const int32_t table_38213_13_1_c3[16]; -extern const int32_t table_38213_13_1_c4[16]; - -extern const int32_t table_38213_13_2_c2[16]; -extern const int32_t table_38213_13_2_c3[16]; -extern const int32_t table_38213_13_2_c4[16]; - -extern const int32_t table_38213_13_3_c2[16]; -extern const int32_t table_38213_13_3_c3[16]; -extern const int32_t table_38213_13_3_c4[16]; - -extern const int32_t table_38213_13_4_c2[16]; -extern const int32_t table_38213_13_4_c3[16]; -extern const int32_t table_38213_13_4_c4[16]; - -extern const int32_t table_38213_13_5_c2[16]; -extern const int32_t table_38213_13_5_c3[16]; -extern const int32_t table_38213_13_5_c4[16]; - -extern const int32_t table_38213_13_6_c2[16]; -extern const int32_t table_38213_13_6_c3[16]; -extern const int32_t table_38213_13_6_c4[16]; - -extern const int32_t table_38213_13_7_c2[16]; -extern const int32_t table_38213_13_7_c3[16]; -extern const int32_t table_38213_13_7_c4[16]; - -extern const int32_t table_38213_13_8_c2[16]; -extern const int32_t table_38213_13_8_c3[16]; -extern const int32_t table_38213_13_8_c4[16]; - -extern const int32_t table_38213_13_9_c2[16]; -extern const int32_t table_38213_13_9_c3[16]; -extern const int32_t table_38213_13_9_c4[16]; - -extern const int32_t table_38213_13_10_c2[16]; -extern const int32_t table_38213_13_10_c3[16]; -extern const int32_t table_38213_13_10_c4[16]; - -extern const float table_38213_13_11_c1[16]; -extern const int32_t table_38213_13_11_c2[16]; -extern const float table_38213_13_11_c3[16]; -extern const int32_t table_38213_13_11_c4[16]; - -extern const float table_38213_13_12_c1[16]; -extern const int32_t table_38213_13_12_c2[16]; -extern const float table_38213_13_12_c3[16]; - -extern const int32_t table_38213_10_1_1_c2[5]; - // DCI extraction // for PUSCH from TS 38.214 subclause 6.1.2.1.1 extern uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_vars.c b/openair2/LAYER2/NR_MAC_UE/mac_vars.c index 95dea61a45..4986ab5883 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_vars.c +++ b/openair2/LAYER2/NR_MAC_UE/mac_vars.c @@ -32,64 +32,6 @@ #include "mac_defs.h" -#define reserved 0xffff - -// specification mapping talbe, table_38$x_$y_$z_c$a -// - $x: specification -// - $y: subclause-major -// - $z: subclause-minor -// - $a: ($a)th of column in table, start from zero -const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved -const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved - -const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved -const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved - -const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48}; -const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2}; -const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16}; - -const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved -const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved - -const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved -const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved - -const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved -const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default - -const int32_t table_38213_13_8_c2[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c3[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved -const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default - -const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved -const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved - -const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved -const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default - -const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5}; // O -const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1}; -const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1}; // M -const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default - -const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // O, index 14-15 reserved -const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved -const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // M, index 14-15 reserved - -const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; - /* #define mu_pusch 1 // definition table j Table 6.1.2.1.1-4 diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index e237a910c6..85f3ebe137 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -49,6 +49,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC_UE/mac_extern.h" +#include "NR_MAC_COMMON/nr_mac_extern.h" #include "common/utils/nr/nr_common.h" /* PHY */ @@ -311,18 +312,19 @@ int8_t nr_ue_decode_mib(module_id_t module_id, } } -#ifdef DEBUG_MIB +//#ifdef DEBUG_MIB LOG_I(MAC,"system frame number(6 MSB bits): %d\n", mac->mib->systemFrameNumber.buf[0]); LOG_I(MAC,"system frame number(with LSB): %d\n", (int)frame); LOG_I(MAC,"subcarrier spacing (0=15or60, 1=30or120): %d\n", (int)mac->mib->subCarrierSpacingCommon); LOG_I(MAC,"ssb carrier offset(with MSB): %d\n", (int)ssb_subcarrier_offset); LOG_I(MAC,"dmrs type A position (0=pos2,1=pos3): %d\n", (int)mac->mib->dmrs_TypeA_Position); - LOG_I(MAC,"pdcch config sib1: %d\n", (int)mac->mib->pdcch_ConfigSIB1); + LOG_I(MAC,"pdcch config sib1.controlResourceSetZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.controlResourceSetZero); + LOG_I(MAC,"pdcch config sib1.searchSpaceZero: %d\n", (int)mac->mib->pdcch_ConfigSIB1.searchSpaceZero); LOG_I(MAC,"cell barred (0=barred,1=notBarred): %d\n", (int)mac->mib->cellBarred); LOG_I(MAC,"intra frequency reselection (0=allowed,1=notAllowed): %d\n", (int)mac->mib->intraFreqReselection); - LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); + //LOG_I(MAC,"half frame bit(extra bits): %d\n", (int)half_frame_bit); LOG_I(MAC,"ssb index(extra bits): %d\n", (int)ssb_index); -#endif +//#endif subcarrier_spacing_t scs_ssb = scs_30kHz; // default for //const uint32_t scs_index = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 989d6fb952..e5734fb66f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -146,4 +146,8 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ } } +void schedule_nr_sib1(){ + +} + diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index babbd1f596..21709471f5 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -28,12 +28,14 @@ * \email: raymond.knopp@eurecom.fr, kroempa@gmail.com */ + #include "platform_types.h" #include "nr_rrc_defs.h" #include "common/utils/LOG/log.h" #include "pdcp.h" #include "common/ran_context.h" -#include "openair2/LAYER2/MAC/mac_vars.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" #include "intertask_interface.h" @@ -42,6 +44,104 @@ extern RAN_CONTEXT_t RC; + +int generate_pdcch_ConfigSIB1(NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1, + long ssbSubcarrierSpacing, + long subCarrierSpacingCommon, + channel_bandwidth_t min_channel_bw) { + + nr_ssb_and_cset_mux_pattern_type_t mux_pattern; + + switch (ssbSubcarrierSpacing) { + + case NR_SubcarrierSpacing_kHz15: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_1_NUM_INDEXES; + mux_pattern = table_38213_13_1_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_2_NUM_INDEXES; + mux_pattern = table_38213_13_2_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz30: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_3_NUM_INDEXES; + mux_pattern = table_38213_13_3_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_5_NUM_INDEXES; + mux_pattern = table_38213_13_5_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { + + if ( (min_channel_bw == bw_5MHz) || (min_channel_bw == bw_10MHz) ) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_4_NUM_INDEXES; + mux_pattern = table_38213_13_4_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (min_channel_bw == bw_40MHz) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_6_NUM_INDEXES; + mux_pattern = table_38213_13_6_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid min_bandwidth\n"); + } + + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz120: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_7_NUM_INDEXES; + mux_pattern = table_38213_13_7_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_8_NUM_INDEXES; + mux_pattern = table_38213_13_8_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + case NR_SubcarrierSpacing_kHz240: + if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_9_NUM_INDEXES; + mux_pattern = table_38213_13_9_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else if (subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { + pdcch_ConfigSIB1->controlResourceSetZero = rand() % TABLE_38213_13_10_NUM_INDEXES; + mux_pattern = table_38213_13_10_c1[pdcch_ConfigSIB1->controlResourceSetZero]; + } else { + AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); + } + break; + + default: + AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); + break; + } + + + frequency_range_t frequency_range = FR1; + if(ssbSubcarrierSpacing>=60) { + frequency_range = FR2; + } + + pdcch_ConfigSIB1->searchSpaceZero = 0; + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR1){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_11_NUM_INDEXES; + } + if(mux_pattern == NR_SSB_AND_CSET_MUX_PATTERN_TYPE1 && frequency_range == FR2){ + pdcch_ConfigSIB1->searchSpaceZero = rand() % TABLE_38213_13_12_NUM_INDEXES; + } + + return 0; +} + int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, @@ -53,110 +153,35 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, uint8_t Sdu_size = 0; uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); + #ifdef DEBUG_RRC - LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); + LOG_D(RRC, "[eNB %d] mac_rrc_data_req to SRB ID=%ld\n", Mod_idP, Srb_id); #endif - gNB_RRC_INST *rrc; - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO * srb_info; - char payload_size, *payload_pP; + gNB_RRC_INST *rrc; + rrc_gNB_carrier_data_t *carrier; + NR_BCCH_BCH_Message_t *mib; + NR_SRB_INFO *srb_info; + char payload_size, *payload_pP; - rrc = RC.nrrrc[Mod_idP]; - carrier = &rrc->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; + rrc = RC.nrrrc[Mod_idP]; + carrier = &rrc->carrier; + mib = &carrier->mib; + srb_info = &carrier->Srb0; /* MIBCH */ if ((Srb_id & RAB_OFFSET) == MIBCH) { - - /// controlResourceSetZero - - switch (*carrier->servingcellconfigcommon->ssbSubcarrierSpacing) { - - case NR_SubcarrierSpacing_kHz15: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_1_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_2_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz30: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz15) { - - // TODO get min_bw 38.101-1 table 5.3.5-1 - //if ( (min_bw == 5) || (min_bw == 10) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_3_num_indexes; - //} else if (min_bw == 40) { - // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_5_num_indexes; - //} - - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz30) { - - // TODO get min_bw 38.101-1 table 5.3.5-1 - //if ( (min_bw == 5) || (min_bw == 10) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_4_num_indexes; - //} else if (min_bw == 40) { - // mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_6_num_indexes; - //} - - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz120: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_7_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_8_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - case NR_SubcarrierSpacing_kHz240: - if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz60) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_9_num_indexes; - } else if (mib->message.choice.mib->subCarrierSpacingCommon == NR_SubcarrierSpacing_kHz120) { - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rand() % table_38213_13_10_num_indexes; - } else { - AssertFatal(true,"Invalid subCarrierSpacingCommon\n"); - } - break; - - default: - AssertFatal(true,"Invalid ssbSubcarrierSpacing\n"); - break; - } - - - /// TODO: searchSpaceZero - - //if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR1){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_11_num_indexes; - /*} - if(mac->type0_pdcch_ss_mux_pattern == 1 && frequency_range == FR2){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_12_num_indexes; - } - if(mac->type0_pdcch_ss_mux_pattern == 2) { - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_13_num_indexes; - } else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rand() % table_38213_13_14_num_indexes; - } - }*/ - - - //NR_UE_MAC_INST_t *mac = get_mac_inst(Mod_idP); - //gNB_mac = RC.nrmac[0]; - //mac->type0_pdcch_ss_mux_pattern - + // Currently we are getting the pdcch_ConfigSIB1 from the configuration file. + // 3GPP is not clear about the static/semi-static/dynamic behaviour of the pdcch_ConfigSIB1 value + // on the gNB side. + // Uncomment this function for a dynamic pdcch_ConfigSIB1. + // TODO: Update this static value + //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 + //generate_pdcch_ConfigSIB1( &mib->message.choice.mib->pdcch_ConfigSIB1, + // *carrier->servingcellconfigcommon->ssbSubcarrierSpacing, + // mib->message.choice.mib->subCarrierSpacingCommon, + // min_channel_bw); mib->message.choice.mib->systemFrameNumber.buf[0] = sfn_msb << 2; enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index c00b57d7aa..f746be6cfe 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -200,8 +200,10 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { mib->message.choice.mib->spare.bits_unused = 7; // This makes a spare of 1 bits mib->message.choice.mib->ssb_SubcarrierOffset = (carrier->ssb_SubcarrierOffset)&15; - mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero; - mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero; + mib->message.choice.mib->pdcch_ConfigSIB1.controlResourceSetZero = rrc->carrier.pdcch_ConfigSIB1->controlResourceSetZero; + mib->message.choice.mib->pdcch_ConfigSIB1.searchSpaceZero = rrc->carrier.pdcch_ConfigSIB1->searchSpaceZero; + + AssertFatal(scc->ssbSubcarrierSpacing != NULL, "scc->ssbSubcarrierSpacing is null\n"); switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 9a53a5bbe0..ec608f1a29 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -383,6 +383,7 @@ typedef struct { int pucch_TargetSNRx10; NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; + NR_PDCCH_ConfigSIB1_t *pdcch_ConfigSIB1; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; NR_SRB_INFO SI; NR_SRB_INFO Srb0;