enb_config.c 140 KB
Newer Older
1 2 3 4 5
/*
 * 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
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7 8 9 10 11 12 13 14 15 16 17 18 19 20
 * 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
 */
21

gauthier's avatar
gauthier committed
22
/*
23 24
  enb_config.c
  -------------------
25
  AUTHOR  : Lionel GAUTHIER, navid nikaein, Laurent Winckel
gauthier's avatar
gauthier committed
26
  COMPANY : EURECOM
27
  EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
28
*/
29 30

#include <string.h>
31
#include <inttypes.h>
32

33
#include "common/utils/LOG/log.h"
34 35
#include "assertions.h"
#include "enb_config.h"
36 37
#include "UTIL/OTG/otg.h"
#include "UTIL/OTG/otg_externs.h"
38
#if defined(ENABLE_ITTI)
39 40 41 42 43 44 45
#include "intertask_interface.h"
#if defined(ENABLE_USE_MME)
#include "s1ap_eNB.h"
#include "sctp_eNB_task.h"
#else
#define EPC_MODE_ENABLED 0
#endif
46
#endif
47
#include "sctp_default_values.h"
48
#include "SystemInformationBlockType2.h"
49 50 51
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac_proto.h"
#include "PHY/phy_extern.h"
knopp's avatar
knopp committed
52
#include "PHY/INIT/phy_init.h"
53
#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h"
54 55 56
#include "nfapi_vnf.h"
#include "nfapi_pnf.h"

57 58
#include "L1_paramdef.h"
#include "MACRLC_paramdef.h"
59
#include "common/config/config_userapi.h"
60 61
#include "RRC_config_tools.h"
#include "enb_paramdef.h"
62

63
extern uint16_t sf_ahead;
64 65
extern void set_parallel_conf(char *parallel_conf);
extern void set_worker_conf(char *worker_conf);
66 67
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t   get_thread_worker_conf(void);
68 69
extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw);
extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw);
70

Thomas Laurent's avatar
Thomas Laurent committed
71
void RCconfig_flexran() {
72 73 74 75
  uint16_t i;
  uint16_t num_enbs;
  char aprefix[MAX_OPTNAME_SIZE*2 + 8];
  /* this will possibly truncate the cell id (RRC assumes int32_t).
Thomas Laurent's avatar
Thomas Laurent committed
76 77
     Both Nid_cell and enb_id are signed in RRC case, but we use unsigned for
     the bitshifting to work properly */
78 79 80 81
  int32_t Nid_cell = 0;
  uint16_t Nid_cell_tr = 0;
  uint32_t enb_id = 0;
  /*
Thomas Laurent's avatar
Thomas Laurent committed
82 83 84
     the only reason for all these variables is, that they are "hard-encoded"
     into the CCPARAMS_DESC macro and we need it for the Nid_cell variable ...
  */
85
  char *frame_type, *prefix_type, *pbch_repetition, *prach_high_speed,
Thomas Laurent's avatar
Thomas Laurent committed
86 87 88 89 90 91
       *pusch_hoppingMode, *pusch_enable64QAM, *pusch_groupHoppingEnabled,
       *pusch_sequenceHoppingEnabled, *phich_duration, *phich_resource,
       *srs_enable, *srs_ackNackST, *srs_MaxUpPts, *pusch_alpha,
       *pucch_deltaF_Format1, *pucch_deltaF_Format1b, *pucch_deltaF_Format2,
       *pucch_deltaF_Format2a, *pucch_deltaF_Format2b,
       *rach_preamblesGroupAConfig, *rach_messagePowerOffsetGroupB, *pcch_nB;
92 93
  long long int     downlink_frequency;
  int32_t tdd_config, tdd_config_s, eutra_band, uplink_frequency_offset,
Thomas Laurent's avatar
Thomas Laurent committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
          Nid_cell_mbsfn, N_RB_DL, nb_antenna_ports, prach_root, prach_config_index,
          prach_zero_correlation, prach_freq_offset, pucch_delta_shift,
          pucch_nRB_CQI, pucch_nCS_AN, pucch_n1_AN, pdsch_referenceSignalPower,
          pdsch_p_b, pusch_n_SB, pusch_hoppingOffset, pusch_groupAssignment,
          pusch_nDMRS1, srs_BandwidthConfig, srs_SubframeConfig, pusch_p0_Nominal,
          pucch_p0_Nominal, msg3_delta_Preamble, rach_numberOfRA_Preambles,
          rach_sizeOfRA_PreamblesGroupA, rach_messageSizeGroupA,
          rach_powerRampingStep, rach_preambleInitialReceivedTargetPower,
          rach_preambleTransMax, rach_raResponseWindowSize,
          rach_macContentionResolutionTimer, rach_maxHARQ_Msg3Tx,
          pcch_defaultPagingCycle, bcch_modificationPeriodCoeff,
          ue_TimersAndConstants_t300, ue_TimersAndConstants_t301,
          ue_TimersAndConstants_t310, ue_TimersAndConstants_t311,
          ue_TimersAndConstants_n310, ue_TimersAndConstants_n311,
          ue_TransmissionMode, ue_multiple_max;
  const char       *rxPool_sc_CP_Len;
  const char       *rxPool_sc_Period;
  const char       *rxPool_data_CP_Len;
112 113 114
  libconfig_int     rxPool_ResourceConfig_prb_Num;
  libconfig_int     rxPool_ResourceConfig_prb_Start;
  libconfig_int     rxPool_ResourceConfig_prb_End;
Thomas Laurent's avatar
Thomas Laurent committed
115
  const char       *rxPool_ResourceConfig_offsetIndicator_present;
116
  libconfig_int     rxPool_ResourceConfig_offsetIndicator_choice;
Thomas Laurent's avatar
Thomas Laurent committed
117 118
  const char       *rxPool_ResourceConfig_subframeBitmap_present;
  char             *rxPool_ResourceConfig_subframeBitmap_choice_bs_buf;
119 120 121 122
  libconfig_int     rxPool_ResourceConfig_subframeBitmap_choice_bs_size;
  libconfig_int     rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
  //SIB19
  //for discRxPool
Thomas Laurent's avatar
Thomas Laurent committed
123 124
  const char       *discRxPool_cp_Len;
  const char       *discRxPool_discPeriod;
125 126 127 128 129
  libconfig_int     discRxPool_numRetx;
  libconfig_int     discRxPool_numRepetition;
  libconfig_int     discRxPool_ResourceConfig_prb_Num;
  libconfig_int     discRxPool_ResourceConfig_prb_Start;
  libconfig_int     discRxPool_ResourceConfig_prb_End;
Thomas Laurent's avatar
Thomas Laurent committed
130
  const char       *discRxPool_ResourceConfig_offsetIndicator_present;
131
  libconfig_int     discRxPool_ResourceConfig_offsetIndicator_choice;
Thomas Laurent's avatar
Thomas Laurent committed
132 133
  const char       *discRxPool_ResourceConfig_subframeBitmap_present;
  char             *discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf;
134 135 136
  libconfig_int     discRxPool_ResourceConfig_subframeBitmap_choice_bs_size;
  libconfig_int     discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
  //for discRxPoolPS
Thomas Laurent's avatar
Thomas Laurent committed
137 138
  const char       *discRxPoolPS_cp_Len;
  const char       *discRxPoolPS_discPeriod;
139 140 141 142 143
  libconfig_int     discRxPoolPS_numRetx;
  libconfig_int     discRxPoolPS_numRepetition;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_Num;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_Start;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_End;
Thomas Laurent's avatar
Thomas Laurent committed
144
  const char       *discRxPoolPS_ResourceConfig_offsetIndicator_present;
145
  libconfig_int     discRxPoolPS_ResourceConfig_offsetIndicator_choice;
Thomas Laurent's avatar
Thomas Laurent committed
146 147
  const char       *discRxPoolPS_ResourceConfig_subframeBitmap_present;
  char             *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf;
148 149
  libconfig_int     discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size;
  libconfig_int     discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused;
150 151 152 153 154 155 156 157 158 159 160
  /* get number of eNBs */
  paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
  config_get(ENBSParams, sizeof(ENBSParams)/sizeof(paramdef_t), NULL);
  num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
  /* for eNB ID */
  paramdef_t ENBParams[]  = ENBPARAMS_DESC;
  paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST, NULL, 0};
  /* for Nid_cell */
  checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
  paramdef_t CCsParams[] = CCPARAMS_DESC;
  paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS, NULL, 0};
