diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index bb7cc25ec0a9ea77835f6c64f37b9c554d43a8e6..01b1d6c273ad74c4e9012a7407237a177df22d46 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -247,22 +247,18 @@ add_boolean_option(T_TRACER            True  "Activate the T tracer, a debugging
 add_boolean_option(UE_AUTOTEST_TRACE   False "Activate UE autotest specific logs")
 add_boolean_option(UE_DEBUG_TRACE      False "Activate UE debug trace")
 add_boolean_option(UE_TIMING_TRACE     False "Activate UE timing trace")
-add_boolean_option(USRP_REC_PLAY       False "Enable USRP record playback mode")
-add_boolean_option(BASIC_SIMULATOR     False "Has to be True when building the basic simulator, False otherwise")
 add_boolean_option(DEBUG_CONSOLE       False "makes debugging easier, disables stdout/stderr buffering")
 
-add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
 set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
-if (${ENABLE_ITTI})
-  add_library(ITTI
-    ${OCP_ITTI}/intertask_interface.cpp
-    ${OPENAIR_DIR}/common/utils/backtrace.c
-    ${OPENAIR_DIR}/common/utils/memory_pools.c
-    )
+add_library(ITTI
+  ${OCP_ITTI}/intertask_interface.cpp
+  ${OPENAIR_DIR}/common/utils/backtrace.c
+  ${OPENAIR_DIR}/common/utils/memory_pools.c
+  )
 add_dependencies(ITTI rrc_flag)
   set(ITTI_LIB ITTI)
   set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
-endif (${ENABLE_ITTI})
+
 
 ##################################################
 # ASN.1 grammar C code generation & dependencies #
@@ -660,7 +656,6 @@ set (SHLIB_LOADER_SOURCES
 include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
 set(HWLIB_USRP_SOURCE
   ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
-  ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
   )
 add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} )
 target_link_libraries(oai_usrpdevif uhd)
@@ -2369,6 +2364,9 @@ add_library(rfsimulator MODULE
 	)
 target_link_libraries(rfsimulator SIMU ${ATLAS_LIBRARIES})
 
+add_library(oai_iqplayer MODULE 
+	${OPENAIR_TARGETS}/ARCH/iqplayer/iqplayer_lib.c
+	)
 set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}")
 
 #include T directory even if the T is off because T macros are in the code
@@ -2448,6 +2446,7 @@ add_executable(lte-softmodem
   ${OPENAIR_TARGETS}/COMMON/create_tasks.c
   ${OPENAIR_TARGETS}/COMMON/create_tasks_mbms.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -2462,7 +2461,7 @@ add_executable(lte-softmodem
   ${CONFIG_SOURCES}
   ${SHLIB_LOADER_SOURCES}
   )
-add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
+add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
 
 target_link_libraries (lte-softmodem
   -Wl,--start-group
@@ -2517,6 +2516,7 @@ add_executable(lte-uesoftmodem
   ${OPENAIR_TARGETS}/RT/USER/rfsim.c
   ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -2563,6 +2563,7 @@ add_executable(nr-softmodem
   ${OPENAIR_DIR}/executables/softmodem-common.c
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -2602,6 +2603,7 @@ add_executable(nr-uesoftmodem
   ${OPENAIR_DIR}/executables/softmodem-common.c
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
+  ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
   ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h
index 6baec7dfeb2188b1360a2cb9d854a1f061bb0520..8e74f4148ccd3d013a214f1881e40454061a265f 100644
--- a/common/utils/LOG/log.h
+++ b/common/utils/LOG/log.h
@@ -274,16 +274,6 @@ typedef struct {
 } log_t;
 
 
-#if defined(ENABLE_ITTI)
-typedef enum log_instance_type_e {
-  LOG_INSTANCE_UNKNOWN,
-  LOG_INSTANCE_ENB,
-  LOG_INSTANCE_UE,
-} log_instance_type_t;
-
-void log_set_instance_type (log_instance_type_t instance);
-#endif
-
 
 #ifdef LOG_MAIN
 log_t *g_log;
diff --git a/common/utils/LOG/vcd_signal_dumper.c b/common/utils/LOG/vcd_signal_dumper.c
index 103cf1cd9473ae142af39f86e9a76ccc73e1b194..9327b6e77a167b86fd530002ac24d6fff2da93cf 100644
--- a/common/utils/LOG/vcd_signal_dumper.c
+++ b/common/utils/LOG/vcd_signal_dumper.c
@@ -633,9 +633,6 @@ inline static uint32_t vcd_get_write_index(void)
   return write_index;
 }
 
-#if defined(ENABLE_ITTI)
-int signal_mask(void);
-#endif
 
 void *vcd_dumper_thread_rt(void *args)
 {
@@ -644,9 +641,7 @@ void *vcd_dumper_thread_rt(void *args)
   struct sched_param sched_param;
   uint32_t data_ready_wait;
 
-# if defined(ENABLE_ITTI)
   return 0; //signal_mask(); //function defined at common/utils/ocp_itti/intertask_interface.cpp
-# endif
 
   sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
   sched_setscheduler(0, SCHED_FIFO, &sched_param);
diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c
index 4be0b35d16a28c3fa9492e5a60a81401d0ff9e5e..8cbd06490dedfa09fca195826098116454c961ca 100644
--- a/common/utils/T/local_tracer.c
+++ b/common/utils/T/local_tracer.c
@@ -15,7 +15,7 @@
 #include "T_messages.txt.h"
 #include "T_defs.h"
 #include "T_IDs.h"
-
+#include "softmodem-common.h"
 static T_cache_t *T_local_cache;
 static int T_busylist_head;
 
@@ -357,24 +357,22 @@ static void forward(void *_forwarder, char *buf, int size) {
   if (f->tail != NULL) f->tail->next = new;
 
   f->tail = new;
-#if BASIC_SIMULATOR
-
+  if( IS_SOFTMODEM_BASICSIM){
   /* When runnng the basic simulator, the tracer may be too slow.
    * Let's not take too much memory in the tracee and
    * wait if there is too much data to send. 200MB is
    * arbitrary.
    */
-  while (f->memusage > 200 * 1024 * 1024) {
-    if (pthread_cond_signal(&f->cond)) abort();
+    while (f->memusage > 200 * 1024 * 1024) {
+      if (pthread_cond_signal(&f->cond)) abort();
 
-    if (pthread_mutex_unlock(&f->lock)) abort();
+      if (pthread_mutex_unlock(&f->lock)) abort();
 
-    usleep(1000);
+      usleep(1000);
 
-    if (pthread_mutex_lock(&f->lock)) abort();
+      if (pthread_mutex_lock(&f->lock)) abort();
+    }
   }
-
-#endif /* BASIC_SIMULATOR */
   f->memusage += size+4;
 
   /* warn every 100MB */
diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c
index 6626c8103bb541cc5eef68d2100dcb34b1a6b2cf..10163b22b5c0a8bb380b762b9608d596fbffbbe2 100644
--- a/common/utils/telnetsrv/telnetsrv.c
+++ b/common/utils/telnetsrv/telnetsrv.c
@@ -53,6 +53,7 @@
 #include <sys/resource.h>
 #include "common/utils/load_module_shlib.h"
 #include "common/config/config_userapi.h"
+#include "executables/softmodem-common.h"
 #include <readline/history.h>
 
 
@@ -546,6 +547,7 @@ void run_telnetsrv(void) {
   int readc, filled;
   int status;
   int optval = 1;
+  char prompt[sizeof(TELNET_PROMPT_PREFIX)+10];
   pthread_setname_np(pthread_self(), "telnet");
   set_sched(pthread_self(),0,telnetparams.priority);
   sock = socket(AF_INET, SOCK_STREAM, 0);
@@ -570,6 +572,7 @@ void run_telnetsrv(void) {
     fprintf(stderr,"[TELNETSRV] Error %s on listen call\n",strerror(errno));
 
   using_history();
+  int plen=sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL));
   printf("\nInitializing telnet server...\n");
 
   while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) ) {
@@ -613,9 +616,9 @@ void run_telnetsrv(void) {
           HIST_ENTRY *hisentry = history_get(strtol(buf+1,NULL,0));
 
           if (hisentry) {
-            char msg[TELNET_MAX_MSGLENGTH + sizeof(TELNET_PROMPT) +10];
+            char msg[TELNET_MAX_MSGLENGTH + plen +10];
             sprintf(buf,"%s",hisentry->line);
-            sprintf(msg,"%s %s\n",TELNET_PROMPT, hisentry->line);
+            sprintf(msg,"%s %s\n",prompt, hisentry->line);
             send(telnetparams.new_socket, msg, strlen(msg), MSG_NOSIGNAL);
           }
         }
@@ -635,7 +638,7 @@ void run_telnetsrv(void) {
           add_history(buf);
         }
 
-        send(telnetparams.new_socket, TELNET_PROMPT, sizeof(TELNET_PROMPT), MSG_NOSIGNAL);
+        send(telnetparams.new_socket, prompt, strlen(prompt), MSG_NOSIGNAL);
       } else {
         printf ("[TELNETSRV] Closing telnet connection...\n");
         break;
@@ -653,7 +656,7 @@ void run_telnetsrv(void) {
 }
 
 /*------------------------------------------------------------------------------------------------*/
-/* set_telnetmodule loads the commands delivered with the telnet server
+/* load the commands delivered with the telnet server
  *
  *
  *
@@ -715,7 +718,11 @@ int add_sharedmodules(void) {
 int telnetsrv_autoinit(void) {
   memset(&telnetparams,0,sizeof(telnetparams));
   config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
-
+  /* possibly load a exec specific shared lib */
+  char *execfunc=get_softmodem_function(NULL);
+  char libname[64];
+  sprintf(libname,"telnetsrv_%s",execfunc);
+  load_module_shlib(libname,NULL,0,NULL);
   if(pthread_create(&telnetparams.telnet_pthread,NULL, (void *(*)(void *))run_telnetsrv, NULL) != 0) {
     fprintf(stderr,"[TELNETSRV] Error %s on pthread_create call\n",strerror(errno));
     return -1;
diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h
index 89f6a8dda11bd3180790359ae666a9b638e2269f..debb9f02ec962c63e798273bb19c481eff38f5c7 100644
--- a/common/utils/telnetsrv/telnetsrv.h
+++ b/common/utils/telnetsrv/telnetsrv.h
@@ -35,7 +35,7 @@
 
 #define TELNET_PORT               9090
 #define TELNET_MAX_MSGLENGTH      2048
-#define TELNET_PROMPT             "softmodem> "
+#define TELNET_PROMPT_PREFIX      "softmodem"
 #define TELNET_MAXCMD             20
 #define TELNET_CMD_MAXSIZE        20
 #define TELNET_HELPSTR_SIZE       80
diff --git a/common/utils/telnetsrv/telnetsrv_enb_measurements.c b/common/utils/telnetsrv/telnetsrv_enb_measurements.c
new file mode 100644
index 0000000000000000000000000000000000000000..9c5c5b675bbd3830560e72cff6413da79cd2e6fe
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_enb_measurements.c
@@ -0,0 +1,179 @@
+/*
+ * 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
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * 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
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
+ * \brief: implementation of telnet commands related to eNB measurments
+ * \author Francois TABURET
+ * \date 2019
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+
+
+
+
+#define TELNETSERVERCODE
+#include "telnetsrv.h"
+
+#include "common/utils/LOG/log.h"
+#include "common/config/config_userapi.h"
+#include "telnetsrv_measurements.h"
+#include "telnetsrv_ltemeasur_def.h"
+#include "telnetsrv_cpumeasur_def.h"
+#include "openair2/LAYER2/MAC/mac.h"
+#include "openair1/PHY/phy_extern.h"
+
+void measurcmd_display_macstats(telnet_printfunc_t prnt);
+void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
+void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
+void measurcmd_display_phycpu(telnet_printfunc_t prnt);
+void measurcmd_display_maccpu(telnet_printfunc_t prnt);
+void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
+
+
+static telnet_measurgroupdef_t enbmeasurgroups[] = {
+  {"enb",   GROUP_LTESTATS,0, measurcmd_display_macstats,   {NULL}},
+  {"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
+  {"rlc",   GROUP_LTESTATS,0, measurcmd_display_rlcstats,   {NULL}},
+  {"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu,     {NULL}},
+  {"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu,      {NULL}},
+  {"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu,      {NULL}},
+};
+#define TELNET_NUM_ENBMEASURGROUPS (sizeof(enbmeasurgroups)/sizeof(telnet_measurgroupdef_t))
+
+static int                     eNB_id =0;
+static double                  cpufreq;
+
+
+#define HDR "---------------------------------"
+
+
+int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
+  *measurgroups = enbmeasurgroups;
+  return TELNET_NUM_ENBMEASURGROUPS;
+}
+
+
+void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
+  PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
+  telnet_cpumeasurdef_t  cpumeasur[]=CPU_PHYENB_MEASURE;
+  prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
+       PRINT_CPUMEAS_STATE,HDR);
+  measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+
+void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
+  eNB_MAC_INST *macvars = RC.mac[eNB_id];
+  telnet_cpumeasurdef_t  cpumeasur[]=CPU_MACENB_MEASURE;
+  prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
+       PRINT_CPUMEAS_STATE,HDR);
+  measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+
+void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
+  pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
+  telnet_cpumeasurdef_t  cpumeasur[]=CPU_PDCPENB_MEASURE;
+  prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
+       PRINT_CPUMEAS_STATE,HDR);
+  measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
+}
+/*----------------------------------------------------------------------------------------------------*/
+
+
+void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
+  UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
+
+  for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+    for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
+      int CC_id = UE_list->ordered_CCids[i][UE_id];
+      prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
+      eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
+      telnet_ltemeasurdef_t  statsptr[]=LTEMAC_UEMEASURE;
+      measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
+    }
+  }
+} /* measurcmd_display_macstats_ue */
+
+void measurcmd_display_macstats(telnet_printfunc_t prnt) {
+  for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
+    eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
+    telnet_ltemeasurdef_t  statsptr[]=LTEMAC_MEASURE;
+    prnt("%s eNB %i mac stats CC %i frame %u %s\n",
+         HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
+    measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
+  }
+} /* measurcmd_display_macstats */
+
+
+void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
+                                   char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
+
+{
+  int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
+                                rlcstats,   rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
+                                rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
+                                rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
+                                rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
+                                rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
+
+  if (rlc_status == RLC_OP_STATUS_OK) {
+    prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
+         (rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
+    measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
+  }
+} /* status measurcmd_rlc_stat_req */
+
+
+void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
+  protocol_ctxt_t      ctxt;
+  UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
+  telnet_ltemeasurdef_t  statsptr[]=LTE_RLCMEASURE;
+  int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
+  unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
+  eNB_MAC_INST *eNB = RC.mac[eNB_id];
+
+  for(int i=0; i <num_rlcmeasure ; i++) {
+    statsptr[i].vptr = rlcstats + i;
+  }
+
+  for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
+#define NB_eNB_INST 1
+    PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
+                                   eNB->frame,eNB->subframe,eNB_id);
+    measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
+    measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO,  DTCH-2);
+  }
+} /* measurcmd_display_macstats_ue */
+
+
+
+
diff --git a/common/utils/telnetsrv/telnetsrv_enb_phycmd.c b/common/utils/telnetsrv/telnetsrv_enb_phycmd.c
new file mode 100644
index 0000000000000000000000000000000000000000..f7deec1801cba99f0f6052a2e85f86b36df32e74
--- /dev/null
+++ b/common/utils/telnetsrv/telnetsrv_enb_phycmd.c
@@ -0,0 +1,123 @@
+/*
+ * 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
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * 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
+ */
+
+/*! \file common/utils/telnetsrv/telnetsrv_phycmd.c
+ * \brief: implementation of telnet commands related to softmodem linux process
+ * \author Francois TABURET
+ * \date 2017
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE
+#include <string.h>
+#include <pthread.h>
+
+
+#define TELNETSERVERCODE
+#include "telnetsrv.h"
+#define TELNETSRV_PHYCMD_MAIN
+#include "telnetsrv_phycmd.h"
+char *prnbuff;
+extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char *buffer, int length);
+
+void init_phytelnet(void) {
+  prnbuff=malloc(get_phybsize() );
+
+  if (prnbuff == NULL) {
+    fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
+  }
+}
+
+void display_uestatshead( telnet_printfunc_t prnt) {
+  prnt("cc  ue  rnti Dmcs Umcs tao  tau   Dbr  Dtb   \n");
+}
+
+void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag) {
+  int p;
+  p=dump_eNB_l2_stats( prnbuff, 0);
+
+  if(prntflag>=1)
+    prnt("%s\n",prnbuff);
+
+  if(debug>=1)
+    prnt("%i bytes printed\n",p);
+}
+
+void display_uestats(int debug, telnet_printfunc_t prnt, int ue) {
+  for (int cc=0; cc<1 ; cc++) {
+  }
+}
+
+void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt) {
+  prnt("  DLSCH kb      DLSCH kb/s\n");
+  dump_uestats(debug, prnt,0);
+}
+
+int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt) {
+  if (debug > 0)
+    prnt("phy interface module received %s\n",buf);
+
+  if (strcasestr(buf,"phycnt") != NULL) {
+    display_phycounters(buf, debug, prnt);
+  }
+
+  if (strcasestr(buf,"uestat") != NULL) {
+    char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
+    display_uestatshead(prnt);
+
+    if (cptr != NULL) {
+      int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
+
+      if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0) {
+        display_uestats(debug, prnt,ueidx);
+      }
+    } /* if cptr != NULL */
+    else {
+      for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++) {
+        display_uestats(debug, prnt,ue);
+      }
+    } /* else cptr != NULL */
+  } /* uestat */
+
+  if (strcasestr(buf,"uedump") != NULL) {
+    dump_uestats(debug, prnt,1);
+  }
+
+  return 0;
+}
+
+
+
+telnetshell_cmddef_t phy_cmdarray[] = {
+  {"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
+
+  {"","",NULL},
+};
+
+
+/*-------------------------------------------------------------------------------------*/
+void add_phy_cmds(void) {
+  init_phytelnet();
+  add_telnetcmd("phy", phy_vardef, phy_cmdarray);
+}
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index 46689b137ac6adcf5139149deac84f0161858b67..fc012b0ab24c212a7fab1ebfbd3c25cb8bcce6ba 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -93,10 +93,8 @@
 // extern openair0_device openair0;
 
 
-#if defined(ENABLE_ITTI)
-  extern volatile int start_gNB;
-  extern volatile int start_UE;
-#endif
+extern volatile int start_gNB;
+extern volatile int start_UE;
 extern volatile int oai_exit;
 
 extern openair0_config_t openair0_cfg[MAX_CARDS];
@@ -360,7 +358,7 @@ static void *gNB_L1_thread( void *param ) {
 }
 
 
-#if 0 //defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
+#if 0 
 // Wait for gNB application initialization to be complete (gNB registration to MME)
 static void wait_system_ready (char *message, volatile int *start_flag) {
   static char *indicator[] = {".    ", "..   ", "...  ", ".... ", ".....",
diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h
index e014eaf93f7adfc631289bf646326c685e76aed7..e6aafafeb99ab34c5fcf20c8240f372491855da4 100644
--- a/executables/nr-softmodem-common.h
+++ b/executables/nr-softmodem-common.h
@@ -142,9 +142,7 @@ extern int sync_var;
 extern int transmission_mode;
 extern double cpuf;
 
-#if defined(ENABLE_ITTI)
-  extern volatile int start_eNB;
-  extern volatile int start_UE;
-#endif
+extern volatile int start_eNB;
+extern volatile int start_UE;
 
 #endif
diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index 6b725620332b73fe7f15f669f42918afb226ff96..d8cb4da267739f9424fd60ce2efa1d67d55c571f 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -71,9 +71,7 @@ unsigned short config_frames[4] = {2,9,11,13};
   #include "UTIL/OTG/otg_vars.h"
 #endif
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "PHY/INIT/phy_init.h"
 
@@ -101,9 +99,7 @@ pthread_mutex_t sync_mutex;
 int sync_var=-1; //!< protected by mutex \ref sync_mutex.
 int config_sync_var=-1;
 
-#if defined(ENABLE_ITTI)
-  volatile int             start_gNB = 0;
-#endif
+volatile int             start_gNB = 0;
 volatile int             oai_exit = 0;
 
 static int wait_for_sync = 0;
@@ -119,9 +115,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
 //Temp fix for inexistent NR upper layer
 unsigned char NB_gNB_INST = 1;
 
-#if defined(ENABLE_ITTI)
-  static char                    *itti_dump_file = NULL;
-#endif
+static char                    *itti_dump_file = NULL;
 
 int UE_scan = 1;
 int UE_scan_carrier = 0;
@@ -302,7 +296,7 @@ void exit_function(const char *file, const char *function, const int line, const
   exit(1);
 }
 
-#if defined(ENABLE_ITTI)
+
 void *l2l1_task(void *arg) {
   MessageDef *message_p = NULL;
   int         result;
@@ -375,7 +369,6 @@ void *l2l1_task(void *arg) {
   */
   return NULL;
 }
-#endif
 
 int create_gNB_tasks(uint32_t gnb_nb) {
   LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
@@ -638,7 +631,6 @@ void wait_gNBs(void) {
   printf("gNB L1 are configured\n");
 }
 
-#if defined(ENABLE_ITTI)
 /*
  * helper function to terminate a certain ITTI task
  */
@@ -756,7 +748,6 @@ int restart_L1L2(module_id_t gnb_id) {
   pthread_mutex_unlock(&sync_mutex);
   return 0;
 }
-#endif
 
 static  void wait_nfapi_init(char *thread_name) {
   printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
@@ -814,7 +805,7 @@ int main( int argc, char **argv )
   configure_linux();
   printf("Reading in command-line options\n");
   get_options ();
-  get_common_options();
+  get_common_options(SOFTMODEM_GNB_BIT );
 
   if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
     fprintf(stderr,"Getting configuration failed\n");
@@ -835,11 +826,10 @@ int main( int argc, char **argv )
   }
 
   cpuf=get_cpu_freq_GHz();
-#if defined(ENABLE_ITTI)
   itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
   // initialize mscgen log after ITTI
   MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
-#endif
+
 
 init_opt();
 
@@ -859,8 +849,6 @@ init_opt();
   if(IS_SOFTMODEM_NOS1)
 	  init_pdcp();
 
-#if defined(ENABLE_ITTI)
-
   if (RC.nb_nr_inst > 0)  {
     // don't create if node doesn't connect to RRC/S1/GTP
     AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
@@ -869,7 +857,6 @@ init_opt();
     RCconfig_L1();
   }
 
-#endif
   /* Start the agent. If it is turned off in the configuration, it won't start */
   RCconfig_nr_flexran();
 
@@ -1004,19 +991,12 @@ init_opt();
   // wait for end of program
   printf("TYPE <CTRL-C> TO TERMINATE\n");
   //getchar();
-#if defined(ENABLE_ITTI)
   printf("Entering ITTI signals handler\n");
   itti_wait_tasks_end();
   printf("Returned from ITTI signal handler\n");
   oai_exit=1;
   printf("oai_exit=%d\n",oai_exit);
-#else
-
-  while (oai_exit==0)
-    sleep(1);
 
-  printf("Terminating application - oai_exit=%d\n",oai_exit);
-#endif
   // stop threads
 /*#ifdef XFORMS
 
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 1781ed0d8de5b9ebbc27783fbef9af45f4430f29..de01240537f0b88806e4b36c204fc29d05cd7d10 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -332,8 +332,6 @@ void init_scope(void) {
 
 }
 
-
-#if defined(ENABLE_ITTI)
 void *l2l1_task(void *arg) {
   MessageDef *message_p = NULL;
   int         result;
@@ -373,7 +371,7 @@ void *l2l1_task(void *arg) {
 
   return NULL;
 }
-#endif
+
 
 int16_t dlsch_demod_shift;
 
@@ -650,7 +648,7 @@ int main( int argc, char **argv ) {
   logInit();
   // get options and fill parameters from configuration file
   get_options (); //Command-line options, enb_properties
-  get_common_options();
+  get_common_options(SOFTMODEM_5GUE_BIT );
 #if T_TRACER
   T_Config_Init();
 #endif
diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c
index 00b974e3ae0b342e6303bfe2a4c01528651121d7..0c4032c41bad78bb620535d0031def2033808b78 100644
--- a/executables/softmodem-common.c
+++ b/executables/softmodem-common.c
@@ -37,6 +37,7 @@
 #include "common/utils/load_module_shlib.h"
 #include "common/utils/telnetsrv/telnetsrv.h"
 #include "executables/thread-common.h"
+#include "common/utils/LOG/log.h"
 #include "softmodem-common.h"
 
 static softmodem_params_t softmodem_params;
@@ -44,7 +45,7 @@ char *parallel_config=NULL;
 char *worker_config=NULL;
 
 
-
+static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
 static struct timespec start;
 
 uint64_t get_softmodem_optmask(void) {
@@ -60,7 +61,26 @@ softmodem_params_t *get_softmodem_params(void) {
   return &softmodem_params;
 }
 
-void get_common_options(void) {
+int32_t check_execmask(uint64_t execmask) {
+  char *softmodemfunc=map_int_to_str(softmodem_funcs, execmask);
+  if (softmodemfunc != NULL) {
+  	  set_softmodem_optmask(execmask);
+  	  return 0;
+  } 
+  return -1;
+}
+char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
+  uint64_t fmask=(get_softmodem_optmask()&SOFTMODEM_FUNC_BITS);
+  char *softmodemfunc=map_int_to_str(softmodem_funcs, fmask);
+  if (sofmodemfunc_mask_ptr != NULL)
+  	  *sofmodemfunc_mask_ptr=fmask;
+  if (softmodemfunc != NULL) {
+  	  return softmodemfunc;
+  }
+  return "???";
+}
+
+void get_common_options(uint32_t execmask) {
   uint32_t online_log_messages;
   uint32_t glog_level ;
   uint32_t start_telnetsrv = 0;
@@ -70,6 +90,7 @@ void get_common_options(void) {
   paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
   paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
   checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
+  check_execmask(execmask);
   config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
   config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
                             sizeof(cmdline_logparams)/sizeof(paramdef_t));
diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h
index 69ed98635baba2590eab333dd31c7d29abe3c1ce..c9a24577dc5019f000081b7190aa2b35f6cdf5ef 100644
--- a/executables/softmodem-common.h
+++ b/executables/softmodem-common.h
@@ -31,6 +31,7 @@
  */
 #ifndef SOFTMODEM_COMMON_H
 #define SOFTMODEM_COMMON_H
+#include "openair1/PHY/defs_common.h"
 #ifdef __cplusplus
 extern "C"
 {
@@ -164,6 +165,14 @@ extern "C"
 #define SOFTMODEM_BASICSIM_BIT        (1<<11)
 #define SOFTMODEM_SIML1_BIT           (1<<12)
 #define SOFTMODEM_DOFORMS_BIT         (1<<15)
+#define SOFTMODEM_RECPLAY_BIT         (1<<16)
+#define SOFTMODEM_ENB_BIT             (1<<20)
+#define SOFTMODEM_GNB_BIT             (1<<21)
+#define SOFTMODEM_4GUE_BIT            (1<<22)
+#define SOFTMODEM_5GUE_BIT            (1<<23)
+#define SOFTMODEM_FUNC_BITS (SOFTMODEM_ENB_BIT | SOFTMODEM_GNB_BIT | SOFTMODEM_5GUE_BIT | SOFTMODEM_4GUE_BIT)
+#define MAPPING_SOFTMODEM_FUNCTIONS {{"enb",SOFTMODEM_ENB_BIT},{"gnb",SOFTMODEM_GNB_BIT},{"4Gue",SOFTMODEM_4GUE_BIT},{"5Gue",SOFTMODEM_5GUE_BIT}}
+
 
 #define IS_SOFTMODEM_NOS1            ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
 #define IS_SOFTMODEM_NOKRNMOD        ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
@@ -172,7 +181,11 @@ extern "C"
 #define IS_SOFTMODEM_BASICSIM        ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
 #define IS_SOFTMODEM_SIML1           ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
 #define IS_SOFTMODEM_DOFORMS         ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
-
+#define IS_SOFTMODEM_IQPLAYER        ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
+#define IS_SOFTMODEM_ENB_BIT         ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
+#define IS_SOFTMODEM_GNB_BIT         ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
+#define IS_SOFTMODEM_4GUE_BIT        ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
+#define IS_SOFTMODEM_5GUE_BIT        ( get_softmodem_optmask() & SOFTMODEM_5GUE_BIT)
 
 typedef struct {
   uint64_t       optmask;
@@ -195,7 +208,8 @@ typedef struct {
 extern uint64_t get_softmodem_optmask(void);
 extern uint64_t set_softmodem_optmask(uint64_t bitmask);
 extern softmodem_params_t *get_softmodem_params(void);
-extern void get_common_options(void);
+extern void get_common_options(uint32_t execmask);
+extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
 #define SOFTMODEM_RTSIGNAL  (SIGRTMIN+1)
 extern void set_softmodem_sighandler(void);
 extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index 8c19f44d2f83a03d57080b44ee225cdd4beb592f..e142d2f29febdac4a98c539f46e9115d461c503f 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -36,7 +36,7 @@
 
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
-
+#include "executables/softmodem-common.h"
 
 //uint8_t ncs_cell[20][7];
 //#define DEBUG_PUCCH_TXS
@@ -801,9 +801,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
       for (j=0; j<NUMBER_OF_UE_MAX; j++) {
         eNB->pucch1_stats_cnt[j][i]=0;
         eNB->pucch1ab_stats_cnt[j][i]=0;
-#if defined(USRP_REC_PLAY) // not 100% sure
-        eNB->pucch1_stats_thres[j][i]=0;
-#endif
+        if ( IS_SOFTMODEM_IQPLAYER)
+          eNB->pucch1_stats_thres[j][i]=0;
       }
     }
 
@@ -1193,15 +1192,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
       stat_re=0;
       stat_im=0;
       // Do detection now
-#if defined(USRP_REC_PLAY)
 
-      // It looks like the value is a bit messy when RF is replayed.
+
+      // It looks like the pucch1_thres value is a bit messy when RF is replayed.
       // For instance i assume to skip pucch1_thres from the test below.
       // Not 100% sure
-      if (sigma2_dB<(dB_fixed(stat_max)))  {//
-#else
-      if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres))  {//
-#endif
+        
+        if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
         chL = (nsymb>>1)-4;
         chest_mag=0;
         cfo =  (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
@@ -1339,11 +1336,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
         if (fmt==pucch_format1b)
           *(1+payload) = (stat_im<0) ? 1 : 2;
       } else { // insufficient energy on PUCCH so NAK
-#if defined(USRP_REC_PLAY)
-        LOG_D(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
-#else
         LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
-#endif
         *payload = 4;  // DTX
         ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
         ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c
index 4f2d05ef5043095abf960e1611db6af9fcee73a8..eb9a2922c555e86fe9023ace2a1f3c85de8ee336 100644
--- a/openair1/SCHED/prach_procedures.c
+++ b/openair1/SCHED/prach_procedures.c
@@ -46,9 +46,7 @@
 
 #include <time.h>
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 
 extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 1bb544d204238a485f58423e208b329943d2b610..95dc539ef4d7309d767fa8c2198bd2116ecaefb2 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -45,9 +45,7 @@
 
 #include <time.h>
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 extern uint8_t nfapi_mode;
 /*
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 0067efb4d96df412df7fd3db66e9590a5eaac2fa..430a3ee0b53a2aa6dbf2942ec4af5b1f73bf9624 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -74,15 +74,7 @@ fifo_dump_emos_UE emos_dump_UE;
 
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
-#endif
-
-//#include "PHY/defs.h"
-
-//#include "PHY/CODING/extern.h"
-
+#include "intertask_interface.h"
 #include "T.h"
 
 #define DLSCH_RB_ALLOC 0x1fbf  // skip DC RB (total 23/25 RBs)
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index 8ca533c1466e7c3031d562bfd6b19208b79e19ba..6d92beaddfa9e969e14b60e01c8b21891aeaa9f6 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -53,11 +53,7 @@
 
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
-
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
-
+#include "intertask_interface.h"
 #include "PHY/defs_UE.h"
 
 #include "PHY/CODING/coding_extern.h"
@@ -4885,10 +4881,8 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
                            uint8_t abstraction_flag,
                            uint8_t do_pdcch_flag,
                            runmode_t mode) {
-#if defined(ENABLE_ITTI)
   MessageDef   *msg_p;
   int           result;
-#endif
   int           frame_rx = proc->frame_rx;
   int           frame_tx = proc->frame_tx;
   int           subframe_rx = proc->subframe_rx;
@@ -4905,9 +4899,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
   if ( LOG_DEBUGFLAG(UE_TIMING)) {
     start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
   }
-
-#if defined(ENABLE_ITTI)
-
   do {
     // Checks if a message has been sent to PHY sub-task
     itti_poll_msg (TASK_PHY_UE, &msg_p);
@@ -4929,8 +4920,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
     }
   } while(msg_p != NULL);
 
-#endif
-
   for (slot=0; slot<2; slot++) {
     if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)||
         (ue->frame_parms.frame_type == FDD)) {
diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h
index 76d24f75f34cf35be72453cdd27c0d3af61b1ea9..5b97796f8a4f99b71d7696dbac0554bfed5659df 100644
--- a/openair2/GNB_APP/gnb_paramdef.h
+++ b/openair2/GNB_APP/gnb_paramdef.h
@@ -45,10 +45,8 @@
 #define GNB_CONF_STRING_OTG_APP_TYPE              "app_type"
 #define GNB_CONF_STRING_OTG_BG_TRAFFIC            "bg_traffic"
 
-#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
 extern int asn_debug;
 extern int asn1_xer_print;
-#endif
 
 #ifdef LIBCONFIG_LONG
 #define libconfig_int long
diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c
index 8d497c80d36505c7fb87b5e2ccc840b360163580..eef1f9c976282dc4ccfaa652c23f64e337b3bdcb 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler.c
@@ -57,9 +57,7 @@
 /* for fair round robin SCHED */
 #include "eNB_scheduler_fairRR.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "assertions.h"
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
index e85255e8ce8eba066fdb8adcf36786e41c73aad5..fb765e6dacbfb6a41b18fe4a2483840b570b52e7 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c
@@ -55,14 +55,12 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "SIMULATION/TOOLS/sim.h" // for taus
 
 #include "T.h"
-
+#include "executables/softmodem-common.h"
 #include "common/ran_context.h"
 #include "LAYER2/MAC/eNB_scheduler_fairRR.h"
 
@@ -1353,28 +1351,31 @@ initiate_ra_proc(module_id_t module_idP,
 
       /* TODO: find better procedure to allocate RNTI */
       do {
-#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode
-        static int drnti[MAX_MOBILES_PER_ENB] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
-        int j = 0;
-        int nb_ue = 0;
-
-        for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
-          if (UE_RNTI(module_idP, j) > 0) {
-            nb_ue++;
-          } else {
-            break;
+        if (IS_SOFTMODEM_IQPLAYER) {  /* iq player mode, use deterministic rnti */
+          static int drnti[MAX_MOBILES_PER_ENB];
+          static int drnti_def[]={ 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
+          for (int j=0; j<MAX_MOBILES_PER_ENB && j< (sizeof(drnti_def)/sizeof(int));j++)
+          	  drnti[i]=drnti_def[i];
+          
+          int nb_ue = 0;
+
+          for (int j = 0; j < MAX_MOBILES_PER_ENB; j++) {
+            if (UE_RNTI(module_idP, j) > 0) {
+              nb_ue++;
+            } else {
+              break;
+            }
           }
-        }
 
-        if (nb_ue >= MAX_MOBILES_PER_ENB) {
-          printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
-          abort();
-        }
+          if (nb_ue >= MAX_MOBILES_PER_ENB || nb_ue >= (sizeof(drnti_def)/sizeof(int))) {
+            printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
+            abort();
+          }
 
-        ra[i].rnti = drnti[nb_ue];
-#else
-        ra[i].rnti = taus();
-#endif
+          ra[i].rnti = drnti[nb_ue];
+        } else {
+          ra[i].rnti = taus();
+        }
         loop++;
       } while (loop != 100 &&
                /* TODO: this is not correct, the rnti may be in use without
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
index f5cd3a075363aa3bcf59b972a242d42531adc063..5b99578d57d340bd724f6d6b81c9f219d9b0994d 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c
@@ -44,9 +44,7 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 #define DEBUG_eNB_SCHEDULER 1
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
index 2a56c61a682489d1640c2e7fd5e8002c0437eafe..eba4bdcee992525d6e1ef420111962c3ed90c1ef 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c
@@ -53,9 +53,7 @@
 
 #include "assertions.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include <dlfcn.h>
 
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
index e351b69bb0980e8905941e303da62a90146781fb..2953c8e70b4065b9af032b4efebe6e10909eef1a 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c
@@ -48,10 +48,6 @@
 #include "pdcp.h"
 #include "assertions.h"
 
-//#if defined(ENABLE_ITTI)
-//#include "intertask_interface.h"
-//#endif
-//
 #include "SIMULATION/TOOLS/sim.h"	// for taus
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index 5189e769757fc79c12b18f844d6fcd6140ce2c2b..e76e6b24ba70a96d5f0140797a86c3b59ccbb2a9 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -48,10 +48,8 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
-
+#include "intertask_interface.h"
+#include "executables/softmodem-common.h"
 #include "T.h"
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
@@ -2184,9 +2182,8 @@ add_new_ue(module_id_t mod_idP,
     UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
     UE_list->num_UEs++;
     UE_list->active[UE_id] = TRUE;
-#if defined(USRP_REC_PLAY) // not specific to record/playback ?
-    UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
-#endif
+    if (IS_SOFTMODEM_IQPLAYER)// not specific to record/playback ?
+      UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
     UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type;
     memset((void *) &UE_list->UE_sched_ctrl[UE_id],
            0,
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index 430f73cd9d1b70f85b675f140bf0affa957a8f5d..6c19ad6a46b76d8adc83a55886be2b81155b88fa 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -48,9 +48,7 @@
 #include "assertions.h"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "ENB_APP/flexran_agent_defs.h"
 #include "flexran_agent_ran_api.h"
diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c
index 1244125bb683c9573eab6663cf5929454c53ae13..8518cba14c2f4307dcf00261032b07c24899f946 100644
--- a/openair2/LAYER2/MAC/ue_procedures.c
+++ b/openair2/LAYER2/MAC/ue_procedures.c
@@ -56,9 +56,7 @@
 #include "pdcp.h"
 #include "targets/RT/USER/lte-softmodem.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "assertions.h"
 
@@ -2455,10 +2453,8 @@ ue_scheduler(const module_id_t module_idP,
   struct LTE_RACH_ConfigCommon *rach_ConfigCommon =
     (struct LTE_RACH_ConfigCommon *) NULL;
   protocol_ctxt_t ctxt;
-#if defined(ENABLE_ITTI)
   MessageDef *msg_p;
   int result;
-#endif
 #if UE_TIMING_TRACE
   start_meas(&UE_mac_inst[module_idP].ue_scheduler);
 #endif
@@ -2467,7 +2463,6 @@ ue_scheduler(const module_id_t module_idP,
   PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO,
                                  UE_mac_inst[module_idP].crnti, txFrameP,
                                  txSubframeP, eNB_indexP);
-#if defined(ENABLE_ITTI)
 
   if(module_idP == 0) {
     do {
@@ -2497,8 +2492,6 @@ ue_scheduler(const module_id_t module_idP,
     } while (msg_p != NULL);
   }
 
-#endif
-
   //Mac_rlc_xface->frameP=frameP;
   //Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
   //if (subframe%5 == 0)
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index ab7757164fcad8c0a106f19e6783789723338fd9..d08b8211ee23a5f14b385c1b13bb787580991e75 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -55,9 +55,7 @@
 #include "flexran_agent_extern.h"
 #include "flexran_agent_mac.h"
 
-#if defined(ENABLE_ITTI)
 #include "intertask_interface.h"
-#endif
 
 #include "assertions.h"
 #include <openair1/PHY/LTE_TRANSPORT/transport_proto.h>
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
index df3e04dccf0224cc4d5a7142a8c2774a600c3954..409ba1d6d2ef1ec1c88a93fdea564a66d786f6d8 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c
@@ -46,9 +46,7 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
 #include "intertask_interface.h"
-#endif
 
 #define ENABLE_MAC_PAYLOAD_DEBUG
 #define DEBUG_eNB_SCHEDULER 1
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
index f3a1b3e7fd792d55b4d323c22a340dd17e1fcd56..d95819d1e78bfc6b61a84d1d46f5b4774a57af12 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
@@ -50,9 +50,7 @@
 //#include "LAYER2/MAC/pre_processor.c"
 #include "pdcp.h"
 
-#if defined(ENABLE_ITTI)
 #include "intertask_interface.h"
-#endif
 
 #include "T.h"
 
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
index 8f9ee0af188e93a7fdb9a15c21d0c3b0551ccf99..cb108f5d260c9f0186d00f52ce7e78b54ef3dfad 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
@@ -33,7 +33,7 @@
 #include "UTIL/OSA/osa_defs.h"
 
 #include "common/utils/LOG/vcd_signal_dumper.h"
-
+#include "executables/softmodem-common.h"
 #include "LAYER2/MAC/mac_extern.h"
 
 #include "pdcp.h"
@@ -213,28 +213,28 @@ pdcp_validate_security(
   stream_decrypt(pdcp_pP->cipheringAlgorithm,
                  &decrypt_params,
                  &buffer_decrypted);
-#if !defined(USRP_REC_PLAY)
-  if (srb_flagP) {
+  if (!IS_SOFTMODEM_IQPLAYER) {
+    if (srb_flagP) {
     /* Now check the integrity of the complete PDU */
-    decrypt_params.message    = pdcp_pdu_buffer;
-    decrypt_params.blength    = sdu_buffer_size << 3;
-    decrypt_params.key        = pdcp_pP->kRRCint + 16;// 128;
-
-    if (stream_check_integrity(pdcp_pP->integrityProtAlgorithm,
-                               &decrypt_params,
-                               &pdcp_pdu_buffer[sdu_buffer_size]) != 0) {
-      MSC_LOG_EVENT(
-    	  (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-    	  " Security: failed MAC-I Algo %X UE %"PRIx16" ",
-    	  pdcp_pP->integrityProtAlgorithm,
-    	  ctxt_pP->rnti);
-      LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
-            rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
-      VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
-      return -1;
+      decrypt_params.message    = pdcp_pdu_buffer;
+      decrypt_params.blength    = sdu_buffer_size << 3;
+      decrypt_params.key        = pdcp_pP->kRRCint + 16;// 128;
+
+      if (stream_check_integrity(pdcp_pP->integrityProtAlgorithm,
+                                 &decrypt_params,
+                                 &pdcp_pdu_buffer[sdu_buffer_size]) != 0) {
+        MSC_LOG_EVENT(
+    	    (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
+    	    " Security: failed MAC-I Algo %X UE %"PRIx16" ",
+    	    pdcp_pP->integrityProtAlgorithm,
+    	    ctxt_pP->rnti);
+        LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
+              rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
+        VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
+        return -1;
+      }
     }
-  }
-#endif
+  } /* !IQPLAYER */
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
 
   return 0;
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
index ddff2cc3d1c16f925785eb4ade039bd430161bb7..02a0247a03d2e8a3c8dc0e498a364838506d33bf 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
@@ -26,9 +26,7 @@
 //-----------------------------------------------------------------------------
 #include "platform_types.h"
 //-----------------------------------------------------------------------------
-#if ENABLE_ITTI
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 #include "assertions.h"
 #include "list.h"
 #include "rlc_am.h"
diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c
index 356dd2e481d54e1d767065220408b35bdc88ff98..68017be85bba9f51b06995116a5721df1307e306 100644
--- a/openair2/RRC/LTE/L2_interface.c
+++ b/openair2/RRC/LTE/L2_interface.c
@@ -37,9 +37,7 @@
 #include "msc.h"
 #include "common/ran_context.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "flexran_agent_extern.h"
 #undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c
index 20df462938f960f3f436d28c51bd97c8708c9e45..fa332b5be1e77bd84ddcb3e89e388d186334380d 100644
--- a/openair2/RRC/LTE/L2_interface_common.c
+++ b/openair2/RRC/LTE/L2_interface_common.c
@@ -37,9 +37,7 @@
 #include "msc.h"
 #include "common/ran_context.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 //#define RRC_DATA_REQ_DEBUG
 //#define DEBUG_RRC 1
@@ -135,7 +133,6 @@ rrc_data_ind(
           ctxt_pP->rnti);
   }
 
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
@@ -152,11 +149,4 @@ rrc_data_ind(
     RRC_DCCH_DATA_IND (message_p).eNB_index  = ctxt_pP->eNB_index;
     itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
   }
-#else
-  rrc_eNB_decode_dcch(
-    ctxt_pP,
-    DCCH_index,
-    buffer_pP,
-    sdu_sizeP);
-#endif
 }
diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c
index c9d4e61d0ae7a19ff251dd8903c67cf3fb1d9e69..61ab63955dd529f6d492b3a837383732701521a7 100644
--- a/openair2/RRC/LTE/L2_interface_ue.c
+++ b/openair2/RRC/LTE/L2_interface_ue.c
@@ -37,9 +37,7 @@
 #include "msc.h"
 
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 //#define RRC_DATA_REQ_DEBUG
 
@@ -76,7 +74,6 @@ mac_rrc_data_req_ue(
   LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
 
   if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
-#if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
       int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
@@ -96,7 +93,6 @@ mac_rrc_data_req_ue(
 
       itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
     }
-#endif
     memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
     uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
     //   UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
@@ -138,7 +134,6 @@ mac_rrc_data_ind_ue(
 
   if(srb_idP == BCCH_SI_MBMS) {
     LOG_D(RRC,"[UE %d] Received SDU for BCCH on MBMS SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
-#if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
       int msg_sdu_size = sizeof(RRC_MAC_BCCH_MBMS_DATA_IND (message_p).sdu);
@@ -161,14 +156,10 @@ mac_rrc_data_ind_ue(
       RRC_MAC_BCCH_MBMS_DATA_IND (message_p).rsrp      = 45 /* TODO change phy to report rspp */;
       itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
     }
-#else
-    decode_BCCH_MBMS_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP, 0, 0);
-#endif
   }
 
   if(srb_idP == BCCH) {
     LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
-#if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
       int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
@@ -191,9 +182,6 @@ mac_rrc_data_ind_ue(
       RRC_MAC_BCCH_DATA_IND (message_p).rsrp      = 45 /* TODO change phy to report rspp */;
       itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
     }
-#else
-    decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP, 0, 0);
-#endif
   }
 
   if(srb_idP == PCCH) {
@@ -204,7 +192,6 @@ mac_rrc_data_ind_ue(
   if((srb_idP & RAB_OFFSET) == CCCH) {
     if (sdu_lenP>0) {
       LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %ld from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
-#if defined(ENABLE_ITTI)
       {
         MessageDef *message_p;
         int msg_sdu_size = CCCH_SDU_SIZE;
@@ -226,20 +213,12 @@ mac_rrc_data_ind_ue(
         RRC_MAC_CCCH_DATA_IND (message_p).rnti      = rntiP;
         itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
       }
-#else
-      SRB_INFO *Srb_info;
-      Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
-      memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
-      Srb_info->Rx_buffer.payload_size = sdu_lenP;
-      rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
-#endif
     }
   }
 
   if ((srb_idP & RAB_OFFSET) == MCCH) {
     LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %ld from eNB %d\n",
           module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
-#if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
       int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
@@ -259,9 +238,6 @@ mac_rrc_data_ind_ue(
       RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
       itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
     }
-#else
-    decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
-#endif
   }
 
   //TTN (for D2D)
@@ -297,7 +273,6 @@ rrc_data_req_ue(
     ctxt_pP->rnti,
     muiP,
     sdu_sizeP);
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
@@ -325,18 +300,6 @@ rrc_data_req_ue(
       message_p);
     return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
   }
-#else
-  return pdcp_data_req (
-           ctxt_pP,
-           SRB_FLAG_YES,
-           rb_idP,
-           muiP,
-           confirmP,
-           sdu_sizeP,
-           buffer_pP,
-           modeP,NULL, NULL
-         );
-#endif
 }
 
 //------------------------------------------------------------------------------
@@ -352,7 +315,6 @@ rrc_data_ind_ue(
   rb_id_t    DCCH_index = Srb_id;
   LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
         ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP,  ctxt_pP->eNB_index);
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
@@ -369,20 +331,11 @@ rrc_data_ind_ue(
     RRC_DCCH_DATA_IND (message_p).eNB_index  = ctxt_pP->eNB_index;
     itti_send_msg_to_task (TASK_RRC_UE, ctxt_pP->instance, message_p);
   }
-#else
-  //#warning "LG put 0 to arg4 that is eNB index"
-  rrc_ue_decode_dcch(
-    ctxt_pP,
-    DCCH_index,
-    buffer_pP,
-    0);
-#endif
 }
 
 //-------------------------------------------------------------------------------------------//
 void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) {
   //-------------------------------------------------------------------------------------------//
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     //LOG_I(RRC,"sending a message to task_mac_ue\n");
@@ -391,14 +344,6 @@ void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) {
     RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
     itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
   }
-#else
-  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
-
-  if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
-    UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
-  }
-
-#endif
 }
 
 //-------------------------------------------------------------------------------------------//
@@ -412,7 +357,6 @@ void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index
           UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
           UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
 
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
@@ -420,9 +364,6 @@ void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index
     RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
     itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
   }
-#else
-  UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
-#endif
 }
 
 //------------------------------------------------------------------------------
@@ -442,16 +383,11 @@ mac_UE_get_rrc_status(
 //-------------------------------------------------------------------------------------------//
 int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) {
   //-------------------------------------------------------------------------------------------//
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
     RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
     itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
   }
-#else
-  // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
-  UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
-#endif
   return 0;
 }
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
index c9071806d29151bcc2e874b8c7511cfbcfb2e3f7..d8f6ac145dd920a3d3771cb753d9a6aa2db8f963 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c
@@ -89,9 +89,9 @@
 #include "LTE_MeasIdToAddModList.h"
 #include "enb_config.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+
+#include "intertask_interface.h"
+
 
 #include "common/ran_context.h"
 #include "secu_defs.h"
@@ -381,17 +381,12 @@ uint8_t do_MIB_SL(const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
 }
 
 uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
-                     int Mod_id,int CC_id
-#if defined(ENABLE_ITTI)
-  , RrcConfigurationReq *configuration
-#endif
+                     int Mod_id,int CC_id,
+                     RrcConfigurationReq *configuration
                     ) {
   //  SystemInformation_t systemInformation;
-#if defined(ENABLE_ITTI)
   int num_plmn = configuration->num_plmn;
-#else
-  int num_plmn = 1;
-#endif
+
   LTE_PLMN_IdentityInfo_t *PLMN_identity_info;
   LTE_MCC_MNC_Digit_t *dummy_mcc_0;
   LTE_MCC_MNC_Digit_t *dummy_mcc_1;
@@ -438,16 +433,10 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
 
     if (dummy_mcc_0 == NULL || dummy_mcc_1 == NULL || dummy_mcc_2 == NULL)
       exit(1);
-
-#if defined(ENABLE_ITTI)
     *dummy_mcc_0 = (configuration->mcc[i] / 100) % 10;
     *dummy_mcc_1 = (configuration->mcc[i] / 10) % 10;
     *dummy_mcc_2 = (configuration->mcc[i] / 1) % 10;
-#else
-    *dummy_mcc_0 = 0;
-    *dummy_mcc_1 = 0;
-    *dummy_mcc_2 = 1;
-#endif
+
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_0);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_1);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_2);
@@ -460,8 +449,6 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
     if (dummy_mnc_0 == NULL || dummy_mnc_1 == NULL || dummy_mnc_2 == NULL)
       exit(1);
 
-#if defined(ENABLE_ITTI)
-
     if (configuration->mnc[i] >= 100) {
       *dummy_mnc_0 = (configuration->mnc[i] / 100) % 10;
       *dummy_mnc_1 = (configuration->mnc[i] / 10) % 10;
@@ -478,11 +465,6 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
       }
     }
 
-#else
-    *dummy_mnc[i][0] = 0;
-    *dummy_mnc[i][1] = 1;
-    *dummy_mnc[i][2] = 0xf;
-#endif
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mnc.list, dummy_mnc_0);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mnc.list, dummy_mnc_1);
 
