asn1_msg.c 137 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
Cedric Roux's avatar
Cedric Roux committed
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
22

/*! \file asn1_msg.c
23
* \brief primitives to build the asn1 messages
24
25
* \author Raymond Knopp and Navid Nikaein
* \date 2011
26
* \version 1.0
27
28
* \company Eurecom
* \email: raymond.knopp@eurecom.fr and  navid.nikaein@eurecom.fr
29
*/
30

31
32
#include <stdio.h>
#include <sys/types.h>
33
34
35
36
37
#include <stdlib.h> /* for atoi(3) */
#include <unistd.h> /* for getopt(3) */
#include <string.h> /* for strerror(3) */
#include <sysexits.h> /* for EX_* exit codes */
#include <errno.h>  /* for errno */
38
39
#include "UTIL/LOG/log.h"
#include <asn_application.h>
40
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
41
42
#include <per_encoder.h>

43
#include "assertions.h"
44
45
46
47
48
#include "RRCConnectionRequest.h"
#include "UL-CCCH-Message.h"
#include "UL-DCCH-Message.h"
#include "DL-CCCH-Message.h"
#include "DL-DCCH-Message.h"
49
50
#include "PCCH-Message.h"
#include "openair3/UTILS/conversions.h"
51
52
53
54
#include "EstablishmentCause.h"
#include "RRCConnectionSetup.h"
#include "SRB-ToAddModList.h"
#include "DRB-ToAddModList.h"
Cedric Roux's avatar
Cedric Roux committed
55
#if defined(Rel10) || defined(Rel14)
56
#include "MCCH-Message.h"
57
//#define MRB1 1
58
59
60
#endif

#include "RRC/LITE/defs.h"
61
#include "RRC/LITE/extern.h"
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "RRCConnectionSetupComplete.h"
#include "RRCConnectionReconfigurationComplete.h"
#include "RRCConnectionReconfiguration.h"
#include "MasterInformationBlock.h"
#include "SystemInformation.h"

#include "SystemInformationBlockType1.h"

#include "SIB-Type.h"

#include "BCCH-DL-SCH-Message.h"

#include "PHY/defs.h"

#include "MeasObjectToAddModList.h"
#include "ReportConfigToAddModList.h"
#include "MeasIdToAddModList.h"
79
#include "enb_config.h"
80

81
82
83
84
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif

85
#include "common/ran_context.h"
86
#include "secu_defs.h"
87

Mongazon's avatar
Mongazon committed
88
89
#if !defined (msg)
#define msg printf
90
91
#endif

92
//#define XER_PRINT
93

94
95
96
97
typedef struct xer_sprint_string_s {
  char *string;
  size_t string_size;
  size_t string_index;
98
99
} xer_sprint_string_t;

100
extern unsigned char NB_eNB_INST;
101
extern uint8_t usim_test;
102

103
104
extern RAN_CONTEXT_t RC;

105
106
uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8};
uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8},    // CellId 0
107
108
109
110
111
112
113
  {11,18,2,0,8,15}, // CellId 1
  {18,13,3,4,0,1},  // CellId 2
  {2,3,14,6,5,0},   // CellId 4
  {0,4,6,16,9,7},   // CellId 5
  {8,0,5,9,17,12},  // CellId 7
  {15,1,0,7,12,10}
};// CellId 8
114

115
116
117
118
119
120
/*
 * This is a helper function for xer_sprint, which directs all incoming data
 * into the provided string.
 */
static int xer__print2s (const void *buffer, size_t size, void *app_key)
{
121
122
123
124
125
126
  xer_sprint_string_t *string_buffer = (xer_sprint_string_t *) app_key;
  size_t string_remaining = string_buffer->string_size - string_buffer->string_index;

  if (string_remaining > 0) {
    if (size > string_remaining) {
      size = string_remaining;
127
    }
128

129
130
131
132
133
    memcpy(&string_buffer->string[string_buffer->string_index], buffer, size);
    string_buffer->string_index += size;
  }

  return 0;
134
135
}