Thomas Laurent's avatar
Thomas Laurent committed
161

162 163 164 165
  /* map parameter checking array instances to parameter definition array instances */
  for (int I = 0; I < (sizeof(CCsParams) / sizeof(paramdef_t)); I++) {
    CCsParams[I].chkPptr = &(config_check_CCparams[I]);
  }
166

167 168
  paramdef_t flexranParams[] = FLEXRANPARAMS_DESC;
  config_get(flexranParams, sizeof(flexranParams)/sizeof(paramdef_t), CONFIG_STRING_NETWORK_CONTROLLER_CONFIG);
169

170
  if (!RC.flexran) {
Thomas Laurent's avatar
Thomas Laurent committed
171
    RC.flexran = calloc(num_enbs, sizeof(flexran_agent_info_t *));
172
    AssertFatal(RC.flexran,
173
                "can't ALLOCATE %zu Bytes for %d flexran agent info with size %zu\n",
Thomas Laurent's avatar
Thomas Laurent committed
174 175
                num_enbs * sizeof(flexran_agent_info_t *),
                num_enbs, sizeof(flexran_agent_info_t *));
176
  }
177

178
  for (i = 0; i < num_enbs; i++) {
179
    RC.flexran[i] = calloc(1, sizeof(flexran_agent_info_t));
180
    AssertFatal(RC.flexran[i],
181
                "can't ALLOCATE %zu Bytes for flexran agent info (iteration %d/%d)\n",
182
                sizeof(flexran_agent_info_t), i + 1, num_enbs);
183
    /* if config says "yes", enable Agent, in all other cases it's like "no" */
184
    RC.flexran[i]->enabled          = strcasecmp(*(flexranParams[FLEXRAN_ENABLED].strptr), "yes") == 0;
Thomas Laurent's avatar
Thomas Laurent committed
185

186 187 188
    /* if not enabled, simply skip the rest, it is not needed anyway */
    if (!RC.flexran[i]->enabled)
      continue;
Thomas Laurent's avatar
Thomas Laurent committed
189

190 191 192 193 194
    RC.flexran[i]->interface_name   = strdup(*(flexranParams[FLEXRAN_INTERFACE_NAME_IDX].strptr));
    //inet_ntop(AF_INET, &(enb_properties->properties[mod_id]->flexran_agent_ipv4_address), in_ip, INET_ADDRSTRLEN);
    RC.flexran[i]->remote_ipv4_addr = strdup(*(flexranParams[FLEXRAN_IPV4_ADDRESS_IDX].strptr));
    RC.flexran[i]->remote_port      = *(flexranParams[FLEXRAN_PORT_IDX].uptr);
    RC.flexran[i]->cache_name       = strdup(*(flexranParams[FLEXRAN_CACHE_IDX].strptr));
195 196
    RC.flexran[i]->node_ctrl_state  = strcasecmp(*(flexranParams[FLEXRAN_AWAIT_RECONF_IDX].strptr), "yes") == 0 ? ENB_WAIT : ENB_NORMAL_OPERATION;
    config_getlist(&ENBParamList, ENBParams, sizeof(ENBParams)/sizeof(paramdef_t),NULL);
Thomas Laurent's avatar
Thomas Laurent committed
197

198 199 200
    /* eNB ID from configuration, as read in by RCconfig_RRC() */
    if (!ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr) {
      // Calculate a default eNB ID
201
      if (EPC_MODE_ENABLED)
Thomas Laurent's avatar
Thomas Laurent committed
202
        enb_id = i + (s1ap_generate_eNB_id () & 0xFFFF8);
203
      else
Thomas Laurent's avatar
Thomas Laurent committed
204
        enb_id = i;
205
    } else {
Thomas Laurent's avatar
Thomas Laurent committed
206
      enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
207
    }
208

209 210 211
    /* cell ID */
    sprintf(aprefix, "%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i);
    config_getlist(&CCsParamList, NULL, 0, aprefix);
Thomas Laurent's avatar
Thomas Laurent committed
212

213 214 215 216 217
    if (CCsParamList.numelt > 0) {
      sprintf(aprefix, "%s.[%i].%s.[%i]", ENB_CONFIG_STRING_ENB_LIST, i, ENB_CONFIG_STRING_COMPONENT_CARRIERS, 0);
      config_get(CCsParams, sizeof(CCsParams)/sizeof(paramdef_t), aprefix);
      Nid_cell_tr = (uint16_t) Nid_cell;
    }
218

219 220 221
    RC.flexran[i]->mod_id   = i;
    RC.flexran[i]->agent_id = (((uint64_t)i) << 48) | (((uint64_t)enb_id) << 16) | ((uint64_t)Nid_cell_tr);
    /* assume for the moment the monolithic case, i.e. agent can provide
Thomas Laurent's avatar
Thomas Laurent committed
222
       information for all layers */
223
    RC.flexran[i]->capability_mask = FLEXRAN_CAP_LOPHY | FLEXRAN_CAP_HIPHY
Thomas Laurent's avatar
Thomas Laurent committed
224 225 226
                                     | FLEXRAN_CAP_LOMAC | FLEXRAN_CAP_HIMAC
                                     | FLEXRAN_CAP_RLC   | FLEXRAN_CAP_PDCP
                                     | FLEXRAN_CAP_SDAP  | FLEXRAN_CAP_RRC;
227
  }
228
}
229

230

231
void RCconfig_L1(void) {
232 233 234 235
  int               i,j;
  paramdef_t L1_Params[] = L1PARAMS_DESC;
  paramlist_def_t L1_ParamList = {CONFIG_STRING_L1_LIST,NULL,0};

236
  if (RC.eNB == NULL) {
237
    RC.eNB                       = (PHY_VARS_eNB ** *)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
238
    LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
Thomas Laurent's avatar
Thomas Laurent committed
239
    memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB **));
240 241
    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int));
  }
242

Cedric Roux's avatar
Cedric Roux committed
243
  config_getlist( &L1_ParamList,L1_Params,sizeof(L1_Params)/sizeof(paramdef_t), NULL);
Thomas Laurent's avatar
Thomas Laurent committed
244

245 246 247 248 249
  if (L1_ParamList.numelt > 0) {
    for (j = 0; j < RC.nb_L1_inst; j++) {
      RC.nb_L1_CC[j] = *(L1_ParamList.paramarray[j][L1_CC_IDX].uptr);

      if (RC.eNB[j] == NULL) {
Thomas Laurent's avatar
Thomas Laurent committed
250 251 252
        RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *));
        LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
        memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB *));
253 254
      }

Thomas Laurent's avatar
Thomas Laurent committed
255
      for (i=0; i<RC.nb_L1_CC[j]; i++) {
256 257
        if (RC.eNB[j][i] == NULL) {
          RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
Thomas Laurent's avatar
Thomas Laurent committed
258
          memset((void *)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
259 260 261 262
          LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
          RC.eNB[j][i]->Mod_id  = j;
          RC.eNB[j][i]->CC_id   = i;
        }
263 264 265
      }

      if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_mac") == 0) {
266
        sf_ahead = 4; // Need 4 subframe gap between RX and TX
Thomas Laurent's avatar
Thomas Laurent committed
267
      } else if (strcmp(*(L1_ParamList.paramarray[j][L1_TRANSPORT_N_PREFERENCE_IDX].strptr), "nfapi") == 0) {
268
        RC.eNB[j][0]->eth_params_n.local_if_name            = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_IF_NAME_IDX].strptr));
