diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b2c0a931ab..56373a3b73 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -646,7 +646,14 @@ int main(int argc, char **argv) .force_256qam_off = false, .timer_config.sr_ProhibitTimer = 0, .timer_config.sr_TransMax = 64, - .timer_config.sr_ProhibitTimer_v1700 = 0}; + .timer_config.sr_ProhibitTimer_v1700 = 0, + .timer_config.t300 = 400, + .timer_config.t301 = 400, + .timer_config.t310 = 2000, + .timer_config.n310 = 10, + .timer_config.t311 = 3000, + .timer_config.n311 = 1, + .timer_config.t319 = 400}; RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 1c8dc7b001..0efdc9be39 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -610,7 +610,14 @@ int main(int argc, char *argv[]) .force_256qam_off = false, .timer_config.sr_ProhibitTimer = 0, .timer_config.sr_TransMax = 64, - .timer_config.sr_ProhibitTimer_v1700 = 0}; + .timer_config.sr_ProhibitTimer_v1700 = 0, + .timer_config.t300 = 400, + .timer_config.t301 = 400, + .timer_config.t310 = 2000, + .timer_config.n310 = 10, + .timer_config.t311 = 3000, + .timer_config.n311 = 1, + .timer_config.t319 = 400}; RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 1c76805eac..9bded8b54c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1329,11 +1329,26 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) config.timer_config.sr_ProhibitTimer = *Timers_Params[GNB_TIMERS_SR_PROHIBIT_TIMER_IDX].iptr; config.timer_config.sr_TransMax = *Timers_Params[GNB_TIMERS_SR_TRANS_MAX_IDX].iptr; config.timer_config.sr_ProhibitTimer_v1700 = *Timers_Params[GNB_TIMERS_SR_PROHIBIT_TIMER_V1700_IDX].iptr; + config.timer_config.t300 = *Timers_Params[GNB_TIMERS_T300_IDX].iptr; + config.timer_config.t301 = *Timers_Params[GNB_TIMERS_T301_IDX].iptr; + config.timer_config.t310 = *Timers_Params[GNB_TIMERS_T310_IDX].iptr; + config.timer_config.n310 = *Timers_Params[GNB_TIMERS_N310_IDX].iptr; + config.timer_config.t311 = *Timers_Params[GNB_TIMERS_T311_IDX].iptr; + config.timer_config.n311 = *Timers_Params[GNB_TIMERS_N311_IDX].iptr; + config.timer_config.t319 = *Timers_Params[GNB_TIMERS_T319_IDX].iptr; LOG_I(GNB_APP, - "sr_ProhibitTimer %d, sr_TransMax %d, sr_ProhibitTimer_v1700 %d\n", + "sr_ProhibitTimer %d, sr_TransMax %d, sr_ProhibitTimer_v1700 %d, " + "t300 %d, t301 %d, t310 %d, n310 %d, t311 %d, n311 %d, t319 %d\n", config.timer_config.sr_ProhibitTimer, config.timer_config.sr_TransMax, - config.timer_config.sr_ProhibitTimer_v1700); + config.timer_config.sr_ProhibitTimer_v1700, + config.timer_config.t300, + config.timer_config.t301, + config.timer_config.t310, + config.timer_config.n310, + config.timer_config.t311, + config.timer_config.n311, + config.timer_config.t319); NR_ServingCellConfigCommon_t *scc = get_scc_config(cfg, config.minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 642c911e5c..7952bbae9c 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -332,6 +332,13 @@ typedef enum { #define GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER "sr_ProhibitTimer" #define GNB_CONFIG_STRING_TIMERS_SR_TRANS_MAX "sr_TransMax" #define GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER_V1700 "sr_ProhibitTimer_v1700" +#define GNB_CONFIG_STRING_TIMERS_T300 "t300" +#define GNB_CONFIG_STRING_TIMERS_T301 "t301" +#define GNB_CONFIG_STRING_TIMERS_T310 "t310" +#define GNB_CONFIG_STRING_TIMERS_N310 "n310" +#define GNB_CONFIG_STRING_TIMERS_T311 "t311" +#define GNB_CONFIG_STRING_TIMERS_N311 "n311" +#define GNB_CONFIG_STRING_TIMERS_T319 "t319" /*-------------------------------------------------------------------------------------------------------------------------------------*/ /* TIMERS configuration parameters */ @@ -341,11 +348,25 @@ typedef enum { {GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_TIMERS_SR_TRANS_MAX, NULL, 0, .iptr=NULL, .defintval=64, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_TIMERS_SR_PROHIBIT_TIMER_V1700, NULL, 0, .iptr=NULL, .defintval=0, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_T300, NULL, 0, .iptr=NULL, .defintval=400, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_T301, NULL, 0, .iptr=NULL, .defintval=400, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_T310, NULL, 0, .iptr=NULL, .defintval=2000, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_N310, NULL, 0, .iptr=NULL, .defintval=10, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_T311, NULL, 0, .iptr=NULL, .defintval=3000, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_N311, NULL, 0, .iptr=NULL, .defintval=1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_TIMERS_T319, NULL, 0, .iptr=NULL, .defintval=400, TYPE_INT, 0}, \ } #define GNB_TIMERS_SR_PROHIBIT_TIMER_IDX 0 #define GNB_TIMERS_SR_TRANS_MAX_IDX 1 #define GNB_TIMERS_SR_PROHIBIT_TIMER_V1700_IDX 2 +#define GNB_TIMERS_T300_IDX 3 +#define GNB_TIMERS_T301_IDX 4 +#define GNB_TIMERS_T310_IDX 5 +#define GNB_TIMERS_N310_IDX 6 +#define GNB_TIMERS_T311_IDX 7 +#define GNB_TIMERS_N311_IDX 8 +#define GNB_TIMERS_T319_IDX 9 /*---------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index e4fbfa6a4b..e165a717f7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -689,7 +689,7 @@ void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_ NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac); + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac, &nrmac->radio_config.timer_config); cc->sib1 = sib1; cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 01dcfc4e40..cecc10e373 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -132,6 +132,13 @@ typedef struct nr_mac_timers { int sr_ProhibitTimer; int sr_TransMax; int sr_ProhibitTimer_v1700; + int t300; + int t301; + int t310; + int n310; + int t311; + int n311; + int t319; } nr_mac_timers_t; typedef struct nr_mac_config_t { diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 2295440973..69d7d39a7a 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1970,7 +1970,175 @@ void free_MeasurementTimingConfiguration(NR_MeasurementTimingConfiguration_t *mt ASN_STRUCT_FREE(asn_DEF_NR_MeasurementTimingConfiguration, mtc); } -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) +static long get_NR_UE_TimersAndConstants_t300(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->t300) { + case 100: + return NR_UE_TimersAndConstants__t300_ms100; + case 200: + return NR_UE_TimersAndConstants__t300_ms200; + case 300: + return NR_UE_TimersAndConstants__t300_ms300; + case 400: + return NR_UE_TimersAndConstants__t300_ms400; + case 600: + return NR_UE_TimersAndConstants__t300_ms600; + case 1000: + return NR_UE_TimersAndConstants__t300_ms1000; + case 1500: + return NR_UE_TimersAndConstants__t300_ms1500; + case 2000: + return NR_UE_TimersAndConstants__t300_ms2000; + default: + AssertFatal(1 == 0, "Invalid value configured for t300!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_t301(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->t301) { + case 100: + return NR_UE_TimersAndConstants__t301_ms100; + case 200: + return NR_UE_TimersAndConstants__t301_ms200; + case 300: + return NR_UE_TimersAndConstants__t301_ms300; + case 400: + return NR_UE_TimersAndConstants__t301_ms400; + case 600: + return NR_UE_TimersAndConstants__t301_ms600; + case 1000: + return NR_UE_TimersAndConstants__t301_ms1000; + case 1500: + return NR_UE_TimersAndConstants__t301_ms1500; + case 2000: + return NR_UE_TimersAndConstants__t301_ms2000; + default: + AssertFatal(1 == 0, "Invalid value configured for t301!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_t310(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->t310) { + case 0: + return NR_UE_TimersAndConstants__t310_ms0; + case 50: + return NR_UE_TimersAndConstants__t310_ms50; + case 100: + return NR_UE_TimersAndConstants__t310_ms100; + case 200: + return NR_UE_TimersAndConstants__t310_ms200; + case 500: + return NR_UE_TimersAndConstants__t310_ms500; + case 1000: + return NR_UE_TimersAndConstants__t310_ms1000; + case 2000: + return NR_UE_TimersAndConstants__t310_ms2000; + default: + AssertFatal(1 == 0, "Invalid value configured for t310!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_n310(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->n310) { + case 1: + return NR_UE_TimersAndConstants__n310_n1; + case 2: + return NR_UE_TimersAndConstants__n310_n2; + case 3: + return NR_UE_TimersAndConstants__n310_n3; + case 4: + return NR_UE_TimersAndConstants__n310_n4; + case 6: + return NR_UE_TimersAndConstants__n310_n6; + case 8: + return NR_UE_TimersAndConstants__n310_n8; + case 10: + return NR_UE_TimersAndConstants__n310_n10; + case 20: + return NR_UE_TimersAndConstants__n310_n20; + default: + AssertFatal(1 == 0, "Invalid value configured for n310!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_t311(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->t311) { + case 1000: + return NR_UE_TimersAndConstants__t311_ms1000; + case 3000: + return NR_UE_TimersAndConstants__t311_ms3000; + case 5000: + return NR_UE_TimersAndConstants__t311_ms5000; + case 10000: + return NR_UE_TimersAndConstants__t311_ms10000; + case 15000: + return NR_UE_TimersAndConstants__t311_ms15000; + case 20000: + return NR_UE_TimersAndConstants__t311_ms20000; + case 30000: + return NR_UE_TimersAndConstants__t311_ms30000; + default: + AssertFatal(1 == 0, "Invalid value configured for t311!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_n311(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->n311) { + case 1: + return NR_UE_TimersAndConstants__n311_n1; + case 2: + return NR_UE_TimersAndConstants__n311_n2; + case 3: + return NR_UE_TimersAndConstants__n311_n3; + case 4: + return NR_UE_TimersAndConstants__n311_n4; + case 5: + return NR_UE_TimersAndConstants__n311_n5; + case 6: + return NR_UE_TimersAndConstants__n311_n6; + case 8: + return NR_UE_TimersAndConstants__n311_n8; + case 10: + return NR_UE_TimersAndConstants__n311_n10; + default: + AssertFatal(1 == 0, "Invalid value configured for n311!\n"); + } +} + +static long get_NR_UE_TimersAndConstants_t319(const nr_mac_timers_t *timer_config) +{ + switch (timer_config->t319) { + case 100: + return NR_UE_TimersAndConstants__t319_ms100; + case 200: + return NR_UE_TimersAndConstants__t319_ms200; + case 300: + return NR_UE_TimersAndConstants__t319_ms300; + case 400: + return NR_UE_TimersAndConstants__t319_ms400; + case 600: + return NR_UE_TimersAndConstants__t319_ms600; + case 1000: + return NR_UE_TimersAndConstants__t319_ms1000; + case 1500: + return NR_UE_TimersAndConstants__t319_ms1500; + case 2000: + return NR_UE_TimersAndConstants__t319_ms2000; + default: + AssertFatal(1 == 0, "Invalid value configured for t319!\n"); + } +} + +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, + const f1ap_plmn_t *plmn, + uint64_t cellID, + int tac, + const nr_mac_timers_t *timer_config) { AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %lu\n", cellID); @@ -2226,13 +2394,13 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, c // ue-TimersAndConstants sib1->ue_TimersAndConstants = CALLOC(1,sizeof(struct NR_UE_TimersAndConstants)); AssertFatal(sib1->ue_TimersAndConstants != NULL, "out of memory\n"); - sib1->ue_TimersAndConstants->t300 = NR_UE_TimersAndConstants__t300_ms400; - sib1->ue_TimersAndConstants->t301 = NR_UE_TimersAndConstants__t301_ms400; - sib1->ue_TimersAndConstants->t310 = NR_UE_TimersAndConstants__t310_ms2000; - sib1->ue_TimersAndConstants->n310 = NR_UE_TimersAndConstants__n310_n10; - sib1->ue_TimersAndConstants->t311 = NR_UE_TimersAndConstants__t311_ms3000; - sib1->ue_TimersAndConstants->n311 = NR_UE_TimersAndConstants__n311_n1; - sib1->ue_TimersAndConstants->t319 = NR_UE_TimersAndConstants__t319_ms400; + sib1->ue_TimersAndConstants->t300 = get_NR_UE_TimersAndConstants_t300(timer_config); + sib1->ue_TimersAndConstants->t301 = get_NR_UE_TimersAndConstants_t301(timer_config); + sib1->ue_TimersAndConstants->t310 = get_NR_UE_TimersAndConstants_t310(timer_config); + sib1->ue_TimersAndConstants->n310 = get_NR_UE_TimersAndConstants_n310(timer_config); + sib1->ue_TimersAndConstants->t311 = get_NR_UE_TimersAndConstants_t311(timer_config); + sib1->ue_TimersAndConstants->n311 = get_NR_UE_TimersAndConstants_n311(timer_config); + sib1->ue_TimersAndConstants->t319 = get_NR_UE_TimersAndConstants_t319(timer_config); // uac-BarringInfo /*sib1->uac_BarringInfo = CALLOC(1, sizeof(struct NR_SIB1__uac_BarringInfo)); diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index d469638fcf..d46363c707 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -38,6 +38,9 @@ struct nr_mac_config_t; typedef struct nr_mac_config_t nr_mac_config_t; +struct nr_mac_timers; +typedef struct nr_mac_timers nr_mac_timers_t; + void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList, frame_type_t frame_type, NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, @@ -63,7 +66,11 @@ int encode_MeasurementTimingConfiguration(const struct NR_MeasurementTimingConfi void free_MeasurementTimingConfiguration(struct NR_MeasurementTimingConfiguration *mtc); #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, + const f1ap_plmn_t *plmn, + uint64_t cellID, + int tac, + const nr_mac_timers_t *timer_config); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size);