main.c 17.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*******************************************************************************

  Eurecom OpenAirInterface
  Copyright(c) 1999 - 2010 Eurecom

  This program is free software; you can redistribute it and/or modify it
  under the terms and conditions of the GNU General Public License,
  version 2, as published by the Free Software Foundation.

  This program is distributed in the hope it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  more details.

  You should have received a copy of the GNU General Public License along with
  this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.

  The full GNU General Public License is included in this distribution in
  the file called "COPYING".

  Contact Information
  Openair Admin: openair_admin@eurecom.fr
  Openair Tech : openair_tech@eurecom.fr
  Forums       : http://forums.eurecom.fsr/openairinterface
  Address      : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France

gauthier's avatar
gauthier committed
28
 *******************************************************************************/
29
/*! \file main.c
gauthier's avatar
gauthier committed
30 31 32 33 34 35
 * \brief top init of Layer 2
 * \author Raymond Knopp and Navid Nikaein
 * \date 2011
 * \version 0.5
 * \email: navid.nikaein@eurecom.fr
 * @ingroup _mac
36

gauthier's avatar
gauthier committed
37
 */
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

#ifdef USER_MODE
#include "LAYER2/register.h"
#else
#ifdef KERNEL2_6
//#include <linux/config.h>
#include <linux/slab.h>
#endif

#ifdef KERNEL2_4
#include <linux/malloc.h>
#include <linux/wrapper.h>
#endif


#endif //USER_MODE

#include "defs.h"
#include "extern.h"
gauthier's avatar
gauthier committed
57
#include "assertions.h"
58 59 60 61
#include "PHY_INTERFACE/extern.h"
#include "PHY_INTERFACE/defs.h"
#include "PHY/defs.h"
#include "SCHED/defs.h"
gauthier's avatar
gauthier committed
62
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
63 64 65 66 67 68 69 70 71 72
#include "RRC/LITE/defs.h"
#include "UTIL/LOG/log.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h"
#endif //PHY_EMUL

#include "SCHED/defs.h"

/***********************************************************************/
gauthier's avatar
gauthier committed
73 74 75 76 77 78
void dl_phy_sync_success(module_id_t   module_idP,
    frame_t       frameP,
    unsigned char eNB_index,
    u8            first_sync){  //init as MR
  /***********************************************************************/
  LOG_D(MAC,"[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n", module_idP, frameP, eNB_index);
79
  if (first_sync==1) {
gauthier's avatar
gauthier committed
80 81
      layer2_init_UE(module_idP);
      openair_rrc_ue_init(module_idP,eNB_index);
82 83
  }
  else {
gauthier's avatar
gauthier committed
84
      mac_in_sync_ind(module_idP,frameP,eNB_index);
85
  }
gauthier's avatar
gauthier committed
86

87 88 89
}

/***********************************************************************/
gauthier's avatar
gauthier committed
90
void mrbch_phy_sync_failure(module_id_t module_idP, frame_t frameP, u8 free_eNB_index){//init as CH
91
  /***********************************************************************/
gauthier's avatar
gauthier committed
92 93 94
  LOG_I(MAC,"[eNB %d] Frame %d: PHY Sync failure \n",module_idP,frameP);
  layer2_init_eNB(module_idP, free_eNB_index);
  openair_rrc_eNB_init(module_idP);
95 96
}

gauthier's avatar
gauthier committed
97
char layer2_init_eNB(module_id_t module_idP, unsigned char eNB_index){
98 99 100 101 102 103

  return 0;

}

/***********************************************************************/
gauthier's avatar
gauthier committed
104 105
char layer2_init_UE(module_id_t module_idP){

106 107 108 109
  return 0;
}

/***********************************************************************/
gauthier's avatar
gauthier committed
110 111
void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP, u16 eNB_index){
  /***********************************************************************/
112

gauthier's avatar
gauthier committed
113
  //  Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
114 115 116 117
}