@@ -499,36 +481,20 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,
 
   // 16 bits
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.buf = MALLOC(2);
-#if defined(ENABLE_ITTI)
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.buf[0] = (configuration->tac >> 8) & 0xff;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.buf[1] = (configuration->tac >> 0) & 0xff;
-#else
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.buf[0] = 0x00;
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.buf[1] = 0x01;
-#endif
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.size=2;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.trackingAreaCode_r14.bits_unused=0;
   // 28 bits
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf = MALLOC(8);
-#if defined(ENABLE_ITTI)
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[0] = (configuration->cell_identity >> 20) & 0xff;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[1] = (configuration->cell_identity >> 12) & 0xff;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[2] = (configuration->cell_identity >>  4) & 0xff;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[3] = (configuration->cell_identity <<  4) & 0xf0;
-#else
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[0] = 0x00;
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[1] = 0x00;
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[2] = 0x00;
-  (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.buf[3] = 0x10;
-#endif
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.size=4;
   (*sib1_MBMS)->cellAccessRelatedInfo_r14.cellIdentity_r14.bits_unused=4;
-  (*sib1_MBMS)->freqBandIndicator_r14 =
-#if defined(ENABLE_ITTI)
-    configuration->eutra_band[CC_id];
-#else
-    7;
-#endif
+  (*sib1_MBMS)->freqBandIndicator_r14 = configuration->eutra_band[CC_id];
+
   schedulingInfo->si_Periodicity_r14=LTE_SchedulingInfo__si_Periodicity_rf16;
   *sib_type = LTE_SIB_Type_MBMS_r14_sibType13_v920;
   ASN_SEQUENCE_ADD(&schedulingInfo->sib_MappingInfo_r14.list, sib_type);
@@ -827,17 +793,11 @@ LTE_DRX_Config_t *do_DrxConfig(int CC_id,
 }
 
 uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
-                int Mod_id,int CC_id, BOOLEAN_t brOption
-#if defined(ENABLE_ITTI)
-  , RrcConfigurationReq *configuration
-#endif
+                int Mod_id,int CC_id, BOOLEAN_t brOption,
+                RrcConfigurationReq *configuration
                ) {
   //  SystemInformation_t systemInformation;
-#if defined(ENABLE_ITTI)
   int num_plmn = configuration->num_plmn;
-#else
-  int num_plmn = 1;
-#endif
   LTE_PLMN_IdentityInfo_t *PLMN_identity_info;
   LTE_MCC_MNC_Digit_t *dummy_mcc_0;
   LTE_MCC_MNC_Digit_t *dummy_mcc_1;
@@ -892,15 +852,10 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
     if (dummy_mcc_0 == NULL || dummy_mcc_1 == NULL || dummy_mcc_2 == NULL)
       exit(1);
 
-#if defined(ENABLE_ITTI)
+
     *dummy_mcc_0 = (configuration->mcc[i] / 100) % 10;
     *dummy_mcc_1 = (configuration->mcc[i] / 10) % 10;
     *dummy_mcc_2 = (configuration->mcc[i] / 1) % 10;
-#else
-    *dummy_mcc_0 = 0;
-    *dummy_mcc_1 = 0;
-    *dummy_mcc_2 = 1;
-#endif
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_0);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_1);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mcc->list, dummy_mcc_2);
@@ -913,7 +868,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
     if (dummy_mnc_0 == NULL || dummy_mnc_1 == NULL || dummy_mnc_2 == NULL)
       exit(1);
 
-#if defined(ENABLE_ITTI)
 
     if (configuration->mnc[i] >= 100) {
       *dummy_mnc_0 = (configuration->mnc[i] / 100) % 10;
@@ -930,12 +884,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
         *dummy_mnc_2 = (configuration->mnc[i] / 1) % 10;
       }
     }
-
-#else
-    *dummy_mnc_0 = 0;
-    *dummy_mnc_1 = 1;
-    *dummy_mnc_2 = 0xf;
-#endif
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mnc.list, dummy_mnc_0);
     ASN_SEQUENCE_ADD(&PLMN_identity_info[i].plmn_Identity.mnc.list, dummy_mnc_1);
 
@@ -952,28 +900,16 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
 
   // 16 bits
   (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2);