136
int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr)
137
{
138
139
140
141
142
143
144
145
146
147
  asn_enc_rval_t er;
  xer_sprint_string_t string_buffer;

  string_buffer.string = string;
  string_buffer.string_size = string_size;
  string_buffer.string_index = 0;

  er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer);

  if (er.encoded < 0) {
Cedric Roux's avatar
Cedric Roux committed
148
    LOG_E(RRC, "xer_sprint encoding error (%zd)!", er.encoded);
149
150
151
    er.encoded = string_buffer.string_size;
  } else {
    if (er.encoded > string_buffer.string_size) {
Cedric Roux's avatar
Cedric Roux committed
152
      LOG_E(RRC, "xer_sprint string buffer too small, got %zd need %zd!", string_buffer.string_size, er.encoded);
153
      er.encoded = string_buffer.string_size;
154
    }
155
  }
156

157
  return er.encoded;
158
}
159

160
161
uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index)
{
162
163
  return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]);
}
164
/* This only works for the hexagonal topology...need a more general function for other topologies */
winckel's avatar
RRC:    
winckel committed
165

166
167
uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId)
{
winckel's avatar
RRC:    
winckel committed
168
  uint8_t i;
169
170

  for(i=0; i<7; i++) {
171
    if(two_tier_hexagonal_cellIds[i] == phyCellId) {
172
      return i;
173
    }
174
  }
175

176
177
178
  LOG_E(RRC,"\nCannot get adjacent cell mod id! Fatal error!\n");
  return 0xFF; //error!
}
winckel's avatar
RRC:    
winckel committed
179

180
uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame)
181
{
182
183

  asn_enc_rval_t enc_rval;
184
  BCCH_BCH_Message_t *mib=&carrier->mib ;
185
  uint8_t sfn = (uint8_t)((frame>>2)&0xff);
Cedric Roux's avatar
Cedric Roux committed
186
187
  uint16_t *spare= calloc(1, sizeof(uint16_t));
  if (spare == NULL) abort();
188

189
  switch (N_RB_DL) {
190
191

  case 6:
192
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6;
193
    break;
194

195
  case 15:
196
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15;
197
    break;
198

199
  case 25:
200
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25;
201
    break;
202

203
  case 50:
204
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50;
205
    break;
206

207
  case 75:
208
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75;
209
    break;
210

211
  case 100:
212
    mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100;
213
214
    break;
  default:
215
    AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL);
216
217
  }

218
219
  AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n");
  mib->message.phich_Config.phich_Resource = phich_Resource;
Xu Bo's avatar
Xu Bo committed
220
  AssertFatal(phich_duration <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n");
221
  mib->message.phich_Config.phich_Duration = phich_duration;
222
223
224
225
  LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n",
         (uint32_t)mib->message.dl_Bandwidth,
         (uint32_t)phich_duration,
         (uint32_t)phich_Resource,
226
         (uint32_t)sfn);
227

228
229
230
  mib->message.systemFrameNumber.buf = &sfn;
  mib->message.systemFrameNumber.size = 1;
  mib->message.systemFrameNumber.bits_unused=0;
Cedric Roux's avatar
Cedric Roux committed
231
  mib->message.spare.buf = (uint8_t *)spare;
232
#ifndef Rel14
233
234
  mib->message.spare.size = 2;
  mib->message.spare.bits_unused = 6;  // This makes a spare of 10 bits
235
236
237
238
239
#else
  mib->message.spare.size = 1;
  mib->message.spare.bits_unused = 3;  // This makes a spare of 5 bits
  mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC
#endif
240
241

  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message,
242
                                   (void*)mib,
Cedric Roux's avatar
Cedric Roux committed
243
244
                                   carrier->MIB,
                                   24);
knopp's avatar
   
knopp committed
245
  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
246
               enc_rval.failed_type->name, enc_rval.encoded);
247