Thomas Laurent's avatar
Thomas Laurent committed
269 270 271 272 273 274 275
        RC.eNB[j][0]->eth_params_n.my_addr                  = strdup(*(L1_ParamList.paramarray[j][L1_LOCAL_N_ADDRESS_IDX].strptr));
        RC.eNB[j][0]->eth_params_n.remote_addr              = strdup(*(L1_ParamList.paramarray[j][L1_REMOTE_N_ADDRESS_IDX].strptr));
        RC.eNB[j][0]->eth_params_n.my_portc                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTC_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.remote_portc             = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTC_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.my_portd                 = *(L1_ParamList.paramarray[j][L1_LOCAL_N_PORTD_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.remote_portd             = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr);
        RC.eNB[j][0]->eth_params_n.transp_preference        = ETH_UDP_MODE;
276 277 278 279 280 281 282 283 284
        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
        RC.nb_macrlc_inst = 1;  // This is used by mac_top_init_eNB()
        // This is used by init_eNB_afterRU()
        RC.nb_CC = (int *)malloc((1+RC.nb_inst)*sizeof(int));
        RC.nb_CC[0]=1;
        RC.nb_inst =1; // DJP - feptx_prec uses num_eNB but phy_init_RU uses nb_inst
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_inst=1 this is because phy_init_RU() uses that to index and not RC.num_eNB - why the 2 similar variables?\n", __FUNCTION__);
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_CC[0]=%d for init_eNB_afterRU()\n", __FUNCTION__, RC.nb_CC[0]);
        LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_macrlc_inst:%d because used by mac_top_init_eNB()\n", __FUNCTION__, RC.nb_macrlc_inst);
285
        //mac_top_init_eNB();
286 287
        configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd,
                            RC.eNB[j][0]->eth_params_n     .remote_portd);
Thomas Laurent's avatar
Thomas Laurent committed
288
      } else { // other midhaul
289 290
      }
    }// j=0..num_inst
Thomas Laurent's avatar
Thomas Laurent committed
291

292 293 294
    printf("Initializing northbound interface for L1\n");
    l1_north_init_eNB();
  } else {
Thomas Laurent's avatar
Thomas Laurent committed
295
    LOG_I(PHY,"No " CONFIG_STRING_L1_LIST " configuration found");
296 297 298 299 300 301
    // DJP need to create some structures for VNF
    j = 0;
    RC.nb_L1_CC = malloc((1+RC.nb_L1_inst)*sizeof(int)); // DJP - 1 lot then???
    RC.nb_L1_CC[j]=1; // DJP - hmmm

    if (RC.eNB[j] == NULL) {
Thomas Laurent's avatar
Thomas Laurent committed
302
      RC.eNB[j]                       = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB **));
303
      LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]);
304
      memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB ** *));
305 306
    }

Thomas Laurent's avatar
Thomas Laurent committed
307
    for (i=0; i<RC.nb_L1_CC[j]; i++) {
308 309
      if (RC.eNB[j][i] == NULL) {
        RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
Thomas Laurent's avatar
Thomas Laurent committed
310
        memset((void *)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB));
311 312 313 314 315
        LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]);
        RC.eNB[j][i]->Mod_id  = j;
        RC.eNB[j][i]->CC_id   = i;
      }
    }
316 317 318 319 320 321 322
  }
}

void RCconfig_macrlc() {
  int               j;
  paramdef_t MacRLC_Params[] = MACRLCPARAMS_DESC;
  paramlist_def_t MacRLC_ParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0};
Thomas Laurent's avatar
Thomas Laurent committed
323
  config_getlist( &MacRLC_ParamList,MacRLC_Params,sizeof(MacRLC_Params)/sizeof(paramdef_t), NULL);
324 325

  if ( MacRLC_ParamList.numelt > 0) {
Thomas Laurent's avatar
Thomas Laurent committed
326 327 328
    RC.nb_macrlc_inst=MacRLC_ParamList.numelt;
    mac_top_init_eNB();
    RC.nb_mac_CC = (int *)malloc(RC.nb_macrlc_inst*sizeof(int));
329

Thomas Laurent's avatar
Thomas Laurent committed
330
    for (j=0; j<RC.nb_macrlc_inst; j++) {
Cedric Roux's avatar
Cedric Roux committed
331 332
      RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr);
      RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr);
knopp's avatar
knopp committed
333
      RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr);
knopp's avatar
knopp committed
334 335
      //RC.mac[j]->phy_test = *(MacRLC_ParamList.paramarray[j][MACRLC_PHY_TEST_IDX].iptr);
      //printf("PHY_TEST = %d,%d\n", RC.mac[j]->phy_test, j);
336 337

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
338
        // check number of instances is same as RRC/PDCP
339
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "cudu") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
340 341 342 343 344 345 346 347
        RC.mac[j]->eth_params_n.local_if_name            = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr));
        RC.mac[j]->eth_params_n.my_addr                  = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_n.remote_addr              = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_n.my_portc                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_n.remote_portc             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_n.my_portd                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_n.remote_portd             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_PORTD_IDX].iptr);;
        RC.mac[j]->eth_params_n.transp_preference        = ETH_UDP_MODE;
348
      } else { // other midhaul
Thomas Laurent's avatar
Thomas Laurent committed
349 350
        AssertFatal(1==0,"MACRLC %d: %s unknown northbound midhaul\n",j, *(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr));
      }
351 352 353

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
Thomas Laurent's avatar
Thomas Laurent committed
354 355 356 357 358 359 360 361
        RC.mac[j]->eth_params_s.local_if_name            = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_IF_NAME_IDX].strptr));
        RC.mac[j]->eth_params_s.my_addr                  = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_s.remote_addr              = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
        RC.mac[j]->eth_params_s.my_portc                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_s.remote_portc             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
        RC.mac[j]->eth_params_s.my_portd                 = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_s.remote_portd             = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
        RC.mac[j]->eth_params_s.transp_preference        = ETH_UDP_MODE;
362 363 364 365
        sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2
        printf("**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
        configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc);
        printf("**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
366
      } else { // other midhaul
Thomas Laurent's avatar
Thomas Laurent committed
367
        AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
368
      }
Thomas Laurent's avatar
Thomas Laurent committed
369 370 371 372 373 374 375 376 377 378

      if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "default") == 0) {
        global_scheduler_mode=SCHED_MODE_DEFAULT;
        printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
      } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr), "fairRR") == 0) {
        global_scheduler_mode=SCHED_MODE_FAIR_RR;
        printf("sched mode = fairRR %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
      } else {
        global_scheduler_mode=SCHED_MODE_DEFAULT;
        printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
379
      }
380 381
    }// j=0..num_inst
  } else {// MacRLC_ParamList.numelt > 0
Thomas Laurent's avatar
Thomas Laurent committed
382 383
    AssertFatal (0,
                 "No " CONFIG_STRING_MACRLC_LIST " configuration found");
384 385
  }
}
386