/***********************************************************************/
118
int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
gauthier's avatar
gauthier committed
119 120
  /***********************************************************************/
  module_id_t    Mod_id,i,j;
121 122
  RA_TEMPLATE *RA_template;
  UE_TEMPLATE *UE_template;
123
  int size_bytes1,size_bytes2,size_bits1,size_bits2;
124 125 126

  LOG_I(MAC,"[MAIN] Init function start:Nb_UE_INST=%d\n",NB_UE_INST);
  if (NB_UE_INST>0) {
gauthier's avatar
gauthier committed
127 128 129 130 131 132 133 134 135 136 137
      UE_mac_inst = (UE_MAC_INST*)malloc16(NB_UE_INST*sizeof(UE_MAC_INST));
      if (UE_mac_inst == NULL) {
          LOG_C(MAC,"[MAIN] Can't ALLOCATE %d Bytes for %d UE_MAC_INST with size %d \n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,sizeof(UE_MAC_INST));
          mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n");
      }
      LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);

      bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
      for(i=0;i<NB_UE_INST; i++)
        ue_init_mac(i);

138 139 140
  }
  else 
    UE_mac_inst = NULL;
gauthier's avatar
gauthier committed
141

142 143
  LOG_I(MAC,"[MAIN] Init function start:Nb_eNB_INST=%d\n",NB_eNB_INST);
  if (NB_eNB_INST>0) {
gauthier's avatar
gauthier committed
144 145 146 147 148 149 150
      eNB_mac_inst = (eNB_MAC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST));
      if (eNB_mac_inst == NULL){
          LOG_D(MAC,"[MAIN] can't ALLOCATE %d Bytes for %d eNB_MAC_INST with size %d \n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,sizeof(eNB_MAC_INST));
          mac_xface->macphy_exit("[MAC][MAIN] not enough memory for eNB \n");
      }
      LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d eNB_MAC_INST @ %p\n",NB_eNB_INST*sizeof(eNB_MAC_INST),NB_eNB_INST,eNB_mac_inst);
      bzero(eNB_mac_inst,NB_eNB_INST*sizeof(eNB_MAC_INST));
151 152 153
  }
  else
    eNB_mac_inst = NULL;
gauthier's avatar
gauthier committed
154

155 156 157
  for(Mod_id=0;Mod_id<NB_eNB_INST;Mod_id++){

#ifdef PHY_EMUL
gauthier's avatar
gauthier committed
158
      Mac_rlc_xface->Is_cluster_head[Mod_id]=2;//0: MR, 1: CH, 2: not CH neither MR
159
#endif
gauthier's avatar
gauthier committed
160
      /*#ifdef Rel10
161 162 163 164
    int n;
    for (n=0;n<4096;n++)
      eNB_mac_inst[Mod_id].MCH_pdu.payload[n] = taus();
    //    Mac_rlc_xface->Node_id[Mod_id]=NODE_ID[Mod_id];
165
    #endif*/
166 167 168 169 170
  }
  //  Mac_rlc_xface->frame=Mac_rlc_xface->frame;


  if (Is_rrc_registered == 1){
gauthier's avatar
gauthier committed
171
      LOG_I(MAC,"[MAIN] calling RRC\n");
172
#ifndef CELLULAR //nothing to be done yet for cellular
gauthier's avatar
gauthier committed
173
      openair_rrc_top_init(eMBMS_active, cba_group_active,HO_active);
174 175
#endif
  }
gauthier's avatar
gauthier committed
176
  else {
177
      LOG_I(MAC,"[MAIN] Running without an RRC\n");
gauthier's avatar
gauthier committed
178
  }
179 180 181
#ifndef USER_MODE
#ifndef PHY_EMUL
  LOG_I(MAC,"[MAIN] add openair2 proc\n");
gauthier's avatar
gauthier committed
182
  ////  add_openair2_stats();
