From aeda8e5cecb30c96ab15eacb84332b926bf65485 Mon Sep 17 00:00:00 2001
From: "mohamed.said" <mohamed.said.fci@gmail.com>
Date: Tue, 15 Aug 2017 15:49:11 +0200
Subject: [PATCH] added pcch_config_v1310 to config file and handled in
 enb_config.c , asn1_msg.c

---
 openair2/COMMON/rrc_messages_types.h          |  8 ++-
 openair2/ENB_APP/enb_config.c                 | 55 ++++++++++++++++++-
 openair2/RRC/LITE/MESSAGES/asn1_msg.c         | 33 ++++++++++-
 .../CONF/enb.band13.tm1.50PRB.emtc.conf       | 17 +++---
 4 files changed, 98 insertions(+), 15 deletions(-)

diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index 6492a0c4d24..9ef9414f91c 100755
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -250,7 +250,7 @@ typedef struct RrcConfigurationReq_s {
   long prach_HoppingConfig_r13                   [MAX_NUM_CCs][4];
   int  prach_parameters_list_size                [MAX_NUM_CCs];
   long max_available_narrow_band                 [MAX_NUM_CCs][4][2];
-  int  max_available_narrow_band_size            [MAX_NUM_CCs];
+  int  max_available_narrow_band_size            [MAX_NUM_CCs][4];
 //    end kogo
 
 
@@ -259,6 +259,12 @@ typedef struct RrcConfigurationReq_s {
     int  pucch_info_value_size  [MAX_NUM_CCs];
 //  end kogo
 
+    // +kogo
+    bool  pcch_config_v1310               [MAX_NUM_CCs];
+    long  paging_narrowbands_r13          [MAX_NUM_CCs];
+    long  mpdcch_numrepetition_paging_r13 [MAX_NUM_CCs];
+    long  *nb_v1310                        [MAX_NUM_CCs];
+
 #endif
 } RrcConfigurationReq;
 
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index dc925da8eb7..65325755272 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -160,6 +160,12 @@ EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
 #define ENB_CONFIG_STRING_MAX_AVAILABLE_NARROWBAND              "maxavailablenarrowband"
 #define ENB_CONFIG_STRING_PUCCH_INFO_VALUE                      "pucch_info_value"
 
+#define ENB_CONFIG_STRING_PCCH_CONFIG_V1310                      "pcch_config_v1310"
+#define ENB_CONFIG_STRING_PAGING_NARROWBANDS_R13                 "paging_narrowbands_r13"
+#define ENB_CONFIG_STRING_MPDCCH_NUMREPETITION_PAGING_R13        "mpdcch_numrepetition_paging_r13"
+#define ENB_CONFIG_STRING_NB_V1310                               "nb_v1310"
+
+
 
 #define ENB_CONFIG_STRING_PDSCH_RS_EPRE                                 "pdsch_referenceSignalPower"
 #define ENB_CONFIG_STRING_PDSCH_PB                                      "pdsch_p_b"
@@ -1007,6 +1013,8 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   config_setting_t *n1_pucch_AN_info_r13_list      = NULL;
   config_setting_t *n1_pucch_AN_info_r13           = NULL;
 
+  config_setting_t *setting_pcch_config_v1310      = NULL;
+
 #if	defined(Rel14)
   config_setting_t *setting_br13 = NULL;
 #endif // REL14
@@ -1134,6 +1142,11 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
   libconfig_int     maxavailablenarrowband                = 0;
   libconfig_int     pucch_info_value                      = 0;
 
+  libconfig_int     paging_narrowbands_r13               = 0;
+  libconfig_int     mpdcch_numrepetition_paging_r13       = 0;
+  libconfig_int     nb_v1310                              = 0;
+
+
   libconfig_int     srb1_timer_poll_retransmit    = 0;
   libconfig_int     srb1_timer_reordering         = 0;
   libconfig_int     srb1_timer_status_prohibit    = 0;
@@ -2692,11 +2705,18 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
                     RRC_CONFIGURATION_REQ (msg_p).maxNumPreambleAttemptCE_r13[j][prach_parameters_index] = NULL;
                   }
 