Thomas Laurent's avatar
Thomas Laurent committed
387
int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) {
388 389 390 391
  int               num_enbs                      = 0;
  int               j,k                           = 0;
  int32_t     enb_id                        = 0;
  int               nb_cc                         = 0;
Thomas Laurent's avatar
Thomas Laurent committed
392
  char       *frame_type                    = NULL;
393 394
  int32_t     tdd_config                    = 0;
  int32_t     tdd_config_s                  = 0;
Thomas Laurent's avatar
Thomas Laurent committed
395 396
  char       *prefix_type                   = NULL;
  char       *pbch_repetition               = NULL;
397 398 399 400 401 402 403 404 405
  int32_t     eutra_band                    = 0;
  long long int     downlink_frequency            = 0;
  int32_t     uplink_frequency_offset       = 0;
  int32_t     Nid_cell                      = 0;
  int32_t     Nid_cell_mbsfn                = 0;
  int32_t     N_RB_DL                       = 0;
  int32_t     nb_antenna_ports              = 0;
  int32_t     prach_root                    = 0;
  int32_t     prach_config_index            = 0;
Thomas Laurent's avatar
Thomas Laurent committed
406
  char            *prach_high_speed         = NULL;
407 408 409 410 411
  int32_t     prach_zero_correlation        = 0;
  int32_t     prach_freq_offset             = 0;
  int32_t     pucch_delta_shift             = 0;
  int32_t     pucch_nRB_CQI                 = 0;
  int32_t     pucch_nCS_AN                  = 0;
Thomas Laurent's avatar
Thomas Laurent committed
412
  //#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
413
  int32_t     pucch_n1_AN                   = 0;
Thomas Laurent's avatar
Thomas Laurent committed
414
  //#endif
415 416 417
  int32_t     pdsch_referenceSignalPower    = 0;
  int32_t     pdsch_p_b                     = 0;
  int32_t     pusch_n_SB                    = 0;
Thomas Laurent's avatar
Thomas Laurent committed
418
  char       *pusch_hoppingMode             = NULL;
419
  int32_t     pusch_hoppingOffset           = 0;
Thomas Laurent's avatar
Thomas Laurent committed
420 421
  char          *pusch_enable64QAM          = NULL;
  char          *pusch_groupHoppingEnabled  = NULL;
422
  int32_t     pusch_groupAssignment         = 0;
Thomas Laurent's avatar
Thomas Laurent committed
423
  char          *pusch_sequenceHoppingEnabled = NULL;
424
  int32_t     pusch_nDMRS1                  = 0;
Thomas Laurent's avatar
Thomas Laurent committed
425 426 427
  char       *phich_duration                = NULL;
  char       *phich_resource                = NULL;
  char       *srs_enable                    = NULL;
428 429
  int32_t     srs_BandwidthConfig           = 0;
  int32_t     srs_SubframeConfig            = 0;
Thomas Laurent's avatar
Thomas Laurent committed
430 431
  char       *srs_ackNackST                 = NULL;
  char       *srs_MaxUpPts                  = NULL;
432
  int32_t     pusch_p0_Nominal              = 0;
Thomas Laurent's avatar
Thomas Laurent committed
433
  char       *pusch_alpha                   = NULL;
434 435 436
  int32_t     pucch_p0_Nominal              = 0;
  int32_t     msg3_delta_Preamble           = 0;
  //int32_t     ul_CyclicPrefixLength         = 0;
Thomas Laurent's avatar
Thomas Laurent committed
437
  char       *pucch_deltaF_Format1          = NULL;
438
  //const char*       pucch_deltaF_Format1a         = NULL;
Thomas Laurent's avatar
Thomas Laurent committed
439 440 441 442
  char       *pucch_deltaF_Format1b         = NULL;
  char       *pucch_deltaF_Format2          = NULL;
  char       *pucch_deltaF_Format2a         = NULL;
  char       *pucch_deltaF_Format2b         = NULL;
443
  int32_t     rach_numberOfRA_Preambles     = 0;
Thomas Laurent's avatar
Thomas Laurent committed
444
  char       *rach_preamblesGroupAConfig    = NULL;
445 446
  int32_t     rach_sizeOfRA_PreamblesGroupA = 0;
  int32_t     rach_messageSizeGroupA        = 0;
Thomas Laurent's avatar
Thomas Laurent committed
447
  char       *rach_messagePowerOffsetGroupB = NULL;
448 449 450
  int32_t     rach_powerRampingStep         = 0;
  int32_t     rach_preambleInitialReceivedTargetPower    = 0;
  int32_t     rach_preambleTransMax         = 0;
451
  int32_t     rach_raResponseWindowSize     = 10;
452 453 454
  int32_t     rach_macContentionResolutionTimer = 0;
  int32_t     rach_maxHARQ_Msg3Tx           = 0;
  int32_t     pcch_defaultPagingCycle       = 0;
Thomas Laurent's avatar
Thomas Laurent committed
455
  char       *pcch_nB                       = NULL;
456 457 458 459 460 461 462 463
  int32_t     bcch_modificationPeriodCoeff  = 0;
  int32_t     ue_TimersAndConstants_t300    = 0;
  int32_t     ue_TimersAndConstants_t301    = 0;
  int32_t     ue_TimersAndConstants_t310    = 0;
  int32_t     ue_TimersAndConstants_t311    = 0;
  int32_t     ue_TimersAndConstants_n310    = 0;
  int32_t     ue_TimersAndConstants_n311    = 0;
  int32_t     ue_TransmissionMode           = 0;
Xu Bo's avatar
Xu Bo committed
464
  int32_t     ue_multiple_max               = 0;
465 466
  //TTN - for D2D
  //SIB18
Thomas Laurent's avatar
Thomas Laurent committed
467 468 469
  const char       *rxPool_sc_CP_Len                                        = NULL;
  const char       *rxPool_sc_Period                                        = NULL;
  const char       *rxPool_data_CP_Len                                      = NULL;
470 471 472
  libconfig_int     rxPool_ResourceConfig_prb_Num                           = 0;
  libconfig_int     rxPool_ResourceConfig_prb_Start                         = 0;
  libconfig_int     rxPool_ResourceConfig_prb_End                           = 0;
Thomas Laurent's avatar
Thomas Laurent committed
473
  const char       *rxPool_ResourceConfig_offsetIndicator_present           = NULL;
474
  libconfig_int     rxPool_ResourceConfig_offsetIndicator_choice            = 0;
Thomas Laurent's avatar
Thomas Laurent committed
475 476
  const char       *rxPool_ResourceConfig_subframeBitmap_present            = NULL;
  char             *rxPool_ResourceConfig_subframeBitmap_choice_bs_buf      = NULL;
477 478 479 480
  libconfig_int     rxPool_ResourceConfig_subframeBitmap_choice_bs_size     = 0;
  libconfig_int     rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused     = 0;
  //SIB19
  //For discRxPool
Thomas Laurent's avatar
Thomas Laurent committed
481 482
  const char       *discRxPool_cp_Len                                              = NULL;
  const char       *discRxPool_discPeriod                                          = NULL;
483 484 485 486 487
  libconfig_int     discRxPool_numRetx                                             = 0;
  libconfig_int     discRxPool_numRepetition                                       = 0;
  libconfig_int     discRxPool_ResourceConfig_prb_Num                              = 0;
  libconfig_int     discRxPool_ResourceConfig_prb_Start                            = 0;
  libconfig_int     discRxPool_ResourceConfig_prb_End                              = 0;
Thomas Laurent's avatar
Thomas Laurent committed
488
  const char       *discRxPool_ResourceConfig_offsetIndicator_present              = NULL;
489
  libconfig_int     discRxPool_ResourceConfig_offsetIndicator_choice               = 0;
Thomas Laurent's avatar
Thomas Laurent committed
490 491
  const char       *discRxPool_ResourceConfig_subframeBitmap_present               = NULL;
  char             *discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf         = NULL;
492 493 494
  libconfig_int     discRxPool_ResourceConfig_subframeBitmap_choice_bs_size        = 0;
  libconfig_int     discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
  //For discRxPoolPS
Thomas Laurent's avatar
Thomas Laurent committed
495 496
  const char       *discRxPoolPS_cp_Len                                              = NULL;
  const char       *discRxPoolPS_discPeriod                                          = NULL;
497 498 499 500 501
  libconfig_int     discRxPoolPS_numRetx                                             = 0;
  libconfig_int     discRxPoolPS_numRepetition                                       = 0;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_Num                              = 0;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_Start                            = 0;
  libconfig_int     discRxPoolPS_ResourceConfig_prb_End                              = 0;
Thomas Laurent's avatar
Thomas Laurent committed
502
  const char       *discRxPoolPS_ResourceConfig_offsetIndicator_present              = NULL;
503
  libconfig_int     discRxPoolPS_ResourceConfig_offsetIndicator_choice               = 0;
Thomas Laurent's avatar
Thomas Laurent committed
504 505
  const char       *discRxPoolPS_ResourceConfig_subframeBitmap_present               = NULL;
  char             *discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_buf         = NULL;
506 507
  libconfig_int     discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_size        = 0;
  libconfig_int     discRxPoolPS_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0;
508 509 510 511 512 513 514
  int32_t     srb1_timer_poll_retransmit    = 0;
  int32_t     srb1_timer_reordering         = 0;
  int32_t     srb1_timer_status_prohibit    = 0;
  int32_t     srb1_poll_pdu                 = 0;
  int32_t     srb1_poll_byte                = 0;
  int32_t     srb1_max_retx_threshold       = 0;
  int32_t     my_int;
Thomas Laurent's avatar
Thomas Laurent committed
515
  // for no gcc warnings
516 517 518
  (void)my_int;
  paramdef_t ENBSParams[] = ENBSPARAMS_DESC;
  paramdef_t ENBParams[]  = ENBPARAMS_DESC;
Thomas Laurent's avatar
Thomas Laurent committed
519
  paramlist_def_t ENBParamList = {ENB_CONFIG_STRING_ENB_LIST,NULL,0};
520
  checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK;
521 522
  paramdef_t CCsParams[] = CCPARAMS_DESC;
  paramlist_def_t CCsParamList = {ENB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0};
Thomas Laurent's avatar
Thomas Laurent committed
523
  paramdef_t SRB1Params[] = SRB1PARAMS_DESC;
524

Thomas Laurent's avatar
Thomas Laurent committed
525
  /* map parameter checking array instances to parameter definition array instances */
526
  for (int I=0; I< ( sizeof(CCsParams)/ sizeof(paramdef_t)  ) ; I++) {
Thomas Laurent's avatar
Thomas Laurent committed
527
    CCsParams[I].chkPptr = &(config_check_CCparams[I]);
528
  }
529

Thomas Laurent's avatar
Thomas Laurent committed
530 531
  /* get global parameters, defined outside any section in the config file */
  config_get( ENBSParams,sizeof(ENBSParams)/sizeof(paramdef_t),NULL);
532 533
  num_enbs = ENBSParams[ENB_ACTIVE_ENBS_IDX].numelt;
  AssertFatal (i<num_enbs,
Thomas Laurent's avatar
Thomas Laurent committed
534
               "Failed to parse config file no %ith element in %s \n",i, ENB_CONFIG_STRING_ACTIVE_ENBS);
535 536 537

  if (num_enbs>0) {
    // Output a list of all eNBs.
Thomas Laurent's avatar
Thomas Laurent committed
538 539 540 541 542 543 544 545
    config_getlist( &ENBParamList,ENBParams,sizeof(ENBParams)/sizeof(paramdef_t),NULL);

    if (ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr == NULL) {
      // Calculate a default eNB ID
      if (EPC_MODE_ENABLED) {
        uint32_t hash;
        hash = s1ap_generate_eNB_id ();
        enb_id = i + (hash & 0xFFFF8);
546
      } else {
Thomas Laurent's avatar
Thomas Laurent committed
547
        enb_id = i;
548
      }
Thomas Laurent's avatar
Thomas Laurent committed
549 550 551
    } else {
      enb_id = *(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr);
    }
552

Thomas Laurent's avatar
Thomas Laurent committed
553 554 555 556 557 558 559 560 561 562 563 564 565 566
    printf("RRC %d: Southbound Transport %s\n",i,*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr));

    if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {
    } else if (strcmp(*(ENBParamList.paramarray[i][ENB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
      rrc->eth_params_s.local_if_name            = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_IF_NAME_IDX].strptr));
      rrc->eth_params_s.my_addr                  = strdup(*(ENBParamList.paramarray[i][ENB_LOCAL_S_ADDRESS_IDX].strptr));
      rrc->eth_params_s.remote_addr              = strdup(*(ENBParamList.paramarray[i][ENB_REMOTE_S_ADDRESS_IDX].strptr));
      rrc->eth_params_s.my_portc                 = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTC_IDX].uptr);
      rrc->eth_params_s.remote_portc             = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTC_IDX].uptr);
      rrc->eth_params_s.my_portd                 = *(ENBParamList.paramarray[i][ENB_LOCAL_S_PORTD_IDX].uptr);
      rrc->eth_params_s.remote_portd             = *(ENBParamList.paramarray[i][ENB_REMOTE_S_PORTD_IDX].uptr);
      rrc->eth_params_s.transp_preference        = ETH_UDP_MODE;
    } else { // other midhaul
    }