183 184 185 186 187 188 189 190
#endif
#endif

  init_transport_channels(2);

  // Set up DCIs for TDD 5MHz Config 1..6

  for (i=0;i<NB_eNB_INST;i++) {
gauthier's avatar
gauthier committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
      LOG_D(MAC,"[MAIN][eNB %d] initializing RA_template\n",i);
      LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i);

      RA_template = (RA_TEMPLATE *)&eNB_mac_inst[i].RA_template[0];
      for (j=0;j<NB_RA_PROC_MAX;j++) {
          if (mac_xface->lte_frame_parms->frame_type == TDD) {
              switch (mac_xface->lte_frame_parms->N_RB_DL) {
              case 6:
                size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
                size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
                size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
                size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
                break;
              case 25:
                size_bytes1 = sizeof(DCI1A_5MHz_TDD_1_6_t);
                size_bytes2 = sizeof(DCI1A_5MHz_TDD_1_6_t);
                size_bits1 = sizeof_DCI1A_5MHz_TDD_1_6_t;
                size_bits2 = sizeof_DCI1A_5MHz_TDD_1_6_t;
                break;
              case 50:
                size_bytes1 = sizeof(DCI1A_10MHz_TDD_1_6_t);
                size_bytes2 = sizeof(DCI1A_10MHz_TDD_1_6_t);
                size_bits1 = sizeof_DCI1A_10MHz_TDD_1_6_t;
                size_bits2 = sizeof_DCI1A_10MHz_TDD_1_6_t;
                break;
              case 100:
                size_bytes1 = sizeof(DCI1A_20MHz_TDD_1_6_t);
                size_bytes2 = sizeof(DCI1A_20MHz_TDD_1_6_t);
                size_bits1 = sizeof_DCI1A_20MHz_TDD_1_6_t;
                size_bits2 = sizeof_DCI1A_20MHz_TDD_1_6_t;
                break;
              default:
                size_bytes1 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
                size_bytes2 = sizeof(DCI1A_1_5MHz_TDD_1_6_t);
                size_bits1 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
                size_bits2 = sizeof_DCI1A_1_5MHz_TDD_1_6_t;
                break;
              }

          }
          else {
              switch (mac_xface->lte_frame_parms->N_RB_DL) {
              case 6:
                size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
                size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
                size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
                size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
                break;
              case 25:
                size_bytes1 = sizeof(DCI1A_5MHz_FDD_t);
                size_bytes2 = sizeof(DCI1A_5MHz_FDD_t);
                size_bits1 = sizeof_DCI1A_5MHz_FDD_t;
                size_bits2 = sizeof_DCI1A_5MHz_FDD_t;
                break;
              case 50:
                size_bytes1 = sizeof(DCI1A_10MHz_FDD_t);
                size_bytes2 = sizeof(DCI1A_10MHz_FDD_t);
                size_bits1 = sizeof_DCI1A_10MHz_FDD_t;
                size_bits2 = sizeof_DCI1A_10MHz_FDD_t;
                break;
              case 100:
                size_bytes1 = sizeof(DCI1A_20MHz_FDD_t);
                size_bytes2 = sizeof(DCI1A_20MHz_FDD_t);
                size_bits1 = sizeof_DCI1A_20MHz_FDD_t;
                size_bits2 = sizeof_DCI1A_20MHz_FDD_t;
                break;
              default:
                size_bytes1 = sizeof(DCI1A_1_5MHz_FDD_t);
                size_bytes2 = sizeof(DCI1A_1_5MHz_FDD_t);
                size_bits1 = sizeof_DCI1A_1_5MHz_FDD_t;
                size_bits2 = sizeof_DCI1A_1_5MHz_FDD_t;
                break;
              }
          }
          memcpy((void *)&RA_template[j].RA_alloc_pdu1[0],(void *)&RA_alloc_pdu,size_bytes1);
          memcpy((void *)&RA_template[j].RA_alloc_pdu2[0],(void *)&DLSCH_alloc_pdu1A,size_bytes2);
          RA_template[j].RA_dci_size_bytes1 = size_bytes1;
          RA_template[j].RA_dci_size_bytes2 = size_bytes2;
          RA_template[j].RA_dci_size_bits1  = size_bits1;
          RA_template[j].RA_dci_size_bits2  = size_bits2;

          RA_template[j].RA_dci_fmt1        = format1A;
          RA_template[j].RA_dci_fmt2        = format1A;
274
      }