-#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
   (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size = 2;
   (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused = 0;
   // 28 bits
   (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8);
-#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
   (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4;
   (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4;
   //  assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred);
@@ -985,12 +921,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
   (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL;
   //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t));
   // *((*sib1)->p_Max) = 23;
-  (*sib1)->freqBandIndicator =
-#if defined(ENABLE_ITTI)
-    configuration->eutra_band[CC_id];
-#else
-    7;
-#endif
+  (*sib1)->freqBandIndicator = configuration->eutra_band[CC_id];
   schedulingInfo.si_Periodicity=LTE_SchedulingInfo__si_Periodicity_rf8;
   if(configuration->eMBMS_M2_configured){
        schedulingInfo2.si_Periodicity=LTE_SchedulingInfo__si_Periodicity_rf8;
@@ -1005,24 +936,12 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
          ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo2);
   }
   //  ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL);
-#if defined(ENABLE_ITTI)
 
   if (configuration->frame_type[CC_id] == TDD)
-#endif
   {
     (*sib1)->tdd_Config =                             CALLOC(1,sizeof(struct LTE_TDD_Config));
-    (*sib1)->tdd_Config->subframeAssignment =
-#if defined(ENABLE_ITTI)
-      configuration->tdd_config[CC_id];
-#else
-      3; // +kogo this was frame_parms->tdd_config
-#endif
-    (*sib1)->tdd_Config->specialSubframePatterns =
-#if defined(ENABLE_ITTI)
-      configuration->tdd_config_s[CC_id];
-#else
-      0;
-#endif
+    (*sib1)->tdd_Config->subframeAssignment = configuration->tdd_config[CC_id];
+    (*sib1)->tdd_Config->specialSubframePatterns =  configuration->tdd_config_s[CC_id];
   }
 
   (*sib1)->si_WindowLength = LTE_SystemInformationBlockType1__si_WindowLength_ms20;
@@ -1050,8 +969,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
   sib1_1250->freqBandIndicatorPriority_r12 = 0; // long* // FIXME
   sib1_1250->nonCriticalExtension = NULL;
   ////Rel1310
-#if defined(ENABLE_ITTI)
-
   if ((configuration->schedulingInfoSIB1_BR_r13[CC_id] != 0) &&
       (brOption==TRUE)) {
     sib1_1250->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
@@ -1245,89 +1162,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
     sib1_1320->nonCriticalExtension = NULL;
   }
 
-#else
-  sib1_1250->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
-  memset(sib1_1250->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1310_IEs_t));
-  SystemInformationBlockType1_v1310_IEs_t *sib1_1310 = sib1_1250->nonCriticalExtension;
-  sib1_1310->hyperSFN_r13 = calloc(1, sizeof(BIT_STRING_t)); // type
-  memset(sib1_1310->hyperSFN_r13, 0, sizeof(BIT_STRING_t));
-  sib1_1310->hyperSFN_r13->buf = calloc(2, sizeof(uint8_t));
-  memset(sib1_1310->hyperSFN_r13->buf, 0, 2*sizeof(uint8_t));
-  sib1_1310->hyperSFN_r13->size = 2;
-  sib1_1310->hyperSFN_r13->bits_unused = 6;
-  sib1_1310->eDRX_Allowed_r13 = NULL; // long*
-  sib1_1310->cellSelectionInfoCE_r13 = calloc(1, sizeof(LTE_CellSelectionInfoCE_r13_t));
-  memset(sib1_1310->cellSelectionInfoCE_r13, 0, sizeof(LTE_CellSelectionInfoCE_r13_t));
-  sib1_1310->cellSelectionInfoCE_r13->q_RxLevMinCE_r13 = -70; // (Q_RxLevMin_t) long
-  sib1_1310->cellSelectionInfoCE_r13->q_QualMinRSRQ_CE_r13 = NULL; // (Q_RxLevMin_t) *long
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13
-    = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13));
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_WindowLength_BR_r13
-    = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_WindowLength_BR_r13_ms20; // 0
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_RepetitionPattern_r13
-    = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_RepetitionPattern_r13_everyRF; // 0
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13 = calloc(1, sizeof(LTE_SchedulingInfoList_BR_r13_t));
-  SchedulingInfo_BR_r13_t *schedulinginfo_br_13 = calloc(1, sizeof(LTE_SchedulingInfo_BR_r13_t));
-  memset(schedulinginfo_br_13, 0, sizeof(LTE_SchedulingInfo_BR_r13_t));
-  schedulinginfo_br_13->si_Narrowband_r13 = 1;
-  schedulinginfo_br_13->si_TBS_r13 = LTE_SchedulingInfo_BR_r13__si_TBS_r13_b152;
-  ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->schedulingInfoList_BR_r13->list, schedulinginfo_br_13);
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13
-    = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13));
-  memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13, 0,
-         sizeof(struct LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13));
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->present
-    = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__fdd_DownlinkOrTddSubframeBitmapBR_r13_PR_subframePattern10_r13;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf = calloc(2, sizeof(uint8_t));
-  memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.buf, 0, 2 * sizeof(uint8_t));
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.size = 2;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_DownlinkOrTddSubframeBitmapBR_r13->choice.subframePattern10_r13.bits_unused = 6;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13 = calloc(1, sizeof(BIT_STRING_t));
-  memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13, 0, sizeof(BIT_STRING_t));
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf = calloc(2, sizeof(uint8_t));
-  memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->buf, 0,
-         2 * sizeof(uint8_t));
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->size = 2;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->fdd_UplinkSubframeBitmapBR_r13->bits_unused = 6;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->startSymbolBR_r13 = 1;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_HoppingConfigCommon_r13
-    = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_HoppingConfigCommon_r13_on;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13 = calloc(1, sizeof(long));
-  memset(sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13, 0, sizeof(long));
-  *sib1_1310->bandwidthReducedAccessRelatedInfo_r13->si_ValidityTime_r13
-    = LTE_SystemInformationBlockType1_v1310_IEs__bandwidthReducedAccessRelatedInfo_r13__si_ValidityTime_r13_true;
-  sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13 = calloc(1, sizeof(LTE_SystemInfoValueTagList_r13_t));
-  LTE_SystemInfoValueTagSI_r13_t *systemInfoValueTagSi_r13 = CALLOC(1, sizeof(LTE_SystemInfoValueTagSI_r13_t));
-  *systemInfoValueTagSi_r13 = 0;
-  ASN_SEQUENCE_ADD(&sib1_1310->bandwidthReducedAccessRelatedInfo_r13->systemInfoValueTagList_r13->list, systemInfoValueTagSi_r13);
-  sib1_1310->nonCriticalExtension = calloc(1, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
-  memset(sib1_1310->nonCriticalExtension, 0, sizeof(LTE_SystemInformationBlockType1_v1320_IEs_t));
-  /////Rel1320
-  LTE_SystemInformationBlockType1_v1320_IEs_t *sib1_1320 = sib1_1310->nonCriticalExtension;
-  sib1_1320->freqHoppingParametersDL_r13 = calloc(1, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
-  memset(sib1_1320->freqHoppingParametersDL_r13, 0, sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13));
-  sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = calloc(1, sizeof(long));
-  *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingNB_r13 = LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__mpdcch_pdsch_HoppingNB_r13_nb2;
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13 = calloc(1,
-      sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
-  memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13, 0,
-         sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13));
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->present =
-    LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13_PR_interval_FDD_r13;
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeA_r13->choice.interval_FDD_r13 =
-    LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeA_r13__interval_FDD_r13_int1;
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13 = calloc(1,
-      sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
-  memset(sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13, 0,
-         sizeof(struct LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13));
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->present =
-    LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13_PR_interval_FDD_r13;
-  sib1_1320->freqHoppingParametersDL_r13->interval_DLHoppingConfigCommonModeB_r13->choice.interval_FDD_r13 =
-    LTE_SystemInformationBlockType1_v1320_IEs__freqHoppingParametersDL_r13__interval_DLHoppingConfigCommonModeB_r13__interval_FDD_r13_int2;
-  sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = calloc(1, sizeof(long));
-  *sib1_1320->freqHoppingParametersDL_r13->mpdcch_pdsch_HoppingOffset_r13 = 1;
-  sib1_1320->nonCriticalExtension = NULL;
-#endif
   (*sib1)->si_WindowLength=LTE_SystemInformationBlockType1__si_WindowLength_ms20;
   (*sib1)->systemInfoValueTag=0;
   //  (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension));
@@ -1358,10 +1192,8 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
 
 uint8_t do_SIB23(uint8_t Mod_id,
 
-                 int CC_id, BOOLEAN_t brOption
-#if defined(ENABLE_ITTI)
-  , RrcConfigurationReq *configuration
-#endif
+                 int CC_id, BOOLEAN_t brOption, 
+                 RrcConfigurationReq *configuration
                 ) {
   struct LTE_SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part;
   int eMTC_configured = configuration->eMTC_configured;
@@ -1455,7 +1287,6 @@ uint8_t do_SIB23(uint8_t Mod_id,
   (*sib2)->ac_BarringInfo = NULL;
   (*sib2)->ext1 = NULL;
   (*sib2)->ext2 = NULL;
-#if defined(ENABLE_ITTI)
   (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles                         = rrconfig->rach_numberOfRA_Preambles;
   (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig                        = NULL;
 
@@ -1846,121 +1677,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
     = rrconfig->ue_TimersAndConstants_t311;
   (*sib2)->ue_TimersAndConstants.n311
     = rrconfig->ue_TimersAndConstants_n311;
-#else
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=LTE_RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=LTE_RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower=
-    RACH_ConfigCommon__powerRampingParameters__preambleInitialReceivedTargetPower_dBm_100;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=LTE_RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=LTE_RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer=
-    LTE_RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4;
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1 = calloc(1, sizeof(struct LTE_RACH_ConfigCommon__ext1));
-  memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1, 0, sizeof(struct LTE_RACH_ConfigCommon__ext1));
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = calloc(1, sizeof(LTE_PreambleTransMax_t));
-  *(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->preambleTransMax_CE_r13 = LTE_PreambleTransMax_n5; // to be re-initialized when we find the enum
-  (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
-  memset((*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13, 0, sizeof(LTE_RACH_CE_LevelInfoList_r13_t));
-  LTE_RACH_CE_LevelInfo_r13_t *rach_ce_levelinfo_r13 = calloc(1, sizeof(LTE_RACH_CE_LevelInfo_r13_t));
-  memset(rach_ce_levelinfo_r13, 0, sizeof(LTE_RACH_CE_LevelInfo_r13_t));
-  rach_ce_levelinfo_r13->preambleMappingInfo_r13.firstPreamble_r13 = 0;
-  rach_ce_levelinfo_r13->preambleMappingInfo_r13.lastPreamble_r13 = 63;
-  rach_ce_levelinfo_r13->ra_ResponseWindowSize_r13 = LTE_RACH_CE_LevelInfo_r13__ra_ResponseWindowSize_r13_sf80;
-  rach_ce_levelinfo_r13->mac_ContentionResolutionTimer_r13 = LTE_RACH_CE_LevelInfo_r13__mac_ContentionResolutionTimer_r13_sf200;
-  rach_ce_levelinfo_r13->rar_HoppingConfig_r13 = LTE_RACH_CE_LevelInfo_r13__rar_HoppingConfig_r13_off;
-  ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ext1->rach_CE_LevelInfoList_r13->list, rach_ce_levelinfo_r13);
-  // BCCH-Config
-  (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=LTE_BCCH_Config__modificationPeriodCoeff_n2;
-  // PCCH-Config
-  (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = LTE_PCCH_Config__defaultPagingCycle_rf128;
-  (*sib2)->radioResourceConfigCommon.pcch_Config.nB=LTE_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
-  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0;  // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz
-  (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0;
-  // PUSCH-Config
-  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1;
-  (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=LTE_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=LTE_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=LTE_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=LTE_UplinkPowerControlCommon__alpha_al1;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=LTE_DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0;
-  (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6;
-  (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1;
-  (*sib2)->radioResourceConfigCommon.ext4 = calloc(1, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
-  memset((*sib2)->radioResourceConfigCommon.ext4, 0, sizeof(struct LTE_RadioResourceConfigCommonSIB__ext4));
-  (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310 = calloc(1, sizeof(LTE_BCCH_Config_v1310_t));
-  memset((*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310, 0, sizeof(LTE_BCCH_Config_v1310_t));
-  (*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310->modificationPeriodCoeff_v1310 = LTE_BCCH_Config_v1310__modificationPeriodCoeff_v1310_n64;
-  (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->freqHoppingParameters_r13 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->pdsch_ConfigCommon_v1310 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->pusch_ConfigCommon_v1310 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PRACH_ConfigSIB_v1310_t));
-  memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310, 0, sizeof(PRACH_ConfigSIB_v1310_t));
-  LTE_RSRP_Range_t rsrp_range = 60;
-  ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->rsrp_ThresholdsPrachInfoList_r13.list, &rsrp_range);
-  (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13 = calloc(1, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
-  memset((*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13, 0, sizeof(struct LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13));
-  (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->present = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13_PR_fdd_r13;
-  (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->mpdcch_startSF_CSS_RA_r13->choice.fdd_r13 = LTE_PRACH_ConfigSIB_v1310__mpdcch_startSF_CSS_RA_r13__fdd_r13_v5;
-  (*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_HoppingOffset_r13 = NULL;
-  LTE_PRACH_ParametersCE_r13_t *prach_parametersce_r13 = calloc(1, sizeof(LTE_PRACH_ParametersCE_r13_t));
-  memset(prach_parametersce_r13, 0, sizeof(LTE_PRACH_ParametersCE_r13_t));
-  prach_parametersce_r13->prach_ConfigIndex_r13 = 3;
-  prach_parametersce_r13->prach_FreqOffset_r13 = 1;
-  prach_parametersce_r13->prach_StartingSubframe_r13 = NULL;
-  prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = calloc(1, sizeof(long));
-  *prach_parametersce_r13->maxNumPreambleAttemptCE_r13 = LTE_PRACH_ParametersCE_r13__maxNumPreambleAttemptCE_r13_n3;
-  prach_parametersce_r13->numRepetitionPerPreambleAttempt_r13 = LTE_PRACH_ParametersCE_r13__numRepetitionPerPreambleAttempt_r13_n1;
-  long maxavailablenarrowband = 2;
-  ASN_SEQUENCE_ADD(&prach_parametersce_r13->mpdcch_NarrowbandsToMonitor_r13.list, &maxavailablenarrowband);
-  prach_parametersce_r13->mpdcch_NumRepetition_RA_r13 = LTE_PRACH_ParametersCE_r13__mpdcch_NumRepetition_RA_r13_r1;
-  prach_parametersce_r13->prach_HoppingConfig_r13 = LTE_PRACH_ParametersCE_r13__prach_HoppingConfig_r13_off;
-  ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->prach_ConfigCommon_v1310->prach_ParametersListCE_r13.list, prach_parametersce_r13);
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310 = calloc(1, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
-  memset((*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310, 0, sizeof(LTE_PUCCH_ConfigCommon_v1310_t));
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13 = calloc(1, sizeof(LTE_N1PUCCH_AN_InfoList_r13_t));
-  long pucch_info_value1 = 0;
-  long pucch_info_value2 = 2;
-  ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13->list, &pucch_info_value1);
-  ASN_SEQUENCE_ADD(&(*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->n1PUCCH_AN_InfoList_r13->list, &pucch_info_value2);
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level0_r13 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level1_r13 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level2_r13 = NULL;
-  (*sib2)->radioResourceConfigCommon.ext4->pucch_ConfigCommon_v1310->pucch_NumRepetitionCE_Msg4_Level3_r13 = NULL;
-  (*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;
-#endif
+
   (*sib2)->freqInfo.additionalSpectrumEmission = 1;
   (*sib2)->freqInfo.ul_CarrierFreq = NULL;
   (*sib2)->freqInfo.ul_Bandwidth = NULL;
@@ -2724,21 +2441,12 @@ do_RRCConnectionSetup(
   SRB1_config->rlc_Config   = SRB1_rlc_config;
   SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue;
   SRB1_rlc_config->choice.explicitValue.present=LTE_RLC_Config_PR_am;
-#if defined(ENABLE_ITTI)
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = rrc->srb1_poll_pdu;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = rrc->srb1_poll_byte;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
   SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = rrc->srb1_timer_reordering;
   SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
-#else
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20;;
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = LTE_PollPDU_p4;;
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = LTE_PollByte_kBinfinity;
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8;
-  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = LTE_T_Reordering_ms35;
-  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0;
-#endif
   SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config));
   SRB1_config->logicalChannelConfig   = SRB1_lchan_config;
   SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
@@ -3099,21 +2807,12 @@ uint8_t do_RRCConnectionSetup_BR(
   SRB1_config->rlc_Config  = SRB1_rlc_config; // check this
   SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue;
   SRB1_rlc_config->choice.explicitValue.present = LTE_RLC_Config_PR_am;
-#if defined(ENABLE_ITTI)
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = rrc->srb1_poll_pdu;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = rrc->srb1_poll_byte;
   SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
   SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = rrc->srb1_timer_reordering;
   SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
-#else
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20; // FIXME should be 80
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = LTE_PollPDU_p4; // FIXME should be infinity
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = LTE_PollByte_kBinfinity;
-  SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8;
-  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = LTE_T_Reordering_ms35;
-  SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0;
-#endif
   SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config));
   SRB1_config->logicalChannelConfig = SRB1_lchan_config;
   SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
@@ -3403,9 +3102,9 @@ uint8_t do_RRCConnectionSetup_BR(
   rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_Config = NULL;
   rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2;
   // rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = NULL;
-#ifdef XER_PRINT
-  xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg);
-#endif
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+    xer_fprint(stdout, &asn_DEF_LTE_DL_CCCH_Message, (void *)&dl_ccch_msg);
+  }
   enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_CCCH_Message,
                                    NULL,
                                    (void *)&dl_ccch_msg,
@@ -3413,31 +3112,8 @@ uint8_t do_RRCConnectionSetup_BR(
                                    100);
   AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
                enc_rval.failed_type->name, enc_rval.encoded);
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
-  {
-    char        message_string[20000];
-    size_t      message_string_size;
-
-    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) {
-      MessageDef *msg_p;
-      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText));
-      msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size;
-      memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size);
-      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-    }
-  }
-# endif
-#endif
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionSetup_BR Encoded %d bits (%d bytes), ecause %d\n",
-        enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
-#endif
-  //  FREEMEM(SRB_list);
-  //  free(SRB1_config);
-  //  free(SRB1_rlc_config);
-  //  free(SRB1_lchan_config);
-  //  free(SRB1_ul_SpecificParameters);
+
+
   return((enc_rval.encoded+7)/8);
 }
 
@@ -3661,25 +3337,10 @@ uint16_t do_RRCConnectionReconfiguration_BR(const protocol_ctxt_t        *const
                                    RRC_BUF_SIZE);
   AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed %s, %lu!\n",
                enc_rval.failed_type->name, enc_rval.encoded);
-#ifdef XER_PRINT
-  xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void *)&dl_dcch_msg);
-#endif
-#if defined(ENABLE_ITTI)
-# if !defined(DISABLE_XER_SPRINT)
-  {
-    char        message_string[30000];
-    size_t      message_string_size;
-
-    if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_LTE_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) {
-      MessageDef *msg_p;
-      msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText));
-      msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size;
-      memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size);
-      itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p);
-    }
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+    xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message,(void *)&dl_dcch_msg);
   }
-# endif
-#endif
+
   LOG_I(RRC,"RRCConnectionReconfiguration Encoded %d bits (%d bytes)\n",(int)enc_rval.encoded,(int)(enc_rval.encoded+7)/8);
   return((enc_rval.encoded+7)/8);
 }
@@ -3933,21 +3594,12 @@ do_RRCConnectionReestablishment(
     SRB1_config->rlc_Config   = SRB1_rlc_config;
     SRB1_rlc_config->present = LTE_SRB_ToAddMod__rlc_Config_PR_explicitValue;
     SRB1_rlc_config->choice.explicitValue.present=LTE_RLC_Config_PR_am;
-#if defined(ENABLE_ITTI)
     SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit;
     SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = rrc->srb1_poll_pdu;
     SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = rrc->srb1_poll_byte;
     SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold;
     SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = rrc->srb1_timer_reordering;
     SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit;
-#else
-    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms20;;
-    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU          = LTE_PollPDU_p4;;
-    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte         = LTE_PollByte_kBinfinity;
-    SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8;
-    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering     = LTE_T_Reordering_ms35;
-    SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms0;
-#endif
     SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config));
     SRB1_config->logicalChannelConfig = SRB1_lchan_config;
     SRB1_lchan_config->present = LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue;
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h
index 925f09416e2c94ec438c4d4c4c31dc870ac52ff5..ccd5e1c5371f07ade921008922df8e80d5139b75 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h
@@ -91,10 +91,8 @@ LTE_DRX_Config_t *do_DrxConfig(int CC_id, RrcConfigurationReq *configuration, LT
 @param br_flag Do for BL/CE UE configuration
 @return size of encoded bit stream in bytes*/
 
-uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, BOOLEAN_t brOption
-#if defined(ENABLE_ITTI)
-  ,RrcConfigurationReq *configuration
-#endif
+uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, BOOLEAN_t brOption,
+  RrcConfigurationReq *configuration
                );
 
 /**
@@ -120,10 +118,8 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcCo
 @param MBMS_flag Indicates presence of MBMS system information (when 1)
 @return size of encoded bit stream in bytes*/
 
-uint8_t do_SIB23(uint8_t Mod_id,int CC_id, BOOLEAN_t brOption
-#if defined(ENABLE_ITTI)
-  , RrcConfigurationReq *configuration
-#endif
+uint8_t do_SIB23(uint8_t Mod_id,int CC_id, BOOLEAN_t brOption,
+  RrcConfigurationReq *configuration
                 );
 
 /**
diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
index 480f5c35163bb94c69c8af5c21c904b84a650af3..350a8baf77faec3e25b78207c1a46b51488f349f 100644
--- a/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
+++ b/openair2/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c
@@ -68,10 +68,8 @@
 
 //#include "PHY/defs.h"
 #include "enb_config.h"
+#include "intertask_interface.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
 
 
 
@@ -178,21 +176,15 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
   memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
   asn_set_empty(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list);//.size=0;
   //left as it is???
-#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_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[0]);
   ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[1]);
   ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[2]);
   PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.size=0;
   PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.count=0;
-#if defined(ENABLE_ITTI)
 
   if (configuration->mnc >= 100) {
     dummy_mnc[0] = (configuration->mnc / 100) % 10;
@@ -210,11 +202,6 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
     }
   }
 
-#else
-  dummy_mnc[0] = 0;
-  dummy_mnc[1] = 1;
-  dummy_mnc[2] = 0xf;
-#endif
   ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[0]);
   ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[1]);
 
@@ -230,28 +217,16 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
   // 16 bits = 2 byte
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
   //lefts as it is?
-#if defined(ENABLE_ITTI)
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = (configuration->tac >> 0) & 0xff;
-#else
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = 0x00;
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = 0x01;
-#endif
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
   // 28 bits --> i have to use 32 bits = 4 byte
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
-#if defined(ENABLE_ITTI)
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = (configuration->cell_identity >> 20) & 0xff;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = (configuration->cell_identity >> 12) & 0xff;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = (configuration->cell_identity >>  4) & 0xff;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = (configuration->cell_identity <<  4) & 0xf0;
-#else
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = 0x00;
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = 0x00;
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = 0x00;
-  (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = 0x10;
-#endif
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
   (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
   //Still set to "notBarred" as in the previous case
@@ -264,11 +239,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
   *((*sib1_NB_IoT)->p_Max_r13) = 23;
   //FIXME
   (*sib1_NB_IoT)->freqBandIndicator_r13 =
-#if defined(ENABLE_ITTI)
     configuration->eutra_band;
-#else
-    5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz  FDD mode)
-#endif
+
   //OPTIONAL new parameters, to be used?
   /*
    * freqBandInfo_r13
@@ -305,10 +277,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
   ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]);
   ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]);
   //printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
-#if defined(ENABLE_ITTI)
 
   if (configuration->frame_type == TDD)
-#endif
   {
     //FIXME in NB-IoT mandatory to be FDD --> so must give an error
     LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
@@ -342,9 +312,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
           enc_rval.failed_type->name, enc_rval.encoded);
   }
 
-#ifdef USER_MODE
   LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
 
   if (enc_rval.encoded==-1) {
     return(-1);
@@ -563,10 +531,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
                                    900);
   //  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
   //               enc_rval.failed_type->name, enc_rval.encoded);
-  //#if defined(ENABLE_ITTI).....
-#ifdef USER_MODE
+
   LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
+
 
   if (enc_rval.encoded==-1) {
     msg("[RRC] ASN1 : SI-NB encoding failed for SIB23_NB_IoT\n");
@@ -748,10 +715,8 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
           enc_rval.failed_type->name, enc_rval.encoded);
   }
 
-#ifdef USER_MODE
-  LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
-        enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
-#endif
+  LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes)\n",
+        enc_rval.encoded,(enc_rval.encoded+7)/8);
   return((enc_rval.encoded+7)/8);
 }
 
@@ -793,15 +758,11 @@ uint8_t do_SecurityModeCommand_NB_IoT(
           enc_rval.failed_type->name, enc_rval.encoded);
   }
 
-  //#if defined(ENABLE_ITTI)
-  //# if !defined(DISABLE_XER_SPRINT)....
-#ifdef USER_MODE
   LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n",
         ctxt_pP->module_id,
         ctxt_pP->rnti,
         enc_rval.encoded,
         (enc_rval.encoded+7)/8);
-#endif
 
   if (enc_rval.encoded==-1) {
     LOG_E(RRC,"[NB-IoT %d] ASN1 : securityModeCommand-NB encoding failed for UE %x\n",
@@ -850,15 +811,12 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
           enc_rval.failed_type->name, enc_rval.encoded);
   }
 
-  //#if defined(ENABLE_ITTI)
-  //# if !defined(DISABLE_XER_SPRINT)....
-#ifdef USER_MODE
   LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n",
         ctxt_pP->module_id,
         ctxt_pP->rnti,
         enc_rval.encoded,
         (enc_rval.encoded+7)/8);
-#endif
+
 
   if (enc_rval.encoded==-1) {
     LOG_E(RRC,"[NB-IoT %d] ASN1 : UECapabilityEnquiry-NB encoding failed for UE %x\n",
@@ -940,8 +898,6 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
     xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message_NB,(void *)&dl_dcch_msg_NB_IoT);
   }
 
-  //#if defined(ENABLE_ITTI)
-  //# if !defined(DISABLE_XER_SPRINT)...
   LOG_I(RRC,"RRCConnectionReconfiguration-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
   return((enc_rval.encoded+7)/8);
 }
@@ -977,10 +933,8 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
   }
 
   //Only change in "asn_DEF_DL_CCCH_Message_NB"
-#ifdef USER_MODE
   LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
         enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
   return((enc_rval.encoded+7)/8);
 }
 
@@ -1025,10 +979,8 @@ uint8_t do_RRCConnectionReject_NB_IoT(
           enc_rval.failed_type->name, enc_rval.encoded);
   }
 
-#ifdef USER_MODE
   LOG_D(RRC,"RRCConnectionReject-NB Encoded %zd bits (%zd bytes)\n",
         enc_rval.encoded,(enc_rval.encoded+7)/8);
-#endif
   return((enc_rval.encoded+7)/8);
 }
 
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index bf62fc3df2873cbb390fe34dc9c13edcd9e6c53b..a91e6fcd00542d397b0e511782f66ac95131c54d 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -152,21 +152,15 @@ init_SI(
           (int)configuration->N_RB_DL[CC_id]);
     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_FeMBMS = (uint8_t *) malloc16(4);
     do_MIB_FeMBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
-#ifdef ENABLE_ITTI
                   configuration->N_RB_DL[CC_id],
-                  0 //additionalNonMBSFN
-#else
-                  50,0
-#endif
-                  ,0);
+                  0, //additionalNonMBSFN
+                  0);
     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = 0;
     RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_MBMS = (uint8_t *) malloc16(32);
     AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_MBMS!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_MBMS allocated\n",
                 PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
-    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = do_SIB1_MBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
-#if defined(ENABLE_ITTI)
-        , configuration
-#endif
+    RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = do_SIB1_MBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id,
+         configuration
                                                                               );
     LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB1-MBMS\n",
           PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)
@@ -892,7 +886,6 @@ rrc_eNB_free_mem_UE_context(
   //uint8_t                            Status;
   //rnti_t                             rnti;
   //uint64_t                           random_ue_identity;
-#if defined(ENABLE_ITTI)
   //UE_S_TMSI                          Initialue_identity_s_TMSI;
   //EstablishmentCause_t               establishment_cause;
   //ReestablishmentCause_t             reestablishment_cause;
@@ -905,7 +898,6 @@ rrc_eNB_free_mem_UE_context(
   //transport_layer_addr_t             enb_gtp_addrs[S1AP_MAX_E_RAB];
   //rb_id_t                            enb_gtp_ebi[S1AP_MAX_E_RAB];
 #endif
-#endif
 }
 
 //-----------------------------------------------------------------------------
@@ -4758,7 +4750,6 @@ check_handovers(
     if (ue_context_p->ue_context.Status == RRC_RECONFIGURED
         && ue_context_p->ue_context.handover_info != NULL &&
         ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_NO_EMPTY ) {
-#if defined(ENABLE_ITTI)
       MessageDef   *msg_p;
       int    result;
       protocol_ctxt_t  ctxt;
@@ -4889,7 +4880,6 @@ check_handovers(
 
       ue_context_p->ue_context.handover_info->endmark_state = ENDMARK_EMPTY;
       ue_context_p->ue_context.handover_info->state = HO_FORWARDING_COMPLETE;
-#endif
     }
   }
 }
@@ -5805,7 +5795,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
   securityConfigHO->handoverType.choice.intraLTE.securityAlgorithmConfig = NULL; /* TODO: to be checked */
   securityConfigHO->handoverType.choice.intraLTE.keyChangeIndicator = 0;
   securityConfigHO->handoverType.choice.intraLTE.nextHopChainingCount = 0;
-#if defined(ENABLE_ITTI)
   /* Initialize NAS list */
   dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
 
@@ -5838,7 +5827,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
     dedicatedInfoNASList = NULL;
   }
 
-#endif
   measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
                          RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
   memset(buffer, 0, RRC_BUF_SIZE);
@@ -5887,7 +5875,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
   *_size = size = ho_size;
   LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size,
               "[MSG] RRC Connection Reconfiguration handover\n");
-#if defined(ENABLE_ITTI)
 
   /* Free all NAS PDUs */
   for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
@@ -5897,8 +5884,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
       ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
     }
   }
-
-#endif
   LOG_I(RRC,
         "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration handover (bytes %d, UE id %x)\n",
         ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
index 749dff3acedf0832f1a737e5382ad66dcdba601a..6bbdef181b4e2793e3c3898e6fc5ee4b5a9dbc8c 100644
--- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
@@ -27,7 +27,6 @@
  * \email: lionel.gauthier@eurecom.fr
  */
 
-//#if defined(ENABLE_USE_MME)
 # include "rrc_defs.h"
 # include "rrc_extern.h"
 # include "RRC/LTE/MESSAGES/asn1_msg.h"
@@ -35,10 +34,10 @@
 # include "rrc_eNB_UE_context.h"
 # include "msc.h"
 
-//# if defined(ENABLE_ITTI)
-#   include "asn1_conversions.h"
-#   include "intertask_interface.h"
-//#endif
+
+#include "asn1_conversions.h"
+#include "intertask_interface.h"
+
 
 # include "common/ran_context.h"
 
@@ -113,7 +112,6 @@ gtpv_data_req(
     return FALSE;
   }
   LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP);
-#if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
     // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
@@ -167,8 +165,6 @@ gtpv_data_req(
       return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
     }
   }