567

Thomas Laurent's avatar
Thomas Laurent committed
568 569 570 571 572
    // search if in active list

    for (k=0; k <num_enbs ; k++) {
      if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) {
        char enbpath[MAX_OPTNAME_SIZE + 8];
573 574 575 576 577 578 579 580 581
        sprintf(enbpath,"%s.[%i]",ENB_CONFIG_STRING_ENB_LIST,k);
        paramdef_t PLMNParams[] = PLMNPARAMS_DESC;
        paramlist_def_t PLMNParamList = {ENB_CONFIG_STRING_PLMN_LIST, NULL, 0};
        /* map parameter checking array instances to parameter definition array instances */
        checkedparam_t config_check_PLMNParams [] = PLMNPARAMS_CHECK;

        for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I)
          PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);

Thomas Laurent's avatar
Thomas Laurent committed
582
        RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id;
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
        RRC_CONFIGURATION_REQ(msg_p).tac = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr;
        AssertFatal(!ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr
                    && !ENBParamList.paramarray[i][ENB_MOBILE_NETWORK_CODE_IDX_OLD].strptr,
                    "It seems that you use an old configuration file. Please change the existing\n"
                    "    tracking_area_code  =  \"1\";\n"
                    "    mobile_country_code =  \"208\";\n"
                    "    mobile_network_code =  \"93\";\n"
                    "to\n"
                    "    tracking_area_code  =  1; // no string!!\n"
                    "    plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
        config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), enbpath);

        if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6)
          AssertFatal(0, "The number of PLMN IDs must be in [1,6], but is %d\n",
                      PLMNParamList.numelt);

        RRC_CONFIGURATION_REQ(msg_p).num_plmn = PLMNParamList.numelt;

        for (int l = 0; l < PLMNParamList.numelt; ++l) {
          RRC_CONFIGURATION_REQ(msg_p).mcc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_COUNTRY_CODE_IDX].uptr;
          RRC_CONFIGURATION_REQ(msg_p).mnc[l] = *PLMNParamList.paramarray[l][ENB_MOBILE_NETWORK_CODE_IDX].uptr;
          RRC_CONFIGURATION_REQ(msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][ENB_MNC_DIGIT_LENGTH].u8ptr;
          AssertFatal(RRC_CONFIGURATION_REQ(msg_p).mnc_digit_length[l] == 3
                      || RRC_CONFIGURATION_REQ(msg_p).mnc[l] < 100,
                      "MNC %d cannot be encoded in two digits as requested (change mnc_digit_length to 3)\n",
                      RRC_CONFIGURATION_REQ(msg_p).mnc[l]);
        }
Thomas Laurent's avatar
Thomas Laurent committed
610 611

        // Parse optional physical parameters
612
        config_getlist( &CCsParamList,NULL,0,enbpath);
Thomas Laurent's avatar
Thomas Laurent committed
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645
        LOG_I(RRC,"num component carriers %d \n",CCsParamList.numelt);

        if ( CCsParamList.numelt> 0) {
          char ccspath[MAX_OPTNAME_SIZE*2 + 16];

          for (j = 0; j < CCsParamList.numelt ; j++) {
            sprintf(ccspath,"%s.%s.[%i]",enbpath,ENB_CONFIG_STRING_COMPONENT_CARRIERS,j);
            LOG_I(RRC, "enb_config::RCconfig_RRC() parameter number: %d, total number of parameters: %zd, ccspath: %s \n \n", j, sizeof(CCsParams)/sizeof(paramdef_t), ccspath);
            config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath);
            //printf("Component carrier %d\n",component_carrier);
            nb_cc++;
            RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config;
            AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6,
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
                         RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6);
            RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s;
            AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8,
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
                         RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);

            if (!prefix_type)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE);
            else if (strcmp(prefix_type, "NORMAL") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL;
            } else  if (strcmp(prefix_type, "EXTENDED") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n",
                           RC.config_file_name, i, prefix_type);
            }
646