-                }
 
+                  max_available_narrow_band_list = config_setting_get_member(prach_parameters_ce_r13_list, ENB_CONFIG_STRING_MAX_AVAILABLE_NARROW_BAND);
+                  int num_available_narrow_bands = config_setting_length(max_available_narrow_band_list);
+                  RRC_CONFIGURATION_REQ (msg_p).maxNumPreambleAttemptCE_r13[j][prach_parameters_index] = num_available_narrow_bands;
+                  int narrow_band_index;
+                  for (narrow_band_index = 0; narrow_band_index < num_available_narrow_bands; narrow_band_index++)
+                  {
+                      max_available_narrow_band = config_setting_get_elem(max_available_narrow_band_list, narrow_band_index);
+                      RRC_CONFIGURATION_REQ (msg_p).max_available_narrow_band[j][prach_parameters_index][narrow_band_index] = config_setting_get_int(max_available_narrow_band);
+                  }
 
-                // TODO
-                //              max_available_narrow_band = config_setting_get_member(prach_parameters_ce_r13, ENB_CONFIG_STRING_MAX_AVAILABLE_NARROW_BAND);
+                }
 
 
                 n1_pucch_AN_info_r13_list = config_setting_get_member(setting_br13, ENB_CONFIG_STRING_N1_PUCCH_AN_INFO_LIST);
@@ -3725,6 +3745,35 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
                 char* prach_ConfigCommon_v1310 = NULL;
                 char* mpdcch_startSF_CSS_RA_r13;
 