-#endif
-
   return TRUE;
 
 }
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 11c6d27f5facd1d66f36b00d276d40f0ea9bdaeb..59998cebcce88304bc42e664abdd5c90dea0295e 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -58,7 +58,7 @@
 #include "TLVDecoder.h"
 #include "S1AP_NAS-PDU.h"
 #include "flexran_agent_common_internal.h"
-
+#include "executables/softmodem-common.h"
 extern RAN_CONTEXT_t RC;
 
 extern int
@@ -540,9 +540,10 @@ rrc_pdcp_config_security(
   derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
                      ue_context_pP->ue_context.kenb,
                      &kRRCint);
-#if !defined(USRP_REC_PLAY)
+ if (!IS_SOFTMODEM_IQPLAYER) {
   SET_LOG_DUMP(DEBUG_SECURITY) ;
-#endif
+ }
+
 
   if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
     if (print_keys ==1 ) {
diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c
index 86cff69517f31df92d4fd9c65496cdf30c27f5f9..2a9448218a91fb0fdee7b6dc3f668ad710b8fed2 100644
--- a/openair2/RRC/NR/L2_nr_interface.c
+++ b/openair2/RRC/NR/L2_nr_interface.c
@@ -36,9 +36,7 @@
 #include "msc.h"
 #include "common/ran_context.h"
 
-#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "NR_MIB.h"
 #include "NR_BCCH-BCH-Message.h"
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
index a3bdffb5f6734fed6e06b4abfde6b357cfb877d1..b321aa3e4f5d0fb31efbe23b7bb609ed7755c43b 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -99,9 +99,7 @@
   #include "gnb_config.h"
 #endif
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 #include "common/ran_context.h"
 
@@ -289,23 +287,18 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
 }
 
 
-uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
-#if defined(ENABLE_ITTI)
-  , gNB_RrcConfigurationReq *configuration
-#endif
+uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, 
+	               gNB_RrcConfigurationReq *configuration
                   ) {
   asn_enc_rval_t enc_rval;
   NR_BCCH_DL_SCH_Message_t *sib1_message ;
   struct NR_SIB1 *sib1 ;
   int i;
   struct NR_PLMN_IdentityInfo nr_plmn_info;
-#if defined(ENABLE_ITTI)
+
   // TODO : Add support for more than one PLMN
   //int num_plmn = configuration->num_plmn;
   int num_plmn = 1;
-#else
-  int num_plmn = 1;
-#endif
   struct NR_PLMN_Identity nr_plmn[num_plmn];
   NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
   NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
@@ -329,30 +322,18 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
   memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity));
 
   for (i = 0; i < num_plmn; ++i) {
-#ifdef ENABLE_ITTI
     nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
     nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
     nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
-#else
-    nr_mcc_digit[i][0] = 0;
-    nr_mcc_digit[i][1] = 0;
-    nr_mcc_digit[i][2] = 1;
-#endif
     nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
     memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC));
     asn_set_empty(&nr_plmn[i].mcc->list);
     ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
     ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
     ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
-#ifdef ENABLE_ITTI
     nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
     nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
     nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
-#else
-    nr_mnc_digit[i][0] = 0;
-    nr_mnc_digit[i][1] = 0;
-    nr_mnc_digit[i][2] = 1;
-#endif
     memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t));
     nr_plmn[i].mnc.list.size=0;
     nr_plmn[i].mnc.list.count=0;
@@ -364,17 +345,10 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
 
   nr_plmn_info.cellIdentity.buf = MALLOC(8);
   memset(nr_plmn_info.cellIdentity.buf,0,8);
-#ifdef ENABLE_ITTI
   nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
   nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
   nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
   nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
-#else
-  nr_plmn_info.cellIdentity.buf[0]= 0x00;
-  nr_plmn_info.cellIdentity.buf[1]= 0x00;
-  nr_plmn_info.cellIdentity.buf[2]= 0x00;
-  nr_plmn_info.cellIdentity.buf[3]= 0x10;
-#endif
   nr_plmn_info.cellIdentity.size= 4;
   nr_plmn_info.cellIdentity.bits_unused= 4;
   nr_plmn_info.cellReservedForOperatorUse = 0;
@@ -410,9 +384,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
 
 void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
                                 int     CC_id,
-#if defined(ENABLE_ITTI)
-  gNB_RrcConfigurationReq *configuration,
-#endif
+                                gNB_RrcConfigurationReq *configuration,
                                 int initial_flag
                                ) {
   NR_ServingCellConfigCommon_t                   **servingcellconfigcommon = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon;
@@ -1143,17 +1115,13 @@ void do_SpCellConfig(uint8_t Mod_id,
   common_configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq));
   //Fill servingcellconfigcommon config value
   rrc_config_servingcellconfigcommon(Mod_id,
-                                     CC_id
-#if defined(ENABLE_ITTI)
-                                     ,common_configuration
-#endif
+                                     CC_id,
+                                     common_configuration
                                     );
   //Fill common config to structure
   do_SERVINGCELLCONFIGCOMMON(Mod_id,
                              CC_id,
-#if defined(ENABLE_ITTI)
                              common_configuration,
-#endif
                              0
                             );
   spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h
index c3154b708eda2581fff0093af7f7c13a70a52e7a..69ce650b237987e730e2ca30ccc38581ba1be581 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h
@@ -76,17 +76,13 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
 @param carrier pointer to Carrier information
 @param configuration Pointer Configuration Request structure  
 @return size of encoded bit stream in bytes*/
-uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
-#if defined(ENABLE_ITTI)
-  , gNB_RrcConfigurationReq *configuration
-#endif
+uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
+  gNB_RrcConfigurationReq *configuration
                   );
 
 void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
                                 int CC_id,
-#if defined(ENABLE_ITTI)
   gNB_RrcConfigurationReq *configuration,
-#endif
                                 int initial_flag);
 
 void do_RLC_BEARER(uint8_t Mod_id,
diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c
index 80008d9af2c75bed7c30ceb076f9800d02fd3249..e09b1e6055706d70a72d923f6bcdadbd767bf214 100644
--- a/openair2/RRC/NR/nr_rrc_config.c
+++ b/openair2/RRC/NR/nr_rrc_config.c
@@ -31,10 +31,8 @@
 #include "nr_rrc_config.h"
 
 void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
-                                        int CC_id
-                                        #if defined(ENABLE_ITTI)
-                                        ,gNB_RrcConfigurationReq *common_configuration
-                                        #endif
+                                        int CC_id,
+                                        gNB_RrcConfigurationReq *common_configuration
                                        ){
 
   common_configuration->MIB_subCarrierSpacingCommon[CC_id]                                = 0;
@@ -259,4 +257,4 @@ void rrc_config_rachdedicated(uint8_t Mod_id,
                               physicalcellgroup_t *physicalcellgroup_config
                               ){
   
-}
\ No newline at end of file
+}
diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h
index c30478f0b0651c1c59120f2fc2e33537b9a72555..e19d94b34123076c173795322e046d6fbd97b8dd 100644
--- a/openair2/RRC/NR/nr_rrc_config.h
+++ b/openair2/RRC/NR/nr_rrc_config.h
@@ -117,10 +117,8 @@ typedef struct rach_dedicated_s{
 }rach_dedicated_t;
 
 void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
-                                        int CC_id
-                                        #if defined(ENABLE_ITTI)
-                                        ,gNB_RrcConfigurationReq *common_configuration
-                                        #endif
+                                        int CC_id,
+                                        gNB_RrcConfigurationReq *common_configuration
                                        );
 
 void rrc_config_rlc_bearer(uint8_t Mod_id,
@@ -138,4 +136,4 @@ void rrc_config_physicalcellgroup(uint8_t Mod_id,
                                   physicalcellgroup_t *physicalcellgroup_config
                                  );
 
-#endif
\ No newline at end of file
+#endif
diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h
index e9d4b4bf59f932a0ec1bda614e111a220e80570b..6b4a9864c7a560b3d581f64975db74debea96123 100644
--- a/openair2/RRC/NR/nr_rrc_defs.h
+++ b/openair2/RRC/NR/nr_rrc_defs.h
@@ -72,21 +72,15 @@
 #include "NR_EstablishmentCause.h"
 //-------------------
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
 
 /* TODO: be sure this include is correct.
  * It solves a problem of compilation of the RRH GW,
  * issue #186.
  */
-#if !defined(ENABLE_ITTI)
   #include "as_message.h"
-#endif
 
-#if defined(ENABLE_USE_MME)
   #include "commonDef.h"
-#endif
 
 
 /*I will change the name of the structure for compile purposes--> hope not to undo this process*/
@@ -295,7 +289,6 @@ typedef struct gNB_RRC_UE_s {
   rnti_t                             rnti;
   uint64_t                           random_ue_identity;
 
-#if defined(ENABLE_ITTI)
   /* Information from UE RRC ConnectionRequest */
   UE_S_TMSI                          Initialue_identity_s_TMSI;
   NR_EstablishmentCause_t            establishment_cause;
@@ -328,7 +321,6 @@ typedef struct gNB_RRC_UE_s {
   uint32_t                           enb_gtp_teid[S1AP_MAX_E_RAB];
   transport_layer_addr_t             enb_gtp_addrs[S1AP_MAX_E_RAB];
   rb_id_t                            enb_gtp_ebi[S1AP_MAX_E_RAB];
-#endif
   uint32_t                           ul_failure_timer;
   uint32_t                           ue_release_timer;
   uint32_t                           ue_release_timer_thres;
@@ -420,9 +412,7 @@ typedef struct gNB_RRC_INST_s {
   hash_table_t                                        *s1ap_id2_s1ap_ids   ; // key is    content is rrc_ue_s1ap_ids_t
 
   //RRC configuration
-#if defined(ENABLE_ITTI)
   gNB_RrcConfigurationReq                             configuration;//rrc_messages_types.h
-#endif
 
   // other PLMN parameters
   /// Mobile country code
diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h
index 67b5c34db93cb71866dfd8247a74c60c8aaea4ea..ce90ee46fbec9e1b211b2d6e4b67f7b23ea009ea 100644
--- a/openair2/RRC/NR/nr_rrc_proto.h
+++ b/openair2/RRC/NR/nr_rrc_proto.h
@@ -58,9 +58,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
      );
 
 
-#if defined(ENABLE_ITTI)
 /**\brief RRC eNB task.
    \param void *args_p Pointer on arguments to start the task. */
 void *rrc_gnb_task(void *args_p);
 
-#endif
\ No newline at end of file
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index 3d42190887f6c8995a6f24f4297172441e219dcb..586fcd34926358aee334bd696330b28a5ce20791 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -67,21 +67,15 @@
   #include "UTIL/OSA/osa_defs.h"
 #endif
 
-#if defined(ENABLE_USE_MME)
-  #include "rrc_eNB_S1AP.h"
-  #include "rrc_eNB_GTPV1U.h"
-  #if defined(ENABLE_ITTI)
-  #else
-    #include "../../S1AP/s1ap_eNB.h"
-  #endif
-#endif
+#include "rrc_eNB_S1AP.h"
+#include "rrc_eNB_GTPV1U.h"
+
 
 #include "pdcp.h"
 #include "gtpv1u_eNB_task.h"
 
-#if defined(ENABLE_ITTI)
-  #include "intertask_interface.h"
-#endif
+#include "intertask_interface.h"
+
 
 #if ENABLE_RAL
   #include "rrc_eNB_ral.h"
@@ -200,11 +194,9 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
 ///---------------------------------------------------------------------------------------------------------------///
 
 static void init_NR_SI(const protocol_ctxt_t *const ctxt_pP,
-                       const int              CC_id
-#if defined(ENABLE_ITTI)
-  ,
-  gNB_RrcConfigurationReq *configuration
-#endif
+                       const int              CC_id,
+                       gNB_RrcConfigurationReq *configuration
+
                       ) {
   //int                                 i;
   LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
@@ -219,20 +211,14 @@ static void init_NR_SI(const protocol_ctxt_t *const ctxt_pP,
   RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB      = 0;
   RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].MIB             = (uint8_t *) malloc16(4);
   RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB      = do_MIB_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],0,
-#ifdef ENABLE_ITTI
-      configuration->MIB_ssb_SubcarrierOffset[CC_id],
-      configuration->pdcch_ConfigSIB1[CC_id],
-      configuration->MIB_subCarrierSpacingCommon[CC_id],
-      configuration->MIB_dmrs_TypeA_Position[CC_id]
-#else
-      0,0,15,2
-#endif
+  configuration->MIB_ssb_SubcarrierOffset[CC_id],
+  configuration->pdcch_ConfigSIB1[CC_id],
+  configuration->MIB_subCarrierSpacingCommon[CC_id],
+  configuration->MIB_dmrs_TypeA_Position[CC_id]
                                                                           );
   do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id,
                              CC_id,
-#if defined(ENABLE_ITTI)
                              configuration,
-#endif
                              1
                             );
   LOG_I(NR_RRC,"Done init_NR_SI\n");
@@ -268,9 +254,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
 #endif
   AssertFatal(RC.nrrrc[gnb_mod_idP] != NULL, "RC.nrrrc not initialized!");
   AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow");
-#ifdef ENABLE_ITTI
   AssertFatal(configuration!=NULL,"configuration input is null\n");
-#endif
+
   RC.nrrrc[ctxt.module_id]->Nb_ue = 0;
 
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
@@ -287,10 +272,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
 
   for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
     init_NR_SI(&ctxt,
-               CC_id
-#if defined(ENABLE_ITTI)
-               ,configuration
-#endif
+               CC_id,
+               configuration
               );
   }//END for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
 
@@ -302,7 +285,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
 
 ///---------------------------------------------------------------------------------------------------------------///
 ///---------------------------------------------------------------------------------------------------------------///
-#if defined(ENABLE_ITTI)
+
 
 void *rrc_gnb_task(void *args_p) {
   MessageDef                         *msg_p;
@@ -408,4 +391,3 @@ void *rrc_gnb_task(void *args_p) {
   }
 }
 