647
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
Thomas Laurent's avatar
Thomas Laurent committed
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662

            if (!pbch_repetition)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: TRUE,FALSE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PBCH_REPETITION);
            else if (strcmp(pbch_repetition, "TRUE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 1;
            } else  if (strcmp(pbch_repetition, "FALSE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pbch_repetition[j] = 0;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pbch_repetition choice: TRUE or FALSE !\n",
                           RC.config_file_name, i, pbch_repetition);
            }

663
#endif
Thomas Laurent's avatar
Thomas Laurent committed
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974
            RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band;
            RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency;
            RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset;
            RRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= Nid_cell;

            if (Nid_cell>503) {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n",
                           RC.config_file_name, i, Nid_cell);
            }

            RRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL;

            if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n",
                           RC.config_file_name, i, N_RB_DL);
            }

            if (strcmp(frame_type, "FDD") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD;
            } else  if (strcmp(frame_type, "TDD") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n",
                           RC.config_file_name, i, frame_type);
            }

            RRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config;
            AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6,
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config %d (should be 0-%d)!",
                         RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6);
            RRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s;
            AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8,
                         "Failed to parse eNB configuration file %s, enb %d illegal tdd_config_s %d (should be 0-%d)!",
                         RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8);

            if (!prefix_type)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: NORMAL,EXTENDED!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE);
            else if (strcmp(prefix_type, "NORMAL") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL;
            } else  if (strcmp(prefix_type, "EXTENDED") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED;
            } else {
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n",
                           RC.config_file_name, i, prefix_type);
            }

            RRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band;
            // printf( "\teutra band:\t%d\n",RRC_CONFIGURATION_REQ (msg_p).eutra_band);
            RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency;
            //printf( "\tdownlink freq:\t%u\n",RRC_CONFIGURATION_REQ (msg_p).downlink_frequency);
            RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset;

            if (config_check_band_frequencies(j,
                                              RRC_CONFIGURATION_REQ (msg_p).eutra_band[j],
                                              RRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j],
                                              RRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j],
                                              RRC_CONFIGURATION_REQ (msg_p).frame_type[j])) {
              AssertFatal(0, "error calling enb_check_band_frequencies\n");
            }

            if ((nb_antenna_ports <1) || (nb_antenna_ports > 2))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n",
                           RC.config_file_name, i, nb_antenna_ports);

            RRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports;
            RRC_CONFIGURATION_REQ (msg_p).prach_root[j] =  prach_root;

            if ((prach_root <0) || (prach_root > 1023))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_root choice: 0..1023 !\n",
                           RC.config_file_name, i, prach_root);

            RRC_CONFIGURATION_REQ (msg_p).prach_config_index[j] = prach_config_index;

            if ((prach_config_index <0) || (prach_config_index > 63))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_config_index choice: 0..1023 !\n",
                           RC.config_file_name, i, prach_config_index);

            if (!prach_high_speed)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PRACH_HIGH_SPEED);
            else if (strcmp(prach_high_speed, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = TRUE;
            } else if (strcmp(prach_high_speed, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).prach_high_speed[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for prach_config choice: ENABLE,DISABLE !\n",
                           RC.config_file_name, i, prach_high_speed);

            RRC_CONFIGURATION_REQ (msg_p).prach_zero_correlation[j] =prach_zero_correlation;

            if ((prach_zero_correlation <0) || (prach_zero_correlation > 15))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_zero_correlation choice: 0..15!\n",
                           RC.config_file_name, i, prach_zero_correlation);

            RRC_CONFIGURATION_REQ (msg_p).prach_freq_offset[j] = prach_freq_offset;

            if ((prach_freq_offset <0) || (prach_freq_offset > 94))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for prach_freq_offset choice: 0..94!\n",
                           RC.config_file_name, i, prach_freq_offset);

            RRC_CONFIGURATION_REQ (msg_p).pucch_delta_shift[j] = pucch_delta_shift-1;

            if ((pucch_delta_shift <1) || (pucch_delta_shift > 3))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_delta_shift choice: 1..3!\n",
                           RC.config_file_name, i, pucch_delta_shift);

            RRC_CONFIGURATION_REQ (msg_p).pucch_nRB_CQI[j] = pucch_nRB_CQI;

            if ((pucch_nRB_CQI <0) || (pucch_nRB_CQI > 98))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nRB_CQI choice: 0..98!\n",
                           RC.config_file_name, i, pucch_nRB_CQI);

            RRC_CONFIGURATION_REQ (msg_p).pucch_nCS_AN[j] = pucch_nCS_AN;

            if ((pucch_nCS_AN <0) || (pucch_nCS_AN > 7))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_nCS_AN choice: 0..7!\n",
                           RC.config_file_name, i, pucch_nCS_AN);

            //#if (RRC_VERSION < MAKE_VERSION(10, 0, 0))
            RRC_CONFIGURATION_REQ (msg_p).pucch_n1_AN[j] = pucch_n1_AN;

            if ((pucch_n1_AN <0) || (pucch_n1_AN > 2047))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_n1_AN choice: 0..2047!\n",
                           RC.config_file_name, i, pucch_n1_AN);

            //#endif
            RRC_CONFIGURATION_REQ (msg_p).pdsch_referenceSignalPower[j] = pdsch_referenceSignalPower;

            if ((pdsch_referenceSignalPower <-60) || (pdsch_referenceSignalPower > 50))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_referenceSignalPower choice:-60..50!\n",
                           RC.config_file_name, i, pdsch_referenceSignalPower);

            RRC_CONFIGURATION_REQ (msg_p).pdsch_p_b[j] = pdsch_p_b;

            if ((pdsch_p_b <0) || (pdsch_p_b > 3))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pdsch_p_b choice: 0..3!\n",
                           RC.config_file_name, i, pdsch_p_b);

            RRC_CONFIGURATION_REQ (msg_p).pusch_n_SB[j] = pusch_n_SB;

            if ((pusch_n_SB <1) || (pusch_n_SB > 4))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_n_SB choice: 1..4!\n",
                           RC.config_file_name, i, pusch_n_SB);

            if (!pusch_hoppingMode)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: interSubframe,intraAndInterSubframe!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_HOPPINGMODE);
            else if (strcmp(pusch_hoppingMode,"interSubFrame")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame;
            }  else if (strcmp(pusch_hoppingMode,"intraAndInterSubFrame")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingMode[j] = PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_intraAndInterSubFrame;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingMode choice: interSubframe,intraAndInterSubframe!\n",
                           RC.config_file_name, i, pusch_hoppingMode);

            RRC_CONFIGURATION_REQ (msg_p).pusch_hoppingOffset[j] = pusch_hoppingOffset;

            if ((pusch_hoppingOffset<0) || (pusch_hoppingOffset>98))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_hoppingOffset choice: 0..98!\n",
                           RC.config_file_name, i, pusch_hoppingMode);

            if (!pusch_enable64QAM)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_ENABLE64QAM);
            else if (strcmp(pusch_enable64QAM, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[j] = TRUE;
            }  else if (strcmp(pusch_enable64QAM, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_enable64QAM[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_enable64QAM choice: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, pusch_enable64QAM);

            if (!pusch_groupHoppingEnabled)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_GROUP_HOPPING_EN);
            else if (strcmp(pusch_groupHoppingEnabled, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[j] = TRUE;
            }  else if (strcmp(pusch_groupHoppingEnabled, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_groupHoppingEnabled[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_groupHoppingEnabled choice: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, pusch_groupHoppingEnabled);

            RRC_CONFIGURATION_REQ (msg_p).pusch_groupAssignment[j] = pusch_groupAssignment;

            if ((pusch_groupAssignment<0)||(pusch_groupAssignment>29))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_groupAssignment choice: 0..29!\n",
                           RC.config_file_name, i, pusch_groupAssignment);

            if (!pusch_sequenceHoppingEnabled)
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d define %s: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, ENB_CONFIG_STRING_PUSCH_SEQUENCE_HOPPING_EN);
            else if (strcmp(pusch_sequenceHoppingEnabled, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[j] = TRUE;
            }  else if (strcmp(pusch_sequenceHoppingEnabled, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_sequenceHoppingEnabled[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pusch_sequenceHoppingEnabled choice: ENABLE,DISABLE!\n",
                           RC.config_file_name, i, pusch_sequenceHoppingEnabled);

            RRC_CONFIGURATION_REQ (msg_p).pusch_nDMRS1[j] = pusch_nDMRS1;  //cyclic_shift in RRC!

            if ((pusch_nDMRS1 <0) || (pusch_nDMRS1>7))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_nDMRS1 choice: 0..7!\n",
                           RC.config_file_name, i, pusch_nDMRS1);

            if (strcmp(phich_duration,"NORMAL")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_normal;
            } else if (strcmp(phich_duration,"EXTENDED")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_duration[j] = PHICH_Config__phich_Duration_extended;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_duration choice: NORMAL,EXTENDED!\n",
                           RC.config_file_name, i, phich_duration);

            if (strcmp(phich_resource,"ONESIXTH")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_oneSixth ;
            } else if (strcmp(phich_resource,"HALF")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_half;
            } else if (strcmp(phich_resource,"ONE")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_one;
            } else if (strcmp(phich_resource,"TWO")==0) {
              RRC_CONFIGURATION_REQ (msg_p).phich_resource[j] = PHICH_Config__phich_Resource_two;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for phich_resource choice: ONESIXTH,HALF,ONE,TWO!\n",
                           RC.config_file_name, i, phich_resource);

            printf("phich.resource %ld (%s), phich.duration %ld (%s)\n",
                   RRC_CONFIGURATION_REQ (msg_p).phich_resource[j],phich_resource,
                   RRC_CONFIGURATION_REQ (msg_p).phich_duration[j],phich_duration);

            if (strcmp(srs_enable, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] = TRUE;
            } else if (strcmp(srs_enable, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n",
                           RC.config_file_name, i, srs_enable);

            if (RRC_CONFIGURATION_REQ (msg_p).srs_enable[j] == TRUE) {
              RRC_CONFIGURATION_REQ (msg_p).srs_BandwidthConfig[j] = srs_BandwidthConfig;

              if ((srs_BandwidthConfig < 0) || (srs_BandwidthConfig >7))
                AssertFatal (0, "Failed to parse eNB configuration file %s, enb %d unknown value %d for srs_BandwidthConfig choice: 0...7\n",
                             RC.config_file_name, i, srs_BandwidthConfig);

              RRC_CONFIGURATION_REQ (msg_p).srs_SubframeConfig[j] = srs_SubframeConfig;

              if ((srs_SubframeConfig<0) || (srs_SubframeConfig>15))
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for srs_SubframeConfig choice: 0..15 !\n",
                             RC.config_file_name, i, srs_SubframeConfig);

              if (strcmp(srs_ackNackST, "ENABLE") == 0) {
                RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[j] = TRUE;
              } else if (strcmp(srs_ackNackST, "DISABLE") == 0) {
                RRC_CONFIGURATION_REQ (msg_p).srs_ackNackST[j] = FALSE;
              } else
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_BandwidthConfig choice: ENABLE,DISABLE !\n",
                             RC.config_file_name, i, srs_ackNackST);

              if (strcmp(srs_MaxUpPts, "ENABLE") == 0) {
                RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[j] = TRUE;
              } else if (strcmp(srs_MaxUpPts, "DISABLE") == 0) {
                RRC_CONFIGURATION_REQ (msg_p).srs_MaxUpPts[j] = FALSE;
              } else
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for srs_MaxUpPts choice: ENABLE,DISABLE !\n",
                             RC.config_file_name, i, srs_MaxUpPts);
            }

            RRC_CONFIGURATION_REQ (msg_p).pusch_p0_Nominal[j] = pusch_p0_Nominal;

            if ((pusch_p0_Nominal<-126) || (pusch_p0_Nominal>24))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pusch_p0_Nominal choice: -126..24 !\n",
                           RC.config_file_name, i, pusch_p0_Nominal);
975

976 977
#if (RRC_VERSION <= MAKE_VERSION(12, 0, 0))

Thomas Laurent's avatar
Thomas Laurent committed
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996
            if (strcmp(pusch_alpha,"AL0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al0;
            } else if (strcmp(pusch_alpha,"AL04")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al04;
            } else if (strcmp(pusch_alpha,"AL05")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al05;
            } else if (strcmp(pusch_alpha,"AL06")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al06;
            } else if (strcmp(pusch_alpha,"AL07")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al07;
            } else if (strcmp(pusch_alpha,"AL08")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al08;
            } else if (strcmp(pusch_alpha,"AL09")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al09;
            } else if (strcmp(pusch_alpha,"AL1")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = UplinkPowerControlCommon__alpha_al1;
            }

#endif
997
#if (RRC_VERSION >= MAKE_VERSION(12, 0, 0))
Thomas Laurent's avatar
Thomas Laurent committed
998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016

            if (strcmp(pusch_alpha,"AL0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al0;
            } else if (strcmp(pusch_alpha,"AL04")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al04;
            } else if (strcmp(pusch_alpha,"AL05")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al05;
            } else if (strcmp(pusch_alpha,"AL06")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al06;
            } else if (strcmp(pusch_alpha,"AL07")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al07;
            } else if (strcmp(pusch_alpha,"AL08")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al08;
            } else if (strcmp(pusch_alpha,"AL09")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al09;
            } else if (strcmp(pusch_alpha,"AL1")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pusch_alpha[j] = Alpha_r12_al1;
            }

1017
#endif
Thomas Laurent's avatar
Thomas Laurent committed
1018 1019 1020 1021
            else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_Alpha choice: AL0,AL04,AL05,AL06,AL07,AL08,AL09,AL1!\n",
                           RC.config_file_name, i, pusch_alpha);
1022

Thomas Laurent's avatar
Thomas Laurent committed
1023
            RRC_CONFIGURATION_REQ (msg_p).pucch_p0_Nominal[j] = pucch_p0_Nominal;
1024

Thomas Laurent's avatar
Thomas Laurent committed
1025 1026 1027 1028
            if ((pucch_p0_Nominal<-127) || (pucch_p0_Nominal>-96))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pucch_p0_Nominal choice: -127..-96 !\n",
                           RC.config_file_name, i, pucch_p0_Nominal);
1029

Thomas Laurent's avatar
Thomas Laurent committed
1030
            RRC_CONFIGURATION_REQ (msg_p).msg3_delta_Preamble[j] = msg3_delta_Preamble;
1031

Thomas Laurent's avatar
Thomas Laurent committed
1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
            if ((msg3_delta_Preamble<-1) || (msg3_delta_Preamble>6))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for msg3_delta_Preamble choice: -1..6 !\n",
                           RC.config_file_name, i, msg3_delta_Preamble);

            if (strcmp(pucch_deltaF_Format1,"deltaF_2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF_2;
            } else if (strcmp(pucch_deltaF_Format1,"deltaF0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF0;
            } else if (strcmp(pucch_deltaF_Format1,"deltaF2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1 choice: deltaF_2,dltaF0,deltaF2!\n",
                           RC.config_file_name, i, pucch_deltaF_Format1);

            if (strcmp(pucch_deltaF_Format1b,"deltaF1")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF1;
            } else if (strcmp(pucch_deltaF_Format1b,"deltaF3")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3;
            } else if (strcmp(pucch_deltaF_Format1b,"deltaF5")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format1b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF5;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format1b choice: deltaF1,dltaF3,deltaF5!\n",
                           RC.config_file_name, i, pucch_deltaF_Format1b);

            if (strcmp(pucch_deltaF_Format2,"deltaF_2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF_2;
            } else if (strcmp(pucch_deltaF_Format2,"deltaF0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0;
            } else if (strcmp(pucch_deltaF_Format2,"deltaF1")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF1;
            } else if (strcmp(pucch_deltaF_Format2,"deltaF2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF2;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2 choice: deltaF_2,dltaF0,deltaF1,deltaF2!\n",
                           RC.config_file_name, i, pucch_deltaF_Format2);

            if (strcmp(pucch_deltaF_Format2a,"deltaF_2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF_2;
            } else if (strcmp(pucch_deltaF_Format2a,"deltaF0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0;
            } else if (strcmp(pucch_deltaF_Format2a,"deltaF2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2a[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF2;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2a choice: deltaF_2,dltaF0,deltaF2!\n",
                           RC.config_file_name, i, pucch_deltaF_Format2a);

            if (strcmp(pucch_deltaF_Format2b,"deltaF_2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF_2;
            } else if (strcmp(pucch_deltaF_Format2b,"deltaF0")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;
            } else if (strcmp(pucch_deltaF_Format2b,"deltaF2")==0) {
              RRC_CONFIGURATION_REQ (msg_p).pucch_deltaF_Format2b[j] = DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF2;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for pucch_deltaF_Format2b choice: deltaF_2,dltaF0,deltaF2!\n",
                           RC.config_file_name, i, pucch_deltaF_Format2b);
1093

Thomas Laurent's avatar
Thomas Laurent committed
1094
            RRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_Preambles[j] = (rach_numberOfRA_Preambles/4)-1;
1095

Thomas Laurent's avatar
Thomas Laurent committed
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132
            if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>64) || ((rach_numberOfRA_Preambles&3)!=0))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_numberOfRA_Preambles choice: 4,8,12,...,64!\n",
                           RC.config_file_name, i, rach_numberOfRA_Preambles);

            if (strcmp(rach_preamblesGroupAConfig, "ENABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[j] = TRUE;
              RRC_CONFIGURATION_REQ (msg_p).rach_sizeOfRA_PreamblesGroupA[j] = (rach_sizeOfRA_PreamblesGroupA/4)-1;

              if ((rach_numberOfRA_Preambles <4) || (rach_numberOfRA_Preambles>60) || ((rach_numberOfRA_Preambles&3)!=0))
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_sizeOfRA_PreamblesGroupA choice: 4,8,12,...,60!\n",
                             RC.config_file_name, i, rach_sizeOfRA_PreamblesGroupA);

              switch (rach_messageSizeGroupA) {
                case 56:
                  RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b56;
                  break;

                case 144:
                  RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b144;
                  break;

                case 208:
                  RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b208;
                  break;

                case 256:
                  RRC_CONFIGURATION_REQ (msg_p).rach_messageSizeGroupA[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messageSizeGroupA_b256;
                  break;

                default:
                  AssertFatal (0,
                               "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_messageSizeGroupA choice: 56,144,208,256!\n",
                               RC.config_file_name, i, rach_messageSizeGroupA);
                  break;
              }
1133

Thomas Laurent's avatar
Thomas Laurent committed
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159
              if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_minusinfinity;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB0")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB0;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB5")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB5;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB8")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB8;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB10")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB10;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB12")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB12;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB15")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB15;
              } else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0) {
                RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB_dB18;
              } else
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n",
                             RC.config_file_name, i, rach_messagePowerOffsetGroupB);
            } else if (strcmp(rach_preamblesGroupAConfig, "DISABLE") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).rach_preamblesGroupAConfig[j] = FALSE;
            } else
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%s\" for rach_preamblesGroupAConfig choice: ENABLE,DISABLE !\n",
                           RC.config_file_name, i, rach_preamblesGroupAConfig);
1160

Thomas Laurent's avatar
Thomas Laurent committed
1161
            RRC_CONFIGURATION_REQ (msg_p).rach_preambleInitialReceivedTargetPower[j] = (rach_preambleInitialReceivedTargetPower+120)/2;
1162

Thomas Laurent's avatar
Thomas Laurent committed
1163 1164 1165 1166
            if ((rach_preambleInitialReceivedTargetPower<-120) || (rach_preambleInitialReceivedTargetPower>-90) || ((rach_preambleInitialReceivedTargetPower&1)!=0))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleInitialReceivedTargetPower choice: -120,-118,...,-90 !\n",
                           RC.config_file_name, i, rach_preambleInitialReceivedTargetPower);