+                setting_pcch_config_v1310 = config_setting_get_member(setting_br13, ENB_CONFIG_STRING_PCCH_CONFIG_V1310);
+                if (setting_pcch_config_v1310 != NULL)
+                {
+                    RRC_CONFIGURATION_REQ(msg_p).pcch_config_v1310[j] = TRUE;
+                    if (!config_setting_lookup_int(setting_pcch_config_v1310, ENB_CONFIG_STRING_PAGING_NARROWBANDS_R13, &paging_narrowbands_r13)
+                            || !config_setting_lookup_int(setting_pcch_config_v1310, ENB_CONFIG_STRING_MPDCCH_NUMREPETITION_PAGING_R13, &mpdcch_numrepetition_paging_r13)
+                            )
+                        AssertFatal(0,
+                            "Failed to parse eNB configuration file %s, enb %d pcch_config_v1310!\n",
+                            RC.config_file_name, i);
+
+                    RRC_CONFIGURATION_REQ(msg_p).paging_narrowbands_r13[j] = paging_narrowbands_r13;
+                    RRC_CONFIGURATION_REQ(msg_p).mpdcch_numrepetition_paging_r13[j] = mpdcch_numrepetition_paging_r13;
+
+                    if (config_setting_lookup_int(setting_pcch_config_v1310, ENB_CONFIG_STRING_MPDCCH_NUMREPETITION_PAGING_R13, &nb_v1310))
+                    {
+                        RRC_CONFIGURATION_REQ(msg_p).nb_v1310[j]  = CALLOC(1, sizeof(long));
+                        *RRC_CONFIGURATION_REQ(msg_p).nb_v1310[j] = nb_v1310;
+                    }
+                    else
+                    {
+                        RRC_CONFIGURATION_REQ(msg_p).nb_v1310[j] = NULL;
+                    }
+
+                }
+                else
+                {
+                    RRC_CONFIGURATION_REQ(msg_p).pcch_config_v1310[j] = FALSE;
+                }
 
                 if (!config_setting_lookup_int(setting_br13, ENB_CONFIG_STRING_schedulingInfoSIB1, &schedulingInfoSIB1_BR_r13))
                   AssertFatal(0,
diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
index e34e6f71620..429fe863bde 100755
--- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c
@@ -1178,7 +1178,28 @@ uint8_t do_SIB23(uint8_t Mod_id,
   (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310 = calloc(1, sizeof(BCCH_Config_v1310_t));
   memset((*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310, 0, sizeof(BCCH_Config_v1310_t));
   (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310->modificationPeriodCoeff_v1310 = BCCH_Config_v1310__modificationPeriodCoeff_v1310_n64;
-  (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = NULL;
+
+  if (configuration->pcch_config_v1310)
+  {
+      (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = CALLOC(1, sizeof(PCCH_Config_v1310_t));
+      (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->paging_narrowBands_r13 = configuration->paging_narrowbands_r13[CC_id];
+      (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->mpdcch_NumRepetition_Paging_r13 = configuration->mpdcch_numrepetition_paging_r13[CC_id];
+      if (configuration->nb_v1310[CC_id])
+      {
+          (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = CALLOC(1, sizeof(long));
+          *(*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = *configuration->nb_v1310[CC_id];
+      }
+      else
+      {
+          (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->nB_v1310 = NULL;
+      }
+  }
+  else
+  {
+      (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = NULL;
+  }
+
+
   (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13 = NULL;
   (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310 = NULL;
   (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310 = NULL;
@@ -1281,8 +1302,14 @@ uint8_t do_SIB23(uint8_t Mod_id,
               prach_parametersce_r13->prach_HoppingConfig_r13 = PRACH_ParametersCE_r13__prach_HoppingConfig_r13_off;
           }
 
-          long maxavailablenarrowband = 2;
-          ASN_SEQUENCE_ADD(&prach_parametersce_r13->mpdcch_NarrowbandsToMonitor_r13.list, &maxavailablenarrowband);
+          long maxavailablenarrowband;
+          int num_narrow_bands = configuration->max_available_narrow_band_size[CC_id][prach_parameters_index];
+          int narrow_band_index;
+          for (narrow_band_index = 0; narrow_band_index < num_narrow_bands; narrow_band_index++)
+          {
+              maxavailablenarrowband = configuration->max_available_narrow_band[CC_id][prach_parameters_index][narrow_band_index];
+              ASN_SEQUENCE_ADD(&prach_parametersce_r13->mpdcch_NarrowbandsToMonitor_r13.list, &maxavailablenarrowband);
+          }
 
           prach_parametersce_r13->mpdcch_NumRepetition_RA_r13 = PRACH_ParametersCE_r13__mpdcch_NumRepetition_RA_r13_r1;
           prach_parametersce_r13->prach_HoppingConfig_r13 = PRACH_ParametersCE_r13__prach_HoppingConfig_r13_off;
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
index dbae933a5f4..6ad1f12c59a 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band13.tm1.50PRB.emtc.conf
@@ -184,14 +184,8 @@ eNBs =
                   numRepetitionPerPreambleAttempt_r13       = 0;
                   mpdcch_NumRepetition_RA_r13               = 0;
                   prach_HoppingConfig_r13                   = 0;
-                  max_available_narrow_band = 
-                  (
-                      {
-                          maxavailablenarrowband = 2;
-
-                      }
-                  );
-              }
+                  max_available_narrow_band                 = [2]; 
+             }
           );
 
           n1PUCCH_AN_InfoList_r13 = 
@@ -203,6 +197,13 @@ eNBs =
                   pucch_info_value = 13;
               }
           );
+          
+          pcch_config_v1310 :
+          {
+              paging_narrowbands_r13          = 1;
+              mpdcch_numrepetition_paging_r13 = 2;
+              nb_v1310                        = 3;
+          }
 
           mpdcch_startSF_CSS_RA_r13                 = "fdd-r13"
           mpdcch_startSF_CSS_RA_r13_val             = 5;
-- 
GitLab