-#endif //END #if defined(ENABLE_ITTI)
diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c
deleted file mode 100644
index faff4fcfb964de838392eee955903ed614322681..0000000000000000000000000000000000000000
--- a/openair2/UTIL/LOG/log.c
+++ /dev/null
@@ -1,1832 +0,0 @@
-/*
- * 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
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * 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
- */
-
-/*! \file log.c
-* \brief log implementaion
-* \author Navid Nikaein
-* \date 2009 - 2014
-* \version 0.5
-* @ingroup util
-
-*/
-
-#define _GNU_SOURCE  /* required for pthread_getname_np */
-//#define LOG_TEST 1
-
-#define COMPONENT_LOG
-#define COMPONENT_LOG_IF
-#include <ctype.h>
-#define LOG_MAIN
-#include "log.h"
-#include "vcd_signal_dumper.h"
-#include "assertions.h"
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
-#endif
-
-# include <pthread.h>
-# include <string.h>
-#include "common/config/config_userapi.h"
-// main log variables
-
-
-mapping log_level_names[] = {
-  {"emerg", LOG_EMERG},
-  {"alert", LOG_ALERT},
-  {"crit", LOG_CRIT},
-  {"error", LOG_ERR},
-  {"warn", LOG_WARNING},
-  {"notice", LOG_NOTICE},
-  {"info", LOG_INFO},
-  {"debug", LOG_DEBUG},
-  {"file", LOG_FILE},
-  {"trace", LOG_TRACE},
-  {NULL, -1}
-};
-mapping log_verbosity_names[] = {
-  {"none", 0x0},
-  {"low", 0x5},
-  {"medium", 0x15},
-  {"high", 0x35},
-  {"full", 0x75},
-  {NULL, -1}
-};
-
-// vars for the log thread
-LOG_params log_list[2000];
-int log_list_tail = 0;
-int log_list_nb_elements = 0;
-
-pthread_mutex_t log_lock;
-pthread_cond_t log_notify;
-
-
-#if !defined(LOG_NO_THREAD)
-int log_list_head = 0;
-int log_shutdown;
-#endif
-
-static int gfd;
-
-static char *log_level_highlight_start[] = {LOG_RED, LOG_RED, LOG_RED, LOG_RED, LOG_ORANGE, LOG_BLUE, "", ""};  /*!< \brief Optional start-format strings for highlighting */
-static char *log_level_highlight_end[]   = {LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET, LOG_RESET,LOG_RESET,  "",""};   /*!< \brief Optional end-format strings for highlighting */
-
-#if defined(ENABLE_ITTI)
-static log_instance_type_t log_instance_type;
-#endif
-
-/* get log parameters from configuration file */
-void  log_getconfig(log_t *g_log) {
-  char *gloglevel = NULL;
-  char *glogverbo = NULL;
-  int level,verbosity;
-  paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
-  paramdef_t logparams_level[MAX_LOG_COMPONENTS];
-  paramdef_t logparams_verbosity[MAX_LOG_COMPONENTS];
-  paramdef_t logparams_logfile[MAX_LOG_COMPONENTS];
-  
-  int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
-  if (ret <0) {
-       fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
-       return;
-  } 
-  memset(logparams_level,    0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
-  memset(logparams_verbosity,0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
-  memset(logparams_logfile,  0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
-  for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
-    if(g_log->log_component[i].name == NULL) {
-       g_log->log_component[i].name = malloc(16);
-       sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
-       logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
-       logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
-       logparams_verbosity[i].paramflags = PARAMFLAG_DONOTREAD;
-    }
-    sprintf(logparams_level[i].optname,    LOG_CONFIG_LEVEL_FORMAT,       g_log->log_component[i].name);
-    sprintf(logparams_verbosity[i].optname,LOG_CONFIG_VERBOSITY_FORMAT,   g_log->log_component[i].name);
-    sprintf(logparams_logfile[i].optname,  LOG_CONFIG_LOGFILE_FORMAT,     g_log->log_component[i].name);
-/* workaround: all log options in existing configuration files use lower case component names
-   where component names include uppercase char in log.h....                                */ 
-    for (int j=0 ; j<strlen(logparams_level[i].optname); j++) 
-          logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
-    for (int j=0 ; j<strlen(logparams_level[i].optname); j++) 
-          logparams_verbosity[i].optname[j] = tolower(logparams_verbosity[i].optname[j]);
-    for (int j=0 ; j<strlen(logparams_level[i].optname); j++) 
-          logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
-/* */
-    logparams_level[i].defstrval     = gloglevel;
-    logparams_verbosity[i].defstrval = glogverbo; 
-
-    logparams_level[i].type          = TYPE_STRING;
-    logparams_verbosity[i].type      = TYPE_STRING;
-    logparams_logfile[i].type        = TYPE_UINT;
-
-    logparams_logfile[i].paramflags  = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
-    }
-  config_get( logparams_level,    MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX); 
-  config_get( logparams_verbosity,MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX); 
-  config_get( logparams_logfile,  MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX); 
-  for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
-    verbosity = map_str_to_int(log_verbosity_names,*(logparams_verbosity[i].strptr));
-    level     = map_str_to_int(log_level_names,    *(logparams_level[i].strptr));
-    set_comp_log(i, level,verbosity,1);
-    set_component_filelog(*(logparams_logfile[i].uptr));
-    }
-}
-
-
-int logInit (void)
-{
-  int i;
-  g_log = calloc(1, sizeof(log_t));
-
-  if (g_log == NULL) {
-    perror ("cannot allocated memory for log generation module \n");
-    exit(EXIT_FAILURE);
-  }
-
-
-#if ! defined(CN_BUILD)
-  g_log->log_component[PHY].name = "PHY";
-  g_log->log_component[PHY].level = LOG_EMERG;
-  g_log->log_component[PHY].flag =  LOG_MED;
-  g_log->log_component[PHY].interval =  1;
-  g_log->log_component[PHY].fd = 0;
-  g_log->log_component[PHY].filelog = 0;
-  g_log->log_component[PHY].filelog_name = "/tmp/phy.log";
-
-  g_log->log_component[MAC].name = "MAC";
-  g_log->log_component[MAC].level = LOG_EMERG;
-  g_log->log_component[MAC].flag =  LOG_MED;
-  g_log->log_component[MAC].interval =  1;
-  g_log->log_component[MAC].fd = 0;
-  g_log->log_component[MAC].filelog = 0;
-  g_log->log_component[MAC].filelog_name = "/tmp/mac.log";
-
-  g_log->log_component[OPT].name = "OPT";
-  g_log->log_component[OPT].level = LOG_EMERG;
-  g_log->log_component[OPT].flag = LOG_MED;
-  g_log->log_component[OPT].interval =  1;
-  g_log->log_component[OPT].fd = 0;
-  g_log->log_component[OPT].filelog = 0;
-  g_log->log_component[OPT].filelog_name = "";
-
-  g_log->log_component[RLC].name = "RLC";
-  g_log->log_component[RLC].level = LOG_INFO;
-  g_log->log_component[RLC].flag = LOG_MED;
-  g_log->log_component[RLC].interval =  1;
-  g_log->log_component[RLC].fd = 0;
-  g_log->log_component[RLC].filelog = 0;
-  g_log->log_component[RLC].filelog_name = "/tmp/rlc.log";
-
-  g_log->log_component[PDCP].name = "PDCP";
-  g_log->log_component[PDCP].level = LOG_INFO;
-  g_log->log_component[PDCP].flag = LOG_MED;
-  g_log->log_component[PDCP].interval =  1;
-  g_log->log_component[PDCP].fd = 0;
-  g_log->log_component[PDCP].filelog = 0;
-  g_log->log_component[PDCP].filelog_name = "/tmp/pdcp.log";
-
-  g_log->log_component[RRC].name = "RRC";
-  g_log->log_component[RRC].level = LOG_TRACE;
-  g_log->log_component[RRC].flag = LOG_MED;
-  g_log->log_component[RRC].interval =  1;
-  g_log->log_component[RRC].fd = 0;
-  g_log->log_component[RRC].filelog = 0;
-  g_log->log_component[RRC].filelog_name = "/tmp/rrc.log";
-
-  g_log->log_component[EMU].name = "EMU";
-  g_log->log_component[EMU].level = LOG_EMERG;
-  g_log->log_component[EMU].flag =  LOG_MED;
-  g_log->log_component[EMU].interval =  1;
-  g_log->log_component[EMU].fd = 0;
-  g_log->log_component[EMU].filelog = 0;
-  g_log->log_component[EMU].filelog_name = "";
-
-  g_log->log_component[OMG].name = "OMG";
-  g_log->log_component[OMG].level = LOG_EMERG;
-  g_log->log_component[OMG].flag =  LOG_MED;
-  g_log->log_component[OMG].interval =  1;
-  g_log->log_component[OMG].fd = 0;
-  g_log->log_component[OMG].filelog = 0;
-  g_log->log_component[OMG].filelog_name = "/tmp/omg.csv";
-
-  g_log->log_component[OTG].name = "OTG";
-  g_log->log_component[OTG].level = LOG_EMERG;
-  g_log->log_component[OTG].flag =  LOG_MED;
-  g_log->log_component[OTG].interval =  1;
-  g_log->log_component[OTG].fd = 0;
-  g_log->log_component[OTG].filelog = 0;
-  g_log->log_component[OTG].filelog_name = "/tmp/otg.log";
-
-  g_log->log_component[OTG_LATENCY].name = "OTG_LATENCY";
-  g_log->log_component[OTG_LATENCY].level = LOG_EMERG;
-  g_log->log_component[OTG_LATENCY].flag =  LOG_MED;
-  g_log->log_component[OTG_LATENCY].interval =  1;
-  g_log->log_component[OTG_LATENCY].fd = 0;
-  g_log->log_component[OTG_LATENCY].filelog = 0;
-  g_log->log_component[OTG_LATENCY].filelog_name = "/tmp/otg_latency.dat";
-
-  g_log->log_component[OTG_LATENCY_BG].name = "OTG_LATENCY_BG";
-  g_log->log_component[OTG_LATENCY_BG].level = LOG_EMERG;
-  g_log->log_component[OTG_LATENCY_BG].flag =  LOG_MED;
-  g_log->log_component[OTG_LATENCY_BG].interval =  1;
-  g_log->log_component[OTG_LATENCY_BG].fd = 0;
-  g_log->log_component[OTG_LATENCY_BG].filelog = 0;
-  g_log->log_component[OTG_LATENCY_BG].filelog_name = "/tmp/otg_latency_bg.dat";
-
-  g_log->log_component[OTG_GP].name = "OTG_GP";
-  g_log->log_component[OTG_GP].level = LOG_EMERG;
-  g_log->log_component[OTG_GP].flag =  LOG_MED;
-  g_log->log_component[OTG_GP].interval =  1;
-  g_log->log_component[OTG_GP].fd = 0;
-  g_log->log_component[OTG_GP].filelog = 0;
-  g_log->log_component[OTG_GP].filelog_name = "/tmp/otg_goodput.dat";
-
-  g_log->log_component[OTG_GP_BG].name = "OTG_GP_BG";
-  g_log->log_component[OTG_GP_BG].level = LOG_EMERG;
-  g_log->log_component[OTG_GP_BG].flag =  LOG_MED;
-  g_log->log_component[OTG_GP_BG].interval =  1;
-  g_log->log_component[OTG_GP_BG].fd = 0;
-  g_log->log_component[OTG_GP_BG].filelog = 0;
-  g_log->log_component[OTG_GP_BG].filelog_name = "/tmp/otg_goodput_bg.dat";
-
-  g_log->log_component[OTG_JITTER].name = "OTG_JITTER";
-  g_log->log_component[OTG_JITTER].level = LOG_EMERG;
-  g_log->log_component[OTG_JITTER].flag =  LOG_MED;
-  g_log->log_component[OTG_JITTER].interval =  1;
-  g_log->log_component[OTG_JITTER].fd = 0;
-  g_log->log_component[OTG_JITTER].filelog = 0;
-  g_log->log_component[OTG_JITTER].filelog_name = "/tmp/otg_jitter.dat";
-
-  g_log->log_component[OCG].name = "OCG";
-  g_log->log_component[OCG].level = LOG_EMERG;
-  g_log->log_component[OCG].flag =  LOG_MED;
-  g_log->log_component[OCG].interval =  1;
-  g_log->log_component[OCG].fd = 0;
-  g_log->log_component[OCG].filelog = 0;
-  g_log->log_component[OCG].filelog_name = "";
-
-  g_log->log_component[PERF].name = "PERF";
-  g_log->log_component[PERF].level = LOG_EMERG;
-  g_log->log_component[PERF].flag =  LOG_MED;
-  g_log->log_component[PERF].interval =  1;
-  g_log->log_component[PERF].fd = 0;
-  g_log->log_component[PERF].filelog = 0;
-  g_log->log_component[PERF].filelog_name = "";
-
-  g_log->log_component[OIP].name = "OIP";
-  g_log->log_component[OIP].level = LOG_EMERG;
-  g_log->log_component[OIP].flag =  LOG_MED;
-  g_log->log_component[OIP].interval =  1;
-  g_log->log_component[OIP].fd = 0;
-  g_log->log_component[OIP].filelog = 0;
-  g_log->log_component[OIP].filelog_name = "";
-
-  g_log->log_component[CLI].name = "CLI";
-  g_log->log_component[CLI].level = LOG_EMERG;
-  g_log->log_component[CLI].flag =  LOG_MED;
-  g_log->log_component[CLI].interval =  1;
-  g_log->log_component[CLI].fd = 0;
-  g_log->log_component[CLI].filelog =  0;
-  g_log->log_component[CLI].filelog_name = "";
-
-  g_log->log_component[MSC].name = "MSC";
-  g_log->log_component[MSC].level = LOG_EMERG;
-  g_log->log_component[MSC].flag =  LOG_MED;
-  g_log->log_component[MSC].interval =  1;
-  g_log->log_component[MSC].fd = 0;
-  g_log->log_component[MSC].filelog =  0;
-  g_log->log_component[MSC].filelog_name = "/tmp/msc.log";
-
-  g_log->log_component[PROTO_AGENT].name = "PROTO_AGENT";
-  g_log->log_component[PROTO_AGENT].level = LOG_EMERG;
-  g_log->log_component[PROTO_AGENT].flag =  LOG_MED;
-  g_log->log_component[PROTO_AGENT].interval =  1;
-  g_log->log_component[PROTO_AGENT].fd = 0;
-  g_log->log_component[PROTO_AGENT].filelog =  0;
-  g_log->log_component[PROTO_AGENT].filelog_name = "/tmp/proto_agent.log";
-
-
-
-  g_log->log_component[PROTO_AGENT].name = "PROTO_AGENT";
-  g_log->log_component[PROTO_AGENT].level = LOG_EMERG;
-  g_log->log_component[PROTO_AGENT].flag =  LOG_MED;
-  g_log->log_component[PROTO_AGENT].interval =  1;
-  g_log->log_component[PROTO_AGENT].fd = 0;
-  g_log->log_component[PROTO_AGENT].filelog =  0;
-  g_log->log_component[PROTO_AGENT].filelog_name = "/tmp/proto_agent.log";
-
-  g_log->log_component[F1U].name = "F1U";
-  g_log->log_component[F1U].level = LOG_EMERG;
-  g_log->log_component[F1U].flag =  LOG_MED;
-  g_log->log_component[F1U].interval =  1;
-  g_log->log_component[F1U].fd = 0;
-  g_log->log_component[F1U].filelog =  0;
-  g_log->log_component[F1U].filelog_name = "/tmp/f1u.log";
-
-  g_log->log_component[OCM].name = "OCM";
-  g_log->log_component[OCM].level = LOG_EMERG;
-  g_log->log_component[OCM].flag =  LOG_MED;
-  g_log->log_component[OCM].interval =  1;
-  g_log->log_component[OCM].fd = 0;
-  g_log->log_component[OCM].filelog =  0;
-  g_log->log_component[OCM].filelog_name = "/tmp/ocm.log";
-
-  g_log->log_component[HW].name = "HW";
-  g_log->log_component[HW].level = LOG_EMERG;
-  g_log->log_component[HW].flag = LOG_MED;
-  g_log->log_component[HW].interval = 1;
-  g_log->log_component[HW].fd = 0;
-  g_log->log_component[HW].filelog = 0;
-  g_log->log_component[HW].filelog_name = "";
-
-  g_log->log_component[OSA].name = "OSA";
-  g_log->log_component[OSA].level = LOG_EMERG;
-  g_log->log_component[OSA].flag = LOG_MED;
-  g_log->log_component[OSA].interval = 1;
-  g_log->log_component[OSA].fd = 0;
-  g_log->log_component[OSA].filelog = 0;
-  g_log->log_component[OSA].filelog_name = "";
-
-  g_log->log_component[RAL_ENB].name = "eRAL";
-  g_log->log_component[RAL_ENB].level = LOG_EMERG;
-  g_log->log_component[RAL_ENB].flag = LOG_MED;
-  g_log->log_component[RAL_ENB].interval = 1;
-  g_log->log_component[RAL_ENB].fd = 0;
-  g_log->log_component[RAL_ENB].filelog = 0;
-  g_log->log_component[RAL_ENB].filelog_name = "";
-
-  g_log->log_component[RAL_UE].name = "mRAL";
-  g_log->log_component[RAL_UE].level = LOG_EMERG;
-  g_log->log_component[RAL_UE].flag = LOG_MED;
-  g_log->log_component[RAL_UE].interval = 1;
-  g_log->log_component[RAL_UE].fd = 0;
-  g_log->log_component[RAL_UE].filelog = 0;
-  g_log->log_component[RAL_UE].filelog_name = "";
-
-  g_log->log_component[ENB_APP].name = "ENB_APP";
-  g_log->log_component[ENB_APP].level = LOG_EMERG;
-  g_log->log_component[ENB_APP].flag = LOG_MED;
-  g_log->log_component[ENB_APP].interval = 1;
-  g_log->log_component[ENB_APP].fd = 0;
-  g_log->log_component[ENB_APP].filelog = 0;
-  g_log->log_component[ENB_APP].filelog_name = "";
-
-  g_log->log_component[FLEXRAN_AGENT].name = "FLEXRAN_AGENT";
-  g_log->log_component[FLEXRAN_AGENT].level = LOG_DEBUG;
-  g_log->log_component[FLEXRAN_AGENT].flag = LOG_MED;
-  g_log->log_component[FLEXRAN_AGENT].interval = 1;
-  g_log->log_component[FLEXRAN_AGENT].fd = 0;
-  g_log->log_component[FLEXRAN_AGENT].filelog = 0;
-  g_log->log_component[FLEXRAN_AGENT].filelog_name = "";
-  
-  g_log->log_component[TMR].name = "TMR";
-  g_log->log_component[TMR].level = LOG_EMERG;
-  g_log->log_component[TMR].flag = LOG_MED;
-  g_log->log_component[TMR].interval = 1;
-  g_log->log_component[TMR].fd = 0;
-  g_log->log_component[TMR].filelog = 0;
-  g_log->log_component[TMR].filelog_name = "";
-
-  g_log->log_component[USIM].name = "USIM";
-  g_log->log_component[USIM].level = LOG_DEBUG;
-  g_log->log_component[USIM].flag = LOG_NONE;
-  g_log->log_component[USIM].interval = 1;
-  g_log->log_component[USIM].fd = 0;
-  g_log->log_component[USIM].filelog = 0;
-  g_log->log_component[USIM].filelog_name = "/tmp/usim.txt";
-
-  /* following log component are used for the localization*/
-  g_log->log_component[LOCALIZE].name = "LOCALIZE";
-  g_log->log_component[LOCALIZE].level = LOG_EMERG;
-  g_log->log_component[LOCALIZE].flag =  LOG_MED;
-  g_log->log_component[LOCALIZE].interval =  1;
-  g_log->log_component[LOCALIZE].fd = 0;
-  g_log->log_component[LOCALIZE].filelog = 0;
-  g_log->log_component[LOCALIZE].filelog_name = "/tmp/localize.log";
-#endif // ! defined(CN_BUILD)
-
-  g_log->log_component[NAS].name = "NAS";
-  g_log->log_component[NAS].level = LOG_TRACE;
-  g_log->log_component[NAS].flag = LOG_MED;
-  g_log->log_component[NAS].interval =  1;
-  g_log->log_component[NAS].fd = 0;
-  g_log->log_component[NAS].filelog = 0;
-  g_log->log_component[NAS].filelog_name = "/tmp/nas.log";
-
-  g_log->log_component[UDP_].name = "UDP";
-  g_log->log_component[UDP_].level = LOG_EMERG;
-  g_log->log_component[UDP_].flag = LOG_FULL;
-  g_log->log_component[UDP_].interval = 1;
-  g_log->log_component[UDP_].fd = 0;
-  g_log->log_component[UDP_].filelog = 0;
-  g_log->log_component[UDP_].filelog_name = "";
-
-  g_log->log_component[GTPU].name = "GTPV1U";
-  g_log->log_component[GTPU].level = LOG_EMERG;
-  g_log->log_component[GTPU].flag = LOG_FULL;
-  g_log->log_component[GTPU].interval = 1;
-  g_log->log_component[GTPU].fd = 0;
-  g_log->log_component[GTPU].filelog = 0;
-  g_log->log_component[GTPU].filelog_name = "";
-
-  g_log->log_component[S1AP].name = "S1AP";
-  g_log->log_component[S1AP].level = LOG_EMERG;
-  g_log->log_component[S1AP].flag = LOG_FULL;
-  g_log->log_component[S1AP].interval = 1;
-  g_log->log_component[S1AP].fd = 0;
-  g_log->log_component[S1AP].filelog = 0;
-  g_log->log_component[S1AP].filelog_name = "";
-
-  g_log->log_component[SCTP].name = "SCTP";
-  g_log->log_component[SCTP].level = LOG_EMERG;
-  g_log->log_component[SCTP].flag = LOG_MED;
-  g_log->log_component[SCTP].interval = 1;
-  g_log->log_component[SCTP].fd = 0;
-  g_log->log_component[SCTP].filelog = 0;
-  g_log->log_component[SCTP].filelog_name = "";
- 
-  g_log->log_component[RRH].name = "RRH";
-  g_log->log_component[RRH].level = LOG_EMERG;
-  g_log->log_component[RRH].flag = LOG_MED;
-  g_log->log_component[RRH].interval = 1;
-  g_log->log_component[RRH].fd = 0;
-  g_log->log_component[RRH].filelog = 0;
-  g_log->log_component[RRH].filelog_name = "";
-  
-  g_log->level2string[LOG_EMERG]         = "G"; //EMERG
-  g_log->level2string[LOG_ALERT]         = "A"; // ALERT
-  g_log->level2string[LOG_CRIT]          = "C"; // CRITIC
-  g_log->level2string[LOG_ERR]           = "E"; // ERROR
-  g_log->level2string[LOG_WARNING]       = "W"; // WARNING
-  g_log->level2string[LOG_NOTICE]        = "N"; // NOTICE
-  g_log->level2string[LOG_INFO]          = "I"; //INFO
-  g_log->level2string[LOG_DEBUG]         = "D"; // DEBUG
-  g_log->level2string[LOG_FILE]          = "F"; // file
-  g_log->level2string[LOG_TRACE]         = "T"; // TRACE
-
-  g_log->onlinelog = 1; //online log file
-  g_log->syslog = 0;
-  g_log->filelog   = 0;
-  g_log->level  = LOG_TRACE;
-  g_log->flag   = LOG_LOW;
-
-  g_log->config.remote_ip      = 0;
-  g_log->config.remote_level   = LOG_EMERG;
-  g_log->config.facility       = LOG_LOCAL7;
-  g_log->config.audit_ip       = 0;
-  g_log->config.audit_facility = LOG_LOCAL6;
-  g_log->config.format         = 0x00; // online debug inactive
-
-  g_log->filelog_name = "/tmp/openair.log";
-
-  if (g_log->syslog) {
-#if ! defined(CN_BUILD)
-    openlog(g_log->log_component[EMU].name, LOG_PID, g_log->config.facility);
-#endif // ! defined(CN_BUILD)
-  }
-  log_getconfig(g_log);
-  if (g_log->filelog) {
-    gfd = open(g_log->filelog_name, O_WRONLY | O_CREAT, 0666);
-  }
-
-  // could put a loop here to check for all comps
-  for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
-    if (g_log->log_component[i].filelog == 1 ) {
-      g_log->log_component[i].fd = open(g_log->log_component[i].filelog_name,
-                                        O_WRONLY | O_CREAT | O_APPEND, 0666);
-    }
-  }
-
-  printf("log init done\n");
-
-  return 0;
-}
-
-void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args)
-{
-  //logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
-  int len = 0;
-  log_component_t *c;
-  char *log_start;
-  char *log_end;
-  /* The main difference with the version above is the use of this local log_buffer.
-   * The other difference is the return value of snprintf which was not used
-   * correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
-   * big enough so that the buffer is never full.
-   */
-  char log_buffer[MAX_LOG_TOTAL];
-
-  /* for no gcc warnings */
-  (void)log_start;
-  (void)log_end;
-
-  c = &g_log->log_component[comp];
-
-  // do not apply filtering for LOG_F
-  // only log messages which are enabled and are below the global log level and component's level threshold
-  if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
-    /* if ((level != LOG_FILE) &&
-          ((level > c->level) ||
-           (level > g_log->level) ||
-           ( c->level > g_log->level))) {
-    */
-    return;
-  }
-
-  //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD, VCD_FUNCTION_IN);
-
-  // adjust syslog level for TRACE messages
-  if (g_log->syslog) {
-    if (g_log->level > LOG_DEBUG) {
-      g_log->level = LOG_DEBUG;
-    }
-  }
-
-  // make sure that for log trace the extra info is only printed once, reset when the level changes
-  if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
-    log_start = log_buffer;
-    len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
-    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    log_end = log_buffer + len;
-  } else {
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-                      log_level_highlight_start[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    log_start = log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->log_component[comp].name);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->level2string[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
-#     define THREAD_NAME_LEN 128
-      char threadname[THREAD_NAME_LEN];
-      if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
-      {
-        perror("pthread_getname_np : ");
-      } else {
-        len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
-        if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-      }
-#     undef THREAD_NAME_LEN
-    }
-
-    if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
-                      func);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
-                      file, line);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    //len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%08lx]", thread_id);
-    //if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-
-    len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
-    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    log_end = log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-          log_level_highlight_end[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-  }
-
-  va_end(args);
-
-  // OAI printf compatibility
-  if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-#ifdef RTAI
-    if (len > MAX_LOG_TOTAL) {
-      rt_printk ("[OPENAIR] FIFO_PRINTF WROTE OUTSIDE ITS MEMORY BOUNDARY : ERRORS WILL OCCUR\n");
-    }
-
-  if (len > 0) {
-    rtf_put (FIFO_PRINTF_NO, log_buffer, len);
-  }
-
-#else
-  fwrite(log_buffer, len, 1, stdout);
-#endif
-
-#ifndef RTAI
-
-  if (g_log->syslog) {
-    syslog(g_log->level, "%s", log_buffer);
-  }
-
-  if (g_log->filelog) {
-    if (write(gfd, log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    if (write(g_log->log_component[comp].fd, log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-#else
-
-  // online print messges
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    printf(log_buffer);
-  }
-
-#endif
-
-#if defined(ENABLE_ITTI)
-
-  if (level <= LOG_DEBUG) {
-    task_id_t origin_task_id = TASK_UNKNOWN;
-    MessagesIds messages_id;
-    MessageDef *message_p;
-    size_t      message_string_size;
-    char       *message_msg_p;
-
-    message_string_size = log_end - log_start;
-
-#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
-
-    /* Try to identify sub task ID from log information (comp, log_instance_type) */
-    switch (comp) {
-    case PHY:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PHY_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PHY_UE;
-        break;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case MAC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_MAC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_MAC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case RLC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_RLC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_RLC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case PDCP:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PDCP_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PDCP_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      messages_id = ERROR_LOG;
-      break;
-
-    case LOG_WARNING:
-      messages_id = WARNING_LOG;
-      break;
-
-    case LOG_NOTICE:
-      messages_id = NOTICE_LOG;
-      break;
-
-    case LOG_INFO:
-      messages_id = INFO_LOG;
-      break;
-
-    default:
-      messages_id = DEBUG_LOG;
-      break;
-    }
-
-    message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      message_msg_p = (char *) &message_p->ittiMsg.error_log;
-      break;
-
-    case LOG_WARNING:
-      message_msg_p = (char *) &message_p->ittiMsg.warning_log;
-      break;
-
-    case LOG_NOTICE:
-      message_msg_p = (char *) &message_p->ittiMsg.notice_log;
-      break;
-
-    case LOG_INFO:
-      message_msg_p = (char *) &message_p->ittiMsg.info_log;
-      break;
-
-    default:
-      message_msg_p = (char *) &message_p->ittiMsg.debug_log;
-      break;
-    }
-
-    memcpy(message_msg_p, log_start, message_string_size);
-
-    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
-  }
-
-#endif
-#if 0
-  LOG_params log_params;
-  int        len;
-
-  len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
-
-  //2 first parameters must be passed as 'const' to the thread function
-  log_params.file = strdup(file);
-  log_params.func = strdup(func);
-  log_params.line = line;
-  log_params.comp = PHY;//comp;
-  log_params.level = 6; // INFO - level;
-  log_params.format = format;
-  log_params.len = len;
-
-  if (pthread_mutex_lock(&log_lock) != 0) {
-    return;
-  }
-
-  log_list_tail++;
-  log_list[log_list_tail - 1] = log_params;
-
-  if (log_list_tail >= 1000) {
-    log_list_tail = 0;
-  }
-
-  if (log_list_nb_elements < 1000) {
-    log_list_nb_elements++;
-  }
-
-  if(pthread_cond_signal(&log_notify) != 0) {
-    pthread_mutex_unlock(&log_lock);
-    return;
-  }
-
-  if(pthread_mutex_unlock(&log_lock) != 0) {
-    return;
-  }
-
-#endif
-}
-
-//log record: add to a list
-void logRecord(const char *file, const char *func, int line,  int comp,
-               int level, const char *format, ...)
-{
-  va_list    args;
-  LOG_params log_params;
-  int        len;
-
-  va_start(args, format);
-  len = vsnprintf(log_params.l_buff_info, MAX_LOG_INFO-1, format, args);
-  va_end(args);
-
-  //2 first parameters must be passed as 'const' to the thread function
-  log_params.file = strdup(file);
-  log_params.func = strdup(func);
-  log_params.line = line;
-  log_params.comp = comp;
-  log_params.level = level;
-  log_params.format = format;
-  log_params.len = len;
-
-  if (pthread_mutex_lock(&log_lock) != 0) {
-    return;
-  }
-
-  log_list_tail++;
-  log_list[log_list_tail - 1] = log_params;
-
-  if (log_list_tail >= 1000) {
-    log_list_tail = 0;
-  }
-
-  if (log_list_nb_elements < 1000) {
-    log_list_nb_elements++;
-  }
-
-  if(pthread_cond_signal(&log_notify) != 0) {
-    pthread_mutex_unlock(&log_lock);
-    return;
-  }
-
-  if(pthread_mutex_unlock(&log_lock) != 0) {
-    return;
-  }
-
-  //log = malloc(sizeof(LOG_elt));
-  //log->next = NULL;
-  //log->log_params = log_params;
-  /* Add log task to queue */
-  //log_list_add_tail_eurecom(log, &log_list);
-
-}
-
-void logRecord_thread_safe(const char *file, const char *func,
-                           int line,  int comp, int level,
-                           int len, const char *params_string)
-{
-  log_component_t *c;
-  int total_len = 0;
-  char log_buffer[MAX_LOG_TOTAL];
-
-  c = &g_log->log_component[comp];
-
-  // do not apply filtering for LOG_F
-  // only log messages which are enabled and are below the global log level and component's level threshold
-  if ((level != LOG_FILE) && ((c->level > g_log->level) ||
-                              (level > c->level) || (level > g_log->level))) {
-    return;
-  }
-
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_IN);
-
-  // adjust syslog level for TRACE messages
-  if (g_log->syslog) {
-    if (g_log->level > LOG_DEBUG) {
-      g_log->level = LOG_DEBUG;
-    }
-  }
-
-  // make sure that for log trace the extra info is only printed once, reset when the level changes
-  if ((level == LOG_FILE) ||  (c->flag == LOG_NONE)  || (level ==LOG_TRACE )) {
-    total_len = snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - 1, "%s",
-                         params_string);
-  } else {
-    if ((g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR)) {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "%s",
-                            log_level_highlight_start[level]);
-    }
-
-    if ((g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s]",
-                            g_log->log_component[comp].name);
-    }
-
-    if ((g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL)) {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s]",
-                            g_log->level2string[level]);
-    }
-
-    if ((g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT)) {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s] ",
-                            func);
-    }
-
-    if ((g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) )  {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "[%s:%d]",
-                            file, line);
-    }
-
-    len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - len, "%s",
-                    params_string);
-
-    if ((g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR)) {
-      total_len += snprintf(&log_buffer[total_len], MAX_LOG_TOTAL - total_len, "%s",
-                            log_level_highlight_end[level]);
-    }
-  }
-
-  // OAI printf compatibility
-  if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
-    fprintf(stdout, "%s", log_buffer);
-  }
-
-  if (g_log->syslog) {
-    syslog(g_log->level, "%s", log_buffer);
-  }
-
-  if (g_log->filelog) {
-    if (write(gfd, log_buffer, total_len) < total_len) {
-      // TODO assert ?
-    }
-  }
-
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    if (write(g_log->log_component[comp].fd, log_buffer, total_len) < total_len) {
-      // TODO assert ?
-    }
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_OUT);
-}
-
-#if !defined(LOG_NO_THREAD)
-void *log_thread_function(void *list)
-{
-
-  LOG_params log_params;
-
-  for(;;) {
-
-    //log_elt = NULL;
-
-    /* Lock must be taken to wait on conditional variable */
-    pthread_mutex_lock(&log_lock);
-
-    /* Wait on condition variable, check for spurious wakeups.
-       When returning from pthread_cond_wait(), we own the lock. */
-
-    // sleep
-    while((log_list_nb_elements == 0) && (log_shutdown == 0)) {
-      pthread_cond_wait(&log_notify, &log_lock);
-    }
-
-    // exit
-    if ((log_shutdown==1) && (log_list_nb_elements == 0)) {
-      break;
-    }
-
-    /* Grab our task */
-    //log_elt = log_list_remove_head(&log_list);
-    log_params = log_list[log_list_head];
-    log_list_head++;
-    log_list_nb_elements--;
-
-    if (log_list_head >= 1000) {
-      log_list_head = 0;
-    }
-
-
-    /* Unlock */
-    pthread_mutex_unlock(&log_lock);
-
-    /* Get to work */
-    logRecord_thread_safe(log_params.file,
-                          log_params.func,
-                          log_params.line,
-                          log_params.comp,
-                          log_params.level,
-                          log_params.len,
-                          log_params.l_buff_info);
-
-    //free(log_elt);
-  }
-}
-#endif
-
-#if 0
-/* This function does not work. When multiple threads call it at the same time
- * for the same component, both threads end up using the same buffer.
- * The output is the completely messed up/wrong.
- * Kept in case the fix below is not correct or acceptable.
- */
-//log record, format, and print:  executed in the main thread (mt)
-void logRecord_mt(const char *file, const char *func, int line, int comp,
-                  int level, const char *format, ...)
-{
-  int len = 0;
-  va_list args;
-  log_component_t *c;
-  char *log_start;
-  char *log_end;
-
-  /* for no gcc warnings */
-  (void)log_start;
-  (void)log_end;
-
-  c = &g_log->log_component[comp];
-
-  // do not apply filtering for LOG_F
-  // only log messages which are enabled and are below the global log level and component's level threshold
-  if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
-    /* if ((level != LOG_FILE) &&
-          ((level > c->level) ||
-           (level > g_log->level) ||
-           ( c->level > g_log->level))) {
-    */
-    return;
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_IN);
-
-  va_start(args, format);
-
-  // adjust syslog level for TRACE messages
-  if (g_log->syslog) {
-    if (g_log->level > LOG_DEBUG) {
-      g_log->level = LOG_DEBUG;
-    }
-  }
-
-  // make sure that for log trace the extra info is only printed once, reset when the level changes
-  if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
-    log_start = c->log_buffer;
-    len = vsnprintf(c->log_buffer, MAX_LOG_TOTAL-1, format, args);
-    log_end = c->log_buffer + len;
-  } else {
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-                      log_level_highlight_start[level]);
-    }
-
-    log_start = c->log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->log_component[comp].name);
-    }
-
-    if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->level2string[level]);
-    }
-
-    if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
-                      func);
-    }
-
-    if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
-                      file, line);
-    }
-
-    len += vsnprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, format, args);
-    log_end = c->log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&c->log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-                      log_level_highlight_end[level]);
-    }
-  }
-
-  va_end(args);
-
-  // OAI printf compatibility
-  if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-    fwrite(c->log_buffer, len, 1, stdout);
-
-  if (g_log->syslog) {
-    syslog(g_log->level, "%s", c->log_buffer);
-  }
-
-  if (g_log->filelog) {
-    if (write(gfd, c->log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    if (write(g_log->log_component[comp].fd, c->log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-#if defined(ENABLE_ITTI)
-
-  if (level <= LOG_DEBUG) {
-    task_id_t origin_task_id = TASK_UNKNOWN;
-    MessagesIds messages_id;
-    MessageDef *message_p;
-    size_t      message_string_size;
-    char       *message_msg_p;
-
-    message_string_size = log_end - log_start;
-
-#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
-
-    /* Try to identify sub task ID from log information (comp, log_instance_type) */
-    switch (comp) {
-    case PHY:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PHY_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PHY_UE;
-        break;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case MAC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_MAC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_MAC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case RLC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_RLC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_RLC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case PDCP:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PDCP_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PDCP_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      messages_id = ERROR_LOG;
-      break;
-
-    case LOG_WARNING:
-      messages_id = WARNING_LOG;
-      break;
-
-    case LOG_NOTICE:
-      messages_id = NOTICE_LOG;
-      break;
-
-    case LOG_INFO:
-      messages_id = INFO_LOG;
-      break;
-
-    default:
-      messages_id = DEBUG_LOG;
-      break;
-    }
-
-    message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      message_msg_p = (char *) &message_p->ittiMsg.error_log;
-      break;
-
-    case LOG_WARNING:
-      message_msg_p = (char *) &message_p->ittiMsg.warning_log;
-      break;
-
-    case LOG_NOTICE:
-      message_msg_p = (char *) &message_p->ittiMsg.notice_log;
-      break;
-
-    case LOG_INFO:
-      message_msg_p = (char *) &message_p->ittiMsg.info_log;
-      break;
-
-    default:
-      message_msg_p = (char *) &message_p->ittiMsg.debug_log;
-      break;
-    }
-
-    memcpy(message_msg_p, log_start, message_string_size);
-
-    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
-  }
-
-#endif
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_OUT);
-}
-#endif /* #if 0 */
-
-//log record, format, and print:  executed in the main thread (mt)
-void logRecord_mt(const char *file, const char *func, int line, int comp,
-                  int level, const char *format, ...)
-{
-  int len = 0;
-  va_list args;
-  log_component_t *c;
-  char *log_start;
-  char *log_end;
-  /* The main difference with the version above is the use of this local log_buffer.
-   * The other difference is the return value of snprintf which was not used
-   * correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
-   * big enough so that the buffer is never full.
-   */
-  char log_buffer[MAX_LOG_TOTAL];
-
-  /* for no gcc warnings */
-  (void)log_start;
-  (void)log_end;
-
-  c = &g_log->log_component[comp];
-
-  // do not apply filtering for LOG_F
-  // only log messages which are enabled and are below the global log level and component's level threshold
-  if ((level != LOG_FILE) && ((level > c->level) || (level > g_log->level))) {
-    /* if ((level != LOG_FILE) &&
-          ((level > c->level) ||
-           (level > g_log->level) ||
-           ( c->level > g_log->level))) {
-    */
-    return;
-  }
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_IN);
-
-  va_start(args, format);
-
-  // adjust syslog level for TRACE messages
-  if (g_log->syslog) {
-    if (g_log->level > LOG_DEBUG) {
-      g_log->level = LOG_DEBUG;
-    }
-  }
-
-  // make sure that for log trace the extra info is only printed once, reset when the level changes
-  if ((level == LOG_FILE) || (c->flag == LOG_NONE) || (level == LOG_TRACE)) {
-    log_start = log_buffer;
-    len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
-    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    log_end = log_buffer + len;
-  } else {
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-                      log_level_highlight_start[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    log_start = log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COMP) || (c->flag & FLAG_COMP) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->log_component[comp].name);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_LEVEL) || (c->flag & FLAG_LEVEL) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
-                      g_log->level2string[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
-#     define THREAD_NAME_LEN 128
-      char threadname[THREAD_NAME_LEN];
-      if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
-      {
-        perror("pthread_getname_np : ");
-      } else {
-        len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
-        if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-      }
-#     undef THREAD_NAME_LEN
-    }
-
-    if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
-                      func);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
-                      file, line);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-
-    len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
-    if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    log_end = log_buffer + len;
-
-    if ( (g_log->flag & FLAG_COLOR) || (c->flag & FLAG_COLOR) ) {
-      len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
-                      log_level_highlight_end[level]);
-      if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
-    }
-  }
-
-  va_end(args);
-
-  // OAI printf compatibility
-  if ((g_log->onlinelog == 1) && (level != LOG_FILE))
-    fwrite(log_buffer, len, 1, stdout);
-
-  if (g_log->syslog) {
-    syslog(g_log->level, "%s", log_buffer);
-  }
-
-  if (g_log->filelog) {
-    if (write(gfd, log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-  if ((g_log->log_component[comp].filelog) && (level == LOG_FILE)) {
-    if (write(g_log->log_component[comp].fd, log_buffer, len) < len) {
-      // TODO assert ?
-    }
-  }
-
-#if defined(ENABLE_ITTI)
-
-  if (level <= LOG_DEBUG) {
-    task_id_t origin_task_id = TASK_UNKNOWN;
-    MessagesIds messages_id;
-    MessageDef *message_p;
-    size_t      message_string_size;
-    char       *message_msg_p;
-
-    message_string_size = log_end - log_start;
-
-#if !defined(DISABLE_ITTI_DETECT_SUB_TASK_ID)
-
-    /* Try to identify sub task ID from log information (comp, log_instance_type) */
-    switch (comp) {
-    case PHY:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PHY_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PHY_UE;
-        break;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case MAC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_MAC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_MAC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case RLC:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_RLC_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_RLC_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    case PDCP:
-      switch (log_instance_type) {
-      case LOG_INSTANCE_ENB:
-        origin_task_id = TASK_PDCP_ENB;
-        break;
-
-      case LOG_INSTANCE_UE:
-        origin_task_id = TASK_PDCP_UE;
-
-      default:
-        break;
-      }
-
-      break;
-
-    default:
-      break;
-    }
-
-#endif
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      messages_id = ERROR_LOG;
-      break;
-
-    case LOG_WARNING:
-      messages_id = WARNING_LOG;
-      break;
-
-    case LOG_NOTICE:
-      messages_id = NOTICE_LOG;
-      break;
-
-    case LOG_INFO:
-      messages_id = INFO_LOG;
-      break;
-
-    default:
-      messages_id = DEBUG_LOG;
-      break;
-    }
-
-    message_p = itti_alloc_new_message_sized(origin_task_id, messages_id, message_string_size);
-
-    switch (level) {
-    case LOG_EMERG:
-    case LOG_ALERT:
-    case LOG_CRIT:
-    case LOG_ERR:
-      message_msg_p = (char *) &message_p->ittiMsg.error_log;
-      break;
-
-    case LOG_WARNING:
-      message_msg_p = (char *) &message_p->ittiMsg.warning_log;
-      break;
-
-    case LOG_NOTICE:
-      message_msg_p = (char *) &message_p->ittiMsg.notice_log;
-      break;
-
-    case LOG_INFO:
-      message_msg_p = (char *) &message_p->ittiMsg.info_log;
-      break;
-
-    default:
-      message_msg_p = (char *) &message_p->ittiMsg.debug_log;
-      break;
-    }
-
-    memcpy(message_msg_p, log_start, message_string_size);
-
-    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
-  }
-
-#endif
-
-  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD,
-                                          VCD_FUNCTION_OUT);
-}
-
-int set_log(int component, int level, int interval)
-{
-  /* Checking parameters */
-  DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
-           component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
-  DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
-           LOG_EMERG);
-  DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
-
-  g_log->log_component[component].level = level;
-
-  switch (level) {
-  case LOG_TRACE:
-    g_log->log_component[component].flag = LOG_MED ;
-    break;
-
-  case LOG_DEBUG:
-    g_log->log_component[component].flag = LOG_MED ;
-    break;
-
-  case LOG_INFO:
-    g_log->log_component[component].flag = LOG_LOW ;
-    break;
-
-  default:
-    g_log->log_component[component].flag = LOG_NONE ;
-    break;
-  }
-
-  g_log->log_component[component].interval = interval;
-
-  return 0;
-}
-
-int set_comp_log(int component, int level, int verbosity, int interval)
-{
-  /* Checking parameters */
-  DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
-           component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
-  DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
-           LOG_EMERG);
-  DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
-
-#if 0
-  if ((verbosity == LOG_NONE) || (verbosity == LOG_LOW) ||
-      (verbosity == LOG_MED) || (verbosity == LOG_FULL) ||
-      (verbosity == LOG_HIGH)) {
-    g_log->log_component[component].flag = verbosity;
-  }
-#else
-  g_log->log_component[component].flag = verbosity;
-#endif
-
-  g_log->log_component[component].level = level;
-  g_log->log_component[component].interval = interval;
-
-  return 0;
-}
-
-void set_glog(int level, int verbosity)
-{
-  if( g_log->level >= 0) g_log->level = level;
-  if( g_log->flag >= 0)  g_log->flag = verbosity;
-}
-void set_glog_syslog(int enable)
-{
-  g_log->syslog = enable;
-}
-void set_glog_onlinelog(int enable)
-{
-  g_log->onlinelog = enable;
-}
-void set_glog_filelog(int enable)
-{
-  g_log->filelog = enable;
-}
-
-void set_component_filelog(int comp)
-{
-  if (g_log->log_component[comp].filelog ==  0) {
-    g_log->log_component[comp].filelog =  1;
-
-    if (g_log->log_component[comp].fd == 0) {
-      g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name,
-                                           O_WRONLY | O_CREAT | O_TRUNC, 0666);
-    }
-  }
-}
-
-/*
- * for the two functions below, the passed array must have a final entry
- * with string value NULL
- */
-/* map a string to an int. Takes a mapping array and a string as arg */
-int map_str_to_int(mapping *map, const char *str)
-{
-  while (1) {
-    if (map->name == NULL) {
-      return(-1);
-    }
-
-    if (!strcmp(map->name, str)) {
-      return(map->value);
-    }
-
-    map++;
-  }
-}
-
-/* map an int to a string. Takes a mapping array and a value */
-char *map_int_to_str(mapping *map, int val)
-{
-  while (1) {
-    if (map->name == NULL) {
-      return NULL;
-    }
-
-    if (map->value == val) {
-      return map->name;
-    }
-
-    map++;
-  }
-}
-
-int is_newline( char *str, int size)
-{
-  int i;
-
-  for (  i = 0; i < size; i++ ) {
-    if ( str[i] == '\n' ) {
-      return 1;
-    }
-  }
-
-  /* if we get all the way to here, there must not have been a newline! */
-  return 0;
-}
-
-void logClean (void)
-{
-  int i;
-
-  if (g_log->syslog) {
-    closelog();
-  }
-
-  if (g_log->filelog) {
-    close(gfd);
-  }
-
-  for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
-    if (g_log->log_component[i].filelog) {
-      close(g_log->log_component[i].fd);
-    }
-  }
-}
-
-#if defined(ENABLE_ITTI)
-void log_set_instance_type (log_instance_type_t instance)
-{
-  log_instance_type = instance;
-}
-#endif
-
-#ifdef LOG_TEST
-
-int main(int argc, char *argv[])
-{
-
-  logInit();
-
-  //set_log_syslog(1);
-  test_log();
-
-  return 1;
-}
-
-int test_log(void)
-{
-  LOG_ENTER(MAC); // because the default level is DEBUG
-  LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_D(MAC, "1 debug  MAC \n");
-  LOG_N(MAC, "1 notice MAC \n");
-  LOG_W(MAC, "1 warning MAC \n");
-
-  set_comp_log(EMU, LOG_INFO, FLAG_ONLINE);
-  set_comp_log(MAC, LOG_WARNING, 0);
-
-  LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_E(MAC, "2 emerge MAC\n");
-  LOG_D(MAC, "2 debug  MAC \n");
-  LOG_N(MAC, "2 notice MAC \n");
-  LOG_W(MAC, "2 warning MAC \n");
-  LOG_I(MAC, "2 info MAC \n");
-
-
-  set_comp_log(MAC, LOG_NOTICE, 1);
-
-  LOG_ENTER(MAC);
-  LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_D(MAC, "3 debug  MAC \n");
-  LOG_N(MAC, "3 notice MAC \n");
-  LOG_W(MAC, "3 warning MAC \n");
-  LOG_I(MAC, "3 info MAC \n");
-
-  set_comp_log(MAC, LOG_DEBUG,1);
-  set_comp_log(EMU, LOG_DEBUG,1);
-
-  LOG_ENTER(MAC);
-  LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_D(MAC, "4 debug  MAC \n");
-  LOG_N(MAC, "4 notice MAC \n");
-  LOG_W(MAC, "4 warning MAC \n");
-  LOG_I(MAC, "4 info MAC \n");
-
-
-  set_comp_log(MAC, LOG_DEBUG,0);
-  set_comp_log(EMU, LOG_DEBUG,0);
-
-  LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_D(MAC, "5 debug  MAC \n");
-  LOG_N(MAC, "5 notice MAC \n");
-  LOG_W(MAC, "5 warning MAC \n");
-  LOG_I(MAC, "5 info MAC \n");
-
-
-  set_comp_log(MAC, LOG_TRACE,0X07F);
-  set_comp_log(EMU, LOG_TRACE,0X07F);
-
-  LOG_ENTER(MAC);
-  LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
-        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
-  LOG_D(MAC, "6 debug  MAC \n");
-  LOG_N(MAC, "6 notice MAC \n");
-  LOG_W(MAC, "6 warning MAC \n");
-  LOG_I(MAC, "6 info MAC \n");
-  LOG_EXIT(MAC);
-
-  return 0;
-}
-#endif
diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c
index 7ddcb61d1dc1cca7f1839ed07883b5dac1ec37d9..9ccca12520f3c6101ea9b978bb543cf02d4bde5a 100644
--- a/openair3/NAS/COMMON/UTIL/nas_timer.c
+++ b/openair3/NAS/COMMON/UTIL/nas_timer.c
@@ -43,13 +43,7 @@ Description Timer utilities
 #include <string.h> // memset
 #include <stdlib.h> // malloc, free
 #include <sys/time.h>   // setitimer