1167

Thomas Laurent's avatar
Thomas Laurent committed
1168
            RRC_CONFIGURATION_REQ (msg_p).rach_powerRampingStep[j] = rach_powerRampingStep/2;
1169

Thomas Laurent's avatar
Thomas Laurent committed
1170 1171 1172 1173
            if ((rach_powerRampingStep<0) || (rach_powerRampingStep>6) || ((rach_powerRampingStep&1)!=0))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_powerRampingStep choice: 0,2,4,6 !\n",
                           RC.config_file_name, i, rach_powerRampingStep);
1174

Thomas Laurent's avatar
Thomas Laurent committed
1175
            switch (rach_preambleTransMax) {
1176
#if (RRC_VERSION < MAKE_VERSION(14, 0, 0))
1177

Thomas Laurent's avatar
Thomas Laurent committed
1178 1179 1180
              case 3:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3;
                break;
1181

Thomas Laurent's avatar
Thomas Laurent committed
1182 1183 1184
              case 4:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4;
                break;
1185

Thomas Laurent's avatar
Thomas Laurent committed
1186 1187 1188
              case 5:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5;
                break;
1189

Thomas Laurent's avatar
Thomas Laurent committed
1190 1191 1192
              case 6:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6;
                break;
1193

Thomas Laurent's avatar
Thomas Laurent committed
1194 1195 1196
              case 7:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7;
                break;
1197

Thomas Laurent's avatar
Thomas Laurent committed
1198 1199 1200
              case 8:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8;
                break;
1201

Thomas Laurent's avatar
Thomas Laurent committed
1202 1203 1204
              case 10:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10;
                break;
1205

Thomas Laurent's avatar
Thomas Laurent committed
1206 1207 1208
              case 20:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20;
                break;
1209

Thomas Laurent's avatar
Thomas Laurent committed
1210 1211 1212
              case 50:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50;
                break;
1213

Thomas Laurent's avatar
Thomas Laurent committed
1214 1215 1216
              case 100:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100;
                break;
1217

Thomas Laurent's avatar
Thomas Laurent committed
1218 1219 1220
              case 200:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200;
                break;
1221 1222
#else

Thomas Laurent's avatar
Thomas Laurent committed
1223 1224 1225
              case 3:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n3;
                break;
1226

Thomas Laurent's avatar
Thomas Laurent committed
1227 1228 1229
              case 4:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n4;
                break;
1230

Thomas Laurent's avatar
Thomas Laurent committed
1231 1232 1233
              case 5:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n5;
                break;
1234

Thomas Laurent's avatar
Thomas Laurent committed
1235 1236 1237
              case 6:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n6;
                break;
1238

Thomas Laurent's avatar
Thomas Laurent committed
1239 1240 1241
              case 7:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n7;
                break;
1242

Thomas Laurent's avatar
Thomas Laurent committed
1243 1244 1245
              case 8:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n8;
                break;
1246

Thomas Laurent's avatar
Thomas Laurent committed
1247 1248 1249
              case 10:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n10;
                break;
1250

Thomas Laurent's avatar
Thomas Laurent committed
1251 1252 1253
              case 20:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n20;
                break;
1254

Thomas Laurent's avatar
Thomas Laurent committed
1255 1256 1257
              case 50:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n50;
                break;
1258

Thomas Laurent's avatar
Thomas Laurent committed
1259 1260 1261
              case 100:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n100;
                break;
1262

Thomas Laurent's avatar
Thomas Laurent committed
1263 1264 1265
              case 200:
                RRC_CONFIGURATION_REQ (msg_p).rach_preambleTransMax[j] =  PreambleTransMax_n200;
                break;
1266 1267
#endif

Thomas Laurent's avatar
Thomas Laurent committed
1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847
              default:
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200!\n",
                             RC.config_file_name, i, rach_preambleTransMax);
                break;
            }

            RRC_CONFIGURATION_REQ (msg_p).rach_raResponseWindowSize[j] =  (rach_raResponseWindowSize==10)?7:rach_raResponseWindowSize-2;

            if ((rach_raResponseWindowSize<0)||(rach_raResponseWindowSize==9)||(rach_raResponseWindowSize>10))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_raResponseWindowSize choice: 2,3,4,5,6,7,8,10!\n",
                           RC.config_file_name, i, rach_preambleTransMax);

            RRC_CONFIGURATION_REQ (msg_p).rach_macContentionResolutionTimer[j] = (rach_macContentionResolutionTimer/8)-1;

            if ((rach_macContentionResolutionTimer<8) || (rach_macContentionResolutionTimer>64) || ((rach_macContentionResolutionTimer&7)!=0))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_macContentionResolutionTimer choice: 8,16,...,56,64!\n",
                           RC.config_file_name, i, rach_preambleTransMax);

            RRC_CONFIGURATION_REQ (msg_p).rach_maxHARQ_Msg3Tx[j] = rach_maxHARQ_Msg3Tx;

            if ((rach_maxHARQ_Msg3Tx<0) || (rach_maxHARQ_Msg3Tx>8))
              AssertFatal (0,
                           "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for rach_maxHARQ_Msg3Tx choice: 1..8!\n",
                           RC.config_file_name, i, rach_preambleTransMax);

            switch (pcch_defaultPagingCycle) {
              case 32:
                RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf32;
                break;

              case 64:
                RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf64;
                break;

              case 128:
                RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf128;
                break;

              case 256:
                RRC_CONFIGURATION_REQ (msg_p).pcch_defaultPagingCycle[j] = PCCH_Config__defaultPagingCycle_rf256;
                break;

              default:
                AssertFatal (0,
                             "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for pcch_defaultPagingCycle choice: 32,64,128,256!\n",
                             RC.config_file_name, i, pcch_defaultPagingCycle);
                break;
            }

            if (strcmp(pcch_nB, "fourT") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_fourT;
            } else if (strcmp(pcch_nB, "twoT") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_twoT;
            } else if (strcmp(pcch_nB, "oneT") == 0) {
              RRC_CONFIGURATION_REQ (msg_p).pcch_nB[j] = PCCH_Config__nB_oneT;
            } else if (strcmp(pcch_nB,