gauthier's avatar
gauthier committed
275 276 277 278 279 280 281

      memset (&eNB_mac_inst[i].eNB_stats,0,sizeof(eNB_STATS));
      UE_template = (UE_TEMPLATE *)&eNB_mac_inst[i].UE_template[0];
      for (j=0;j<NUMBER_OF_UE_MAX;j++) {
          UE_template[j].rnti=0;
          // initiallize the eNB to UE statistics
          memset (&eNB_mac_inst[i].eNB_UE_stats[j],0,sizeof(eNB_UE_STATS));
282 283 284 285
      }
  }


gauthier's avatar
gauthier committed
286
  //ICIC init param
287
#ifdef ICIC
288
  u8 SB_size;
289 290 291 292 293
  SB_size=mac_xface->get_SB_size(mac_xface->lte_frame_parms->N_RB_DL);

  srand (time(NULL));

  for(j=0;j<NB_eNB_INST;j++){
gauthier's avatar
gauthier committed
294 295 296 297 298 299
      eNB_mac_inst[j].sbmap_conf.first_subframe=0;
      eNB_mac_inst[j].sbmap_conf.periodicity=10;
      eNB_mac_inst[j].sbmap_conf.sb_size=SB_size;
      eNB_mac_inst[j].sbmap_conf.nb_active_sb=1;
      for(i=0;i<NUMBER_OF_SUBBANDS;i++)
        eNB_mac_inst[j].sbmap_conf.sbmap[i]=1;
300

gauthier's avatar
gauthier committed
301
      eNB_mac_inst[j].sbmap_conf.sbmap[rand()%NUMBER_OF_SUBBANDS]=0;
302 303 304

  }
#endif
gauthier's avatar
gauthier committed
305
  //end ALU's algo
306

gauthier's avatar
gauthier committed
307
  LOG_I(MAC,"[MAIN][INIT] Init function finished\n");
308 309 310 311 312 313 314 315 316 317

  return(0);

}


/***********************************************************************/
int mac_init_global_param(void){
  /***********************************************************************/

318

319 320 321 322 323 324 325 326 327 328 329 330
  Mac_rlc_xface = NULL;
  LOG_I(MAC,"[MAIN] CALLING RLC_MODULE_INIT...\n");

  if (rlc_module_init()!=0)
    return(-1);

  LOG_I(MAC,"[MAIN] RLC_MODULE_INIT OK, malloc16 for mac_rlc_xface...\n");

  Mac_rlc_xface = (MAC_RLC_XFACE*)malloc16(sizeof(MAC_RLC_XFACE));
  bzero(Mac_rlc_xface,sizeof(MAC_RLC_XFACE));

  if(Mac_rlc_xface == NULL){
gauthier's avatar
gauthier committed
331 332
      LOG_E(MAC,"[MAIN] FATAL EROOR: Could not allocate memory for Mac_rlc_xface !!!\n");
      return (-1);
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363

  }

  LOG_I(MAC,"[MAIN] malloc16 OK, mac_rlc_xface @ %p\n",(void *)Mac_rlc_xface);

  //  mac_xface->macphy_data_ind=macphy_data_ind;
  mac_xface->mrbch_phy_sync_failure=mrbch_phy_sync_failure;
  mac_xface->dl_phy_sync_success=dl_phy_sync_success;
  mac_xface->out_of_sync_ind=mac_out_of_sync_ind;

  //  Mac_rlc_xface->macphy_exit=  mac_xface->macphy_exit;
  //  Mac_rlc_xface->frame = 0;
  //  Mac_rlc_xface->mac_config_req=mac_config_req;
  //  Mac_rlc_xface->mac_meas_req=mac_meas_req;
  //  Mac_rlc_xface->rrc_rlc_config_req=rrc_rlc_config_req;
  //  Mac_rlc_xface->rrc_rlc_data_req=rrc_rlc_data_req;
  //  Mac_rlc_xface->rrc_rlc_register_rrc=rrc_rlc_register_rrc;

  //  Mac_rlc_xface->rrc_mac_config_req=rrc_mac_config_req;

  //  LOG_I(MAC,"[MAIN] INIT_GLOBAL_PARAM: Mac_rlc_xface=%p,rrc_rlc_register_rrc =%p\n",Mac_rlc_xface,Mac_rlc_xface->rrc_rlc_register_rrc);

  //  Mac_rlc_xface->mac_rlc_data_req=mac_rlc_data_req;
  //  Mac_rlc_xface->mac_rlc_data_ind=mac_rlc_data_ind;
  //  Mac_rlc_xface->mac_rlc_status_ind=mac_rlc_status_ind;
  //  Mac_rlc_xface->pdcp_data_req=pdcp_data_req;
  //  Mac_rlc_xface->mrbch_phy_sync_failure=mrbch_phy_sync_failure;
  //  Mac_rlc_xface->dl_phy_sync_success=dl_phy_sync_success;

  LOG_I(MAC,"[MAIN] RLC interface setup and init\n");
  rrc_init_global_param();
364

365 366 367 368 369 370 371 372 373 374 375 376 377 378
#ifdef USER_MODE
  pdcp_layer_init ();
#else
  pdcp_module_init ();
#endif

  LOG_I(MAC,"[MAIN] Init Global Param Done\n");

  return 0;
}