-
-#if defined(ENABLE_ITTI)
-# include "intertask_interface.h"
-#else
-# include <signal.h>
-# include <time.h>   // clock_gettime
-#endif
+#include "intertask_interface.h"
 #include "nas_timer.h"
 #include "commonDef.h"
 #include "msc.h"
@@ -69,11 +63,7 @@ Description Timer utilities
  * value when the timer entry was allocated.
  */
 typedef struct {
-#if defined(ENABLE_ITTI)
-  long timer_id;          /* Timer id returned by the timer API from ITTI */
-#else
-  pthread_t pid;          /* Thread identifier of the callback    */
-#endif
+long timer_id;          /* Timer id returned by the timer API from ITTI */
 
   struct timeval itv;     /* Initial interval timer value         */
   struct timeval tv;      /* Interval timer value                 */
@@ -105,10 +95,6 @@ typedef struct {
 #define TIMER_DATABASE_SIZE 256
   timer_queue_t tq[TIMER_DATABASE_SIZE];
   timer_queue_t *head;/* Pointer to the first timer entry to be fired  */
-
-#if !defined(ENABLE_ITTI)
-  pthread_mutex_t mutex;
-#endif
 } nas_timer_database_t;
 
 /*
@@ -118,25 +104,15 @@ static nas_timer_database_t _nas_timer_db = {
   0,
   {},
   NULL
-#if !defined(ENABLE_ITTI)
-  , PTHREAD_MUTEX_INITIALIZER
-#endif
 };
 
-#if defined(ENABLE_ITTI)
 #define nas_timer_lock_db()
 #define nas_timer_unlock_db()
-#else
-#define nas_timer_lock_db()     pthread_mutex_lock(&_nas_timer_db.mutex)
-#define nas_timer_unlock_db()   pthread_mutex_unlock(&_nas_timer_db.mutex)
-#endif
 
 /*
  * The handler executed whenever the system timer expires
  */
-#if !defined(ENABLE_ITTI)
-static void _nas_timer_handler(int signal);
-#endif
+
 
 /*
  * -----------------------------------------------------------------------------
@@ -191,33 +167,6 @@ int nas_timer_init(void)
   /* Initialize the timer database */
   _nas_timer_db_init();
 
-#if !defined(ENABLE_ITTI)
-  /* Setup the timer database handler */
-  struct sigaction act;
-
-  (void) memset (&act, 0, sizeof (act));
-  (void) sigfillset (&act.sa_mask);
-  (void) sigdelset (&act.sa_mask, SIGHUP);
-  (void) sigdelset (&act.sa_mask, SIGINT);
-  (void) sigdelset (&act.sa_mask, SIGTERM);
-  (void) sigdelset (&act.sa_mask, SIGILL);
-  (void) sigdelset (&act.sa_mask, SIGTRAP);
-  (void) sigdelset (&act.sa_mask, SIGIOT);
-# ifndef LINUX
-  (void) sigdelset (&act.sa_mask, SIGEMT);
-# endif
-  (void) sigdelset (&act.sa_mask, SIGFPE);
-  (void) sigdelset (&act.sa_mask, SIGBUS);
-  (void) sigdelset (&act.sa_mask, SIGSEGV);
-  (void) sigdelset (&act.sa_mask, SIGSYS);
-
-  act.sa_handler = _nas_timer_handler;
-
-  if ( sigaction (SIGALRM, &act, 0) < 0 ) {
-    return (RETURNerror);
-  }
-
-#endif
   return (RETURNok);
 }
 
@@ -243,10 +192,8 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
 {
   int id;
   nas_timer_entry_t *te;
-#if defined(ENABLE_ITTI)
   int ret;
   long timer_id;
-#endif
 
   /* Do not start null timer */
   if (sec == 0) {
@@ -270,7 +217,6 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
 
   /* Insert the new entry into the timer queue */
   _nas_timer_db_insert_entry(id, te);
-#if defined(ENABLE_ITTI)
 # if defined(NAS_MME)
   ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
 # else
@@ -280,10 +226,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
   if (ret == -1) {
     return NAS_TIMER_INACTIVE_ID;
   }
-
   te->timer_id = timer_id;
-#endif
-
   return (id);
 }
 
@@ -309,11 +252,7 @@ int nas_timer_stop(int id)
     nas_timer_entry_t *entry;
     /* Remove the entry from the timer queue */
     entry = _nas_timer_db_remove_entry(id);
-#if defined(ENABLE_ITTI)
     timer_remove(entry->timer_id);
-#else
-    (void)entry;
-#endif
     /* Delete the timer entry */
     _nas_timer_db_delete_entry(id);
     return (NAS_TIMER_INACTIVE_ID);
@@ -380,7 +319,7 @@ int nas_timer_restart(int id)
  **      Others:    _nas_timer_db                              **
  **                                                                        **
  ***************************************************************************/
-#if defined(ENABLE_ITTI)
+
 void nas_timer_handle_signal_expiry(long timer_id, void *arg_p)
 {
   /* Get the timer entry for which the system timer expired */
@@ -388,25 +327,7 @@ void nas_timer_handle_signal_expiry(long timer_id, void *arg_p)
 
   te->cb(te->args);
 }
-#else
-static void _nas_timer_handler(int signal)
-{
-  /* At least one timer has been started */
-  assert( (_nas_timer_db.head != NULL) && (_nas_timer_db.head->entry != NULL) );
-
-  /* Get the timer entry for which the system timer expired */
-  nas_timer_entry_t *te = _nas_timer_db.head->entry;
-
-  threadCreate (&te->pid, te->cb, te->args, "nas-timer", -1, OAI_PRIORITY_RT_LOW);
 
-    void *result = NULL;
-    (void) pthread_join(te->pid, &result);
-
-    if (result) {
-      free(result);
-    }
-}
-#endif
 
 /*
  * -----------------------------------------------------------------------------
@@ -605,17 +526,7 @@ static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te)
   restart = _nas_timer_db_insert(&_nas_timer_db.tq[id]);
   nas_timer_unlock_db();
 
-#if !defined(ENABLE_ITTI)
-
-  if (restart) {
-    /* The new entry is the first entry of the list;
-     * restart the system timer */
-    setitimer(ITIMER_REAL, &it, 0);
-  }
-
-#else
   (void)(restart);
-#endif
 }
 
 static int _nas_timer_db_insert(timer_queue_t *entry)
@@ -704,21 +615,8 @@ static nas_timer_entry_t *_nas_timer_db_remove_entry(int id)
     tv.tv_usec = ts.tv_nsec/1000;
     /* tv = tv - time() */
     rc = _nas_timer_sub(&_nas_timer_db.head->entry->tv, &tv, &it.it_value);
-
-#if defined(ENABLE_ITTI)
     timer_remove(_nas_timer_db.head->entry->timer_id);
     (void) (rc);
-#else
-
-    if (rc < 0) {
-      /* The system timer should have already expired */
-      _nas_timer_handler(SIGALRM);
-    } else {
-      /* Restart the system timer */
-      setitimer(ITIMER_REAL, &it, 0);
-    }
-
-#endif
   }
 
   /* Return a pointer to the removed entry */
@@ -749,17 +647,6 @@ static int _nas_timer_db_remove(timer_queue_t *entry)
       /* Other timers are scheduled to expire */
       return TRUE;
     }
-
-#if !defined(ENABLE_ITTI)
-    {
-      /* No more timer is scheduled to expire; stop the system timer */
-      struct itimerval it;
-      it.it_interval.tv_sec = it.it_interval.tv_usec = 0;
-      it.it_value.tv_sec = it.it_value.tv_usec = 0;
-      setitimer(ITIMER_REAL, &it, 0);
-      return FALSE;
-    }
-#endif
   }
 
   /* The entry was NOT the first entry of the list */
diff --git a/openair3/NAS/UE/ESM/PdnConnectivity.c b/openair3/NAS/UE/ESM/PdnConnectivity.c
index 48730f2ca9d2f68e981f8268362d89b8af8bde1b..3b5bad7529d386bca0eb92b4afca5bbe8de16d8a 100644
--- a/openair3/NAS/UE/ESM/PdnConnectivity.c
+++ b/openair3/NAS/UE/ESM/PdnConnectivity.c
@@ -61,9 +61,7 @@ Description Defines the PDN connectivity ESM procedure executed by the
 
 #include "emm_sap.h"
 
-#if defined(ENABLE_ITTI)
 # include "assertions.h"
-#endif
 
 /****************************************************************************/
 /****************  E X T E R N A L    D E F I N I T I O N S  ****************/
diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c
index 6df66666389ce1c3f7f36163f51cccf0205b5249..d712a7b7f091a8e80534dd93a789cb443ea3bf54 100644
--- a/openair3/NAS/UE/nas_ue_task.c
+++ b/openair3/NAS/UE/nas_ue_task.c
@@ -20,7 +20,6 @@
  */
 
 #include "utils.h"
-#if defined(ENABLE_ITTI)
 # include "assertions.h"
 # include "intertask_interface.h"
 # include "nas_ue_task.h"
@@ -301,4 +300,3 @@ char *make_port_str_from_ueid(const char *base_port_str, int ueid) {
 
   return itoa(port);
 }