248
  /*
249
250
251
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
  {
252
    char        message_string[20000];
253
254
    size_t      message_string_size;

255
    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_BCH_Message, (void *) &mib)) > 0) {
256
      MessageDef *msg_p;
257

winckel's avatar
winckel committed
258
259
260
      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
      msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
      memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
261

262
      itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p);
263
264
265
266
    }
  }
# endif
#endif
267
  */
268
  if (enc_rval.encoded==-1) {
269
    return(-1);
270
  }
271

272
273
  return((enc_rval.encoded+7)/8);
}
winckel's avatar
RRC:    
winckel committed
274

275
276
uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
		int Mod_id,int CC_id
winckel's avatar
winckel committed
277
#if defined(ENABLE_ITTI)
278
                , RrcConfigurationReq *configuration
winckel's avatar
winckel committed
279
#endif
280
281
               )
{
282
283
284

  //  SystemInformation_t systemInformation;
  PLMN_IdentityInfo_t PLMN_identity_info;
winckel's avatar
winckel committed
285
  MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3];
286
287
288
289
  asn_enc_rval_t enc_rval;
  SchedulingInfo_t schedulingInfo;
  SIB_Type_t sib_type;

290
291
292
293
294
  uint8_t *buffer                      = carrier->SIB1;
  BCCH_DL_SCH_Message_t *bcch_message  = &carrier->siblock1;
  SystemInformationBlockType1_t **sib1 = &carrier->sib1;

  
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
  memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t));
  bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1;
  bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1;
  //  memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t));

  *sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1;

  memset(&PLMN_identity_info,0,sizeof(PLMN_IdentityInfo_t));
  memset(&schedulingInfo,0,sizeof(SchedulingInfo_t));
  memset(&sib_type,0,sizeof(SIB_Type_t));



  PLMN_identity_info.plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info.plmn_Identity.mcc));
  memset(PLMN_identity_info.plmn_Identity.mcc,0,sizeof(*PLMN_identity_info.plmn_Identity.mcc));

  asn_set_empty(&PLMN_identity_info.plmn_Identity.mcc->list);//.size=0;

winckel's avatar
winckel committed
313
314
315
316
317
318
319
320
321
322
323
324
#if defined(ENABLE_ITTI)
  dummy_mcc[0] = (configuration->mcc / 100) % 10;
  dummy_mcc[1] = (configuration->mcc / 10) % 10;
  dummy_mcc[2] = (configuration->mcc / 1) % 10;
#else
  dummy_mcc[0] = 0;
  dummy_mcc[1] = 0;
  dummy_mcc[2] = 1;
#endif
  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[0]);
  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[1]);
  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[2]);
325
326
327

  PLMN_identity_info.plmn_Identity.mnc.list.size=0;
  PLMN_identity_info.plmn_Identity.mnc.list.count=0;
winckel's avatar
winckel committed
328
#if defined(ENABLE_ITTI)
329

winckel's avatar
winckel committed
330
  if (configuration->mnc >= 100) {
331
332
333
334
335
336
337
338
339
340
    dummy_mnc[0] = (configuration->mnc / 100) % 10;
    dummy_mnc[1] = (configuration->mnc / 10) % 10;
    dummy_mnc[2] = (configuration->mnc / 1) % 10;
  } else {
    if (configuration->mnc_digit_length == 2) {
      dummy_mnc[0] = (configuration->mnc / 10) % 10;
      dummy_mnc[1] = (configuration->mnc / 1) % 10;
      dummy_mnc[2] = 0xf;
    } else {
      dummy_mnc[0] = (configuration->mnc / 100) % 100;
winckel's avatar
winckel committed
341
342
      dummy_mnc[1] = (configuration->mnc / 10) % 10;
      dummy_mnc[2] = (configuration->mnc / 1) % 10;
343
    }
winckel's avatar
winckel committed
344
  }
345