/***********************************************************************/
void mac_top_cleanup(void){
gauthier's avatar
gauthier committed
379
  /***********************************************************************/
380 381 382 383 384 385 386 387 388 389
#ifndef USER_MODE
  pdcp_module_cleanup ();
#endif
  if (NB_UE_INST>0)
    free (UE_mac_inst);
  if (NB_eNB_INST>0)
    free(eNB_mac_inst);
  free( Mac_rlc_xface);
}

390
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active, u8 HO_active) {
391 392 393 394 395 396 397



  LOG_I(MAC,"[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
  //    NB_NODE=2;
  //    NB_INST=2;

398
  Is_rrc_registered=0;
399
  mac_init_global_param();
400
  Is_rrc_registered=1;
401

Cedric Roux's avatar
Cedric Roux committed
402
  mac_xface->macphy_init = mac_top_init;
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
#ifndef USER_MODE
  mac_xface->macphy_exit = openair_sched_exit;
#else
  mac_xface->macphy_exit=(void (*)(const char*)) exit;
#endif
  LOG_I(MAC,"[MAIN] init eNB MAC functions  \n");
  mac_xface->eNB_dlsch_ulsch_scheduler = eNB_dlsch_ulsch_scheduler;
  mac_xface->get_dci_sdu               = get_dci_sdu;
  mac_xface->fill_rar                  = fill_rar;
  mac_xface->terminate_ra_proc         = terminate_ra_proc;
  mac_xface->initiate_ra_proc          = initiate_ra_proc;
  mac_xface->cancel_ra_proc            = cancel_ra_proc;
  mac_xface->SR_indication             = SR_indication;
  mac_xface->rx_sdu                    = rx_sdu;
  mac_xface->get_dlsch_sdu             = get_dlsch_sdu;
  mac_xface->get_eNB_UE_stats          = get_eNB_UE_stats;
  mac_xface->get_transmission_mode     = get_transmission_mode;
  mac_xface->get_rballoc               = get_rballoc;
  mac_xface->get_nb_rb                 = conv_nprb;
  mac_xface->get_SB_size               = Get_SB_size;
  mac_xface->get_subframe_direction    = get_subframe_direction;
  mac_xface->Msg3_transmitted          = Msg3_tx;
  mac_xface->Msg1_transmitted          = Msg1_tx;
  mac_xface->ra_failed                 = ra_failed;
  mac_xface->ra_succeeded              = ra_succeeded;

  LOG_I(MAC,"[MAIN] init UE MAC functions \n");
  mac_xface->ue_decode_si              = ue_decode_si;
  mac_xface->ue_send_sdu               = ue_send_sdu;
#ifdef Rel10
  mac_xface->ue_send_mch_sdu           = ue_send_mch_sdu;
  mac_xface->ue_query_mch              = ue_query_mch;
#endif
  mac_xface->ue_get_SR                 = ue_get_SR;
  mac_xface->ue_get_sdu                = ue_get_sdu;
  mac_xface->ue_get_rach               = ue_get_rach;
  mac_xface->ue_process_rar            = ue_process_rar;
  mac_xface->ue_scheduler              = ue_scheduler;
  mac_xface->process_timing_advance    = process_timing_advance;


  LOG_I(MAC,"[MAIN] PHY Frame configuration \n");
  mac_xface->lte_frame_parms = frame_parms;

  mac_xface->get_ue_active_harq_pid = get_ue_active_harq_pid;
  mac_xface->get_PL                 = get_PL;
449 450 451 452 453
  mac_xface->get_RSRP               = get_RSRP;
  mac_xface->get_RSRQ               = get_RSRQ;
  mac_xface->get_RSSI               = get_RSSI;
  mac_xface->get_n_adj_cells        = get_n_adj_cells;
  mac_xface->get_rx_total_gain_dB   = get_rx_total_gain_dB;
454 455 456 457 458 459 460 461 462 463 464 465 466 467
  mac_xface->get_Po_NOMINAL_PUSCH   = get_Po_NOMINAL_PUSCH;
  mac_xface->get_num_prach_tdd      = get_num_prach_tdd;
  mac_xface->get_fid_prach_tdd      = get_fid_prach_tdd;
  mac_xface->get_deltaP_rampup      = get_deltaP_rampup;
  mac_xface->computeRIV             = computeRIV;
  mac_xface->get_TBS_DL             = get_TBS_DL;
  mac_xface->get_TBS_UL             = get_TBS_UL;
  mac_xface->get_nCCE_max           = get_nCCE_max;
  mac_xface->get_ue_mode            = get_ue_mode;
  mac_xface->phy_config_sib1_eNB    = phy_config_sib1_eNB;
  mac_xface->phy_config_sib1_ue     = phy_config_sib1_ue;

  mac_xface->phy_config_sib2_eNB        = phy_config_sib2_eNB;
  mac_xface->phy_config_sib2_ue         = phy_config_sib2_ue;
468
  mac_xface->phy_config_afterHO_ue      = phy_config_afterHO_ue;
469 470 471 472 473 474 475 476
#ifdef Rel10
  mac_xface->phy_config_sib13_eNB        = phy_config_sib13_eNB;
  mac_xface->phy_config_sib13_ue         = phy_config_sib13_ue;
#endif
#ifdef CBA
  mac_xface->phy_config_cba_rnti         = phy_config_cba_rnti ;
#endif 
  mac_xface->phy_config_meas_ue          = phy_config_meas_ue;
477
  mac_xface->phy_reset_ue		 = phy_reset_ue;
478 479 480 481 482 483 484 485 486 487 488

  mac_xface->phy_config_dedicated_eNB    = phy_config_dedicated_eNB;
  mac_xface->phy_config_dedicated_ue     = phy_config_dedicated_ue;

#ifdef Rel10
  mac_xface->get_mch_sdu                 = get_mch_sdu;
#endif

  mac_xface->get_PHR = get_PHR;
  LOG_D(MAC,"[MAIN] ALL INIT OK\n");

489
  mac_xface->macphy_init(eMBMS_active,cba_group_active,HO_active);
490 491 492 493

  //Mac_rlc_xface->Is_cluster_head[0] = 1;
  //Mac_rlc_xface->Is_cluster_head[1] = 0;

gauthier's avatar
gauthier committed
494

495 496 497
  return(1);
}