-#endif
diff --git a/openair3/NAS/UE/nas_ue_task.h b/openair3/NAS/UE/nas_ue_task.h
index c9890719cbcf51793c092a3c9d1a88eb2d5adc9f..5615f366b71e4c9c1a2e336dac55fd06577794e0 100644
--- a/openair3/NAS/UE/nas_ue_task.h
+++ b/openair3/NAS/UE/nas_ue_task.h
@@ -33,8 +33,6 @@ typedef struct {
 
 nas_user_t *find_user_from_fd(nas_user_container_t *users, int fd);
 
-# if defined(ENABLE_ITTI)
 void *nas_ue_task(void *args_p);
-# endif
 
 #endif /* NAS_TASK_H_ */
diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c
index 16b86cfd64778d50b8bdefe48ecd8ec2bfdd5445..757ad6f75dea02c3fc1bdec463e44d7f578f1e24 100644
--- a/targets/ARCH/COMMON/common_lib.c
+++ b/targets/ARCH/COMMON/common_lib.c
@@ -41,49 +41,22 @@
 #include "common/utils/LOG/log.h"
 #include "targets/RT/USER/lte-softmodem.h"
 
+char *get_devname(int devtype) {
+char *devnames[MAX_RF_DEV_TYPE]=DEVTYPE_NAMES;
+  if (devtype < MAX_RF_DEV_TYPE && devtype !=MIN_RF_DEV_TYPE )
+  	  return devnames[devtype];
+  return "none";
+}
+
 int set_device(openair0_device *device)
 {
-  switch (device->type) {
-    case EXMIMO_DEV:
-      LOG_I(HW,"[%s] has loaded EXPRESS MIMO device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case USRP_B200_DEV:
-      LOG_I(HW,"[%s] has loaded USRP B200 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case USRP_X300_DEV:
-      LOG_I(HW,"[%s] has loaded USRP X300 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case BLADERF_DEV:
-      LOG_I(HW,"[%s] has loaded BLADERF device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case LMSSDR_DEV:
-      LOG_I(HW,"[%s] has loaded LMSSDR device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case IRIS_DEV:
-	  LOG_I(HW,"[%s] has loaded Iris device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case ADRV9371_ZC706_DEV:
-      LOG_I(HW,"[%s] has loaded ADRV9371_ZC706 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case UEDv2_DEV:
-      LOG_I(HW,"[%s] has loaded UEDv2 device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    case NONE_DEV:
-      LOG_I(HW,"[%s] has not loaded a HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
-      break;
-
-    default:
+  char *devname = get_devname(device->type);
+    if (strcmp(devname,"none") != 0) {
+      LOG_I(HW,"[%s] has loaded %s device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"),devname);
+    } else {
       LOG_E(HW,"[%s] invalid HW device.\n",((device->host_type == RAU_HOST) ? "RAU": "RRU"));
       return -1;
-  }
+    }
   return 0;
 }
 
@@ -108,7 +81,7 @@ int set_transport(openair0_device *device)
 }
 
 typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
-//loader_shlibfunc_t shlib_fdesc[2];
+
 
 /* look for the interface library and load it */
 int load_lib(openair0_device *device,
@@ -119,7 +92,14 @@ int load_lib(openair0_device *device,
   loader_shlibfunc_t shlib_fdesc[1];
   int ret=0;
   char *libname;
-  if ( IS_SOFTMODEM_BASICSIM ) {
+  
+  openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state));
+
+  if ( openair0_cfg->recplay_mode == RECPLAY_REPLAYMODE ) {
+  	  libname=OAI_IQPLAYER_LIBNAME;
+  	  shlib_fdesc[0].fname="device_init";
+  	  set_softmodem_optmask(SOFTMODEM_RECPLAY_BIT);  // softmodem has to know we use the iqplayer to workaround randomized algorithms
+  } else  if ( IS_SOFTMODEM_BASICSIM ) {
 	  libname=OAI_BASICSIM_LIBNAME;
 	  shlib_fdesc[0].fname="device_init";
   } else if (IS_SOFTMODEM_RFSIM && flag == RAU_LOCAL_RADIO_HEAD) {
diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h
index 03ab4da5f97d4c646ba63162c69e9556f9d6aa5e..7e51bdc81a6ad9690f119cfb25b4292ea847960f 100644
--- a/targets/ARCH/COMMON/common_lib.h
+++ b/targets/ARCH/COMMON/common_lib.h
@@ -35,15 +35,19 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include <openair1/PHY/TOOLS/tools_defs.h>
+#include "record_player.h"
 
-/* name of shared library implementing the radio front end */
+/* default name of shared library implementing the radio front end */
 #define OAI_RF_LIBNAME        "oai_device"
 /* name of shared library implementing the transport */
 #define OAI_TP_LIBNAME        "oai_transpro"
-/* name of shared library implementing the basic/rf simulator */
+/* name of shared library implementing the rf simulator */
 #define OAI_RFSIM_LIBNAME     "rfsimulator"
-/* name of shared library implementing the basic/rf simulator */
+/* name of shared library implementing the basic simulator */
 #define OAI_BASICSIM_LIBNAME  "tcp_bridge_oai"
+/* name of shared library implementing the iq player */
+#define OAI_IQPLAYER_LIBNAME  "oai_iqplayer"
+
 /* flags for BBU to determine whether the attached radio head is local or remote */
 #define RAU_LOCAL_RADIO_HEAD  0
 #define RAU_REMOTE_RADIO_HEAD 1
@@ -101,7 +105,7 @@ typedef enum {
   UEDv2_DEV,
   MAX_RF_DEV_TYPE
 } dev_type_t;
-
+#define DEVTYPE_NAMES {"","EXMIMO","USRP B200","USRP X300","BLADERF","LMSSDR","IRIS","No HW","ADRV9371_ZC706","UEDv2"} 
 /*!\brief transport protocol types
  */
 typedef enum {
@@ -145,6 +149,7 @@ typedef enum {
   gpsdo=2
 } clock_source_t;
 
+
 /*! \brief RF frontend parameters set by application */
 typedef struct {
   //! Module ID for this configuration
@@ -219,15 +224,9 @@ typedef struct {
   char *my_addr;
   //! local port number for Ethernet interface (eNB/BBU, UE)
   unsigned int my_port;
-#if defined(USRP_REC_PLAY)
-  unsigned short sf_mode;           // 1=record, 2=replay
-  char           sf_filename[1024]; // subframes file path
-  unsigned int   sf_max;            // max number of recorded subframes
-  unsigned int   sf_loops;          // number of loops in replay mode
-  unsigned int   sf_read_delay;     // read delay in replay mode
-  unsigned int   sf_write_delay;    // write delay in replay mode
-  unsigned int   eth_mtu;           // ethernet MTU
-#endif
+  //! record player configuration, definition in record_player.h
+  uint32_t       recplay_mode;
+  recplay_conf_t *recplay_conf;
   //! number of samples per tti
   unsigned int  samples_per_tti;
   //! the sample rate for receive.
@@ -298,7 +297,8 @@ struct openair0_device_t {
 
   /* !brief ETH params set by application */
   eth_params_t *eth_params;
-
+  //! record player data, definition in record_player.h
+  recplay_state_t *recplay_state;
   /* !brief Indicates if device already initialized */
   int is_init;
 
@@ -443,11 +443,13 @@ typedef struct {
 
 #define OPTION_LZ4  0x00000001          // LZ4 compression (option_value is set to compressed size)
 
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
-
+/*! \brief get device name from device type */
+char *get_devname(int devtype);
 /*! \brief Initialize openair RF target. It returns 0 if OK */
 int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cfg);
 /*! \brief Initialize transport protocol . It returns 0 if OK */
@@ -465,6 +467,11 @@ openair0_timestamp get_usrp_time(openair0_device *device);
  * \returns 0 in success
  */
 int openair0_set_rx_frequencies(openair0_device *device, openair0_config_t *openair0_cfg);
+/*! \brief read the iq record/player configuration */
+extern int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state);
+/*! \brief store recorded iqs from memory to file. */
+extern void iqrecorder_end(openair0_device *device);
+
 
 #define gettid() syscall(__NR_gettid)
 /*@}*/
diff --git a/targets/ARCH/COMMON/record_player.c b/targets/ARCH/COMMON/record_player.c
new file mode 100644
index 0000000000000000000000000000000000000000..2dcd61e47949be1b2311c905e89d62221ffaaf40
--- /dev/null
+++ b/targets/ARCH/COMMON/record_player.c
@@ -0,0 +1,115 @@
+/*
+ * 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
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * 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
+ */
+
+/** record_player.c
+ *
+ * \author: Nokia bellLabs B. Mongazon F. Taburet
+ *
+ */
+
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/sysinfo.h>
+#include <sys/resource.h>
+#include "common/utils/LOG/log.h"
+#include "assertions.h"
+#include "common_lib.h"
+#include "record_player.h"
+
+/*! \brief read the oai recorder or player configuration, called from common device code
+ * \param recplay_conf:  store parameters
+ *        recplay_state: store recorder or player data while the device runs
+ */
+int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {
+  unsigned int    u_sf_record = 0;                       // record mode
+  unsigned int    u_sf_replay = 0;                       // replay mode
+  *recplay_conf = calloc(sizeof(recplay_conf_t),1);
+  paramdef_t device_recplay_params[]=DEVICE_RECPLAY_PARAMS_DESC ;
+  config_get(device_recplay_params,sizeof(device_recplay_params)/sizeof(paramdef_t),DEVICE_RECPLAY_SECTION);
+
+  if (u_sf_record || u_sf_replay ) {
+    struct sysinfo systeminfo;
+    *recplay_state = calloc(sizeof(recplay_state_t),1);
+
+    if ( *recplay_state == NULL) {
+      LOG_E(HW,"calloc error in %s\n", __FILE__);
+      return -1;
+    }
+
+    // Use mmap for IQ files for systems with less than 6GB total RAM
+    sysinfo(&systeminfo);
+
+    if (systeminfo.totalram < 6144000000) {
+      (*recplay_state)->use_mmap = 0;
+    } else {
+      (*recplay_state)->use_mmap = 1;
+    }
+  } else { /* record player enabled */
+    free(*recplay_conf);
+    *recplay_conf=NULL;
+  }
+
+  if (u_sf_replay == 1) return RECPLAY_REPLAYMODE;
+  else if (u_sf_record == 1) return RECPLAY_RECORDMODE;
+
+  return 0;
+}
+
+/*! \brief Terminate operation of the oai iq recorder. to be called by any device
+ * used in record mode
+ * \param device, the hardware used
+ */
+void iqrecorder_end(openair0_device *device) {
+  if (device->recplay_state != NULL) { // subframes store
+    iqfile_header_t    fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,OAIIQFILE_ID};
+    recplay_state_t *rs = device->recplay_state;
+    recplay_conf_t  *rc = device->openair0_cfg[0].recplay_conf;
+    rs->pFile = fopen (rc->u_sf_filename,"wb+");
+
+    if (rs->pFile == NULL) {
+      LOG_E(HW,"Cannot open %s\n", rc->u_sf_filename);
+    } else {
+      unsigned int i = 0;
+      unsigned int modu = 0;
+
+      if ((modu = rs->nb_samples % 10) != 0) {
+        rs->nb_samples -= modu; // store entire number of frames
+      }
+
+      LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename );
+      fwrite(&fh, sizeof(fh), 1, rs->pFile);
+      LOG_UI(HW,"Writing %u subframes to %s \n",rs->nb_samples, rc->u_sf_filename );
+
+      for (i = 0; i < rs->nb_samples; i++) {
+        fwrite(rs->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), rs->pFile);
+      }
+
+      fclose (rs->pFile);
+      LOG_UI(HW,"File %s closed\n",rc->u_sf_filename );
+    }
+
+    if (rs->ms_sample != NULL) {
+      free((void *)rs->ms_sample);
+      rs->ms_sample = NULL;
+    }
+  }
+}
\ No newline at end of file
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h b/targets/ARCH/COMMON/record_player.h
similarity index 81%
rename from targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
rename to targets/ARCH/COMMON/record_player.h
index d29cf41db2061a8fd574e95df0f588b17c74ed13..903dda006b02e0eb79e1107665220d80090ea225 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.h
+++ b/targets/ARCH/COMMON/record_player.h
@@ -1,5 +1,5 @@
-#ifndef __USRP_LIB_H
-#define __USRP_LIB_H
+#ifndef __RECORD_PLAYER_H
+#define __RECORD_PLAYER_H
 /*
  * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -21,7 +21,7 @@
  *      contact@openairinterface.org
  */
 
-/** usrp_lib.h
+/** targets/ARCH/COMMON/record-player.h
  *
  * \author: bruno.mongazon-cazavet@nokia-bell-labs.com
  */
@@ -46,7 +46,7 @@ extern "C"
 /*                                            command line parameters for USRP record/playback                                                                               */
 /*   optname                     helpstr                paramflags                      XXXptr                  defXXXval                            type           numelt   */
 /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define USRP_DEVICE_PARAMS_DESC {  \
+#define DEVICE_PARAMS_DESC {  \
     {CONFIG_OPT_RECPLAY,      CONFIG_HLP_RECPLAY, PARAMFLAG_BOOL,   uptr:&enable_recplay,                 defuintval:0,                    TYPE_UINT,     0} \
   }
 
@@ -59,6 +59,15 @@ extern "C"
 #define BELL_LABS_IQ_HEADER       0xabababababababab
 #define BELL_LABS_IQ_PER_SF       7680 // Up to 5MHz bw for now
 #define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4)
+
+#define    OAIIQFILE_ID "OIQF"
+typedef struct {
+  uint64_t      devtype;
+  uint64_t      tx_sample_advance;
+  double        bw;
+  char          oaiid[4];
+} iqfile_header_t;
+
 typedef struct {
   int64_t       header;
   int64_t       ts;
@@ -75,8 +84,8 @@ typedef struct {
 
 /* help strings definition for config options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */
 #define CONFIG_HLP_SF_FILE      "Path of the file used for subframes record or replay"
-#define CONFIG_HLP_SF_REC       "Record subframes from USRP driver into a file for later replay"
-#define CONFIG_HLP_SF_REP       "Replay subframes into USRP driver from a file"
+#define CONFIG_HLP_SF_REC       "Record subframes from device driver into a file for later replay"
+#define CONFIG_HLP_SF_REP       "Replay subframes from a file using the oai replay driver"
 #define CONFIG_HLP_SF_MAX       "Maximum count of subframes to be recorded in subframe file"
 #define CONFIG_HLP_SF_LOOPS     "Number of loops to replay of the entire subframes file"
 #define CONFIG_HLP_SF_RDELAY    "Delay in microseconds to read a subframe in replay mode"
@@ -91,41 +100,43 @@ typedef struct {
 #define CONFIG_OPT_SF_RDELAY    "subframes-read-delay"
 #define CONFIG_OPT_SF_WDELAY    "subframes-write-delay"
 
-#define USRP_RECPLAY_SECTION "device.recplay"
+#define DEVICE_RECPLAY_SECTION "device.recplay"
 /* For information only - the macro is not usable in C++ */
 /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            command line parameters for USRP record/playback                                                                               */
-/*   optname                     helpstr                paramflags                      XXXptr                  defXXXval                            type           numelt   */
+/*   optname                     helpstr                paramflags                      XXXptr                           defXXXval                            type           numelt   */
 /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
-#define USRP_RECPLAY_PARAMS_DESC {  \
-    {CONFIG_OPT_SF_FILE,      CONFIG_HLP_SF_FILE, 0,              strptr:(char **)((*recplay_state)->u_sf_filename),       defstrval:DEF_SF_FILE,            TYPE_STRING,   1024}, \
-    {CONFIG_OPT_SF_REC,       CONFIG_HLP_SF_REC,  PARAMFLAG_BOOL,   uptr:&(u_sf_record),                  defuintval:0,                TYPE_UINT,   0}, \
-    {CONFIG_OPT_SF_REP,       CONFIG_HLP_SF_REP,  PARAMFLAG_BOOL,   uptr:&(u_sf_replay),                  defuintval:0,                TYPE_UINT,   0}, \
-    {CONFIG_OPT_SF_MAX,       CONFIG_HLP_SF_MAX,    0,                uptr:&((*recplay_state)->u_sf_max),                 defintval:DEF_NB_SF,             TYPE_UINT,   0}, \
-    {CONFIG_OPT_SF_LOOPS,     CONFIG_HLP_SF_LOOPS,  0,                uptr:&((*recplay_state)->u_sf_loops),                 defintval:DEF_SF_NB_LOOP,        TYPE_UINT,   0}, \
-    {CONFIG_OPT_SF_RDELAY,    CONFIG_HLP_SF_RDELAY, 0,                uptr:&((*recplay_state)->u_sf_read_delay),              defintval:DEF_SF_DELAY_READ,     TYPE_UINT,   0}, \
-    {CONFIG_OPT_SF_WDELAY,    CONFIG_HLP_SF_WDELAY, 0,                uptr:&((*recplay_state)->u_sf_write_delay),           defintval:DEF_SF_DELAY_WRITE,    TYPE_UINT,   0}, \
+#define DEVICE_RECPLAY_PARAMS_DESC {  \
+    {CONFIG_OPT_SF_FILE,      CONFIG_HLP_SF_FILE, 0,              strptr:(char **)((*recplay_conf)->u_sf_filename),       defstrval:DEF_SF_FILE,            TYPE_STRING,   1024}, \
+    {CONFIG_OPT_SF_REC,       CONFIG_HLP_SF_REC,  PARAMFLAG_BOOL,   uptr:&(u_sf_record),                                  defuintval:0,                TYPE_UINT,   0}, \
+    {CONFIG_OPT_SF_REP,       CONFIG_HLP_SF_REP,  PARAMFLAG_BOOL,   uptr:&(u_sf_replay),                                  defuintval:0,                TYPE_UINT,   0}, \
+    {CONFIG_OPT_SF_MAX,       CONFIG_HLP_SF_MAX,    0,                uptr:&((*recplay_conf)->u_sf_max),                  defintval:DEF_NB_SF,             TYPE_UINT,   0}, \
+    {CONFIG_OPT_SF_LOOPS,     CONFIG_HLP_SF_LOOPS,  0,                uptr:&((*recplay_conf)->u_sf_loops),                defintval:DEF_SF_NB_LOOP,        TYPE_UINT,   0}, \
+    {CONFIG_OPT_SF_RDELAY,    CONFIG_HLP_SF_RDELAY, 0,                uptr:&((*recplay_conf)->u_sf_read_delay),           defintval:DEF_SF_DELAY_READ,     TYPE_UINT,   0}, \
+    {CONFIG_OPT_SF_WDELAY,    CONFIG_HLP_SF_WDELAY, 0,                uptr:&((*recplay_conf)->u_sf_write_delay),          defintval:DEF_SF_DELAY_WRITE,    TYPE_UINT,   0}, \
   }/*! \brief USRP Configuration and state */
+typedef struct {
+  char            u_sf_filename[1024];              // subframes file path
+  unsigned int    u_sf_max ;                  // max number of recorded subframes
+  unsigned int    u_sf_loops ;           // number of loops in replay mode
+  unsigned int    u_sf_read_delay;   // read delay in replay mode
+  unsigned int    u_sf_write_delay ; // write delay in replay mode
+} recplay_conf_t;
 
 typedef struct {
+  int             use_mmap; // default is to use mmap
+  size_t          mapsize;
   FILE            *pFile;
   int             mmapfd;
   int             iqfd;
-  int             use_mmap; // default is to use mmap
-  size_t          mapsize;
   iqrec_t        *ms_sample;                      // memory for all subframes
   unsigned int    nb_samples;
-  char            u_sf_filename[1024];              // subframes file path
-  unsigned int    u_sf_max ;                  // max number of recorded subframes
-  unsigned int    u_sf_loops ;           // number of loops in replay mode
-  unsigned int    u_sf_read_delay;   // read delay in replay mode
-  unsigned int    u_sf_write_delay ; // write delay in replay mode
 } recplay_state_t;
 
 
-extern int read_usrpconfig(uint32_t *recplay_mode, recplay_state_t **recplay_state);
+
 #ifdef __cplusplus
 }
 #endif
-#endif // __USRP_LIB_H
+#endif // __RECORD_PLAYER_H
 
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
index eb8c6ec010e22d1597aff1a0f6e3774ac269bf69..5135be0cd4943e8d8423f6ce8adada9e5eecbbbd 100644
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
+++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
@@ -23,7 +23,8 @@
  *
  * \author: HongliangXU : hong-liang-xu@agilent.com
  */
-
+#define _LARGEFILE_SOURCE
+#define _FILE_OFFSET_BITS 64
 #include <string.h>
 #include <pthread.h>
 #include <unistd.h>
@@ -51,8 +52,6 @@
 
 #include <sys/resource.h>
 
-#include "usrp_lib.h"
-
 #ifdef __SSE4_1__
   #include <smmintrin.h>
 #endif
@@ -108,8 +107,6 @@ typedef struct {
   int first_tx;
   //! timestamp of RX packet
   openair0_timestamp rx_timestamp;
-  uint32_t recplay_mode;
-  recplay_state_t *recplay_state;
 } usrp_state_t;
 
 //void print_notes(void)
@@ -271,9 +268,6 @@ static int sync_to_gps(openair0_device *device) {
 static int trx_usrp_start(openair0_device *device) {
   usrp_state_t *s = (usrp_state_t *)device->priv;
 
-  if ( s->recplay_mode == RECPLAY_REPLAYMODE)
-    return 0;
-
   // setup GPIO for TDD, GPIO(4) = ATR_RX
   //set data direction register (DDR) to output
   s->usrp->set_gpio_attr("FP0", "DDR", 0x7f, 0x7f);
@@ -316,86 +310,14 @@ static void trx_usrp_end(openair0_device *device) {
     return;
 
   usrp_state_t *s = (usrp_state_t *)device->priv;
-
+  
   if (s == NULL)
     return;
+  iqrecorder_end(device);
 
-  if (s->recplay_mode != RECPLAY_REPLAYMODE) { // not subframes replay
-    s->rx_stream->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
-    //send a mini EOB packet
-    s->tx_md.end_of_burst = true;
-    s->tx_stream->send("", 0, s->tx_md);
-    s->tx_md.end_of_burst = false;
-    sleep(1);
-  }
-
-  if (s->recplay_mode == RECPLAY_RECORDMODE) { // subframes store
-    s->recplay_state->pFile = fopen (s->recplay_state->u_sf_filename,"wb+");
-
-    if (s->recplay_state->pFile == NULL) {
-      std::cerr << "Cannot open " << s->recplay_state->u_sf_filename << std::endl;
-    } else {
-      unsigned int i = 0;
-      unsigned int modu = 0;
-
-      if ((modu = s->recplay_state->nb_samples % 10) != 0) {
-        s->recplay_state->nb_samples -= modu; // store entire number of frames
-      }
-
-      std::cerr << "Writing " << s->recplay_state->nb_samples << " subframes to " << s->recplay_state->u_sf_filename << " ..." << std::endl;
-
-      for (i = 0; i < s->recplay_state->nb_samples; i++) {
-        fwrite(s->recplay_state->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), s->recplay_state->pFile);
-      }
-
-      fclose (s->recplay_state->pFile);
-      std::cerr << "File " << s->recplay_state->u_sf_filename << " closed." << std::endl;
-    }
-
-    if (s->recplay_state->ms_sample != NULL) {
-      free((void *)s->recplay_state->ms_sample);
-      s->recplay_state->ms_sample = NULL;
-    }
-  } else if (s->recplay_mode == RECPLAY_REPLAYMODE) { // replay
-    if (s->recplay_state->use_mmap) {
-      if (s->recplay_state->ms_sample != MAP_FAILED) {
-        munmap(s->recplay_state->ms_sample, s->recplay_state->mapsize);
-        s->recplay_state->ms_sample = NULL;
-      }
-
-      if (s->recplay_state->mmapfd != 0) {
-        close(s->recplay_state->mmapfd);
-        s->recplay_state->mmapfd = 0;
-      }
-    } else {
-      if (s->recplay_state->ms_sample != NULL) {
-        free(s->recplay_state->ms_sample);
-        s->recplay_state->ms_sample = NULL;
-      }
 
-      if (s->recplay_state->iqfd != 0) {
-        close(s->recplay_state->iqfd);
-        s->recplay_state->iqfd = 0;
-      }
-    }
-  }
-}
-/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
-      @param device pointer to the device structure specific to the RF hardware target
-      @param timestamp The timestamp at which the first sample MUST be sent
-      @param buff Buffer which holds the samples
-      @param nsamps number of samples to be sent
-      @param antenna_id index of the antenna if the device has multiple antennas
-      @param flags flags must be set to TRUE if timestamp parameter needs to be applied
-*/
-static int trx_usrp_write_recplay(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
-  struct timespec req;
-  usrp_state_t *s = (usrp_state_t *)device->priv;
-  req.tv_sec = 0;
-  req.tv_nsec = s->recplay_state->u_sf_write_delay * 1000;
-  nanosleep(&req, NULL);
-  return nsamps;
 }
+
 /*! \brief Called to send samples to the USRP RF target
       @param device pointer to the device structure specific to the RF hardware target
       @param timestamp The timestamp at which the first sample MUST be sent
@@ -488,106 +410,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
   return ret;
 }
 
-/*! \brief Receive samples from iq file.
- * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
- * the first channel. *ptimestamp is the time at which the first sample
- * was received.
- * \param device the hardware to use
- * \param[out] ptimestamp the time at which the first sample was received.
- * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps.
- * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
- * \param antenna_id Index of antenna for which to receive samples
- * \returns the number of sample read
-*/
-static int trx_usrp_read_recplay(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
-  int samples_received=0;
-  static unsigned int    cur_samples;
-  static int64_t         wrap_count;
-  static int64_t  wrap_ts;
-  usrp_state_t *s = (usrp_state_t *)device->priv;
-
-
-  if (cur_samples == s->recplay_state->nb_samples) {
-    cur_samples = 0;
-    wrap_count++;
-    if (wrap_count == s->recplay_state->u_sf_loops) {
-      std::cerr << "USRP device terminating subframes replay mode after " << s->recplay_state->u_sf_loops << " loops." << std::endl;
-      exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n");
-    }
-
-    wrap_ts = wrap_count * (s->recplay_state->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000));
-
-    if (!s->recplay_state->use_mmap) {
-      if (lseek(s->recplay_state->iqfd, 0, SEEK_SET) == 0) {
-        std::cerr << "Seeking at the beginning of IQ file" << std::endl;
-      } else {
-        std::cerr << "Problem seeking at the beginning of IQ file" << std::endl;
-      }
-    }
-  }
-
-  if (s->recplay_state->use_mmap) {
-    if (cur_samples < s->recplay_state->nb_samples) {
-      *ptimestamp = (s->recplay_state->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts;
-
-      if (cur_samples == 0) {
-        std::cerr << "starting subframes file with wrap_count=" << wrap_count << " wrap_ts=" << wrap_ts
-                  << " ts=" << *ptimestamp << std::endl;
-      }
-
-      memcpy(buff[0], &s->recplay_state->ms_sample[cur_samples].samples[0], nsamps*4);
-      cur_samples++;
-    }
-  } else {
-    // read sample from file
-    if (read(s->recplay_state->iqfd, s->recplay_state->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
-      std::cerr << "pb reading iqfile at index " << sizeof(iqrec_t)*cur_samples << std::endl;
-      close(s->recplay_state->iqfd);
-      free(s->recplay_state->ms_sample);
-      s->recplay_state->ms_sample = NULL;
-      s->recplay_state->iqfd = 0;
-      exit(-1);
-    }
-
-    if (cur_samples < s->recplay_state->nb_samples) {
-      static int64_t ts0 = 0;
-
-      if ((cur_samples == 0) && (wrap_count == 0)) {
-        ts0 = s->recplay_state->ms_sample->ts;
-      }
-
-      *ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts;
-
-      if (cur_samples == 0) {
-        std::cerr << "starting subframes file with wrap_count=" << wrap_count << " wrap_ts=" << wrap_ts
-                  << " ts=" << *ptimestamp << std::endl;
-      }
-
-      memcpy(buff[0], &s->recplay_state->ms_sample->samples[0], nsamps*4);
-      cur_samples++;
-      // Prepare for next read
-      off_t where = lseek(s->recplay_state->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET);
-
-      if (where < 0) {
-        LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno));
-      }
-    }
-  }
-
-  struct timespec req;
-
-  req.tv_sec = 0;
-
-  req.tv_nsec = s->recplay_state->u_sf_read_delay * 1000;
-
-  nanosleep(&req, NULL);
-
-  return nsamps;
-
-  return samples_received;
-}
-
-
 /*! \brief Receive samples from hardware.
  * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
  * the first channel. *ptimestamp is the time at which the first sample
@@ -689,13 +511,13 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
   s->rx_timestamp = s->rx_md.time_spec.to_ticks(s->sample_rate);
   *ptimestamp = s->rx_timestamp;
 
-  if (s->recplay_mode == RECPLAY_RECORDMODE) { // record mode
+  if (device->recplay_state != NULL) { // record mode
     // Copy subframes to memory (later dump on a file)
-    if (s->recplay_state->nb_samples < s->recplay_state->u_sf_max) {
-      (s->recplay_state->ms_sample+s->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER;
-      (s->recplay_state->ms_sample+s->recplay_state->nb_samples)->ts = *ptimestamp;
-      memcpy((s->recplay_state->ms_sample+s->recplay_state->nb_samples)->samples, buff[0], nsamps*4);
-      s->recplay_state->nb_samples++;
+    if (device->recplay_state->nb_samples < device->openair0_cfg->recplay_conf->u_sf_max) {
+      (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER;
+      (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->ts = *ptimestamp;
+      memcpy((device->recplay_state->ms_sample+device->recplay_state->nb_samples)->samples, buff[0], nsamps*4);
+      device->recplay_state->nb_samples++;
     } else     exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n");
   }
 
@@ -909,7 +731,6 @@ extern "C" {
     }
 
     device->openair0_cfg = openair0_cfg;
-    read_usrpconfig(&(s->recplay_mode), &(s->recplay_state));
     device->trx_start_func = trx_usrp_start;
     device->trx_get_stats_func = trx_usrp_get_stats;
     device->trx_reset_stats_func = trx_usrp_reset_stats;
@@ -918,90 +739,74 @@ extern "C" {
     device->trx_set_freq_func = trx_usrp_set_freq;
     device->trx_set_gains_func   = trx_usrp_set_gains;
 
-    if ( s->recplay_mode == RECPLAY_REPLAYMODE) {
-      // Replay subframes from from file
-      int bw_gain_adjust=0;
-      device->type = USRP_B200_DEV;
-      openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
-      bw_gain_adjust=1;
-      openair0_cfg[0].tx_sample_advance     = 80;
-      openair0_cfg[0].tx_bw                 = 20e6;
-      openair0_cfg[0].rx_bw                 = 20e6;
-      openair0_cfg[0].iq_txshift = 4;//shift
-      openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
-      set_rx_gain_offset(&openair0_cfg[0],0,bw_gain_adjust);
-      device->trx_write_func = trx_usrp_write_recplay;
-      device->trx_read_func  = trx_usrp_read_recplay;
-      std::cerr << "USRP device initialized in subframes replay mode for " << s->recplay_state->u_sf_loops << " loops. Use mmap="
-                << s->recplay_state->use_mmap << std::endl;
-    } else {
-      // hotfix! to be checked later
-      uhd::set_thread_priority_safe(1.0);
-      // Initialize USRP device
-      int vers=0,subvers=0,subsubvers=0;
-      int bw_gain_adjust=0;
-
-      if (s->recplay_mode == RECPLAY_RECORDMODE) {
-        std::cerr << "USRP device initialized in subframes record mode" << std::endl;
-      }
-
-      sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
-      LOG_I(HW,"UHD version %s (%d.%d.%d)\n",
-            uhd::get_version_string().c_str(),vers,subvers,subsubvers);
-      std::string args;
-
-      if (openair0_cfg[0].sdr_addrs == NULL) {
-        args = "type=b200";
-      } else {
-        args = openair0_cfg[0].sdr_addrs;
-        LOG_I(HW,"Checking for USRP with args %s\n",openair0_cfg[0].sdr_addrs);
-      }
-
-      uhd::device_addrs_t device_adds = uhd::device::find(args);
-
-      if (device_adds.size() == 0) {
-        LOG_E(HW,"No USRP Device Found.\n ");
-        free(s);
-        return -1;
-      } else if (device_adds.size() > 1) {
-        LOG_E(HW,"More than one USRP Device Found. Please specify device more precisely in config file.\n");
-        free(s);
-        return -1;
-      }
-
-      LOG_I(HW,"Found USRP %s\n", device_adds[0].get("type").c_str());
-      double usrp_master_clock;
-
-      if (device_adds[0].get("type") == "b200") {
-        printf("Found USRP b200\n");
-        device->type = USRP_B200_DEV;
-        usrp_master_clock = 30.72e6;
-        args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
-        args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ;
-      }
-
-      if (device_adds[0].get("type") == "n3xx") {
-        printf("Found USRP n300\n");
-        device->type=USRP_X300_DEV; //treat it as X300 for now
-        usrp_master_clock = 122.88e6;
-        args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
-        //args += ", send_buff_size=33554432";
-      }
-
-      if (device_adds[0].get("type") == "x300") {
-        printf("Found USRP x300\n");
-        device->type=USRP_X300_DEV;
-        usrp_master_clock = 184.32e6;
-        args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
-
-        // USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
-        if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") )
-          LOG_W(HW,"Can't set kernel parameters for X3xx\n");
-      }
-
-      s->usrp = uhd::usrp::multi_usrp::make(args);
 
-      if (args.find("clock_source")==std::string::npos) {
+    // hotfix! to be checked later
+    uhd::set_thread_priority_safe(1.0);
+    // Initialize USRP device
+    int vers=0,subvers=0,subsubvers=0;
+    int bw_gain_adjust=0;
+  
+    if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) {
+      std::cerr << "USRP device initialized in subframes record mode" << std::endl;
+    }
+  
+    sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
+    LOG_I(HW,"UHD version %s (%d.%d.%d)\n",
+          uhd::get_version_string().c_str(),vers,subvers,subsubvers);
+    std::string args;
+  
+    if (openair0_cfg[0].sdr_addrs == NULL) {
+      args = "type=b200";
+    } else {
+      args = openair0_cfg[0].sdr_addrs;
+      LOG_I(HW,"Checking for USRP with args %s\n",openair0_cfg[0].sdr_addrs);
+    }
+  
+    uhd::device_addrs_t device_adds = uhd::device::find(args);
+  
+    if (device_adds.size() == 0) {
+      LOG_E(HW,"No USRP Device Found.\n ");
+      free(s);
+      return -1;
+    } else if (device_adds.size() > 1) {
+      LOG_E(HW,"More than one USRP Device Found. Please specify device more precisely in config file.\n");
+      free(s);
+      return -1;
+    }
+  
+    LOG_I(HW,"Found USRP %s\n", device_adds[0].get("type").c_str());
+    double usrp_master_clock;
+  
+    if (device_adds[0].get("type") == "b200") {
+      printf("Found USRP b200\n");
+      device->type = USRP_B200_DEV;
+      usrp_master_clock = 30.72e6;
+      args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
+      args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ;
+    }
+  
+    if (device_adds[0].get("type") == "n3xx") {
+      printf("Found USRP n300\n");
+      device->type=USRP_X300_DEV; //treat it as X300 for now
+      usrp_master_clock = 122.88e6;
+      args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
+      //args += ", send_buff_size=33554432";
+    }
+  
+    if (device_adds[0].get("type") == "x300") {
+      printf("Found USRP x300\n");
+      device->type=USRP_X300_DEV;
+      usrp_master_clock = 184.32e6;
+      args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
+  
+      // USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
+      if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") )
+        LOG_W(HW,"Can't set kernel parameters for X3xx\n");
+    }
+  
+    s->usrp = uhd::usrp::multi_usrp::make(args);
+  
+    if (args.find("clock_source")==std::string::npos) {
 	if (openair0_cfg[0].clock_source == internal) {
 	  //in UHD 3.14 we could use
 	  //s->usrp->set_sync_source("clock_source=internal","time_source=internal");
@@ -1023,358 +828,292 @@ extern "C" {
 	else { 
 	  LOG_W(HW,"Clock source set neither in usrp_args nor on command line, using default!\n");
 	}
-      }
-      else {
+    }
+    else {
 	if (openair0_cfg[0].clock_source != unset) {
 	  LOG_W(HW,"Clock source set in both usrp_args and in clock_source, ingnoring the latter!\n");
 	}
-      }
-      
-      if (s->usrp->get_clock_source(0) == "gpsdo") {
-        s->use_gps = 1;
-
-        if (sync_to_gps(device)==EXIT_SUCCESS) {
-          LOG_I(HW,"USRP synced with GPS!\n");
-        } else {
-          LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n");
-          exit(EXIT_FAILURE);
-        }
-      } else if (s->usrp->get_clock_source(0) == "external") {
-        if (check_ref_locked(s,0)) {
-          LOG_I(HW,"USRP locked to external reference!\n");
-        } else {
-          LOG_I(HW,"Failed to lock to external reference. Exiting.\n");
-          exit(EXIT_FAILURE);
-        }
-      }
-
-      if (device->type==USRP_X300_DEV) {
-        openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
-        std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; // Bell Labs info
-        LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate);
-
-        switch ((int)openair0_cfg[0].sample_rate) {
-          case 122880000:
-            // from usrp_time_offset
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 15; //to be checked
-            openair0_cfg[0].tx_bw                 = 80e6;
-            openair0_cfg[0].rx_bw                 = 80e6;
-            break;
-
-          case 92160000:
-            // from usrp_time_offset
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 15; //to be checked
-            openair0_cfg[0].tx_bw                 = 80e6;
-            openair0_cfg[0].rx_bw                 = 80e6;
-            break;
-
-          case 61440000:
-            // from usrp_time_offset
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 15;
-            openair0_cfg[0].tx_bw                 = 40e6;
-            openair0_cfg[0].rx_bw                 = 40e6;
-            break;
-
-          case 46080000:
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 15;
-            openair0_cfg[0].tx_bw                 = 40e6;
-            openair0_cfg[0].rx_bw                 = 40e6;
-            break;
-
-          case 30720000:
-            // from usrp_time_offset
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 15;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          case 15360000:
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 45;
-            openair0_cfg[0].tx_bw                 = 10e6;
-            openair0_cfg[0].rx_bw                 = 10e6;
-            break;
-
-          case 7680000:
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 50;
-            openair0_cfg[0].tx_bw                 = 5e6;
-            openair0_cfg[0].rx_bw                 = 5e6;
-            break;
-
-          case 1920000:
-            //openair0_cfg[0].samples_per_packet    = 2048;
-            openair0_cfg[0].tx_sample_advance     = 50;
-            openair0_cfg[0].tx_bw                 = 1.25e6;
-            openair0_cfg[0].rx_bw                 = 1.25e6;
-            break;
-
-          default:
-            LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
-            exit(-1);
-            break;
-        }
-      }
-
-      if (device->type == USRP_B200_DEV) {
-        if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
-          openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
-          bw_gain_adjust=0;
-          std::cerr << "-- Using calibration table: calib_table_b210" << std::endl; // Bell Labs info
-        } else {
-          openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
-          bw_gain_adjust=1;
-          std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info
-        }
-
-        switch ((int)openair0_cfg[0].sample_rate) {
-          case 46080000:
-            s->usrp->set_master_clock_rate(46.08e6);
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 115;
-            openair0_cfg[0].tx_bw                 = 40e6;
-            openair0_cfg[0].rx_bw                 = 40e6;
-            break;
-
-          case 30720000:
-            s->usrp->set_master_clock_rate(30.72e6);
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 115;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          case 23040000:
-            s->usrp->set_master_clock_rate(23.04e6); //to be checked
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 113;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          case 15360000:
-            s->usrp->set_master_clock_rate(30.72e06);
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 103;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          case 7680000:
-            s->usrp->set_master_clock_rate(30.72e6);
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 80;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          case 1920000:
-            s->usrp->set_master_clock_rate(30.72e6);
-            //openair0_cfg[0].samples_per_packet    = 1024;
-            openair0_cfg[0].tx_sample_advance     = 40;
-            openair0_cfg[0].tx_bw                 = 20e6;
-            openair0_cfg[0].rx_bw                 = 20e6;
-            break;
-
-          default:
-            LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
-            exit(-1);
-            break;
-        }
-      }
-
-      /* device specific */
-      //openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered
-      //openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
-      openair0_cfg[0].iq_txshift = 4;//shift
-      openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
-
-      for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) {
-        if (i<openair0_cfg[0].rx_num_channels) {
-          s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
-          s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
-          set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
-          ::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
-          // limit to maximum gain
-          AssertFatal( openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] <= gain_range.stop(),
-                       "RX Gain too high, lower by %f dB\n",
-                       openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] - gain_range.stop());
-          s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],i);
-          LOG_I(HW,"RX Gain %d %f (%f) => %f (max %f)\n",i,
-                openair0_cfg[0].rx_gain[i],openair0_cfg[0].rx_gain_offset[i],
-                openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop());
-        }
-      }
-
-      LOG_D(HW, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels());
-      LOG_D(HW, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels);
-
-      for(int i=0; i<((int) s->usrp->get_tx_num_channels()); i++) {
-        ::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i);
-
-        if (i<openair0_cfg[0].tx_num_channels) {
-          s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
-          s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
-          s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[i],i);
-          LOG_I(HW,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]);
-        }
-      }
-
-      //s->usrp->set_clock_source("external");
-      //s->usrp->set_time_source("external");
-      // display USRP settings
-      LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6);
-      sleep(1);
-      // create tx & rx streamer
-      uhd::stream_args_t stream_args_rx("sc16", "sc16");
-      int samples=openair0_cfg[0].sample_rate;
-      int max=s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps();
-      samples/=10000;
-      LOG_I(HW,"RF board max packet size %u, size for 100µs jitter %d \n", max, samples);
-
-      if ( samples < max ) {
-        stream_args_rx.args["spp"] = str(boost::format("%d") % samples );
-      }
-
-      LOG_I(HW,"rx_max_num_samps %zu\n",
-            s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps());
-
-      for (int i = 0; i<openair0_cfg[0].rx_num_channels; i++)
-        stream_args_rx.channels.push_back(i);
-
-      s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
-      uhd::stream_args_t stream_args_tx("sc16", "sc16");
-
-      for (int i = 0; i<openair0_cfg[0].tx_num_channels; i++)
-        stream_args_tx.channels.push_back(i);
-
-      s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
-
-      /* Setting TX/RX BW after streamers are created due to USRP calibration issue */
-      for(int i=0; i<((int) s->usrp->get_tx_num_channels()) && i<openair0_cfg[0].tx_num_channels; i++)
-        s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i);
-
-      for(int i=0; i<((int) s->usrp->get_rx_num_channels()) && i<openair0_cfg[0].rx_num_channels; i++)
-        s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
-
-      for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) {
-        LOG_I(HW,"RX Channel %d\n",i);
-        LOG_I(HW,"  Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6);
-        LOG_I(HW,"  Actual RX frequency: %fGHz...\n", s->usrp->get_rx_freq(i)/1e9);
-        LOG_I(HW,"  Actual RX gain: %f...\n", s->usrp->get_rx_gain(i));
-        LOG_I(HW,"  Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6);
-        LOG_I(HW,"  Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str());
-      }
-
-      for (int i=0; i<openair0_cfg[0].tx_num_channels; i++) {
-        LOG_I(HW,"TX Channel %d\n",i);
-        LOG_I(HW,"  Actual TX sample rate: %fMSps...\n", s->usrp->get_tx_rate(i)/1e6);
-        LOG_I(HW,"  Actual TX frequency: %fGHz...\n", s->usrp->get_tx_freq(i)/1e9);
-        LOG_I(HW,"  Actual TX gain: %f...\n", s->usrp->get_tx_gain(i));
-        LOG_I(HW,"  Actual TX bandwidth: %fM...\n", s->usrp->get_tx_bandwidth(i)/1e6);
-        LOG_I(HW,"  Actual TX antenna: %s...\n", s->usrp->get_tx_antenna(i).c_str());
-        LOG_I(HW,"  Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps());
-      }
-
-      LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs());
-      device->trx_write_func = trx_usrp_write;
-      device->trx_read_func  = trx_usrp_read;
-      s->sample_rate = openair0_cfg[0].sample_rate;
-
-      // TODO:
-      // init tx_forward_nsamps based usrp_time_offset ex
-      if(is_equal(s->sample_rate, (double)30.72e6))
-        s->tx_forward_nsamps  = 176;
-
-      if(is_equal(s->sample_rate, (double)15.36e6))
-        s->tx_forward_nsamps = 90;
-
-      if(is_equal(s->sample_rate, (double)7.68e6))
-        s->tx_forward_nsamps = 50;
+  }
+  
+  if (s->usrp->get_clock_source(0) == "gpsdo") {
+    s->use_gps = 1;
+  
+    if (sync_to_gps(device)==EXIT_SUCCESS) {
+      LOG_I(HW,"USRP synced with GPS!\n");
+    } else {
+      LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n");
+      exit(EXIT_FAILURE);
     }
-
-    if (s->recplay_mode == RECPLAY_RECORDMODE) { // record mode
-      s->recplay_state->ms_sample = (iqrec_t *) malloc(s->recplay_state->u_sf_max * sizeof(iqrec_t));
-
-      if (s->recplay_state->ms_sample == NULL) {
-        std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
+  } else if (s->usrp->get_clock_source(0) == "external") {
+    if (check_ref_locked(s,0)) {
+      LOG_I(HW,"USRP locked to external reference!\n");
+    } else {
+      LOG_I(HW,"Failed to lock to external reference. Exiting.\n");
+      exit(EXIT_FAILURE);
+    }
+  }
+  
+  if (device->type==USRP_X300_DEV) {
+    openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
+    std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; // Bell Labs info
+    LOG_I(HW,"%s() sample_rate:%u\n", __FUNCTION__, (int)openair0_cfg[0].sample_rate);
+  
+    switch ((int)openair0_cfg[0].sample_rate) {
+      case 122880000:
+        // from usrp_time_offset
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 15; //to be checked
+        openair0_cfg[0].tx_bw                 = 80e6;
+        openair0_cfg[0].rx_bw                 = 80e6;
+        break;
+  
+      case 92160000:
+        // from usrp_time_offset
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 15; //to be checked
+        openair0_cfg[0].tx_bw                 = 80e6;
+        openair0_cfg[0].rx_bw                 = 80e6;
+        break;
+  
+      case 61440000:
+        // from usrp_time_offset
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 15;
+        openair0_cfg[0].tx_bw                 = 40e6;
+        openair0_cfg[0].rx_bw                 = 40e6;
+        break;
+  
+      case 46080000:
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 15;
+        openair0_cfg[0].tx_bw                 = 40e6;
+        openair0_cfg[0].rx_bw                 = 40e6;
+        break;
+  
+      case 30720000:
+        // from usrp_time_offset
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 15;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      case 15360000:
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 45;
+        openair0_cfg[0].tx_bw                 = 10e6;
+        openair0_cfg[0].rx_bw                 = 10e6;
+        break;
+  
+      case 7680000:
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 50;
+        openair0_cfg[0].tx_bw                 = 5e6;
+        openair0_cfg[0].rx_bw                 = 5e6;
+        break;
+  
+      case 1920000:
+        //openair0_cfg[0].samples_per_packet    = 2048;
+        openair0_cfg[0].tx_sample_advance     = 50;
+        openair0_cfg[0].tx_bw                 = 1.25e6;
+        openair0_cfg[0].rx_bw                 = 1.25e6;
+        break;
+  
+      default:
+        LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
         exit(-1);
-      }
-
-      memset(s->recplay_state->ms_sample, 0, s->recplay_state->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
-    } else if (s->recplay_mode == RECPLAY_REPLAYMODE) {
-      if (s->recplay_state->use_mmap) {
-        // use mmap
-        s->recplay_state->mmapfd = open(s->recplay_state->u_sf_filename, O_RDONLY | O_LARGEFILE);
-
-        if (s->recplay_state->mmapfd != 0) {
-          struct stat sb;
-          fstat(s->recplay_state->mmapfd, &sb);
-          s->recplay_state->mapsize=sb.st_size;
-          std::cerr << "Loading subframes using mmap() from " << s->recplay_state->u_sf_filename << " size=" << (uint64_t)sb.st_size << " bytes ..." << std::endl;
-          s->recplay_state->ms_sample = (iqrec_t *) mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->recplay_state->mmapfd, 0);
-
-          if (s->recplay_state->ms_sample != MAP_FAILED) {
-            s->recplay_state->nb_samples = (sb.st_size / sizeof(iqrec_t));
-            int aligned = (((unsigned long)s->recplay_state->ms_sample & 31) == 0)? 1:0;
-            std::cerr<< "Loaded "<< s->recplay_state->nb_samples << " subframes." << std::endl;
-
-            if (aligned == 0) {
-              std::cerr<< "mmap address is not 32 bytes aligned, exiting." << std::endl;
-              close(s->recplay_state->mmapfd);
-              exit(-1);
-            }
-          } else {
-            std::cerr << "Cannot mmap file, exiting." << std::endl;
-            close(s->recplay_state->mmapfd);
-            exit(-1);
-          }
-        } else {
-          std::cerr << "Cannot open " << s->recplay_state->u_sf_filename << " , exiting." << std::endl;
-          exit(-1);
-        }
-      } else {
-        s->recplay_state->iqfd = open(s->recplay_state->u_sf_filename, O_RDONLY | O_LARGEFILE);
-
-        if (s->recplay_state->iqfd != 0) {
-          struct stat sb;
-          fstat(s->recplay_state->iqfd, &sb);
-          s->recplay_state->mapsize=sb.st_size;
-          s->recplay_state->nb_samples = (sb.st_size / sizeof(iqrec_t));
-          std::cerr << "Loading " << s->recplay_state->nb_samples << " subframes from " << s->recplay_state->u_sf_filename
-                    << " size=" << (uint64_t)sb.st_size << " bytes ..." << std::endl;
-          // allocate buffer for 1 sample at a time
-          s->recplay_state->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t));
-
-          if (s->recplay_state->ms_sample == NULL) {
-            std::cerr<< "Memory allocation failed for individual subframe replay mode." << std::endl;
-            close(s->recplay_state->iqfd);
-            exit(-1);
-          }
-
-          memset(s->recplay_state->ms_sample, 0, sizeof(iqrec_t));
-
-          // point at beginning of file
-          if (lseek(s->recplay_state->iqfd, 0, SEEK_SET) == 0) {
-            std::cerr << "Initial seek at beginning of the file" << std::endl;
-          } else {
-            std::cerr << "Problem initial seek at beginning of the file" << std::endl;
-          }
-        } else {
-          std::cerr << "Cannot open " << s->recplay_state->u_sf_filename << " , exiting." << std::endl;
-          exit(-1);
-        }
-      }
+        break;
     }
-
-    return 0;
   }
-
-
+  
+  if (device->type == USRP_B200_DEV) {
+    if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
+      openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
+      bw_gain_adjust=0;
+      std::cerr << "-- Using calibration table: calib_table_b210" << std::endl; // Bell Labs info
+    } else {
+      openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
+      bw_gain_adjust=1;
+      std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info
+    }
+  
+    switch ((int)openair0_cfg[0].sample_rate) {
+      case 46080000:
+        s->usrp->set_master_clock_rate(46.08e6);
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 115;
+        openair0_cfg[0].tx_bw                 = 40e6;
+        openair0_cfg[0].rx_bw                 = 40e6;
+        break;
+  
+      case 30720000:
+        s->usrp->set_master_clock_rate(30.72e6);
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 115;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      case 23040000:
+        s->usrp->set_master_clock_rate(23.04e6); //to be checked
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 113;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      case 15360000:
+        s->usrp->set_master_clock_rate(30.72e06);
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 103;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      case 7680000:
+        s->usrp->set_master_clock_rate(30.72e6);
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 80;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      case 1920000:
+        s->usrp->set_master_clock_rate(30.72e6);
+        //openair0_cfg[0].samples_per_packet    = 1024;
+        openair0_cfg[0].tx_sample_advance     = 40;
+        openair0_cfg[0].tx_bw                 = 20e6;
+        openair0_cfg[0].rx_bw                 = 20e6;
+        break;
+  
+      default:
+        LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate);
+        exit(-1);
+        break;
+    }
+  }
+  
+  /* device specific */
+  //openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered
+  //openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered
+  openair0_cfg[0].iq_txshift = 4;//shift
+  openair0_cfg[0].iq_rxrescale = 15;//rescale iqs
+  
+  for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) {
+    if (i<openair0_cfg[0].rx_num_channels) {
+      s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
+      s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
+      set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
+      ::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
+      // limit to maximum gain
+      AssertFatal( openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] <= gain_range.stop(),
+                   "RX Gain too high, lower by %f dB\n",
+                   openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] - gain_range.stop());
+      s->usrp->set_rx_gain(openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],i);
+      LOG_I(HW,"RX Gain %d %f (%f) => %f (max %f)\n",i,
+            openair0_cfg[0].rx_gain[i],openair0_cfg[0].rx_gain_offset[i],
+            openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop());
+    }
+  }
+  
+  LOG_D(HW, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels());
+  LOG_D(HW, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels);
+  
+  for(int i=0; i<((int) s->usrp->get_tx_num_channels()); i++) {
+    ::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i);
+  
+    if (i<openair0_cfg[0].tx_num_channels) {
+      s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
+      s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
+      s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[i],i);
+      LOG_I(HW,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]);
+    }
+  }
+  
+  //s->usrp->set_clock_source("external");
+  //s->usrp->set_time_source("external");
+  // display USRP settings
+  LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6);
+  sleep(1);
+  // create tx & rx streamer
+  uhd::stream_args_t stream_args_rx("sc16", "sc16");
+  int samples=openair0_cfg[0].sample_rate;
+  int max=s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps();
+  samples/=10000;
+  LOG_I(HW,"RF board max packet size %u, size for 100µs jitter %d \n", max, samples);
+  
+  if ( samples < max ) {
+    stream_args_rx.args["spp"] = str(boost::format("%d") % samples );
+  }
+  
+  LOG_I(HW,"rx_max_num_samps %zu\n",
+        s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps());
+  
+  for (int i = 0; i<openair0_cfg[0].rx_num_channels; i++)
+    stream_args_rx.channels.push_back(i);
+  
+  s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
+  uhd::stream_args_t stream_args_tx("sc16", "sc16");
+  
+  for (int i = 0; i<openair0_cfg[0].tx_num_channels; i++)
+    stream_args_tx.channels.push_back(i);
+  
+  s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
+  
+  /* Setting TX/RX BW after streamers are created due to USRP calibration issue */
+  for(int i=0; i<((int) s->usrp->get_tx_num_channels()) && i<openair0_cfg[0].tx_num_channels; i++)
+    s->usrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i);
+  
+  for(int i=0; i<((int) s->usrp->get_rx_num_channels()) && i<openair0_cfg[0].rx_num_channels; i++)
+    s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
+  
+  for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) {
+    LOG_I(HW,"RX Channel %d\n",i);
+    LOG_I(HW,"  Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6);
+    LOG_I(HW,"  Actual RX frequency: %fGHz...\n", s->usrp->get_rx_freq(i)/1e9);
+    LOG_I(HW,"  Actual RX gain: %f...\n", s->usrp->get_rx_gain(i));
+    LOG_I(HW,"  Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6);
+    LOG_I(HW,"  Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str());
+  }
+  
+  for (int i=0; i<openair0_cfg[0].tx_num_channels; i++) {
+    LOG_I(HW,"TX Channel %d\n",i);
+    LOG_I(HW,"  Actual TX sample rate: %fMSps...\n", s->usrp->get_tx_rate(i)/1e6);
+    LOG_I(HW,"  Actual TX frequency: %fGHz...\n", s->usrp->get_tx_freq(i)/1e9);
+    LOG_I(HW,"  Actual TX gain: %f...\n", s->usrp->get_tx_gain(i));
+    LOG_I(HW,"  Actual TX bandwidth: %fM...\n", s->usrp->get_tx_bandwidth(i)/1e6);
+    LOG_I(HW,"  Actual TX antenna: %s...\n", s->usrp->get_tx_antenna(i).c_str());
+    LOG_I(HW,"  Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps());
+  }
+  
+  LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs());
+  device->trx_write_func = trx_usrp_write;
+  device->trx_read_func  = trx_usrp_read;
+  s->sample_rate = openair0_cfg[0].sample_rate;
+  
+  // TODO:
+  // init tx_forward_nsamps based usrp_time_offset ex
+  if(is_equal(s->sample_rate, (double)30.72e6))
+    s->tx_forward_nsamps  = 176;
+  
+  if(is_equal(s->sample_rate, (double)15.36e6))
+    s->tx_forward_nsamps = 90;
+  
+  if(is_equal(s->sample_rate, (double)7.68e6))
+    s->tx_forward_nsamps = 50;
+  
+  
+  if (device->recplay_state != NULL) { // record mode
+    device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t));
+  
+    if (device->recplay_state->ms_sample == NULL) {
+      std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl;
+      exit(-1);
+    }
+  
+    memset(device->recplay_state->ms_sample, 0, openair0_cfg[0].recplay_conf->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF);
+  }
+  return 0;
 }
 /*@}*/