winckel's avatar
winckel committed
346
347
348
349
350
351
352
#else
  dummy_mnc[0] = 0;
  dummy_mnc[1] = 1;
  dummy_mnc[2] = 0xf;
#endif
  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[0]);
  ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[1]);
353

winckel's avatar
winckel committed
354
355
356
357
  if (dummy_mnc[2] != 0xf) {
    ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[2]);
  }

358
359
360
361
362
363
364
365
  //assign_enum(&PLMN_identity_info.cellReservedForOperatorUse,PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved);
  PLMN_identity_info.cellReservedForOperatorUse=PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved;

  ASN_SEQUENCE_ADD(&(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list,&PLMN_identity_info);


  // 16 bits
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2);
winckel's avatar
winckel committed
366
367
368
369
370
371
372
#if defined(ENABLE_ITTI)
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = (configuration->tac >> 8) & 0xff;
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = (configuration->tac >> 0) & 0xff;
#else
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = 0x00;
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = 0x01;
#endif
373
374
375
376
377
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2;
  (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0;

  // 28 bits
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8);
winckel's avatar
winckel committed
378
379
380
381
382
383
384
385
386
387
388
#if defined(ENABLE_ITTI)
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = (configuration->cell_identity >> 20) & 0xff;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = (configuration->cell_identity >> 12) & 0xff;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = (configuration->cell_identity >>  4) & 0xff;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = (configuration->cell_identity <<  4) & 0xf0;
#else
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = 0x00;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = 0x00;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = 0x00;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = 0x10;
#endif
389
390
391
392
393
394
395
396
397
398
399
400
  (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4;
  (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4;

  //  assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred);
  (*sib1)->cellAccessRelatedInfo.cellBarred=SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred;

  //  assign_enum(&(*sib1)->cellAccessRelatedInfo.intraFreqReselection,SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_allowed);
  (*sib1)->cellAccessRelatedInfo.intraFreqReselection=SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed;
  (*sib1)->cellAccessRelatedInfo.csg_Indication=0;

  (*sib1)->cellSelectionInfo.q_RxLevMin=-65;
  (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL;
401
  //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t));
402
  //*((*sib1)->p_Max) = 23;
403
404
  (*sib1)->freqBandIndicator =
#if defined(ENABLE_ITTI)
405
    configuration->eutra_band[CC_id];
406
#else
407
    7;
408
#endif
409
410
411
412
413
414
415
416
417

  schedulingInfo.si_Periodicity=SchedulingInfo__si_Periodicity_rf8;

  // This is for SIB2/3
  sib_type=SIB_Type_sibType3;
  ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type);
  ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo);

  //  ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL);
418

419
#if defined(ENABLE_ITTI)
420

421
  if (configuration->frame_type[CC_id] == TDD)
422
423
#endif
  {
424
    (*sib1)->tdd_Config =                             CALLOC(1,sizeof(struct TDD_Config));
425

426
    (*sib1)->tdd_Config->subframeAssignment =
427
#if defined(ENABLE_ITTI)
428
      configuration->tdd_config[CC_id];
429
#else
430
      3;
431
#endif
432

433
    (*sib1)->tdd_Config->specialSubframePatterns =
434
#if defined(ENABLE_ITTI)
435
      configuration->tdd_config_s[CC_id];
436
#else
437
    0;
438
#endif
439
  }
440
441
442
443
444
445
446
447
448

  (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20;
  (*sib1)->systemInfoValueTag=0;
  //  (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension));

#ifdef XER_PRINT
  xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message);
#endif
  enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message,
winckel's avatar
winckel committed
449
450
451
                                   (void*)bcch_message,
                                   buffer,
                                   100);
knopp's avatar
   
knopp committed
452
  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
453
               enc_rval.failed_type->name, enc_rval.encoded);
winckel's avatar
winckel committed
454
455
456
457
458
459
460

#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
  {
    char        message_string[10000];
    size_t      message_string_size;

461
    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) {
462
      MessageDef *msg_p;
winckel's avatar
winckel committed
463

winckel's avatar
winckel committed
464
465
466
      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
      msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
      memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
467
      itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
winckel's avatar
winckel committed
468
469
470
471
472
    }
  }
# endif
#endif

Cedric Roux's avatar
Cedric Roux committed
473
  LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
474

475
  if (enc_rval.encoded==-1) {
476
    return(-1);
477
  }
478

479
480
481
482
  return((enc_rval.encoded+7)/8);
}

uint8_t do_SIB23(uint8_t Mod_id,
483

484
                 int CC_id
485
#if defined(ENABLE_ITTI)
486
                 , RrcConfigurationReq *configuration
487
#endif
488
489
                )
{
490
  struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part;
Cedric Roux's avatar
Cedric Roux committed
491
#if defined(Rel10) || defined(Rel14)
492
  struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part;
493
494
  MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList;
  MBSFN_AreaInfoList_r9_t *MBSFNArea_list;
495
  struct MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2;
496
497
498
#endif
  asn_enc_rval_t enc_rval;

499
500
501
502
  uint8_t                           *buffer       = RC.rrc[Mod_id]->carrier[CC_id].SIB23;
  BCCH_DL_SCH_Message_t             *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation;
  SystemInformationBlockType2_t     **sib2        = &RC.rrc[Mod_id]->carrier[CC_id].sib2;
  SystemInformationBlockType3_t     **sib3        = &RC.rrc[Mod_id]->carrier[CC_id].sib3;
503
#if defined(Rel10) || defined(Rel14)
504
505
506
507
  SystemInformationBlockType13_r9_t **sib13       = &RC.rrc[Mod_id]->carrier[CC_id].sib13;
  uint8_t                           MBMS_flag     = RC.rrc[Mod_id]->carrier[CC_id].MBMS_flag;
#endif

508
  if (bcch_message) {
509
    memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t));
510
  } else {
winckel's avatar
winckel committed
511
    LOG_E(RRC,"[eNB %d] BCCH_MESSAGE is null, exiting\n", Mod_id);
512
513
514
515
    exit(-1);
  }

  if (!sib2) {
winckel's avatar
winckel committed
516
    LOG_E(RRC,"[eNB %d] sib2 is null, exiting\n", Mod_id);
517
518
519
520
    exit(-1);
  }

  if (!sib3) {
winckel's avatar
winckel committed
521
    LOG_E(RRC,"[eNB %d] sib3 is null, exiting\n", Mod_id);
522
523
    exit(-1);
  }
524

Cedric Roux's avatar
Cedric Roux committed
525
#if defined(Rel10) || defined(Rel14)
winckel's avatar
winckel committed
526
  LOG_I(RRC,"[eNB %d] Configuration SIB2/3, MBMS = %d\n", Mod_id, MBMS_flag);
527
#else
winckel's avatar
winckel committed
528
  LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id);