+}/* extern c */
\ No newline at end of file
diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
deleted file mode 100644
index ebf1d61eedf210463678bc6ede05a122eb366baf..0000000000000000000000000000000000000000
--- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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
- * the OAI Public License, Version 1.1  (the "License"); you may not use this file
- * 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
- */
-
-/** usrp_lib_config.c
- *
- * \author: HongliangXU : hong-liang-xu@agilent.com
- */
-
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/sysinfo.h>
-#include <sys/resource.h>
-#include "common/utils/LOG/log.h"
-#include "assertions.h"
-#include "common_lib.h"
-#include "usrp_lib.h"
-
-
-int read_usrpconfig(uint32_t *recplay_mode, recplay_state_t **recplay_state) {
-unsigned int    u_sf_record = 0;                       // record mode
-unsigned int    u_sf_replay = 0;                       // replay mode
-uint32_t enable_recplay;
-
-    paramdef_t usrp_params[] = USRP_DEVICE_PARAMS_DESC;
-    config_get(usrp_params,sizeof(usrp_params)/sizeof(paramdef_t),USRP_SECTION);
-    if (enable_recplay) {
-      *recplay_state = calloc(sizeof(recplay_state_t),1);      
-      paramdef_t usrp_recplay_params[]=USRP_RECPLAY_PARAMS_DESC ;
-      struct sysinfo systeminfo;
- 
-    // Use mmap for IQ files for systems with less than 6GB total RAM
-      sysinfo(&systeminfo);
-
-      if (systeminfo.totalram < 6144000000) {
-        (*recplay_state)->use_mmap = 0;
-      } else {
-        (*recplay_state)->use_mmap = 1;
-      }
-
-      memset((*recplay_state)->u_sf_filename, 0, 1024);
-      config_get(usrp_recplay_params,sizeof(usrp_recplay_params)/sizeof(paramdef_t),USRP_RECPLAY_SECTION);
-
-      if (strlen((*recplay_state)->u_sf_filename) == 0) {
-        (void) strcpy((
-        	*recplay_state)->u_sf_filename, DEF_SF_FILE);
-      }
-    } /* record player enabled */
-    if (u_sf_replay == 1) *recplay_mode = RECPLAY_REPLAYMODE;
-
-    if (u_sf_record == 1) *recplay_mode = RECPLAY_RECORDMODE;
-
-
-    return 0;
-  }
\ No newline at end of file
diff --git a/targets/ARCH/iqplayer/iqplayer_lib.c b/targets/ARCH/iqplayer/iqplayer_lib.c
new file mode 100644
index 0000000000000000000000000000000000000000..beb05de3fdbf9859f33ad549319bf4ad94def31e
--- /dev/null
+++ b/targets/ARCH/iqplayer/iqplayer_lib.c
@@ -0,0 +1,307 @@
+/*
+ * 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
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * 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
+ */
+
+/** iqplayer_lib.cpp
+ *
+ * \author:FrancoisTaburet: francois.taburet@nokia-bell-labs.com
+ */
+#define _LARGEFILE_SOURCE
+#define _FILE_OFFSET_BITS 64
+#include <string.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/resource.h>
+#include <errno.h>
+#include "common_lib.h"
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+
+
+
+
+
+
+static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) {
+  AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0),"iqfile doesn't seem to be compatible with oai (invalid id in header)\n");
+  device->type = iq_fh->devtype;
+  device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance;
+  device->openair0_cfg[0].tx_bw =  device->openair0_cfg[0].rx_bw = iq_fh->bw;
+  LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw);
+}
+
+
+/*! \brief Called to start the iqplayer device. Return 0 if OK, < 0 if error
+    @param device pointer to the device structure specific to the RF hardware target
+*/
+static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair0_cfg) {
+  recplay_state_t *s = device->recplay_state;
+  recplay_conf_t  *c = openair0_cfg->recplay_conf;
+
+  if (s->use_mmap) {
+    // use mmap
+    s->mmapfd = open(c->u_sf_filename, O_RDONLY );
+
+    if (s->mmapfd != 0) {
+      struct stat sb;
+      fstat(s->mmapfd, &sb);
+      s->mapsize=sb.st_size;
+      LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size );
+      void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) ;
+      s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) + sizeof(iqfile_header_t));
+
+      if (mptr != MAP_FAILED) {
+        parse_iqfile_header(device, (iqfile_header_t *)mptr);
+        s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t));
+        s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t)) / sizeof(iqrec_t));
+        int aligned = (((unsigned long)s->ms_sample & 31) == 0)? 1:0;
+        LOG_I(HW,"Loaded %u subframes.\n",s->nb_samples );
+
+        if (aligned == 0) {
+          LOG_E(HW, "mmap address is not 32 bytes aligned, exiting.\n" );
+          close(s->mmapfd);
+          exit(-1);
+        }
+      } else {
+        LOG_E(HW,"Cannot mmap file, exiting.\n");
+        close(s->mmapfd);
+        exit(-1);
+      }
+    } else {
+      LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename );
+      exit(-1);
+    }
+  } else {
+    s->iqfd = open(c->u_sf_filename, O_RDONLY);
+
+    if (s->iqfd != 0) {
+      struct stat sb;
+      iqfile_header_t fh;
+      size_t hs = read(s->iqfd,&fh,sizeof(fh));
+
+      if (hs == sizeof(fh)) {
+        parse_iqfile_header(device, &fh);
+        fstat(s->iqfd, &sb);
+        s->mapsize=sb.st_size;
+        s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t))/ sizeof(iqrec_t));
+        LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nb_samples, c->u_sf_filename,(uint64_t)sb.st_size);
+        // allocate buffer for 1 sample at a time
+        s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t));
+
+        if (s->ms_sample == NULL) {
+          LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" );
+          close(s->iqfd);
+          exit(-1);
+        }
+
+        memset(s->ms_sample, 0, sizeof(iqrec_t));
+
+        // point at beginning of iqs in file
+        if (lseek(s->iqfd,sizeof(iqfile_header_t), SEEK_SET) == 0) {
+          LOG_I(HW,"Initial seek at beginning of the file\n" );
+        } else {
+          LOG_I(HW,"Problem initial seek at beginning of the file\n");
+        }
+      } else {
+        LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename );
+        close(s->iqfd);
+        exit(-1);
+      }
+    } else {
+      LOG_E(HW,"Cannot open %s exiting.\n",c->u_sf_filename );
+      exit(-1);
+    }
+  }
+
+  return 0;
+}
+
+/*! \brief Terminate operation of the oai iq player
+ * \param device, the hardware used
+ */
+static void trx_iqplayer_end(openair0_device *device) {
+  if (device == NULL)
+    return;
+
+  if (device->recplay_state == NULL)
+    return;
+
+  if (device->recplay_state->use_mmap) {
+    if (device->recplay_state->ms_sample != MAP_FAILED) {
+      munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize);
+      device->recplay_state->ms_sample = NULL;
+    }
+
+    if (device->recplay_state->mmapfd != 0) {
+      close(device->recplay_state->mmapfd);
+      device->recplay_state->mmapfd = 0;
+    }
+  } else {
+    if (device->recplay_state->ms_sample != NULL) {
+      free(device->recplay_state->ms_sample);
+      device->recplay_state->ms_sample = NULL;
+    }
+
+    if (device->recplay_state->iqfd != 0) {
+      close(device->recplay_state->iqfd);
+      device->recplay_state->iqfd = 0;
+    }
+  }
+}
+/*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time,
+      @param device pointer to the device structure specific to the RF hardware target
+      @param timestamp The timestamp at which the first sample MUST be sent
+      @param buff Buffer which holds the samples
+      @param nsamps number of samples to be sent
+      @param antenna_id index of the antenna if the device has multiple antennas
+      @param flags flags must be set to TRUE if timestamp parameter needs to be applied
+*/
+static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int cc, int flags) {
+  struct timespec req;
+  req.tv_sec = 0;
+  req.tv_nsec = device->openair0_cfg->recplay_conf->u_sf_write_delay * 1000;
+  nanosleep(&req, NULL);
+  return nsamps;
+}
+
+/*! \brief Receive samples from iq file.
+ * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for
+ * the first channel. *ptimestamp is the time at which the first sample
+ * was received.
+ * \param device the hardware to use
+ * \param[out] ptimestamp the time at which the first sample was received.
+ * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps.
+ * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte.
+ * \param antenna_id Index of antenna for which to receive samples
+ * \returns the number of sample read
+*/
+static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) {
+  int samples_received=0;
+  static unsigned int    cur_samples;
+  static int64_t         wrap_count;
+  static int64_t  wrap_ts;
+  recplay_state_t *s = device->recplay_state;
+
+  if (cur_samples == s->nb_samples) {
+    cur_samples = 0;
+    wrap_count++;
+
+    if (wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) {
+      LOG_W(HW, "iqplayer device terminating subframes replay  after %u iteration\n",device->openair0_cfg->recplay_conf->u_sf_loops);
+      exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n");
+    }
+
+    wrap_ts = wrap_count * (s->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000));
+
+    if (!device->recplay_state->use_mmap) {
+      if (lseek(device->recplay_state->iqfd, 0, SEEK_SET) == 0) {
+        LOG_I(HW,"Seeking at the beginning of IQ file");
+      } else {
+        LOG_I(HW, "Problem seeking at the beginning of IQ file");
+      }
+    }
+  }
+
+  if (s->use_mmap) {
+    if (cur_samples < s->nb_samples) {
+      *ptimestamp = (s->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts;
+
+      if (cur_samples == 0) {
+        LOG_I(HW,"starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu\n", wrap_count,wrap_ts,*ptimestamp);
+      }
+
+      memcpy(buff[0], &s->ms_sample[cur_samples].samples[0], nsamps*4);
+      cur_samples++;
+    }
+  } else {
+    // read sample from file
+    if (read(s->iqfd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) {
+      LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*cur_samples );
+      close(s->iqfd);
+      free(s->ms_sample);
+      s->ms_sample = NULL;
+      s->iqfd = 0;
+      exit(-1);
+    }
+
+    if (cur_samples < s->nb_samples) {
+      static int64_t ts0 = 0;
+
+      if ((cur_samples == 0) && (wrap_count == 0)) {
+        ts0 = s->ms_sample->ts;
+      }
+
+      *ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts;
+
+      if (cur_samples == 0) {
+        LOG_I(HW, "starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu ",wrap_count,wrap_ts, *ptimestamp);
+      }
+
+      memcpy(buff[0], &s->ms_sample->samples[0], nsamps*4);
+      cur_samples++;
+      // Prepare for next read
+      off_t where = lseek(s->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET);
+
+      if (where < 0) {
+        LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno));
+        exit(-1);
+      }
+    }
+  }
+
+  struct timespec req;
+
+  req.tv_sec = 0;
+
+  req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000;
+
+  nanosleep(&req, NULL);
+
+  return nsamps;
+
+  return samples_received;
+}
+
+
+int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
+  device->openair0_cfg = openair0_cfg;
+  device->trx_start_func = NULL;
+  device->trx_get_stats_func = NULL;
+  device->trx_reset_stats_func = NULL;
+  device->trx_end_func   = trx_iqplayer_end;
+  device->trx_stop_func  = NULL;
+  device->trx_set_freq_func = NULL;
+  device->trx_set_gains_func   = NULL;
+  // Replay subframes from from file
+  //  openair0_cfg[0].rx_gain_calib_table = calib_table_b210_38;
+  //  bw_gain_adjust=1;
+  device->trx_write_func = trx_iqplayer_write;
+  device->trx_read_func  = trx_iqplayer_read;
+  iqplayer_loadfile(device, openair0_cfg);
+  LOG_UI(HW,"iqplayer device initialized, replay %s  for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops);
+  return 0;
+}
+
+/*@}*/
diff --git a/targets/COMMON/create_nr_tasks.h b/targets/COMMON/create_nr_tasks.h
index 7f5961f5aef5cdd0a3653ad60f5615aeec5686b5..ca259a2b34a6cce96639ffa1ef2762511d73c3eb 100644
--- a/targets/COMMON/create_nr_tasks.h
+++ b/targets/COMMON/create_nr_tasks.h
@@ -22,12 +22,10 @@
 #ifndef CREATE_NR_TASKS_H_
 #define CREATE_NR_TASKS_H_
 
-#if defined(ENABLE_ITTI)
 /* External declaration of L2L1 task that depend on the target */
 extern void *l2l1_task(void *arg);
 
 int create_gNB_tasks(uint32_t gnb_nb);
 
-#endif
 
 #endif /* CREATE_TASKS_H_ */
diff --git a/targets/COMMON/create_tasks.h b/targets/COMMON/create_tasks.h
index 339f4aaa8f5fdaa1d0a8c2839afda9586e9f2053..843897cefb4a73b0f52fc74e7b2fc80ddeb0790d 100644
--- a/targets/COMMON/create_tasks.h
+++ b/targets/COMMON/create_tasks.h
@@ -22,13 +22,11 @@
 #ifndef CREATE_TASKS_H_
 #define CREATE_TASKS_H_
 
-#if defined(ENABLE_ITTI)
 /* External declaration of L2L1 task that depend on the target */
 extern void *l2l1_task(void *arg);
 
 int create_tasks(uint32_t enb_nb);
 int create_tasks_ue(uint32_t ue_nb);
 int create_tasks_mbms(uint32_t enb_nb);
-#endif
 
 #endif /* CREATE_TASKS_H_ */
diff --git a/targets/COMMON/create_tasks_mbms.h b/targets/COMMON/create_tasks_mbms.h
index 339f4aaa8f5fdaa1d0a8c2839afda9586e9f2053..843897cefb4a73b0f52fc74e7b2fc80ddeb0790d 100644
--- a/targets/COMMON/create_tasks_mbms.h
+++ b/targets/COMMON/create_tasks_mbms.h
@@ -22,13 +22,11 @@
 #ifndef CREATE_TASKS_H_
 #define CREATE_TASKS_H_
 
-#if defined(ENABLE_ITTI)
 /* External declaration of L2L1 task that depend on the target */
 extern void *l2l1_task(void *arg);
 
 int create_tasks(uint32_t enb_nb);
 int create_tasks_ue(uint32_t ue_nb);
 int create_tasks_mbms(uint32_t enb_nb);
-#endif
 
 #endif /* CREATE_TASKS_H_ */
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index eccece02caac18d2d59db9c5836a5a3fc7c581dd..c08ab2a77ba33dfe83452759a48925db40a16e4d 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -265,7 +265,7 @@ void exit_function(const char *file, const char *function, const int line, const
 
 static void get_options(void) {
   CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
-  get_common_options();
+  get_common_options(SOFTMODEM_ENB_BIT );
   CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
 
   if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index b468ff12d4ab8b1ea72a80f3e3c9fa3736bf2234..d0014b5e8a61fe0d4a81c7467b515c1e2bbb4c6f 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -79,10 +79,7 @@
   #include "UTIL/OTG/otg_vars.h"
 #endif
 
-#if defined(ENABLE_ITTI)
-  #include "create_tasks.h"
-#endif
-
+#include "create_tasks.h"
 #include "system.h"
 
 
@@ -300,7 +297,7 @@ static void get_options(void) {
   CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
   /* unknown parameters on command line will be checked in main
      after all init have been performed                         */
-  get_common_options();
+  get_common_options(SOFTMODEM_4GUE_BIT );
   get_uethreads_params();
   paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
   paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
@@ -780,19 +777,11 @@ int main( int argc, char **argv ) {
   // wait for end of program
   printf("TYPE <CTRL-C> TO TERMINATE\n");
   //getchar();
-#if defined(ENABLE_ITTI)
   printf("Entering ITTI signals handler\n");
   itti_wait_tasks_end();
   printf("Returned from ITTI signal handler\n");
   oai_exit=1;
   printf("oai_exit=%d\n",oai_exit);
-#else
-
-  while (oai_exit==0)
-    rt_sleep_ns(100000000ULL);
-
-  printf("Terminating application - oai_exit=%d\n",oai_exit);
-#endif
 
   // stop threads
   if(IS_SOFTMODEM_DOFORMS)