529
#endif
530
531
532
533
  sib2_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
  sib3_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
  memset(sib2_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
  memset(sib3_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
534

535
536
  sib2_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2;
  sib3_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3;
537
538
539
540

  *sib2 = &sib2_part->choice.sib2;
  *sib3 = &sib3_part->choice.sib3;

Cedric Roux's avatar
Cedric Roux committed
541
#if defined(Rel10) || defined(Rel14)
542

543
  if (MBMS_flag > 0) {
544
545
546
    sib13_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
    memset(sib13_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member));
    sib13_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920;
547
548
    *sib13 = &sib13_part->choice.sib13_v920;
  }
549

550
551
552
553
554
#endif

  // sib2

  (*sib2)->ac_BarringInfo = NULL;
Cedric Roux's avatar
Cedric Roux committed
555
#if defined(Rel10) || defined(Rel14)
556
#if 0
557
558
559
560
  (*sib2)->ssac_BarringForMMTEL_Voice_r9 = NULL;
  (*sib2)->ssac_BarringForMMTEL_Video_r9 = NULL;
  (*sib2)->ac_BarringForCSFB_r10 = NULL;
#endif
561
562
563
  (*sib2)->ext1 = NULL;
  (*sib2)->ext2 = NULL;
#endif
564

knopp's avatar
knopp committed
565
566
#if defined(ENABLE_ITTI)

567
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles                         = configuration->rach_numberOfRA_Preambles[CC_id];
knopp's avatar
knopp committed
568
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig                        = NULL;
569

570
  if (configuration->rach_preamblesGroupAConfig[CC_id]) {
571
572
573
    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig
      = CALLOC(1,sizeof(struct RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig));
    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA
574
      = configuration->rach_sizeOfRA_PreamblesGroupA[CC_id];
575
    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA
576
      = configuration->rach_messageSizeGroupA[CC_id];
knopp's avatar
knopp committed
577
    (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB
578
      = configuration->rach_messagePowerOffsetGroupB[CC_id];
knopp's avatar
knopp committed
579
  }
580

581
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep                   = configuration->rach_powerRampingStep[CC_id];
582
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower =
583
584
585
    configuration->rach_preambleInitialReceivedTargetPower[CC_id];
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax                       = configuration->rach_preambleTransMax[CC_id];
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize                  = configuration->rach_raResponseWindowSize[CC_id];
586
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer          =
587
588
    configuration->rach_macContentionResolutionTimer[CC_id];
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx                                            = configuration->rach_maxHARQ_Msg3Tx[CC_id];
knopp's avatar
knopp committed
589
590

  // BCCH-Config
591
  (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff
592
    = configuration->bcch_modificationPeriodCoeff[CC_id];
knopp's avatar
knopp committed
593
594

  // PCCH-Config
595
  (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle
596
    = configuration->pcch_defaultPagingCycle[CC_id];
597
  (*sib2)->radioResourceConfigCommon.pcch_Config.nB
598
    = configuration->pcch_nB[CC_id];
knopp's avatar
knopp committed
599
600

  // PRACH-Config
601
  (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex
602
    = configuration->prach_root[CC_id];
603
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex
604
    = configuration->prach_config_index[CC_id];
605
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag
606
    = configuration->prach_high_speed[CC_id];
607
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig
608
    = configuration->prach_zero_correlation[CC_id];
609
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset
610
    = configuration->prach_freq_offset[CC_id];
knopp's avatar
knopp committed
611
612
613

  // PDSCH-Config
  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower
614
    = configuration->pdsch_referenceSignalPower[CC_id];
knopp's avatar
knopp committed
615
  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b
616
    = configuration->pdsch_p_b[CC_id];
knopp's avatar
knopp committed
617
618

  // PUSCH-Config
619
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB
620
    = configuration->pusch_n_SB[CC_id];
knopp's avatar
knopp committed
621
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode
622
    = configuration->pusch_hoppingMode[CC_id];
knopp's avatar
knopp committed
623
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset
624
    = configuration->pusch_hoppingOffset[CC_id];
knopp's avatar
knopp committed
625
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM
626
    = configuration->pusch_enable64QAM[CC_id];
knopp's avatar
knopp committed
627
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled
628
    = configuration->pusch_groupHoppingEnabled[CC_id];
knopp's avatar
knopp committed
629
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH
630
    = configuration->pusch_groupAssignment[CC_id];
knopp's avatar
knopp committed
631
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled
632
    = configuration->pusch_sequenceHoppingEnabled[CC_id];
knopp's avatar
knopp committed
633
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift
634
    = configuration->pusch_nDMRS1[CC_id];
knopp's avatar
knopp committed
635
636
637
638

  // PUCCH-Config

  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift
639
    = configuration->pucch_delta_shift[CC_id];
640
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI
641
    = configuration->pucch_nRB_CQI[CC_id];
642
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN
643
    = configuration->pucch_nCS_AN[CC_id];
644
//#if !defined(Rel10) && !defined(Rel14)
645
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN
646
    = configuration->pucch_n1_AN[CC_id];
647
//#endif
knopp's avatar
knopp committed
648
649

  // SRS Config
650
  if (configuration->srs_enable[CC_id]==1) {
knopp's avatar
knopp committed
651
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present
652
      = SoundingRS_UL_ConfigCommon_PR_setup;
knopp's avatar
knopp committed
653
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig
654
      = configuration->srs_BandwidthConfig[CC_id];
knopp's avatar
knopp committed
655
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig
656
      = configuration->srs_SubframeConfig[CC_id];
knopp's avatar
knopp committed
657
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission
658
      = configuration->srs_ackNackST[CC_id];
659

660
    if (configuration->srs_MaxUpPts[CC_id]) {
knopp's avatar
knopp committed
661
      (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts
662
        = CALLOC(1,sizeof(long));
knopp's avatar
knopp committed
663
      *(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts=1;
664
    } else {
knopp's avatar
knopp committed
665
666
      (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL;
    }
667
    RC.rrc[Mod_id]->srs_enable[CC_id] = 1;
668
  } else {
669
    RC.rrc[Mod_id]->srs_enable[CC_id] = 0;
knopp's avatar
knopp committed
670
671
672
673
674
675
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release;
    (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0;
  }

  // uplinkPowerControlCommon

676
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH
677
    = configuration->pusch_p0_Nominal[CC_id];
678
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH
679
    = configuration->pucch_p0_Nominal[CC_id];
680
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha
681
    = configuration->pusch_alpha[CC_id];
knopp's avatar
knopp committed
682
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1
683
    = configuration->pucch_deltaF_Format1[CC_id];
knopp's avatar
knopp committed
684
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b
685
    = configuration->pucch_deltaF_Format1b[CC_id];
knopp's avatar
knopp committed
686
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2
687
    = configuration->pucch_deltaF_Format2[CC_id];
knopp's avatar
knopp committed
688
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a
689
    = configuration->pucch_deltaF_Format2a[CC_id];
knopp's avatar
knopp committed
690
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b
691
    = configuration->pucch_deltaF_Format2b[CC_id];
knopp's avatar
knopp committed
692
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3
693
    = configuration->msg3_delta_Preamble[CC_id];
knopp's avatar
knopp committed
694
  (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength
695
    = configuration->ul_CyclicPrefixLength[CC_id];
knopp's avatar
knopp committed
696
697
698
699

  // UE Timers and Constants

  (*sib2)->ue_TimersAndConstants.t300
700
    = configuration->ue_TimersAndConstants_t300[CC_id];
knopp's avatar
knopp committed
701
  (*sib2)->ue_TimersAndConstants.t301
702
    = configuration->ue_TimersAndConstants_t301[CC_id];
knopp's avatar
knopp committed
703
  (*sib2)->ue_TimersAndConstants.t310
704
    = configuration->ue_TimersAndConstants_t310[CC_id];
knopp's avatar
knopp committed
705
  (*sib2)->ue_TimersAndConstants.n310
706
    = configuration->ue_TimersAndConstants_n310[CC_id];
knopp's avatar
knopp committed
707
  (*sib2)->ue_TimersAndConstants.t311
708
    = configuration->ue_TimersAndConstants_t311[CC_id];
knopp's avatar
knopp committed
709
  (*sib2)->ue_TimersAndConstants.n311
710
    = configuration->ue_TimersAndConstants_n311[CC_id];
knopp's avatar
knopp committed
711
712

#else
713
714
715
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64;
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL;
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2;
716
717
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower=
    RACH_ConfigCommon__powerRampingParameters__preambleInitialReceivedTargetPower_dBm_100;
718
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10;
knopp's avatar
knopp committed
719
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10;
720
721
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer=
    RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48;
722
723
724
725
726
727
  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4;

  // BCCH-Config
  (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2;

  // PCCH-Config
knopp's avatar
knopp committed
728
  (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = PCCH_Config__defaultPagingCycle_rf128;
729
730
731
732
733
734
735
736
737
738
  (*sib2)->radioResourceConfigCommon.pcch_Config.nB=PCCH_Config__nB_oneT;

  // PRACH-Config
  (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384;
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3;
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0;
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12;
  (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 2;

  // PDSCH-Config
knopp's avatar
   
knopp committed
739
  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0;  // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz
knopp's avatar
knopp committed
740

741

742
  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0;
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

  // PUSCH-Config
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset=0;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM=0;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled=1;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH=0;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled=0;
  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift=0;

  // PUCCH-Config

  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1;
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = 1;
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = 0;
  (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = 32;


  (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release;
  (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0;

  // uplinkPowerControlCommon

  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108;
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108;
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=UplinkPowerControlCommon__alpha_al1;
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2;
  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3;

  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0;

  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0;

  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;

  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6;

  (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1;

  (*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000;

  (*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000;

  (*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000;

  (*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20;

  (*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000;

  (*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1;

knopp's avatar
knopp committed
795
796
#endif

797
798
799
800
801
  (*sib2)->freqInfo.additionalSpectrumEmission = 1;
  (*sib2)->freqInfo.ul_CarrierFreq = NULL;
  (*sib2)->freqInfo.ul_Bandwidth = NULL;
  //  (*sib2)->mbsfn_SubframeConfigList = NULL;

Cedric Roux's avatar
Cedric Roux committed
802
#if defined(Rel10) || defined(Rel14)
803

804
  if (MBMS_flag > 0) {
805
    LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2\n");
806
807
808
    MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1;
    (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct MBSFN_SubframeConfigList));
    MBSFNSubframeConfigList = (*sib2)->mbsfn_SubframeConfigList;
809

810
811
    sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1));
    memset((void*)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1));
812

813
814
815
816
817
818
    sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
    sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset= 1;
    sib2_mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1;
    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2;
819

820
    sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2;
821

822
    ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1);
823

824
825
826
827
828
    if (MBMS_flag == 4 ) {
      LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n");
      MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2;
      sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2));
      memset((void*)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2));
829

830
831
832
833
834
835
      sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4;
      sib2_mbsfn_SubframeConfig2->radioframeAllocationOffset= 1;
      sib2_mbsfn_SubframeConfig2->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame;
      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf= MALLOC(1);
      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1;
      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2;
836

837
838
      sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2;
     
839

840
841
      ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2);
    }
842
  }
843

844
#else // no MBMS transmission
845
  (*sib2)->mbsfn_SubframeConfigList = NULL;
846
#endif
847

gauthier's avatar
gauthier committed
848
  (*sib2)->timeAlignmentTimerCommon=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120;
849
850

  /// (*SIB3)
Cedric Roux's avatar
Cedric Roux committed
851
#if defined(Rel10) || defined(Rel14)
852
853
  (*sib3)->ext1 = NULL;
#if 0
854
855
856
857
  (*sib3)->s_IntraSearch_v920=NULL;
  (*sib3)->s_NonIntraSearch_v920=NULL;
  (*sib3)->q_QualMin_r9=NULL;
  (*sib3)->threshServingLowQ_r9=NULL;
858
#endif
859
860
861
862
863
864
865
866
867
868
869
#endif
  (*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4;

  (*sib3)->cellReselectionInfoCommon.speedStateReselectionPars=NULL;

  (*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL;
  (*sib3)->cellReselectionServingFreqInfo.threshServingLow=31;
  (*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7;

  (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70;
  (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL;
nikaeinn's avatar
nikaeinn committed
870
  (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch));
871
872
873
  *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31;
  (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth));

874
  *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = AllowedMeasBandwidth_mbw6;
875
876
877
878
879
880
881
882
883
884
885

  (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0;
  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1);
  (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1;
  (*sib3)->intraFreqCellReselectionInfo.neighC