diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 61d7b2449614639acc01db7bd4180f0835ac498a..87afa0450c4c3138e97bc31388b049332a75f88d 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1151,6 +1151,7 @@ set(PHY_SRC_RU
   ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c
   ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c
   ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c
+  ${OPENAIR1_DIR}/PHY/INIT/nr_init_ru.c
   ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c
 
   )
@@ -1196,12 +1197,10 @@ set(PHY_SRC_UE
   ${RRC_FULL_DIR}/asn1_constants.h
   # actual source
   ${OPENAIR1_DIR}/PHY/INIT/nr_init.c
-  ${OPENAIR1_DIR}/PHY/INIT/nr_init_ru.c
   ${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
   ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pss.c
   ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sss.c
   ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_pbch.c
-  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
   ${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
   ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
   ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
@@ -1221,10 +1220,7 @@ set(PHY_SRC_UE
   # depend on code generation from asn1c
   ${RRC_FULL_DIR}/asn1_constants.h
   # actual source
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
-  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
-  #${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
-  #${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
+  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
   ${OPENAIR1_DIR}/PHY/INIT/nr_parms.c
   ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
   ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
@@ -2132,7 +2128,7 @@ add_executable(nr-softmodem
 
 target_link_libraries (nr-softmodem
   -Wl,--start-group
-  UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
+  UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
   ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB}
   RRC_LIB S1AP_LIB S1AP_ENB L2
   NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
diff --git a/common/ran_context.h b/common/ran_context.h
index 66ce5299dd43a74c1b4c9bfc2c5d3fb79308cd6d..1496791099db7e979c4c750b4e6187e7d2fd44b5 100644
--- a/common/ran_context.h
+++ b/common/ran_context.h
@@ -38,7 +38,6 @@
 #include "PHY/defs_eNB.h"
 #include "PHY/types.h"
 #include "PHY/impl_defs_top.h"
-#include "PHY/impl_defs_lte.h"
 #include "RRC/LTE/rrc_defs.h"
 #include "flexran_agent_defs.h"
 
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index 8c270fe7ba6960cb0a608dfc1877f66b858af66d..688e4d3fa89058d8b1fc37ed0d52ba54e58d18b9 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -33,7 +33,7 @@
 
 int phy_init_RU(RU_t *ru) {
 
-  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
   int i,j;
   int p;
   int re;
@@ -155,6 +155,8 @@ void phy_free_RU(RU_t *ru)
 
   LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
 
+  free_and_zero(ru->frame_parms);
+
   if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
     for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
     for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c
index 0830058a8fb4bda41bb692a4e29b9aa460fb7104..9394e29a9041c755eaaf1424ee50f0c7da961a4c 100644
--- a/openair1/PHY/INIT/lte_param_init.c
+++ b/openair1/PHY/INIT/lte_param_init.c
@@ -117,7 +117,7 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
   UE->frame_parms = *frame_parms;
   UE->frame_parms.nb_antennas_rx=N_rx_ue;
   //  eNB->frame_parms = *frame_parms;
-  ru->frame_parms = *frame_parms;
+  ru->frame_parms = frame_parms;
   ru->nb_tx = N_tx_phy;
   ru->nb_rx = N_rx_ru;
   ru->if_south = LOCAL_RF;
diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c
index 85dcd51921ee261b0b69122235c1d44d6c53b99b..920939654fef0af26d162e045aade91aed61dd26 100644
--- a/openair1/PHY/INIT/nr_init.c
+++ b/openair1/PHY/INIT/nr_init.c
@@ -19,14 +19,14 @@
  *      contact@openairinterface.org
  */
 
-#include "PHY/defs.h"
-#include "SCHED/defs.h"
-#include "PHY/extern.h"
-#include "SIMULATION/TOOLS/defs.h"
+#include "PHY/defs_gNB.h"
+#include "SCHED/sched_eNB.h"
+#include "PHY/phy_extern.h"
+#include "PHY/INIT/phy_init.h"
 #include "RadioResourceConfigCommonSIB.h"
 #include "RadioResourceConfigDedicated.h"
 #include "TDD-Config.h"
-#include "LAYER2/MAC/extern.h"
+#include "LAYER2/MAC/mac_extern.h"
 #include "MBSFN-SubframeConfigList.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "assertions.h"
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index fdad8e94ab032783693da7ac1bb2fe351b6ba269..d11624557d49e26ac024ae9495bb23d2d735ede0 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -19,14 +19,13 @@
  *      contact@openairinterface.org
  */
 
-#include "defs.h"
-#include "SCHED/defs.h"
-#include "PHY/extern.h"
-#include "SIMULATION/TOOLS/defs.h"
+#include "phy_init.h"
+#include "SCHED/sched_common.h"
+#include "PHY/phy_extern.h"
+#include "SIMULATION/TOOLS/sim.h"
 #include "RadioResourceConfigCommonSIB.h"
 #include "RadioResourceConfigDedicated.h"
 #include "TDD-Config.h"
-#include "LAYER2/MAC/extern.h"
 #include "MBSFN-SubframeConfigList.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "assertions.h"
@@ -34,7 +33,7 @@
 
 int nr_phy_init_RU(RU_t *ru) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   int i,j;
   int p;
   int re;
@@ -150,6 +149,9 @@ void nr_phy_free_RU(RU_t *ru)
 
   LOG_I(PHY, "Feeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
 
+  free_and_zero(ru->nr_frame_parms);
+  free_and_zero(ru->frame_parms);
+
   if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
     for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdata[i]);
     for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata[i]);
diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index c4463a13890db781ed640b7d44f23263e803085e..2a6bb66700fc78a95b344127d867ebb28d3dbe4d 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -19,7 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#include "../defs.h"
+#include "phy_init.h"
 #include "log.h"
 
 /// Subcarrier spacings in Hz indexed by numerology index
diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h
index 097958f842de9e90692ad55e7da3fa1667cc1500..2a6196aa293977aeac35ee03a21871123430df51 100644
--- a/openair1/PHY/INIT/phy_init.h
+++ b/openair1/PHY/INIT/phy_init.h
@@ -24,6 +24,8 @@
 
 #include "PHY/defs_eNB.h"
 #include "PHY/defs_UE.h"
+#include "PHY/defs_gNB.h"
+#include "PHY/defs_nr_UE.h"
 
 #include "SystemInformationBlockType2.h"
 //#include "RadioResourceConfigCommonSIB.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
index cfe4cf85588d882492ba0a81ba3b06e5b1faafd4..7b6e282b0672116c68deda8ca5d8f5aff96636a0 100644
--- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c
@@ -43,7 +43,7 @@ const uint8_t lin2alaw_if4p5[65536] = {213, 213, 213, 213, 213, 213, 213, 213, 2
 
 void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
 
-  LTE_DL_FRAME_PARMS *fp     = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp     = ru->frame_parms;
   int32_t **txdataF          = ru->common.txdataF_BF;
   int32_t **rxdataF          = ru->common.rxdataF;
   int16_t **prach_rxsigF     = ru->prach_rxsigF;  
@@ -258,7 +258,7 @@ void send_IF4p5(RU_t *ru, int frame, int subframe, uint16_t packet_type) {
 }
 
 void recv_IF4p5(RU_t *ru, int *frame, int *subframe, uint16_t *packet_type, uint32_t *symbol_number) {
-  LTE_DL_FRAME_PARMS *fp     = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp     = ru->frame_parms;
   int32_t **txdataF          = ru->common.txdataF_BF;
   int32_t **rxdataF          = ru->common.rxdataF;
   int16_t **prach_rxsigF     = ru->prach_rxsigF;  
diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
index 06b4a4ad806fd746323c678dc8a568379f73c82a..2b596e48a3427dfc5f1d17c4c09751be871f0dd3 100644
--- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c
@@ -53,7 +53,7 @@ int start_flag = 1;
 int offset_cnt = 1;
 void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t *seqno, uint16_t packet_type) {      
   
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
   int32_t *txp[fp->nb_antennas_tx], *rxp[fp->nb_antennas_rx]; 
   int32_t *tx_buffer=NULL;
 #ifdef DEBUG_DL_MOBIPASS
@@ -202,7 +202,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
       header->ack = 0;
       header->word0 = 0;
 
-      txp[0] = (void*)&ru->common.txdata[0][subframe*ru->frame_parms.samples_per_tti];
+      txp[0] = (void*)&ru->common.txdata[0][subframe*ru->frame_parms->samples_per_tti];
       txp128 = (__m128i *) txp[0];
 
       for (packet_id=0; packet_id<fp->samples_per_tti/db_fulllength; packet_id++) {
@@ -247,7 +247,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
       header->ack = 0;
       header->word0 = 0;  
       
-      txp[0] = (void*)&ru->common.txdata[0][subframe*ru->frame_parms.samples_per_tti];
+      txp[0] = (void*)&ru->common.txdata[0][subframe*ru->frame_parms->samples_per_tti];
       txp128 = (__m128i *) txp[0];
                 
       for (packet_id=0; packet_id<fp->samples_per_tti/db_fulllength; packet_id++) {
@@ -310,7 +310,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int subframe, uint8_t
 
 void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16_t packet_type) {
 
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
   int32_t *txp[fp->nb_antennas_tx], *rxp[fp->nb_antennas_rx]; 
 
   uint16_t packet_id=0, i=0, element_id=0;
@@ -455,7 +455,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
       rx_buffer = (int32_t *)_rx_buffer;
       data_block_head = (__m128i *)((uint8_t *)rx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t);
 
-      rxp[0] = (void*)&ru->common.rxdata[0][subframe*ru->frame_parms.samples_per_tti];
+      rxp[0] = (void*)&ru->common.rxdata[0][subframe*ru->frame_parms->samples_per_tti];
       rxp128 = (__m128i *) (rxp[0]);
 
       packet_id=0;
@@ -470,7 +470,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
                                           );
 
           //store rxdata and increase packet_id
-          rxp[0] = (void*)&ru->common.rxdata[0][(subframe*ru->frame_parms.samples_per_tti)+packet_id*db_fulllength];
+          rxp[0] = (void*)&ru->common.rxdata[0][(subframe*ru->frame_parms->samples_per_tti)+packet_id*db_fulllength];
           rxp128 = (__m128i *) (rxp[0]);
           for (i=0; i<db_fulllength>>2; i+=2) {
             r0 = _mm_loadu_si128(data_block++);
@@ -501,7 +501,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
       IF5_mobipass_header_t *header = (IF5_mobipass_header_t *)((uint8_t *)rx_buffer + MAC_HEADER_SIZE_BYTES);
       data_block_head = (__m128i *)((uint8_t *)rx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t);
    
-      rxp[0] = (void*)&ru->common.rxdata[0][subframe*ru->frame_parms.samples_per_tti];
+      rxp[0] = (void*)&ru->common.rxdata[0][subframe*ru->frame_parms->samples_per_tti];
       rxp128 = (__m128i *) (rxp[0]);
    
       RU_proc_t *proc = &ru->proc;
@@ -581,7 +581,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16
           start_flag = 0;
 
           //store rxdata and increase packet_id
-          rxp[0] = (void*)&ru->common.rxdata[0][(subframe*ru->frame_parms.samples_per_tti)+packet_id*db_fulllength];
+          rxp[0] = (void*)&ru->common.rxdata[0][(subframe*ru->frame_parms->samples_per_tti)+packet_id*db_fulllength];
           rxp128 = (__m128i *) (rxp[0]);
           for (i=0; i<db_fulllength>>2; i+=2) {
             r0 = _mm_loadu_si128(data_block++);
diff --git a/openair1/PHY/LTE_TRANSPORT/power_control.c b/openair1/PHY/LTE_TRANSPORT/power_control.c
index 32273015ce9417bd80cb8f408ffb662f043afcbc..64b3ad3ef6264b08e185ecd1223593dcaa987e5d 100644
--- a/openair1/PHY/LTE_TRANSPORT/power_control.c
+++ b/openair1/PHY/LTE_TRANSPORT/power_control.c
@@ -21,7 +21,6 @@
 
 #include "PHY/defs_eNB.h"
 #include "PHY/defs_UE.h"
-#include "PHY/impl_defs_lte.h"
 
 //#define DEBUG_PC 0
 /*
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c
index 7871239b6d75fd11da8fa93b4efa1a1d0b021009..f782129c81e92d4afc383f9382ec76e4d962fb65 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach.c
@@ -42,635 +42,6 @@
 //#define PRACH_WRITE_OUTPUT_DEBUG 1
 
 
-<<<<<<< HEAD
-      if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
-        n_ra_prb = 6*f_ra;
-      } else {
-        n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1);
-      }
-    }
-  }
-  else { //FDD
-    n_ra_prb = n_ra_prboffset;
-  }
-  return(n_ra_prb);
-}
-
-int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe)
-{
-  //  uint8_t prach_ConfigIndex  = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
-  uint8_t tdd_config         = frame_parms->tdd_config;
-  uint8_t t0_ra;
-  uint8_t t1_ra;
-  uint8_t t2_ra;
-
-  int prach_mask = 0;
-
-  if (frame_parms->frame_type == FDD) { //FDD
-    //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41)
-    if ((((frame&1) == 1) && (subframe < 9)) ||
-        (((frame&1) == 0) && (subframe == 9)))  // This is an odd frame, ignore even-only PRACH frames
-      if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50
-          ((prach_ConfigIndex&0x1f)==18) || // 18,50
-          ((prach_ConfigIndex&0xf)==15))   // 15,47
-        return(0);
-
-    switch (prach_ConfigIndex&0x1f) {
-    case 0:
-    case 3:
-      if (subframe==1) prach_mask = 1;
-      break;
-
-    case 1:
-    case 4:
-      if (subframe==4) prach_mask = 1;
-      break;
-
-    case 2:
-    case 5:
-      if (subframe==7) prach_mask = 1;
-      break;
-
-    case 6:
-      if ((subframe==1) || (subframe==6)) prach_mask=1;
-      break;
-
-    case 7:
-      if ((subframe==2) || (subframe==7)) prach_mask=1;
-      break;
-
-    case 8:
-      if ((subframe==3) || (subframe==8)) prach_mask=1;
-      break;
-
-    case 9:
-      if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1;
-      break;
-
-    case 10:
-      if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1;
-      break;
-
-    case 11:
-      if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1;
-      break;
-
-    case 12:
-      if ((subframe&1)==0) prach_mask=1;
-      break;
-
-    case 13:
-      if ((subframe&1)==1) prach_mask=1;
-      break;
-
-    case 14:
-      prach_mask=1;
-      break;
-
-    case 15:
-      if (subframe==9) prach_mask=1;
-      break;
-    }
-  } else { // TDD
-
-    AssertFatal(prach_ConfigIndex<64,
-		"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
-    AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0,
-		"Illegal prach_ConfigIndex %d for ",prach_ConfigIndex);
-
-    t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra;
-    t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
-    t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra;
-#ifdef PRACH_DEBUG
-    LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n",
-          prach_ConfigIndex,
-          subframe,
-          t0_ra,t1_ra,t2_ra);
-#endif
-
-    if ((((t0_ra == 1) && ((frame &1)==0))||  // frame is even and PRACH is in even frames
-         ((t0_ra == 2) && ((frame &1)==1))||  // frame is odd and PRACH is in odd frames
-         (t0_ra == 0)) &&                                // PRACH is in all frames
-        (((subframe<5)&&(t1_ra==0)) ||                   // PRACH is in 1st half-frame
-         (((subframe>4)&&(t1_ra==1))))) {                // PRACH is in 2nd half-frame
-      if ((prach_ConfigIndex<48) &&                          // PRACH only in normal UL subframe
-	  (((subframe%5)-2)==t2_ra)) prach_mask=1;
-      else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1;      // PRACH can be in UpPTS
-    }
-  }
-
-  return(prach_mask);
-}
-
-int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) {
-  
-  uint8_t prach_ConfigIndex  = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
-  int prach_mask             = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
-
-#ifdef Rel14
-  int i;
-
-  for (i=0;i<4;i++) {
-    if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1) 
-      prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1));
-  }
-#endif
-  return(prach_mask);
-}
-
-int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf )
-{
-
-  lte_frame_type_t frame_type         = ue->frame_parms.frame_type;
-  //uint8_t tdd_config         = ue->frame_parms.tdd_config;
-  uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex;
-  uint8_t prach_ConfigIndex  = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
-  uint8_t Ncs_config         = ue->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
-  uint8_t restricted_set     = ue->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag;
-  //uint8_t n_ra_prboffset     = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
-  uint8_t preamble_index     = ue->prach_resources[eNB_id]->ra_PreambleIndex;
-  uint8_t tdd_mapindex       = ue->prach_resources[eNB_id]->ra_TDD_map_index;
-  int16_t *prachF           = ue->prach_vars[eNB_id]->prachF;
-  static int16_t prach_tmp[45600*2] __attribute__((aligned(32)));
-  int16_t *prach            = prach_tmp;
-  int16_t *prach2;
-  int16_t amp               = ue->prach_vars[eNB_id]->amp;
-  int16_t Ncp;
-  uint8_t n_ra_prb;
-  uint16_t NCS;
-  uint16_t *prach_root_sequence_map;
-  uint16_t preamble_offset,preamble_shift;
-  uint16_t preamble_index0,n_shift_ra,n_shift_ra_bar;
-  uint16_t d_start,numshift;
-
-  uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type);
-  //uint8_t Nsp=2;
-  //uint8_t f_ra,t1_ra;
-  uint16_t N_ZC = (prach_fmt<4)?839:139;
-  uint8_t not_found;
-  int k;
-  int16_t *Xu;
-  uint16_t u;
-  int32_t Xu_re,Xu_im;
-  uint16_t offset,offset2;
-  int prach_start;
-  int i, prach_len;
-  uint16_t first_nonzero_root_idx=0;
-
-#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_ADRV9371_ZC706)
-  prach_start =  (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset);
-#ifdef PRACH_DEBUG
-    LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
-        prach_start,
-        ue->rx_offset,
-        ue->hw_timing_advance,
-        ue->N_TA_offset);
-#endif
-
-  if (prach_start<0)
-    prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
-
-  if (prach_start>=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
-    prach_start-=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
-
-#else //normal case (simulation)
-  prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
-  LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
-    prach_start,
-    ue->rx_offset,
-    ue->hw_timing_advance,
-    ue->N_TA_offset);
-  
-#endif
-
-
-  // First compute physical root sequence
-  if (restricted_set == 0) {
-    AssertFatal(Ncs_config <= 15,
-		"[PHY] FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", Ncs_config );
-    NCS = NCS_unrestricted[Ncs_config];
-  } else {
-    AssertFatal(Ncs_config <= 14,
-		"[PHY] FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", Ncs_config );
-    NCS = NCS_restricted[Ncs_config];
-  }
-
-  n_ra_prb = get_prach_prb_offset(&(ue->frame_parms),
-				  ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
-				  ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset,
-				  tdd_mapindex, Nf);
-  prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
-
-  /*
-  // this code is not part of get_prach_prb_offset
-  if (frame_type == TDD) { // TDD
-
-    if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) {
-      LOG_E( PHY, "[PHY][UE %"PRIu8"] Illegal prach_ConfigIndex %"PRIu8" for ", ue->Mod_id, prach_ConfigIndex );
-    }
-
-    // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211)
-    f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra;
-
-    if (prach_fmt < 4) {
-      if ((f_ra&1) == 0) {
-        n_ra_prb = n_ra_prboffset + 6*(f_ra>>1);
-      } else {
-        n_ra_prb = ue->frame_parms.N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1);
-      }
-    } else {
-      if ((tdd_config >2) && (tdd_config<6))
-        Nsp = 2;
-
-      t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra;
-
-      if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) {
-        n_ra_prb = 6*f_ra;
-      } else {
-        n_ra_prb = ue->frame_parms.N_RB_UL - 6*(f_ra+1);
-      }
-    }
-  }
-  */
-
-  // This is the relative offset (for unrestricted case) in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
-  preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
-
-  if (restricted_set == 0) {
-    // This is the \nu corresponding to the preamble index
-    preamble_shift  = (NCS==0)? 0 : (preamble_index % (N_ZC/NCS));
-    preamble_shift *= NCS;
-  } else { // This is the high-speed case
-
-#ifdef PRACH_DEBUG
-    LOG_I(PHY,"[UE %d] High-speed mode, NCS_config %d\n",ue->Mod_id,Ncs_config);
-#endif
-
-    not_found = 1;
-    preamble_index0 = preamble_index;
-    // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this
-    // preamble index and find the corresponding cyclic shift
-    preamble_offset = 0; // relative rootSequenceIndex;
-
-    while (not_found == 1) {
-      // current root depending on rootSequenceIndex and preamble_offset
-      int index = (rootSequenceIndex + preamble_offset) % N_ZC;
-
-      if (prach_fmt<4) {
-        // prach_root_sequence_map points to prach_root_sequence_map0_3
-        DevAssert( index < sizeof(prach_root_sequence_map0_3) / sizeof(prach_root_sequence_map0_3[0]) );
-      } else {
-        // prach_root_sequence_map points to prach_root_sequence_map4
-        DevAssert( index < sizeof(prach_root_sequence_map4) / sizeof(prach_root_sequence_map4[0]) );
-      }
-
-      u = prach_root_sequence_map[index];
-
-      uint16_t n_group_ra = 0;
-
-      if ( (du[u]<(N_ZC/3)) && (du[u]>=NCS) ) {
-        n_shift_ra     = du[u]/NCS;
-        d_start        = (du[u]<<1) + (n_shift_ra * NCS);
-        n_group_ra     = N_ZC/d_start;
-        n_shift_ra_bar = max(0,(N_ZC-(du[u]<<1)-(n_group_ra*d_start))/N_ZC);
-      } else if  ( (du[u]>=(N_ZC/3)) && (du[u]<=((N_ZC - NCS)>>1)) ) {
-        n_shift_ra     = (N_ZC - (du[u]<<1))/NCS;
-        d_start        = N_ZC - (du[u]<<1) + (n_shift_ra * NCS);
-        n_group_ra     = du[u]/d_start;
-        n_shift_ra_bar = min(n_shift_ra,max(0,(du[u]- (n_group_ra*d_start))/NCS));
-      } else {
-        n_shift_ra     = 0;
-        n_shift_ra_bar = 0;
-      }
-
-      // This is the number of cyclic shifts for the current root u
-      numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar;
-
-      if (numshift>0 && preamble_index0==preamble_index)
-        first_nonzero_root_idx = preamble_offset;
-
-      if (preamble_index0 < numshift) {
-        not_found      = 0;
-        preamble_shift = (d_start * (preamble_index0/n_shift_ra)) + ((preamble_index0%n_shift_ra)*NCS);
-
-      } else { // skip to next rootSequenceIndex and recompute parameters
-        preamble_offset++;
-        preamble_index0 -= numshift;
-      }
-    }
-  }
-
-  // now generate PRACH signal
-#ifdef PRACH_DEBUG
-
-  if (NCS>0)
-    LOG_I(PHY,"Generate PRACH for RootSeqIndex %d, Preamble Index %d, NCS %d (NCS_config %d, N_ZC/NCS %d) n_ra_prb %d: Preamble_offset %d, Preamble_shift %d\n",
-          rootSequenceIndex,preamble_index,NCS,Ncs_config,N_ZC/NCS,n_ra_prb,
-          preamble_offset,preamble_shift);
-
-#endif
-
-  //  nsymb = (frame_parms->Ncp==0) ? 14:12;
-  //  subframe_offset = (unsigned int)frame_parms->ofdm_symbol_size*subframe*nsymb;
-
-  k = (12*n_ra_prb) - 6*ue->frame_parms.N_RB_UL;
-
-  if (k<0)
-    k+=ue->frame_parms.ofdm_symbol_size;
-
-  k*=12;
-  k+=13;
-
-  Xu = (int16_t*)ue->X_u[preamble_offset-first_nonzero_root_idx];
-
-  /*
-    k+=(12*ue->frame_parms.first_carrier_offset);
-    if (k>(12*ue->frame_parms.ofdm_symbol_size))
-    k-=(12*ue->frame_parms.ofdm_symbol_size);
-  */
-  k*=2;
-
-  switch (ue->frame_parms.N_RB_UL) {
-  case 6:
-    memset((void*)prachF,0,4*1536);
-    break;
-
-  case 15:
-    memset((void*)prachF,0,4*3072);
-    break;
-
-  case 25:
-    memset((void*)prachF,0,4*6144);
-    break;
-
-  case 50:
-    memset((void*)prachF,0,4*12288);
-    break;
-
-  case 75:
-    memset((void*)prachF,0,4*18432);
-    break;
-
-  case 100:
-    if (ue->frame_parms.threequarter_fs == 0)
-      memset((void*)prachF,0,4*24576);
-    else
-      memset((void*)prachF,0,4*18432);
-    break;
-  }
-
-  for (offset=0,offset2=0; offset<N_ZC; offset++,offset2+=preamble_shift) {
-
-    if (offset2 >= N_ZC)
-      offset2 -= N_ZC;
-
-    Xu_re = (((int32_t)Xu[offset<<1]*amp)>>15);
-    Xu_im = (((int32_t)Xu[1+(offset<<1)]*amp)>>15);
-    prachF[k++]= ((Xu_re*ru[offset2<<1]) - (Xu_im*ru[1+(offset2<<1)]))>>15;
-    prachF[k++]= ((Xu_im*ru[offset2<<1]) + (Xu_re*ru[1+(offset2<<1)]))>>15;
-
-    if (k==(12*2*ue->frame_parms.ofdm_symbol_size))
-      k=0;
-  }
-
-  switch (prach_fmt) {
-  case 0:
-    Ncp = 3168;
-    break;
-
-  case 1:
-  case 3:
-    Ncp = 21024;
-    break;
-
-  case 2:
-    Ncp = 6240;
-    break;
-
-  case 4:
-    Ncp = 448;
-    break;
-
-  default:
-    Ncp = 3168;
-    break;
-  }
-
-  switch (ue->frame_parms.N_RB_UL) {
-  case 6:
-    Ncp>>=4;
-    prach+=4; // makes prach2 aligned to 128-bit
-    break;
-
-  case 15:
-    Ncp>>=3;
-    break;
-
-  case 25:
-    Ncp>>=2;
-    break;
-
-  case 50:
-    Ncp>>=1;
-    break;
-
-  case 75:
-    Ncp=(Ncp*3)>>2;
-    break;
-  }
-
-  if (ue->frame_parms.threequarter_fs == 1)
-    Ncp=(Ncp*3)>>2;
-
-  prach2 = prach+(Ncp<<1);
-
-  // do IDFT
-  switch (ue->frame_parms.N_RB_UL) {
-  case 6:
-    if (prach_fmt == 4) {
-      idft256(prachF,prach2,1);
-      memmove( prach, prach+512, Ncp<<2 );
-      prach_len = 256+Ncp;
-    } else {
-      idft1536(prachF,prach2,1);
-      memmove( prach, prach+3072, Ncp<<2 );
-      prach_len = 1536+Ncp;
-
-      if (prach_fmt>1) {
-        memmove( prach2+3072, prach2, 6144 );
-        prach_len = 2*1536+Ncp;
-      }
-    }
-
-    break;
-
-  case 15:
-    if (prach_fmt == 4) {
-      idft512(prachF,prach2,1);
-      //TODO: account for repeated format in dft output
-      memmove( prach, prach+1024, Ncp<<2 );
-      prach_len = 512+Ncp;
-    } else {
-      idft3072(prachF,prach2);
-      memmove( prach, prach+6144, Ncp<<2 );
-      prach_len = 3072+Ncp;
-
-      if (prach_fmt>1) {
-        memmove( prach2+6144, prach2, 12288 );
-        prach_len = 2*3072+Ncp;
-      }
-    }
-
-    break;
-
-  case 25:
-  default:
-    if (prach_fmt == 4) {
-      idft1024(prachF,prach2,1);
-      memmove( prach, prach+2048, Ncp<<2 );
-      prach_len = 1024+Ncp;
-    } else {
-      idft6144(prachF,prach2);
-      /*for (i=0;i<6144*2;i++)
-      prach2[i]<<=1;*/
-      memmove( prach, prach+12288, Ncp<<2 );
-      prach_len = 6144+Ncp;
-
-      if (prach_fmt>1) {
-        memmove( prach2+12288, prach2, 24576 );
-        prach_len = 2*6144+Ncp;
-      }
-    }
-
-    break;
-
-  case 50:
-    if (prach_fmt == 4) {
-      idft2048(prachF,prach2,1);
-      memmove( prach, prach+4096, Ncp<<2 );
-      prach_len = 2048+Ncp;
-    } else {
-      idft12288(prachF,prach2);
-      memmove( prach, prach+24576, Ncp<<2 );
-      prach_len = 12288+Ncp;
-
-      if (prach_fmt>1) {
-        memmove( prach2+24576, prach2, 49152 );
-        prach_len = 2*12288+Ncp;
-      }
-    }
-
-    break;
-
-  case 75:
-    if (prach_fmt == 4) {
-      idft3072(prachF,prach2);
-      //TODO: account for repeated format in dft output
-      memmove( prach, prach+6144, Ncp<<2 );
-      prach_len = 3072+Ncp;
-    } else {
-      idft18432(prachF,prach2);
-      memmove( prach, prach+36864, Ncp<<2 );
-      prach_len = 18432+Ncp;
-
-      if (prach_fmt>1) {
-        memmove( prach2+36834, prach2, 73728 );
-        prach_len = 2*18432+Ncp;
-      }
-    }
-
-    break;
-
-  case 100:
-    if (ue->frame_parms.threequarter_fs == 0) { 
-      if (prach_fmt == 4) {
-	idft4096(prachF,prach2,1);
-	memmove( prach, prach+8192, Ncp<<2 );
-	prach_len = 4096+Ncp;
-      } else {
-	idft24576(prachF,prach2);
-	memmove( prach, prach+49152, Ncp<<2 );
-	prach_len = 24576+Ncp;
-	
-	if (prach_fmt>1) {
-	  memmove( prach2+49152, prach2, 98304 );
-	  prach_len = 2* 24576+Ncp;
-	}
-      }
-    }
-    else {
-      if (prach_fmt == 4) {
-	idft3072(prachF,prach2);
-	//TODO: account for repeated format in dft output
-	memmove( prach, prach+6144, Ncp<<2 );
-	prach_len = 3072+Ncp;
-      } else {
-	idft18432(prachF,prach2);
-	memmove( prach, prach+36864, Ncp<<2 );
-	prach_len = 18432+Ncp;
-	printf("Generated prach for 100 PRB, 3/4 sampling\n");
-	if (prach_fmt>1) {
-	  memmove( prach2+36834, prach2, 73728 );
-	  prach_len = 2*18432+Ncp;
-	}
-      } 
-    }
-
-    break;
-  }
-
-  //LOG_I(PHY,"prach_len=%d\n",prach_len);
-
-  AssertFatal(prach_fmt<4,
-	      "prach_fmt4 not fully implemented" );
-#if defined(EXMIMO) || defined(OAI_USRP)  || defined(OAI_ADRV9371_ZC706)
-  int j;
-  int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*ue->frame_parms.samples_per_tti;
-  LOG_I( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
-  
-  for (i=prach_start,j=0; i<min(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME,prach_start+prach_len); i++,j++) {
-    ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
-    ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
-  }
-  
-  for (i=0; i<overflow; i++,j++) {
-    ((int16_t*)ue->common_vars.txdata[0])[2*i] = prach[2*j]<<4;
-    ((int16_t*)ue->common_vars.txdata[0])[2*i+1] = prach[2*j+1]<<4;
-  }
-#if defined(EXMIMO)
-  // handle switch before 1st TX subframe, guarantee that the slot prior to transmission is switch on
-  for (k=prach_start - (ue->frame_parms.samples_per_tti>>1) ; k<prach_start ; k++) {
-    if (k<0)
-      ue->common_vars.txdata[0][k+ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
-    else if (k>(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME))
-      ue->common_vars.txdata[0][k-ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] &= 0xFFFEFFFE;
-    else
-      ue->common_vars.txdata[0][k] &= 0xFFFEFFFE;
-  }
-#endif
-#else
-  
-  for (i=0; i<prach_len; i++) {
-    ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i] = prach[2*i];
-    ((int16_t*)(&ue->common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1];
-  }
-  
-#endif
-  
-
-  
-#if defined(PRACH_WRITE_OUTPUT_DEBUG)
-  write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
-  write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
-  write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
-  exit(-1);
-#endif
-
-  return signal_energy( (int*)prach, 256 );
-}
-//__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
-=======
->>>>>>> develop-uedirectorysplit
 
 #ifndef Rel14
 #define rx_prach0 rx_prach
@@ -741,7 +112,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 #endif
 
   if (ru) { 
-    fp    = &ru->frame_parms;
+    fp    = ru->frame_parms;
     nb_rx = ru->nb_rx;
   }
   else if (eNB) {
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h
index a236fa5f55ce045c5d0232df5c86083837d1fc5a..45c7f5484840a11e26be78bfff48911cc683687e 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h
@@ -32,7 +32,6 @@
 #ifndef __TRANSPORT_COMMON__H__
 #define __TRANSPORT_COMMON__H__
 #include "PHY/defs_common.h"
-#include "PHY/impl_defs_lte.h"
 #include "dci.h"
 #include "mdci.h"
 //#include "uci.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
index a54353c022e73814a47cbd203a7932c683320c44..90714cf3a2e632a3aed0ca48e5edf97f4ae07fa3 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h
@@ -32,8 +32,7 @@
 #ifndef __TRANSPORT_ENB__H__
 #define __TRANSPORT_ENB__H__
 #include "transport_common.h"
-//#include "PHY/defs_eNB.h"
-#include "PHY/impl_defs_lte.h"
+#include "PHY/defs_eNB.h"
 #include "dci.h"
 #include "mdci.h"
 #include "uci_common.h"
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
index e97353a902868b1417240dfc2bc97e168db4e883..98e6f90a53cb7ee30ed3dbf996851cb722e42451 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
@@ -32,7 +32,6 @@
 #ifndef __TRANSPORT_UE__H__
 #define __TRANSPORT_UE__H__
 #include "PHY/defs_UE.h"
-#include "PHY/impl_defs_lte.h"
 #include "../LTE_TRANSPORT/dci.h"
 #include "../LTE_TRANSPORT/mdci.h"
 #include "../LTE_TRANSPORT/uci_common.h"
diff --git a/openair1/PHY/MODULATION/compute_bf_weights.c b/openair1/PHY/MODULATION/compute_bf_weights.c
index 89d76058e6d2b1859124a14408704403fc9f778b..039ce3b9cfc31cc262a0f60df6f1993988760b0e 100644
--- a/openair1/PHY/MODULATION/compute_bf_weights.c
+++ b/openair1/PHY/MODULATION/compute_bf_weights.c
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
-#include "PHY/impl_defs_lte.h"
 #include "PHY/defs_common.h"
 
 int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs){
diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c
index 448db6f1f120c584f357e6a64a4074ff132452c5..49f0ba19d9b5e99efea00fb53b23c7d0ed0ab130 100644
--- a/openair1/PHY/MODULATION/ofdm_mod.c
+++ b/openair1/PHY/MODULATION/ofdm_mod.c
@@ -30,6 +30,7 @@ This section deals with basic functions for OFDM Modulation.
 */
 
 #include "PHY/defs_eNB.h"
+#include "PHY/defs_gNB.h"
 #include "PHY/impl_defs_top.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c
index fe5488c73c7f29c136bb9730ca10e1f11149521c..3ac8537c696ff2df692e98ad0967c1c296253ac8 100644
--- a/openair1/PHY/MODULATION/slot_fep_ul.c
+++ b/openair1/PHY/MODULATION/slot_fep_ul.c
@@ -36,7 +36,7 @@ int slot_fep_ul(RU_t *ru,
 #endif
   unsigned char aa;
   RU_COMMON *common=&ru->common;
-  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
   unsigned char symbol = l+((7-fp->Ncp)*(Ns&1)); ///symbol within sub-frame
   unsigned int nb_prefix_samples = (no_prefix ? 0 : fp->nb_prefix_samples);
   unsigned int nb_prefix_samples0 = (no_prefix ? 0 : fp->nb_prefix_samples0);
diff --git a/openair1/PHY/NR_REFSIG/defs.h b/openair1/PHY/NR_REFSIG/defs.h
index f1b382c29de517f1cd518f4e2cc982c57808a12a..5bb53fac874bcb0389f7813d58ed16fecd0cec3f 100644
--- a/openair1/PHY/NR_REFSIG/defs.h
+++ b/openair1/PHY/NR_REFSIG/defs.h
@@ -23,7 +23,7 @@
 /* Author R. Knopp / EURECOM / OpenAirInterface.org */
 #ifndef __NR_REFSIG_DEFS__H__
 #define __NR_REFSIG_DEFS__H__
-#include "PHY/defs.h"
+#include "PHY/defs_gNB.h"
 
 
 /*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PBCH DMRS.
diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
index ddef1067b013d6e1e4eb8aa0812e0267ce8fe29b..74231d95743cda2a16c9ad066776d562f2d3dced 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c
@@ -21,7 +21,7 @@
 
 /*! \file PHY/NR_TRANSPORT/nr_pbch.c
 * \brief Top-level routines for generating and decoding  the PBCH/BCH physical/transport channel V15.1 03/2018
-* \author G. De Souza
+* \author Guy De Souza
 * \date 2018
 * \version 0.1
 * \company Eurecom
@@ -29,12 +29,8 @@
 * \note
 * \warning
 */
-#include "PHY/defs.h"
-#include "PHY/CODING/extern.h"
-#include "PHY/CODING/lte_interleaver_inline.h"
-#include "defs.h"
-#include "extern.h"
-#include "PHY/extern.h"
+#include "PHY/defs_gNB.h"
+#include "PHY/phy_extern.h"
 #include "PHY/sse_intrin.h"
 
 #define DEBUG_PBCH
diff --git a/openair1/PHY/NR_TRANSPORT/nr_pss.c b/openair1/PHY/NR_TRANSPORT/nr_pss.c
index f686f32dcdd2c8b537cae8b79a6cf76027450436..bce2d05b2bbbc86bd7cc6e15f435b706b8340fe7 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_pss.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_pss.c
@@ -19,7 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#include "PHY/defs.h"
+#include "PHY/defs_gNB.h"
 
 //#define NR_PSS_DEBUG
 
diff --git a/openair1/PHY/NR_TRANSPORT/nr_sss.c b/openair1/PHY/NR_TRANSPORT/nr_sss.c
index 5b82e4e4c9f4e91bcdb88f9ee3a778202a2f50d1..7674fafd4f142588bf3eee88048dfaeded4c5052 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_sss.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_sss.c
@@ -19,7 +19,7 @@
  *      contact@openairinterface.org
  */
 
-#include "PHY/defs.h"
+#include "PHY/defs_gNB.h"
 
 extern short nr_mod_table[MOD_TABLE_SIZE_SHORT];
 
diff --git a/openair1/PHY/TOOLS/smbv.h b/openair1/PHY/TOOLS/smbv.h
index 127cd3f7b976ad6a5c54aff5e064cd4e436c5745..ef40a9ed7d08e27817430e622ecc056e36b0c48a 100644
--- a/openair1/PHY/TOOLS/smbv.h
+++ b/openair1/PHY/TOOLS/smbv.h
@@ -31,9 +31,8 @@
 //#include <netinet/in.h>
 #include <netdb.h>
 #ifndef CONFIG_SMBV
-#include "../impl_defs_lte.h"
 #include "../impl_defs_top.h"
-#include "../defs.h"
+#include "../defs_eNB.h"
 #include "../LTE_TRANSPORT/defs.h"
 #else
 #define msg printf
diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h
new file mode 100644
index 0000000000000000000000000000000000000000..fc95c7f2d18ff17ded0bb759ecd2c2bbb1256b84
--- /dev/null
+++ b/openair1/PHY/defs_RU.h
@@ -0,0 +1,522 @@
+/*
+ * 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 PHY/defs_RU.h
+ \brief Top-level defines and structure definitions
+ \author R. Knopp, F. Kaltenberger
+ \date 2018
+ \version 0.1
+ \company Eurecom
+ \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+ \note
+ \warning
+*/
+
+#ifndef __PHY_DEFS_RU__H__
+#define __PHY_DEFS_RU__H__
+
+
+#define MAX_BANDS_PER_RRU 4
+
+
+#ifdef OCP_FRAMEWORK
+#include <enums.h>
+#else
+typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
+
+/*! \brief Extension Type */
+typedef enum {
+  CYCLIC_PREFIX,
+  CYCLIC_SUFFIX,
+  ZEROS,
+  NONE
+} Extension_t;
+	
+enum transmission_access_mode {
+  NO_ACCESS=0,
+  POSTPONED_ACCESS,
+  CANCELED_ACCESS,
+  UNKNOWN_ACCESS,
+  SCHEDULED_ACCESS,
+  CBA_ACCESS};
+
+typedef enum  {
+  eNodeB_3GPP=0,   // classical eNodeB function
+  NGFI_RAU_IF5,    // RAU with NGFI IF5
+  NGFI_RAU_IF4p5,  // RAU with NFGI IF4p5
+  NGFI_RRU_IF5,    // NGFI_RRU (NGFI remote radio-unit,IF5)
+  NGFI_RRU_IF4p5,  // NGFI_RRU (NGFI remote radio-unit,IF4p5)
+  MBP_RRU_IF5,      // Mobipass RRU
+  gNodeB_3GPP
+} node_function_t;
+
+typedef enum {
+
+  synch_to_ext_device=0,  // synch to RF or Ethernet device
+  synch_to_other,          // synch to another source_(timer, other RU)
+  synch_to_mobipass_standalone  // special case for mobipass in standalone mode
+} node_timing_t;
+#endif
+
+
+typedef struct {
+  /// \brief Holds the transmit data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **txdata;
+  /// \brief holds the transmit data after beamforming in the frequency domain.
+  /// - first index: tx antenna [0..nb_antennas_tx[
+  /// - second index: sample [0..]
+  int32_t **txdataF_BF;
+  /// \brief holds the transmit data before beamforming for epdcch/mpdcch
+  /// - first index : tx antenna [0..nb_epdcch_antenna_ports[
+  /// - second index: sampl [0..]
+  int32_t **txdataF_epdcch;
+  /// \brief Holds the receive data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdata;
+  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: sample [0..samples_per_tti[
+  int32_t **rxdata_7_5kHz;
+  /// \brief Holds the received data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdataF;
+  /// \brief Holds output of the sync correlator.
+  /// - first index: sample [0..samples_per_tti*10[
+  uint32_t *sync_corr;
+  /// \brief Holds the tdd reciprocity calibration coefficients 
+  /// - first index: eNB id [0..2] (hard coded) 
+  /// - second index: tx antenna [0..nb_antennas_tx[
+  /// - third index: frequency [0..]
+  int32_t **tdd_calib_coeffs;
+} RU_COMMON;
+
+
+typedef struct RU_proc_t_s {
+  /// Pointer to associated RU descriptor
+  struct RU_t_s *ru;
+  /// timestamp received from HW
+  openair0_timestamp timestamp_rx;
+  /// timestamp to send to "slave rru"
+  openair0_timestamp timestamp_tx;
+  /// subframe to act upon for reception
+  int subframe_rx;
+  /// subframe to act upon for transmission
+  int subframe_tx;
+  /// subframe to act upon for reception of prach
+  int subframe_prach;
+#ifdef Rel14
+  /// subframe to act upon for reception of prach BL/CE UEs
+  int subframe_prach_br;
+#endif
+  /// frame to act upon for reception
+  int frame_rx;
+  /// frame to act upon for transmission
+  int frame_tx;
+  /// unwrapped frame count
+  int frame_tx_unwrap;
+  /// frame to act upon for reception of prach
+  int frame_prach;
+#ifdef Rel14
+  /// frame to act upon for reception of prach
+  int frame_prach_br;
+#endif
+  /// frame offset for slave RUs (to correct for frame asynchronism at startup)
+  int frame_offset;
+  /// \brief Instance count for FH processing thread.
+  /// \internal This variable is protected by \ref mutex_FH.
+  int instance_cnt_FH;
+  int instance_cnt_FH1;
+  /// \internal This variable is protected by \ref mutex_prach.
+  int instance_cnt_prach;
+#ifdef Rel14
+  /// \internal This variable is protected by \ref mutex_prach.
+  int instance_cnt_prach_br;
+#endif
+  /// \internal This variable is protected by \ref mutex_synch.
+  int instance_cnt_synch;
+  /// \internal This variable is protected by \ref mutex_eNBs.
+  int instance_cnt_eNBs;
+  int instance_cnt_gNBs;
+  /// \brief Instance count for rx processing thread.
+  /// \internal This variable is protected by \ref mutex_asynch_rxtx.
+  int instance_cnt_asynch_rxtx;
+  /// \internal This variable is protected by \ref mutex_fep
+  int instance_cnt_fep;
+  /// \internal This variable is protected by \ref mutex_feptx
+  int instance_cnt_feptx;
+  /// This varible is protected by \ref mutex_emulatedRF
+  int instance_cnt_emulateRF;
+  /// pthread structure for RU FH processing thread
+  pthread_t pthread_FH;
+  pthread_t pthread_FH1;
+  /// pthread structure for RU prach processing thread
+  pthread_t pthread_prach;
+#ifdef Rel14
+  /// pthread structure for RU prach processing thread BL/CE UEs
+  pthread_t pthread_prach_br;
+#endif
+  /// pthread struct for RU synch thread
+  pthread_t pthread_synch;
+  /// pthread struct for RU RX FEP worker thread
+  pthread_t pthread_fep;
+  /// pthread struct for RU TX FEP worker thread
+  pthread_t pthread_feptx;
+  /// pthread struct for emulated RF
+  pthread_t pthread_emulateRF;
+  /// pthread structure for asychronous RX/TX processing thread
+  pthread_t pthread_asynch_rxtx;
+  /// flag to indicate first RX acquisition
+  int first_rx;
+  /// flag to indicate first TX transmission
+  int first_tx;
+  /// pthread attributes for RU FH processing thread
+  pthread_attr_t attr_FH;
+  pthread_attr_t attr_FH1;
+  /// pthread attributes for RU prach
+  pthread_attr_t attr_prach;
+#ifdef Rel14
+  /// pthread attributes for RU prach BL/CE UEs
+  pthread_attr_t attr_prach_br;
+#endif
+  /// pthread attributes for RU synch thread
+  pthread_attr_t attr_synch;
+  /// pthread attributes for asynchronous RX thread
+  pthread_attr_t attr_asynch_rxtx;
+  /// pthread attributes for worker fep thread
+  pthread_attr_t attr_fep;
+  /// pthread attributes for worker feptx thread
+  pthread_attr_t attr_feptx;
+  /// pthread attributes for emulated RF
+  pthread_attr_t attr_emulateRF;
+  /// scheduling parameters for RU FH thread
+  struct sched_param sched_param_FH;
+  struct sched_param sched_param_FH1;
+  /// scheduling parameters for RU prach thread
+  struct sched_param sched_param_prach;
+#ifdef Rel14
+  /// scheduling parameters for RU prach thread BL/CE UEs
+  struct sched_param sched_param_prach_br;
+#endif
+  /// scheduling parameters for RU synch thread
+  struct sched_param sched_param_synch;
+  /// scheduling parameters for asynch_rxtx thread
+  struct sched_param sched_param_asynch_rxtx;
+  /// condition variable for RU FH thread
+  pthread_cond_t cond_FH;
+  pthread_cond_t cond_FH1;
+  /// condition variable for RU prach thread
+  pthread_cond_t cond_prach;
+#ifdef Rel14
+  /// condition variable for RU prach thread BL/CE UEs
+  pthread_cond_t cond_prach_br;
+#endif
+  /// condition variable for RU synch thread
+  pthread_cond_t cond_synch;
+  /// condition variable for asynch RX/TX thread
+  pthread_cond_t cond_asynch_rxtx;
+  /// condition varible for RU RX FEP thread
+  pthread_cond_t cond_fep;
+  /// condition varible for RU TX FEP thread
+  pthread_cond_t cond_feptx;
+  /// condition varible for emulated RF
+  pthread_cond_t cond_emulateRF;
+  /// condition variable for eNB signal
+  pthread_cond_t cond_eNBs;
+  pthread_cond_t cond_gNBs;
+  /// mutex for RU FH
+  pthread_mutex_t mutex_FH;
+  pthread_mutex_t mutex_FH1;
+  /// mutex for RU prach
+  pthread_mutex_t mutex_prach;
+#ifdef Rel14
+  /// mutex for RU prach BL/CE UEs
+  pthread_mutex_t mutex_prach_br;
+#endif
+  /// mutex for RU synch
+  pthread_mutex_t mutex_synch;
+  /// mutex for eNB signal
+  pthread_mutex_t mutex_eNBs;
+  pthread_mutex_t mutex_gNBs;
+  /// mutex for asynch RX/TX thread
+  pthread_mutex_t mutex_asynch_rxtx;
+  /// mutex for fep RX worker thread
+  pthread_mutex_t mutex_fep;
+  /// mutex for fep TX worker thread
+  pthread_mutex_t mutex_feptx;
+  /// mutex for emulated RF thread
+  pthread_mutex_t mutex_emulateRF;
+  /// symbol mask for IF4p5 reception per subframe
+  uint32_t symbol_mask[10];
+  /// number of slave threads
+  int                  num_slaves;
+  /// array of pointers to slaves
+  struct RU_proc_t_s           **slave_proc;
+  /// pipeline ready state
+  int ru_rx_ready;
+  int ru_tx_ready;
+} RU_proc_t;
+
+
+typedef enum {
+  LOCAL_RF        =0,
+  REMOTE_IF5      =1,
+  REMOTE_MBP_IF5  =2,
+  REMOTE_IF4p5    =3,
+  REMOTE_IF1pp    =4,
+  MAX_RU_IF_TYPES =5
+  //EMULATE_RF      =6
+} RU_if_south_t;
+
+typedef struct RU_t_s{
+  /// index of this ru
+  uint32_t idx;
+ /// Pointer to configuration file
+  char *rf_config_file;
+  /// southbound interface
+  RU_if_south_t if_south;
+  /// timing
+  node_timing_t if_timing;
+  /// function
+  node_function_t function;
+  /// Ethernet parameters for fronthaul interface
+  eth_params_t eth_params;
+  /// flag to indicate the RU is in synch with a master reference
+  int in_synch;
+  /// timing offset
+  int rx_offset;        
+  /// flag to indicate the RU is a slave to another source
+  int is_slave;
+  /// Total gain of receive chain
+  uint32_t             rx_total_gain_dB;
+  /// number of bands that this device can support
+  int num_bands;
+  /// band list
+  int band[MAX_BANDS_PER_RRU];
+  /// number of RX paths on device
+  int nb_rx;
+  /// number of TX paths on device
+  int nb_tx;
+  /// maximum PDSCH RS EPRE
+  int max_pdschReferenceSignalPower;
+  /// maximum RX gain
+  int max_rxgain;
+  /// Attenuation of RX paths on device
+  int att_rx;
+  /// Attenuation of TX paths on device
+  int att_tx;
+  /// flag to indicate precoding operation in RU
+  int do_precoding;
+  /// Frame parameters
+  struct LTE_DL_FRAME_PARMS *frame_parms;
+  struct NR_DL_FRAME_PARMS *nr_frame_parms;
+  ///timing offset used in TDD
+  int              N_TA_offset; 
+  /// RF device descriptor
+  openair0_device rfdevice;
+  /// HW configuration
+  openair0_config_t openair0_cfg;
+  /// Number of NBs using this RU
+  int num_eNB;
+  int num_gNB;
+  /// list of NBs using this RU
+  struct PHY_VARS_eNB_s *eNB_list[NUMBER_OF_eNB_MAX];
+  struct PHY_VARS_gNB_s *gNB_list[NUMBER_OF_eNB_MAX];
+  /// Mapping of antenna ports to RF chain index
+  openair0_rf_map      rf_map;
+  /// IF device descriptor
+  openair0_device ifdevice;
+  /// Pointer for ifdevice buffer struct
+  if_buffer_t ifbuffer;
+  /// if prach processing is to be performed in RU
+  int                  do_prach;
+  /// function pointer to synchronous RX fronthaul function (RRU,3GPP_eNB/3GPP_gNB)
+  void                 (*fh_south_in)(struct RU_t_s *ru,int *frame, int *subframe);
+  /// function pointer to synchronous TX fronthaul function
+  void                 (*fh_south_out)(struct RU_t_s *ru);
+  /// function pointer to synchronous RX fronthaul function (RRU)
+  void                 (*fh_north_in)(struct RU_t_s *ru,int *frame, int *subframe);
+  /// function pointer to synchronous RX fronthaul function (RRU)
+  void                 (*fh_north_out)(struct RU_t_s *ru);
+  /// function pointer to asynchronous fronthaul interface
+  void                 (*fh_north_asynch_in)(struct RU_t_s *ru,int *frame, int *subframe);
+  /// function pointer to asynchronous fronthaul interface
+  void                 (*fh_south_asynch_in)(struct RU_t_s *ru,int *frame, int *subframe);
+  /// function pointer to initialization function for radio interface
+  int                  (*start_rf)(struct RU_t_s *ru);
+  /// function pointer to release function for radio interface
+  int                  (*stop_rf)(struct RU_t_s *ru);
+  /// function pointer to initialization function for radio interface
+  int                  (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB);
+  /// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL)
+  void                 (*feprx)(struct RU_t_s *ru);
+  /// function pointer to TX front-end processing routine (IDFTs and prefix removal or NULL)
+  void                 (*feptx_ofdm)(struct RU_t_s *ru);
+  /// function pointer to TX front-end processing routine (PRECODING)
+  void                 (*feptx_prec)(struct RU_t_s *ru);
+  /// function pointer to wakeup routine in lte-enb/nr-gnb.
+  int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru);
+  int (*nr_wakeup_rxtx)(struct PHY_VARS_gNB_s *gNB, struct RU_t_s *ru);
+  /// function pointer to wakeup routine in lte-enb/nr-gnb.
+  void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
+
+  void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *gNB,struct RU_t_s *ru,int frame,int subframe);
+  #ifdef Rel14
+  /// function pointer to wakeup routine in lte-enb.
+  void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
+  #endif
+
+  /// function pointer to NB entry routine
+  void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string);
+  void (*gNB_top)(struct PHY_VARS_gNB_s *eNB, int frame_rx, int subframe_rx, char *string);
+
+  /// Timing statistics
+  time_stats_t ofdm_demod_stats;
+  /// Timing statistics (TX)
+  time_stats_t ofdm_mod_stats;
+  /// Timing wait statistics
+  time_stats_t ofdm_demod_wait_stats;
+  /// Timing wakeup statistics
+  time_stats_t ofdm_demod_wakeup_stats;
+  /// Timing wait statistics (TX)
+  time_stats_t ofdm_mod_wait_stats;
+  /// Timing wakeup statistics (TX)
+  time_stats_t ofdm_mod_wakeup_stats;
+  /// Timing statistics (RX Fronthaul + Compression)
+  time_stats_t rx_fhaul;
+  /// Timing statistics (TX Fronthaul + Compression)
+  time_stats_t tx_fhaul; 
+  /// Timong statistics (Compression)
+  time_stats_t compression;
+  /// Timing statistics (Fronthaul transport)
+  time_stats_t transport;
+  /// RX and TX buffers for precoder output
+  RU_COMMON            common;
+  /// beamforming weight vectors per eNB
+  int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15];
+
+  /// received frequency-domain signal for PRACH (IF4p5 RRU) 
+  int16_t              **prach_rxsigF;
+  /// received frequency-domain signal for PRACH BR (IF4p5 RRU) 
+  int16_t              **prach_rxsigF_br[4];
+  /// sequence number for IF5
+  uint8_t seqno;
+  /// initial timestamp used as an offset make first real timestamp 0
+  openair0_timestamp   ts_offset;
+  /// process scheduling variables
+  RU_proc_t            proc;
+  /// stats thread pthread descriptor
+  pthread_t            ru_stats_thread;
+
+} RU_t;
+
+
+
+#define MAX_RRU_CONFIG_SIZE 1024
+typedef enum {
+  RAU_tick=0,
+  RRU_capabilities=1,
+  RRU_config=2,
+  RRU_MSG_max_num=3
+} rru_config_msg_type_t;
+
+typedef struct RRU_CONFIG_msg_s {
+  rru_config_msg_type_t type;
+  ssize_t len;
+  uint8_t msg[MAX_RRU_CONFIG_SIZE];
+} RRU_CONFIG_msg_t;
+
+typedef enum {
+  OAI_IF5_only      =0,
+  OAI_IF4p5_only    =1,
+  OAI_IF5_and_IF4p5 =2,
+  MBP_IF5           =3,
+  MAX_FH_FMTs       =4
+} FH_fmt_options_t;
+
+#define MAX_BANDS_PER_RRU 4
+
+typedef struct RRU_capabilities_s {
+  /// Fronthaul format
+  FH_fmt_options_t FH_fmt;
+  /// number of EUTRA bands (<=4) supported by RRU
+  uint8_t          num_bands;
+  /// EUTRA band list supported by RRU
+  uint8_t          band_list[MAX_BANDS_PER_RRU];
+  /// Number of concurrent bands (component carriers)
+  uint8_t          num_concurrent_bands;
+  /// Maximum TX EPRE of each band
+  int8_t           max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU];
+  /// Maximum RX gain of each band
+  uint8_t          max_rxgain[MAX_BANDS_PER_RRU];
+  /// Number of RX ports of each band
+  uint8_t          nb_rx[MAX_BANDS_PER_RRU];
+  /// Number of TX ports of each band
+  uint8_t          nb_tx[MAX_BANDS_PER_RRU]; 
+  /// max DL bandwidth (1,6,15,25,50,75,100)
+  uint8_t          N_RB_DL[MAX_BANDS_PER_RRU];
+  /// max UL bandwidth (1,6,15,25,50,75,100)
+  uint8_t          N_RB_UL[MAX_BANDS_PER_RRU];
+} RRU_capabilities_t;
+
+typedef struct RRU_config_s {
+
+  /// Fronthaul format
+  RU_if_south_t FH_fmt;
+  /// number of EUTRA bands (<=4) configured in RRU
+  uint8_t num_bands;
+  /// EUTRA band list configured in RRU
+  uint8_t band_list[MAX_BANDS_PER_RRU];
+  /// TDD configuration (0-6)
+  uint8_t tdd_config[MAX_BANDS_PER_RRU];
+  /// TDD special subframe configuration (0-10)
+  uint8_t tdd_config_S[MAX_BANDS_PER_RRU];
+  /// TX frequency
+  uint32_t tx_freq[MAX_BANDS_PER_RRU];
+  /// RX frequency
+  uint32_t rx_freq[MAX_BANDS_PER_RRU];
+  /// TX attenation w.r.t. max
+  uint8_t att_tx[MAX_BANDS_PER_RRU];
+  /// RX attenuation w.r.t. max
+  uint8_t att_rx[MAX_BANDS_PER_RRU];
+  /// DL bandwidth
+  uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
+  /// UL bandwidth
+  uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
+  /// 3/4 sampling rate
+  uint8_t threequarter_fs[MAX_BANDS_PER_RRU];
+  /// prach_FreqOffset for IF4p5
+  int prach_FreqOffset[MAX_BANDS_PER_RRU];
+  /// prach_ConfigIndex for IF4p5
+  int prach_ConfigIndex[MAX_BANDS_PER_RRU];
+#ifdef Rel14
+  int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4];
+  /// emtc_prach_FreqOffset for IF4p5 per CE Level
+  int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4];
+  /// emtc_prach_ConfigIndex for IF4p5 per CE Level
+  int emtc_prach_ConfigIndex[MAX_BANDS_PER_RRU][4];
+#endif
+} RRU_config_t;
+
+#endif //__PHY_DEFS_RU__H__
diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h
index 4a8b90b7705e5aa94ef8e98059a9da60ff67f8c9..fe8bf7b402315a3a4eb3869a2929d7fd530f31de 100644
--- a/openair1/PHY/defs_common.h
+++ b/openair1/PHY/defs_common.h
@@ -29,16 +29,10 @@
  \note
  \warning
 */
-<<<<<<< HEAD
+
 #ifndef __PHY_DEFS_COMMON__H__
 #define __PHY_DEFS_COMMON__H__
 
-#define MAX_NUM_RU_PER_eNB 64
-#define MAX_NUM_RU_PER_gNB 64
-=======
-#ifndef __PHY_DEFS_COMMON_H__
-#define __PHY_DEFS_COMMON_H__
-
 
 #define _GNU_SOURCE
 #include <sched.h>
@@ -64,15 +58,7 @@
 #include "common_lib.h"
 #include "msc.h"
 
-
 //#include <complex.h>
-
-
-
-
-
-
-
 #include "PHY/TOOLS/time_meas.h"
 #include "platform_types.h"
 #define MAX_NUM_RU_PER_eNB 64 
@@ -87,6 +73,8 @@
 //#include "defs.h"
 #include "openair2/COMMON/platform_types.h"
 
+#include "defs_RU.h"
+
 #define RX_NB_TH_MAX 2
 #define RX_NB_TH 2
 
@@ -586,7 +574,7 @@ typedef struct {
   int mbsfn_SubframeConfig;
 } MBSFN_config_t;
 
-typedef struct {
+typedef struct LTE_DL_FRAME_PARMS {
   /// Number of resource blocks (RB) in DL
   uint8_t N_RB_DL;
   /// Number of resource blocks (RB) in UL
@@ -871,7 +859,6 @@ typedef enum {
 
 
 typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;
->>>>>>> develop-uedirectorysplit
 
 #define NUMBER_OF_SUBBANDS_MAX 13
 #define NUMBER_OF_HARQ_PID_MAX 8
@@ -879,10 +866,6 @@ typedef enum {SF_DL, SF_UL, SF_S} lte_subframe_t;
 #define MAX_FRAME_NUMBER 0x400
 
 
-<<<<<<< HEAD
-=======
-
->>>>>>> develop-uedirectorysplit
 #define NUMBER_OF_RN_MAX 3
 typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t;
 
@@ -898,66 +881,6 @@ typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_rela
 
 #define NB_BANDS_MAX 8
 
-#define MAX_BANDS_PER_RRU 4
-
-
-#ifdef OCP_FRAMEWORK
-#include <enums.h>
-#else
-typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
-
-/*! \brief Extension Type */
-typedef enum {
-  CYCLIC_PREFIX,
-  CYCLIC_SUFFIX,
-  ZEROS,
-  NONE
-} Extension_t;
-	
-enum transmission_access_mode {
-  NO_ACCESS=0,
-  POSTPONED_ACCESS,
-  CANCELED_ACCESS,
-  UNKNOWN_ACCESS,
-  SCHEDULED_ACCESS,
-  CBA_ACCESS};
-
-typedef enum  {
-  eNodeB_3GPP=0,   // classical eNodeB function
-  NGFI_RAU_IF5,    // RAU with NGFI IF5
-  NGFI_RAU_IF4p5,  // RAU with NFGI IF4p5
-  NGFI_RRU_IF5,    // NGFI_RRU (NGFI remote radio-unit,IF5)
-  NGFI_RRU_IF4p5,  // NGFI_RRU (NGFI remote radio-unit,IF4p5)
-  MBP_RRU_IF5      // Mobipass RRU
-} node_function_t;
-
-typedef enum {
-
-  synch_to_ext_device=0,  // synch to RF or Ethernet device
-  synch_to_other,          // synch to another source_(timer, other RU)
-  synch_to_mobipass_standalone  // special case for mobipass in standalone mode
-} node_timing_t;
-#endif
-
-<<<<<<< HEAD
-typedef struct {
-  struct PHY_VARS_eNB_s *eNB;
-  int UE_id;
-  int harq_pid;
-  int llr8_flag;
-  int ret;
-} td_params;
-
-typedef struct {
-  struct PHY_VARS_eNB_s *eNB;
-  LTE_eNB_DLSCH_t *dlsch;
-  int G;
-  int harq_pid;
-} te_params;
-
-#endif
-=======
-
 void exit_fun(const char* s);
 
 #include "UTIL/LOG/log_extern.h"
@@ -1089,5 +1012,4 @@ static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *
 }
 
 
-#endif //  __PHY_DEFS__H__
->>>>>>> develop-uedirectorysplit
+#endif //  __PHY_DEFS_COMMON_H__
diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h
index ca66df94a50155e5e2b3a883be6834434281abf9..7eb9ee23fa3c9f9d0ef3378a67ef6868e7cc0dd4 100644
--- a/openair1/PHY/defs_eNB.h
+++ b/openair1/PHY/defs_eNB.h
@@ -74,7 +74,6 @@
 
 #define MAX_NUM_RU_PER_eNB 64 
 
-#include "PHY/LTE_TRANSPORT/defs.h"
 #include <pthread.h>
 
 #include "targets/ARCH/COMMON/common_lib.h"
@@ -103,592 +102,6 @@
 
 #define MAX_FRAME_NUMBER 0x400
 
-#if 1
-
-#define nr_subframe_t lte_subframe_t
-
-#define NR_PBCH_DMRS_LENGTH 144
-#define NR_PBCH_DMRS_LENGTH_DWORD 5 // roundup(NR_PBCH_DMRS_LENGTH/32)
-
-typedef enum{
-  nr_ssb_type_A = 0,
-  nr_ssb_type_B,
-  nr_ssb_type_C,
-  nr_ssb_type_D,
-  nr_ssb_type_E
-} nr_ssb_type_e;
-
-typedef struct {
-  /// EUTRA Band
-  uint8_t eutra_band;
-  /// DL carrier frequency
-  uint32_t dl_CarrierFreq;
-  /// UL carrier frequency
-  uint32_t ul_CarrierFreq;
-  /// TX attenuation
-  uint32_t att_tx;
-  /// RX attenuation
-  uint32_t att_rx;
-  ///  total Number of Resource Block Groups: this is ceil(N_PRB/P)
-  uint32_t subcarrier_spacing;
-  /// 3/4 sampling
-  uint8_t threequarter_fs;
-  /// Size of FFT
-  uint16_t ofdm_symbol_size;
-  /// Number of prefix samples in all but first symbol of slot
-  uint16_t nb_prefix_samples;
-  /// Number of prefix samples in first symbol of slot
-  uint16_t nb_prefix_samples0;
-  /// Carrier offset in FFT buffer for first RE in PRB0
-  uint16_t first_carrier_offset;
-  /// Number of OFDM/SC-FDMA symbols in one slot
-  uint16_t symbols_per_slot;
-  /// Number of slots per subframe
-  uint16_t slots_per_subframe;
-  /// Number of samples in a subframe
-  uint32_t samples_per_subframe;
-  /// Number of samples in a radio frame
-  uint32_t samples_per_frame;
-  /// Number of samples in a subframe without CP
-  uint32_t samples_per_subframe_wCP;
-  /// Number of samples in a radio frame without CP
-  uint32_t samples_per_frame_wCP;
-
-    //SSB related params
-  /// Start in Subcarrier index of the SSB block
-  uint16_t ssb_start_subcarrier;
-  nr_ssb_type_e ssb_type;
-
-} NR_DL_FRAME_PARMS;
-struct PHY_VARS_gNB_s;
-#endif
-
-#define NUMBER_OF_RN_MAX 3
-typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_relay} relaying_type_t;
-
-
-#define MCS_COUNT 28
-#define MCS_TABLE_LENGTH_MAX 64
-
-
-#define NUM_DCI_MAX 32
-
-#define NUMBER_OF_eNB_SECTORS_MAX 3
-
-#define NB_BANDS_MAX 8
-
-#define MAX_BANDS_PER_RRU 4
-
-#ifdef OCP_FRAMEWORK
-#include <enums.h>
-#else
-typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
-
-/*! \brief Extension Type */
-typedef enum {
-  CYCLIC_PREFIX,
-  CYCLIC_SUFFIX,
-  ZEROS,
-  NONE
-} Extension_t;
-	
-enum transmission_access_mode {
-  NO_ACCESS=0,
-  POSTPONED_ACCESS,
-  CANCELED_ACCESS,
-  UNKNOWN_ACCESS,
-  SCHEDULED_ACCESS,
-  CBA_ACCESS};
-
-typedef enum  {
-  eNodeB_3GPP=0,   // classical eNodeB function
-  NGFI_RAU_IF5,    // RAU with NGFI IF5
-  NGFI_RAU_IF4p5,  // RAU with NFGI IF4p5
-  NGFI_RRU_IF5,    // NGFI_RRU (NGFI remote radio-unit,IF5)
-  NGFI_RRU_IF4p5,  // NGFI_RRU (NGFI remote radio-unit,IF4p5)
-  MBP_RRU_IF5,      // Mobipass RRU
-  gNodeB_3GPP
-} node_function_t;
-
-typedef enum {
-
-  synch_to_ext_device=0,  // synch to RF or Ethernet device
-  synch_to_other,          // synch to another source_(timer, other RU)
-  synch_to_mobipass_standalone  // special case for mobipass in standalone mode
-} node_timing_t;
-#endif
-
-typedef struct UE_SCAN_INFO_s {
-  /// 10 best amplitudes (linear) for each pss signals
-  int32_t amp[3][10];
-  /// 10 frequency offsets (kHz) corresponding to best amplitudes, with respect do minimum DL frequency in the band
-  int32_t freq_offset_Hz[3][10];
-} UE_SCAN_INFO_t;
-
-/// Top-level PHY Data Structure for RN
-typedef struct {
-  /// Module ID indicator for this instance
-  uint8_t Mod_id;
-  uint32_t frame;
-  // phy_vars_eNB
-  // phy_vars ue
-  // cuurently only used to store and forward the PMCH
-  uint8_t mch_avtive[10];
-  uint8_t sync_area[10]; // num SF
-  LTE_UE_DLSCH_t   *dlsch_rn_MCH[10];
-
-} PHY_VARS_RN;
-
-/// Context data structure for RX/TX portion of subframe processing
-typedef struct {
-  /// Component Carrier index
-  uint8_t              CC_id;
-  /// timestamp transmitted to HW
-  openair0_timestamp timestamp_tx;
-  /// subframe to act upon for transmission
-  int subframe_tx;
-  /// subframe to act upon for reception
-  int subframe_rx;
-  /// frame to act upon for transmission
-  int frame_tx;
-  /// frame to act upon for reception
-  int frame_rx;
-  /// \brief Instance count for RXn-TXnp4 processing thread.
-  /// \internal This variable is protected by \ref mutex_rxtx.
-  int instance_cnt_rxtx;
-  /// pthread structure for RXn-TXnp4 processing thread
-  pthread_t pthread_rxtx;
-  /// pthread attributes for RXn-TXnp4 processing thread
-  pthread_attr_t attr_rxtx;
-  /// condition variable for tx processing thread
-  pthread_cond_t cond_rxtx;
-  /// mutex for RXn-TXnp4 processing thread
-  pthread_mutex_t mutex_rxtx;
-  /// scheduling parameters for RXn-TXnp4 thread
-  struct sched_param sched_param_rxtx;
-} eNB_rxtx_proc_t;
-
-
-typedef struct RU_proc_t_s {
-  /// Pointer to associated RU descriptor
-  struct RU_t_s *ru;
-  /// timestamp received from HW
-  openair0_timestamp timestamp_rx;
-  /// timestamp to send to "slave rru"
-  openair0_timestamp timestamp_tx;
-  /// subframe to act upon for reception
-  int subframe_rx;
-  /// subframe to act upon for transmission
-  int subframe_tx;
-  /// subframe to act upon for reception of prach
-  int subframe_prach;
-#ifdef Rel14
-  /// subframe to act upon for reception of prach BL/CE UEs
-  int subframe_prach_br;
-#endif
-  /// frame to act upon for reception
-  int frame_rx;
-  /// frame to act upon for transmission
-  int frame_tx;
-  /// unwrapped frame count
-  int frame_tx_unwrap;
-  /// frame to act upon for reception of prach
-  int frame_prach;
-#ifdef Rel14
-  /// frame to act upon for reception of prach
-  int frame_prach_br;
-#endif
-  /// frame offset for slave RUs (to correct for frame asynchronism at startup)
-  int frame_offset;
-  /// \brief Instance count for FH processing thread.
-  /// \internal This variable is protected by \ref mutex_FH.
-  int instance_cnt_FH;
-  int instance_cnt_FH1;
-  /// \internal This variable is protected by \ref mutex_prach.
-  int instance_cnt_prach;
-#ifdef Rel14
-  /// \internal This variable is protected by \ref mutex_prach.
-  int instance_cnt_prach_br;
-#endif
-  /// \internal This variable is protected by \ref mutex_synch.
-  int instance_cnt_synch;
-  /// \internal This variable is protected by \ref mutex_eNBs.
-  int instance_cnt_eNBs;
-  int instance_cnt_gNBs;
-  /// \brief Instance count for rx processing thread.
-  /// \internal This variable is protected by \ref mutex_asynch_rxtx.
-  int instance_cnt_asynch_rxtx;
-  /// \internal This variable is protected by \ref mutex_fep
-  int instance_cnt_fep;
-  /// \internal This variable is protected by \ref mutex_feptx
-  int instance_cnt_feptx;
-  /// This varible is protected by \ref mutex_emulatedRF
-  int instance_cnt_emulateRF;
-  /// pthread structure for RU FH processing thread
-  pthread_t pthread_FH;
-  pthread_t pthread_FH1;
-  /// pthread structure for RU prach processing thread
-  pthread_t pthread_prach;
-#ifdef Rel14
-  /// pthread structure for RU prach processing thread BL/CE UEs
-  pthread_t pthread_prach_br;
-#endif
-  /// pthread struct for RU synch thread
-  pthread_t pthread_synch;
-  /// pthread struct for RU RX FEP worker thread
-  pthread_t pthread_fep;
-  /// pthread struct for RU TX FEP worker thread
-  pthread_t pthread_feptx;
-  /// pthread struct for emulated RF
-  pthread_t pthread_emulateRF;
-  /// pthread structure for asychronous RX/TX processing thread
-  pthread_t pthread_asynch_rxtx;
-  /// flag to indicate first RX acquisition
-  int first_rx;
-  /// flag to indicate first TX transmission
-  int first_tx;
-  /// pthread attributes for RU FH processing thread
-  pthread_attr_t attr_FH;
-  pthread_attr_t attr_FH1;
-  /// pthread attributes for RU prach
-  pthread_attr_t attr_prach;
-#ifdef Rel14
-  /// pthread attributes for RU prach BL/CE UEs
-  pthread_attr_t attr_prach_br;
-#endif
-  /// pthread attributes for RU synch thread
-  pthread_attr_t attr_synch;
-  /// pthread attributes for asynchronous RX thread
-  pthread_attr_t attr_asynch_rxtx;
-  /// pthread attributes for worker fep thread
-  pthread_attr_t attr_fep;
-  /// pthread attributes for worker feptx thread
-  pthread_attr_t attr_feptx;
-  /// pthread attributes for emulated RF
-  pthread_attr_t attr_emulateRF;
-  /// scheduling parameters for RU FH thread
-  struct sched_param sched_param_FH;
-  struct sched_param sched_param_FH1;
-  /// scheduling parameters for RU prach thread
-  struct sched_param sched_param_prach;
-#ifdef Rel14
-  /// scheduling parameters for RU prach thread BL/CE UEs
-  struct sched_param sched_param_prach_br;
-#endif
-  /// scheduling parameters for RU synch thread
-  struct sched_param sched_param_synch;
-  /// scheduling parameters for asynch_rxtx thread
-  struct sched_param sched_param_asynch_rxtx;
-  /// condition variable for RU FH thread
-  pthread_cond_t cond_FH;
-  pthread_cond_t cond_FH1;
-  /// condition variable for RU prach thread
-  pthread_cond_t cond_prach;
-#ifdef Rel14
-  /// condition variable for RU prach thread BL/CE UEs
-  pthread_cond_t cond_prach_br;
-#endif
-  /// condition variable for RU synch thread
-  pthread_cond_t cond_synch;
-  /// condition variable for asynch RX/TX thread
-  pthread_cond_t cond_asynch_rxtx;
-  /// condition varible for RU RX FEP thread
-  pthread_cond_t cond_fep;
-  /// condition varible for RU TX FEP thread
-  pthread_cond_t cond_feptx;
-  /// condition varible for emulated RF
-  pthread_cond_t cond_emulateRF;
-  /// condition variable for eNB signal
-  pthread_cond_t cond_eNBs;
-  pthread_cond_t cond_gNBs;
-  /// mutex for RU FH
-  pthread_mutex_t mutex_FH;
-  pthread_mutex_t mutex_FH1;
-  /// mutex for RU prach
-  pthread_mutex_t mutex_prach;
-#ifdef Rel14
-  /// mutex for RU prach BL/CE UEs
-  pthread_mutex_t mutex_prach_br;
-#endif
-  /// mutex for RU synch
-  pthread_mutex_t mutex_synch;
-  /// mutex for eNB signal
-  pthread_mutex_t mutex_eNBs;
-  pthread_mutex_t mutex_gNBs;
-  /// mutex for asynch RX/TX thread
-  pthread_mutex_t mutex_asynch_rxtx;
-  /// mutex for fep RX worker thread
-  pthread_mutex_t mutex_fep;
-  /// mutex for fep TX worker thread
-  pthread_mutex_t mutex_feptx;
-  /// mutex for emulated RF thread
-  pthread_mutex_t mutex_emulateRF;
-  /// symbol mask for IF4p5 reception per subframe
-  uint32_t symbol_mask[10];
-  /// number of slave threads
-  int                  num_slaves;
-  /// array of pointers to slaves
-  struct RU_proc_t_s           **slave_proc;
-  /// pipeline ready state
-  int ru_rx_ready;
-  int ru_tx_ready;
-} RU_proc_t;
-
-
-
-
-typedef enum {
-  LOCAL_RF        =0,
-  REMOTE_IF5      =1,
-  REMOTE_MBP_IF5  =2,
-  REMOTE_IF4p5    =3,
-  REMOTE_IF1pp    =4,
-  MAX_RU_IF_TYPES =5
-  //EMULATE_RF      =6
-} RU_if_south_t;
-
-typedef struct RU_t_s{
-  /// index of this ru
-  uint32_t idx;
- /// Pointer to configuration file
-  char *rf_config_file;
-  /// southbound interface
-  RU_if_south_t if_south;
-  /// timing
-  node_timing_t if_timing;
-  /// function
-  node_function_t function;
-  /// Ethernet parameters for fronthaul interface
-  eth_params_t eth_params;
-  /// flag to indicate the RU is in synch with a master reference
-  int in_synch;
-  /// timing offset
-  int rx_offset;        
-  /// flag to indicate the RU is a slave to another source
-  int is_slave;
-  /// Total gain of receive chain
-  uint32_t             rx_total_gain_dB;
-  /// number of bands that this device can support
-  int num_bands;
-  /// band list
-  int band[MAX_BANDS_PER_RRU];
-  /// number of RX paths on device
-  int nb_rx;
-  /// number of TX paths on device
-  int nb_tx;
-  /// maximum PDSCH RS EPRE
-  int max_pdschReferenceSignalPower;
-  /// maximum RX gain
-  int max_rxgain;
-  /// Attenuation of RX paths on device
-  int att_rx;
-  /// Attenuation of TX paths on device
-  int att_tx;
-  /// flag to indicate precoding operation in RU
-  int do_precoding;
-  /// Frame parameters
-  LTE_DL_FRAME_PARMS frame_parms;
-  NR_DL_FRAME_PARMS nr_frame_parms;
-  ///timing offset used in TDD
-  int              N_TA_offset; 
-  /// RF device descriptor
-  openair0_device rfdevice;
-  /// HW configuration
-  openair0_config_t openair0_cfg;
-  /// Number of NBs using this RU
-  int num_eNB;
-  int num_gNB;
-  /// list of NBs using this RU
-  struct PHY_VARS_eNB_s *eNB_list[NUMBER_OF_eNB_MAX];
-  struct PHY_VARS_gNB_s *gNB_list[NUMBER_OF_eNB_MAX];
-  /// Mapping of antenna ports to RF chain index
-  openair0_rf_map      rf_map;
-  /// IF device descriptor
-  openair0_device ifdevice;
-  /// Pointer for ifdevice buffer struct
-  if_buffer_t ifbuffer;
-  /// if prach processing is to be performed in RU
-  int                  do_prach;
-  /// function pointer to synchronous RX fronthaul function (RRU,3GPP_eNB/3GPP_gNB)
-  void                 (*fh_south_in)(struct RU_t_s *ru,int *frame, int *subframe);
-  /// function pointer to synchronous TX fronthaul function
-  void                 (*fh_south_out)(struct RU_t_s *ru);
-  /// function pointer to synchronous RX fronthaul function (RRU)
-  void                 (*fh_north_in)(struct RU_t_s *ru,int *frame, int *subframe);
-  /// function pointer to synchronous RX fronthaul function (RRU)
-  void                 (*fh_north_out)(struct RU_t_s *ru);
-  /// function pointer to asynchronous fronthaul interface
-  void                 (*fh_north_asynch_in)(struct RU_t_s *ru,int *frame, int *subframe);
-  /// function pointer to asynchronous fronthaul interface
-  void                 (*fh_south_asynch_in)(struct RU_t_s *ru,int *frame, int *subframe);
-  /// function pointer to initialization function for radio interface
-  int                  (*start_rf)(struct RU_t_s *ru);
-  /// function pointer to release function for radio interface
-  int                  (*stop_rf)(struct RU_t_s *ru);
-  /// function pointer to initialization function for radio interface
-  int                  (*start_if)(struct RU_t_s *ru,struct PHY_VARS_eNB_s *eNB);
-  /// function pointer to RX front-end processing routine (DFTs/prefix removal or NULL)
-  void                 (*feprx)(struct RU_t_s *ru);
-  /// function pointer to TX front-end processing routine (IDFTs and prefix removal or NULL)
-  void                 (*feptx_ofdm)(struct RU_t_s *ru);
-  /// function pointer to TX front-end processing routine (PRECODING)
-  void                 (*feptx_prec)(struct RU_t_s *ru);
-  /// function pointer to wakeup routine in lte-enb/nr-gnb.
-  int (*wakeup_rxtx)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru);
-  int (*nr_wakeup_rxtx)(struct PHY_VARS_gNB_s *gNB, struct RU_t_s *ru);
-  /// function pointer to wakeup routine in lte-enb/nr-gnb.
-  void (*wakeup_prach_eNB)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
-<<<<<<< HEAD:openair1/PHY/defs.h
-  void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *gNB,struct RU_t_s *ru,int frame,int subframe);
-  #ifdef Rel14
-  /// function pointer to wakeup routine in lte-enb.
-  void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
-  #endif
-
-  /// function pointer to NB entry routine
-  void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string);
-  void (*gNB_top)(struct PHY_VARS_gNB_s *eNB, int frame_rx, int subframe_rx, char *string);
-=======
-#ifdef Rel14
-  /// function pointer to wakeup routine in lte-enb.
-  void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB,struct RU_t_s *ru,int frame,int subframe);
-#endif
-  /// function pointer to eNB entry routine
-  void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
->>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h
-  /// Timing statistics
-  time_stats_t ofdm_demod_stats;
-  /// Timing statistics (TX)
-  time_stats_t ofdm_mod_stats;
-<<<<<<< HEAD:openair1/PHY/defs.h
-=======
-  /// Timing wait statistics
-  time_stats_t ofdm_demod_wait_stats;
-  /// Timing wakeup statistics
-  time_stats_t ofdm_demod_wakeup_stats;
-  /// Timing wait statistics (TX)
-  time_stats_t ofdm_mod_wait_stats;
-  /// Timing wakeup statistics (TX)
-  time_stats_t ofdm_mod_wakeup_stats;
->>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h
-  /// Timing statistics (RX Fronthaul + Compression)
-  time_stats_t rx_fhaul;
-  /// Timing statistics (TX Fronthaul + Compression)
-  time_stats_t tx_fhaul; 
-  /// Timong statistics (Compression)
-  time_stats_t compression;
-  /// Timing statistics (Fronthaul transport)
-  time_stats_t transport;
-  /// RX and TX buffers for precoder output
-  RU_COMMON            common;
-  /// beamforming weight vectors per eNB
-  int32_t **beam_weights[NUMBER_OF_eNB_MAX+1][15];
-
-  /// received frequency-domain signal for PRACH (IF4p5 RRU) 
-  int16_t              **prach_rxsigF;
-  /// received frequency-domain signal for PRACH BR (IF4p5 RRU) 
-  int16_t              **prach_rxsigF_br[4];
-  /// sequence number for IF5
-  uint8_t seqno;
-  /// initial timestamp used as an offset make first real timestamp 0
-  openair0_timestamp   ts_offset;
-  /// process scheduling variables
-  RU_proc_t            proc;
-<<<<<<< HEAD:openair1/PHY/defs.h
-=======
-  /// stats thread pthread descriptor
-  pthread_t            ru_stats_thread;
-
-} RU_t;
-
-
-
-#define MAX_RRU_CONFIG_SIZE 1024
-typedef enum {
-  RAU_tick=0,
-  RRU_capabilities=1,
-  RRU_config=2,
-  RRU_MSG_max_num=3
-} rru_config_msg_type_t;
-
-typedef struct RRU_CONFIG_msg_s {
-  rru_config_msg_type_t type;
-  ssize_t len;
-  uint8_t msg[MAX_RRU_CONFIG_SIZE];
-} RRU_CONFIG_msg_t;
-
-typedef enum {
-  OAI_IF5_only      =0,
-  OAI_IF4p5_only    =1,
-  OAI_IF5_and_IF4p5 =2,
-  MBP_IF5           =3,
-  MAX_FH_FMTs       =4
-} FH_fmt_options_t;
-
-#define MAX_BANDS_PER_RRU 4
-
-typedef struct RRU_capabilities_s {
-  /// Fronthaul format
-  FH_fmt_options_t FH_fmt;
-  /// number of EUTRA bands (<=4) supported by RRU
-  uint8_t          num_bands;
-  /// EUTRA band list supported by RRU
-  uint8_t          band_list[MAX_BANDS_PER_RRU];
-  /// Number of concurrent bands (component carriers)
-  uint8_t          num_concurrent_bands;
-  /// Maximum TX EPRE of each band
-  int8_t           max_pdschReferenceSignalPower[MAX_BANDS_PER_RRU];
-  /// Maximum RX gain of each band
-  uint8_t          max_rxgain[MAX_BANDS_PER_RRU];
-  /// Number of RX ports of each band
-  uint8_t          nb_rx[MAX_BANDS_PER_RRU];
-  /// Number of TX ports of each band
-  uint8_t          nb_tx[MAX_BANDS_PER_RRU]; 
-  /// max DL bandwidth (1,6,15,25,50,75,100)
-  uint8_t          N_RB_DL[MAX_BANDS_PER_RRU];
-  /// max UL bandwidth (1,6,15,25,50,75,100)
-  uint8_t          N_RB_UL[MAX_BANDS_PER_RRU];
-} RRU_capabilities_t;
-
-typedef struct RRU_config_s {
-
-  /// Fronthaul format
-  RU_if_south_t FH_fmt;
-  /// number of EUTRA bands (<=4) configured in RRU
-  uint8_t num_bands;
-  /// EUTRA band list configured in RRU
-  uint8_t band_list[MAX_BANDS_PER_RRU];
-  /// TDD configuration (0-6)
-  uint8_t tdd_config[MAX_BANDS_PER_RRU];
-  /// TDD special subframe configuration (0-10)
-  uint8_t tdd_config_S[MAX_BANDS_PER_RRU];
-  /// TX frequency
-  uint32_t tx_freq[MAX_BANDS_PER_RRU];
-  /// RX frequency
-  uint32_t rx_freq[MAX_BANDS_PER_RRU];
-  /// TX attenation w.r.t. max
-  uint8_t att_tx[MAX_BANDS_PER_RRU];
-  /// RX attenuation w.r.t. max
-  uint8_t att_rx[MAX_BANDS_PER_RRU];
-  /// DL bandwidth
-  uint8_t N_RB_DL[MAX_BANDS_PER_RRU];
-  /// UL bandwidth
-  uint8_t N_RB_UL[MAX_BANDS_PER_RRU];
-  /// 3/4 sampling rate
-  uint8_t threequarter_fs[MAX_BANDS_PER_RRU];
-  /// prach_FreqOffset for IF4p5
-  int prach_FreqOffset[MAX_BANDS_PER_RRU];
-  /// prach_ConfigIndex for IF4p5
-  int prach_ConfigIndex[MAX_BANDS_PER_RRU];
-#ifdef Rel14
-  int emtc_prach_CElevel_enable[MAX_BANDS_PER_RRU][4];
-  /// emtc_prach_FreqOffset for IF4p5 per CE Level
-  int emtc_prach_FreqOffset[MAX_BANDS_PER_RRU][4];
-  /// emtc_prach_ConfigIndex for IF4p5 per CE Level
-  int emtc_prach_ConfigIndex[MAX_BANDS_PER_RRU][4];
-#endif
-} RRU_config_t;
-
 
 typedef struct {
   /// \brief Pointers (dynamic) to the received data in the time domain.
@@ -1020,7 +433,6 @@ typedef struct eNB_proc_t_s {
   te_params tep[3];
   /// set of scheduling variables RXn-TXnp4 threads
   eNB_rxtx_proc_t proc_rxtx[2];
->>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h
   /// stats thread pthread descriptor
   pthread_t process_stats_thread;
   /// for waking up tx procedure
@@ -1028,10 +440,6 @@ typedef struct eNB_proc_t_s {
 } eNB_proc_t;
 
 
-
-
-
-
 typedef struct {
   //unsigned int   rx_power[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];     //! estimated received signal power (linear)
   //unsigned short rx_power_dB[NUMBER_OF_CONNECTED_eNB_MAX][NB_ANTENNAS_RX];  //! estimated received signal power (dB)
@@ -1323,500 +731,5 @@ typedef struct PHY_VARS_eNB_s {
   int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
 } PHY_VARS_eNB;
 
-
-
-
-
-<<<<<<< HEAD:openair1/PHY/defs.h
-  printf( "waiting for sync (%s)\n",thread_name);
-  pthread_mutex_lock( &sync_mutex );
-  
-  while (sync_var<0)
-    pthread_cond_wait( &sync_cond, &sync_mutex );
-  
-  pthread_mutex_unlock(&sync_mutex);
-  
-  printf( "got sync (%s)\n", thread_name);
-
-}
-
-static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
-  if (pthread_mutex_lock(mutex) != 0) {
-    LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-
-  while (*instance_cnt < 0) {
-    // most of the time the thread is waiting here
-    // proc->instance_cnt_rxtx is -1
-    pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
-  }
-
-  if (pthread_mutex_unlock(mutex) != 0) {
-    LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-  return(0);
-}
-
-static inline int wait_on_busy_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
-
-  if (pthread_mutex_lock(mutex) != 0) {
-    LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-
-  while (*instance_cnt == 0) {
-    // most of the time the thread will skip this
-    // waits only if proc->instance_cnt_rxtx is 0
-    pthread_cond_wait(cond,mutex); // this unlocks mutex_rxtx while waiting and then locks it again
-  }
-
-  if (pthread_mutex_unlock(mutex) != 0) {
-    LOG_E(PHY,"[SCHED][eNB] error unlocking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-  return(0);
-}
-
-static inline int release_thread(pthread_mutex_t *mutex,int *instance_cnt,char *name) {
-
-  if (pthread_mutex_lock(mutex) != 0) {
-    LOG_E( PHY, "[SCHED][eNB] error locking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-
-  *instance_cnt=*instance_cnt-1;
-
-  if (pthread_mutex_unlock(mutex) != 0) {
-    LOG_E( PHY, "[SCHED][eNB] error unlocking mutex for %s\n",name);
-    exit_fun("nothing to add");
-    return(-1);
-  }
-  return(0);
-}
-
-//#include "defs_NR.h"
-#if 1 //temp solution to include NR defs
-
-#include "impl_defs_nr.h"
-
-#define MAX_NUM_SUBCARRIER_SPACING 5
-
-#define NR_SYMBOLS_PER_SLOT 14
-
-#define NR_PSS_LENGTH 127
-#define NR_SSS_LENGTH 127
-
-#define ONE_OVER_SQRT2_Q15 23170
-#define ONE_OVER_TWO_Q15 16384
-
-#define MOD_TABLE_SIZE_SHORT 6
-#define MOD_TABLE_BPSK_OFFSET 1
-
-typedef enum {
-  NR_MU_0=0,
-  NR_MU_1,
-  NR_MU_2,
-  NR_MU_3,
-  NR_MU_4,
-} nr_numerology_index_e;
-
-
-/// Context data structure for RX/TX portion of subframe processing
-typedef struct {
-  /// Component Carrier index
-  uint8_t              CC_id;
-  /// timestamp transmitted to HW
-  openair0_timestamp timestamp_tx;
-  /// subframe to act upon for transmission
-  int subframe_tx;
-  /// subframe to act upon for reception
-  int subframe_rx;
-  /// frame to act upon for transmission
-  int frame_tx;
-  /// frame to act upon for reception
-  int frame_rx;
-  /// \brief Instance count for RXn-TXnp4 processing thread.
-  /// \internal This variable is protected by \ref mutex_rxtx.
-  int instance_cnt_rxtx;
-  /// pthread structure for RXn-TXnp4 processing thread
-  pthread_t pthread_rxtx;
-  /// pthread attributes for RXn-TXnp4 processing thread
-  pthread_attr_t attr_rxtx;
-  /// condition variable for tx processing thread
-  pthread_cond_t cond_rxtx;
-  /// mutex for RXn-TXnp4 processing thread
-  pthread_mutex_t mutex_rxtx;
-  /// scheduling parameters for RXn-TXnp4 thread
-  struct sched_param sched_param_rxtx;
-} gNB_rxtx_proc_t;
-
-
-/// Context data structure for eNB subframe processing
-typedef struct gNB_proc_t_s {
-  /// Component Carrier index
-  uint8_t              CC_id;
-  /// thread index
-  int thread_index;
-  /// timestamp received from HW
-  openair0_timestamp timestamp_rx;
-  /// timestamp to send to "slave rru"
-  openair0_timestamp timestamp_tx;
-  /// subframe to act upon for reception
-  int subframe_rx;
-  /// subframe to act upon for PRACH
-  int subframe_prach;
-  /// frame to act upon for reception
-  int frame_rx;
-  /// frame to act upon for transmission
-  int frame_tx;
-  /// frame to act upon for PRACH
-  int frame_prach;
-  /// \internal This variable is protected by \ref mutex_td.
-  int instance_cnt_td;
-  /// \internal This variable is protected by \ref mutex_te.
-  int instance_cnt_te;
-  /// \internal This variable is protected by \ref mutex_prach.
-  int instance_cnt_prach;
-
-  // instance count for over-the-air gNB synchronization
-  int instance_cnt_synch;
-  /// \internal This variable is protected by \ref mutex_asynch_rxtx.
-  int instance_cnt_asynch_rxtx;
-  /// pthread structure for eNB single processing thread
-  pthread_t pthread_single;
-  /// pthread structure for asychronous RX/TX processing thread
-  pthread_t pthread_asynch_rxtx;
-  /// flag to indicate first RX acquisition
-  int first_rx;
-  /// flag to indicate first TX transmission
-  int first_tx;
-  /// pthread attributes for single gNB processing thread
-  pthread_attr_t attr_single;
-  /// pthread attributes for prach processing thread
-  pthread_attr_t attr_prach;
-  /// pthread attributes for asynchronous RX thread
-  pthread_attr_t attr_asynch_rxtx;
-  /// scheduling parameters for parallel turbo-decoder thread
-  struct sched_param sched_param_td;
-  /// scheduling parameters for parallel turbo-encoder thread
-  struct sched_param sched_param_te;
-  /// scheduling parameters for single eNB thread
-  struct sched_param sched_param_single;
-  /// scheduling parameters for prach thread
-  struct sched_param sched_param_prach;
-  /// scheduling parameters for asynch_rxtx thread
-  struct sched_param sched_param_asynch_rxtx;
-  pthread_cond_t cond_prach;
-  /// condition variable for asynch RX/TX thread
-  pthread_cond_t cond_asynch_rxtx;
-  /// mutex for parallel turbo-decoder thread
-  pthread_mutex_t mutex_td;
-  /// mutex for parallel turbo-encoder thread
-  pthread_mutex_t mutex_te;
-  /// mutex for PRACH thread
-  pthread_mutex_t mutex_prach;
-  /// mutex for asynch RX/TX thread
-  pthread_mutex_t mutex_asynch_rxtx;
-  /// mutex for RU access to eNB processing (PDSCH/PUSCH)
-  pthread_mutex_t mutex_RU;
-  /// mutex for RU access to eNB processing (PRACH)
-  pthread_mutex_t mutex_RU_PRACH;
-  /// mutex for RU access to eNB processing (PRACH BR)
-  pthread_mutex_t mutex_RU_PRACH_br;
-  /// mask for RUs serving eNB (PDSCH/PUSCH)
-  int RU_mask;
-  /// mask for RUs serving eNB (PRACH)
-  int RU_mask_prach;
-  /// set of scheduling variables RXn-TXnp4 threads
-  gNB_rxtx_proc_t proc_rxtx[2];
-} gNB_proc_t;
-
-typedef struct {
-  // common measurements
-  //! estimated noise power (linear)
-  unsigned int   n0_power[MAX_NUM_RU_PER_eNB];
-  //! estimated noise power (dB)
-  unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
-  //! total estimated noise power (linear)
-  unsigned int   n0_power_tot;
-  //! estimated avg noise power (dB)
-  unsigned short n0_power_tot_dB;
-  //! estimated avg noise power (dB)
-  short n0_power_tot_dBm;
-  //! estimated avg noise power per RB per RX ant (lin)
-  unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
-  //! estimated avg noise power per RB per RX ant (dB)
-  unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
-  //! estimated avg noise power per RB (dB)
-  short n0_subband_power_tot_dB[100];
-  //! estimated avg noise power per RB (dBm)
-  short n0_subband_power_tot_dBm[100];
-  // gNB measurements (per user)
-  //! estimated received spatial signal power (linear)
-  unsigned int   rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
-  //! estimated received spatial signal power (dB)
-  unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
-  //! estimated rssi (dBm)
-  short          rx_rssi_dBm[NUMBER_OF_UE_MAX];
-  //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
-  int            rx_correlation[NUMBER_OF_UE_MAX][2];
-  //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
-  int            rx_correlation_dB[NUMBER_OF_UE_MAX][2];
-
-  /// Wideband CQI (= SINR)
-  int            wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
-  /// Wideband CQI in dB (= SINR dB)
-  int            wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
-  /// Wideband CQI (sum of all RX antennas, in dB)
-  char           wideband_cqi_tot[NUMBER_OF_UE_MAX];
-  /// Subband CQI per RX antenna and RB (= SINR)
-  int            subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
-  /// Total Subband CQI and RB (= SINR)
-  int            subband_cqi_tot[NUMBER_OF_UE_MAX][100];
-  /// Subband CQI in dB and RB (= SINR dB)
-  int            subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
-  /// Total Subband CQI and RB
-  int            subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
-  /// PRACH background noise level
-  int            prach_I0;
-} PHY_MEASUREMENTS_gNB;
-
-/// Top-level PHY Data Structure for gNB
-typedef struct PHY_VARS_gNB_s {
-  /// Module ID indicator for this instance
-  module_id_t          Mod_id;
-  uint8_t              CC_id;
-  uint8_t              configured;
-  gNB_proc_t           proc;
-  int                  single_thread_flag;
-  int                  abstraction_flag;
-  int                  num_RU;
-  RU_t                 *RU_list[MAX_NUM_RU_PER_eNB];
-  /// Ethernet parameters for northbound midhaul interface
-  eth_params_t         eth_params_n;
-  /// Ethernet parameters for fronthaul interface
-  eth_params_t         eth_params;
-  int                  rx_total_gain_dB;
-  int                  (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB);
-  uint8_t              local_flag;
-  nfapi_config_request_t  gNB_config;
-  NR_DL_FRAME_PARMS   frame_parms;
-  PHY_MEASUREMENTS_gNB measurements;
-  IF_Module_t          *if_inst;
-  UL_IND_t             UL_INFO;
-  pthread_mutex_t      UL_INFO_mutex;
-  /// NFAPI RX ULSCH information
-  nfapi_rx_indication_pdu_t  rx_pdu_list[NFAPI_RX_IND_MAX_PDU];
-  /// NFAPI RX ULSCH CRC information
-  nfapi_crc_indication_pdu_t crc_pdu_list[NFAPI_CRC_IND_MAX_PDU];
-  /// NFAPI HARQ information
-  nfapi_harq_indication_pdu_t harq_pdu_list[NFAPI_HARQ_IND_MAX_PDU];
-  /// NFAPI SR information
-  nfapi_sr_indication_pdu_t sr_pdu_list[NFAPI_SR_IND_MAX_PDU];
-  /// NFAPI CQI information
-  nfapi_cqi_indication_pdu_t cqi_pdu_list[NFAPI_CQI_IND_MAX_PDU];
-  /// NFAPI CQI information (raw component)
-  nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU];
-  /// NFAPI PRACH information
-  nfapi_preamble_pdu_t preamble_list[MAX_NUM_RX_PRACH_PREAMBLES];
-
-  Sched_Rsp_t          Sched_INFO;
-  LTE_eNB_PDCCH        pdcch_vars[2];
-  LTE_eNB_PHICH        phich_vars[2];
-
-  NR_gNB_COMMON       common_vars;
-  LTE_eNB_UCI          uci_vars[NUMBER_OF_UE_MAX];
-  LTE_eNB_SRS          srs_vars[NUMBER_OF_UE_MAX];
-  LTE_eNB_PBCH         pbch;
-  LTE_eNB_PUSCH       *pusch_vars[NUMBER_OF_UE_MAX];
-  LTE_eNB_PRACH        prach_vars;
-  LTE_eNB_DLSCH_t     *dlsch[NUMBER_OF_UE_MAX][2];   // Nusers times two spatial streams
-  LTE_eNB_ULSCH_t     *ulsch[NUMBER_OF_UE_MAX+1];      // Nusers + number of RA
-  LTE_eNB_DLSCH_t     *dlsch_SI,*dlsch_ra,*dlsch_p;
-  LTE_eNB_DLSCH_t     *dlsch_MCH;
-  LTE_eNB_DLSCH_t     *dlsch_PCH;
-  LTE_eNB_UE_stats     UE_stats[NUMBER_OF_UE_MAX];
-  LTE_eNB_UE_stats    *UE_stats_ptr[NUMBER_OF_UE_MAX];
-
-  uint8_t pbch_configured;
-  uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
-  char gNB_generate_rar;
-
-  /// NR synchronization sequences
-  int16_t d_pss[NR_PSS_LENGTH];
-  int16_t d_sss[NR_SSS_LENGTH];
-
-  /// PBCH DMRS sequence
-  uint32_t nr_gold_pbch_dmrs[2][64][NR_PBCH_DMRS_LENGTH_DWORD];
-
-  /// Indicator set to 0 after first SR
-  uint8_t first_sr[NUMBER_OF_UE_MAX];
-
-  uint32_t max_peak_val;
-
-  /// \brief sinr for all subcarriers of the current link (used only for abstraction).
-  /// first index: ? [0..N_RB_DL*12[
-  double *sinr_dB;
-
-  /// N0 (used for abstraction)
-  double N0;
-
-  unsigned char first_run_timing_advance[NUMBER_OF_UE_MAX];
-  unsigned char first_run_I0_measurements;
-
-  
-  unsigned char    is_secondary_gNB; // primary by default
-  unsigned char    is_init_sync;     /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
-  unsigned char    has_valid_precoder; /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from, and this B/F vector is created.
-  unsigned char    PgNB_id;          /// id of Primary eNB
-
-  /// hold the precoder for NULL beam to the primary user
-  int              **dl_precoder_SgNB[3];
-  char             log2_maxp; /// holds the maximum channel/precoder coefficient
-
-  /// if ==0 enables phy only test mode
-  int mac_enabled;
-  /// counter to average prach energh over first 100 prach opportunities
-  int prach_energy_counter;
-
-  // PDSCH Varaibles
-  PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX];
-
-  // PUSCH Varaibles
-  PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_UE_MAX];
-
-  // PUCCH variables
-  PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_UE_MAX];
-
-  // UL-POWER-Control
-  UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_UE_MAX];
-
-  // TPC
-  TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_UE_MAX];
-  TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_UE_MAX];
-
-  // CQI reporting
-  CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_UE_MAX];
-
-  // SRS Variables
-  SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX];
-  uint8_t ncs_cell[20][7];
-
-  // Scheduling Request Config
-  SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_UE_MAX];
-
-  // Transmission mode per UE
-  uint8_t transmission_mode[NUMBER_OF_UE_MAX];
-
-  /// cba_last successful reception for each group, used for collision detection
-  uint8_t cba_last_reception[4];
-
-  // Pointers for active physicalConfigDedicated to be applied in current subframe
-  struct PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX];
-
-
-  uint32_t rb_mask_ul[4];
-
-  /// Information regarding TM5
-  MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX];
-
-
-  /// target_ue_dl_mcs : only for debug purposes
-  uint32_t target_ue_dl_mcs;
-  /// target_ue_ul_mcs : only for debug purposes
-  uint32_t target_ue_ul_mcs;
-  /// target_ue_dl_rballoc : only for debug purposes
-  uint32_t ue_dl_rb_alloc;
-  /// target ul PRBs : only for debug
-  uint32_t ue_ul_nb_rb;
-
-  ///check for Total Transmissions
-  uint32_t check_for_total_transmissions;
-
-  ///check for MU-MIMO Transmissions
-  uint32_t check_for_MUMIMO_transmissions;
-
-  ///check for SU-MIMO Transmissions
-  uint32_t check_for_SUMIMO_transmissions;
-
-  ///check for FULL MU-MIMO Transmissions
-  uint32_t  FULL_MUMIMO_transmissions;
-
-  /// Counter for total bitrate, bits and throughput in downlink
-  uint32_t total_dlsch_bitrate;
-  uint32_t total_transmitted_bits;
-  uint32_t total_system_throughput;
-
-  int hw_timing_advance;
-
-  time_stats_t phy_proc;
-  time_stats_t phy_proc_tx;
-  time_stats_t phy_proc_rx;
-  time_stats_t rx_prach;
-
-  time_stats_t ofdm_mod_stats;
-  time_stats_t dlsch_encoding_stats;
-  time_stats_t dlsch_modulation_stats;
-  time_stats_t dlsch_scrambling_stats;
-  time_stats_t dlsch_rate_matching_stats;
-  time_stats_t dlsch_turbo_encoding_stats;
-  time_stats_t dlsch_interleaving_stats;
-
-  time_stats_t rx_dft_stats;
-  time_stats_t ulsch_channel_estimation_stats;
-  time_stats_t ulsch_freq_offset_estimation_stats;
-  time_stats_t ulsch_decoding_stats;
-  time_stats_t ulsch_demodulation_stats;
-  time_stats_t ulsch_rate_unmatching_stats;
-  time_stats_t ulsch_turbo_decoding_stats;
-  time_stats_t ulsch_deinterleaving_stats;
-  time_stats_t ulsch_demultiplexing_stats;
-  time_stats_t ulsch_llr_stats;
-  time_stats_t ulsch_tc_init_stats;
-  time_stats_t ulsch_tc_alpha_stats;
-  time_stats_t ulsch_tc_beta_stats;
-  time_stats_t ulsch_tc_gamma_stats;
-  time_stats_t ulsch_tc_ext_stats;
-  time_stats_t ulsch_tc_intl1_stats;
-  time_stats_t ulsch_tc_intl2_stats;
-
-#ifdef LOCALIZATION
-  /// time state for localization
-  time_stats_t localization_stats;
-#endif
-
-  int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10];
-  int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024];
-  int32_t pucch1_stats_thres[NUMBER_OF_UE_MAX][10*1024];
-  int32_t pucch1ab_stats_cnt[NUMBER_OF_UE_MAX][10];
-  int32_t pucch1ab_stats[NUMBER_OF_UE_MAX][2*10*1024];
-  int32_t pusch_stats_rb[NUMBER_OF_UE_MAX][10240];
-  int32_t pusch_stats_round[NUMBER_OF_UE_MAX][10240];
-  int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240];
-  int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240];
-  int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
-} PHY_VARS_gNB;
-
-
-#endif
-
-
-
-#include "PHY/INIT/defs.h"
-#include "PHY/LTE_REFSIG/defs.h"
-#include "PHY/MODULATION/defs.h"
-#include "PHY/LTE_TRANSPORT/proto.h"
-#include "PHY/LTE_ESTIMATION/defs.h"
-
-#include "SIMULATION/ETH_TRANSPORT/defs.h"
-#endif //  __PHY_DEFS__H__
-=======
 #endif //  __PHY_DEFS_eNB_H__
->>>>>>> develop-uedirectorysplit:openair1/PHY/defs_eNB.h
+
diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h
new file mode 100644
index 0000000000000000000000000000000000000000..7706a6642580a29ed5abd9685268b9729a53114d
--- /dev/null
+++ b/openair1/PHY/defs_gNB.h
@@ -0,0 +1,437 @@
+/*
+ * 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 PHY/defs_gNB.h
+ \brief Top-level defines and structure definitions for gNB
+ \author Guy De Souza
+ \date 2018
+ \version 0.1
+ \company Eurecom
+ \email: desouza@eurecom.fr
+ \note
+ \warning
+*/
+#ifndef __PHY_DEFS_GNB__H__
+#define __PHY_DEFS_GNB__H__
+
+#include "defs_eNB.h"
+#include "defs_nr_common.h"
+
+
+typedef struct {
+  /// \brief Pointers (dynamic) to the received data in the time domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdata;
+  /// \brief Pointers (dynamic) to the received data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
+  int32_t **rxdataF;
+  /// \brief holds the transmit data in the frequency domain.
+  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
+  /// - third index: sample [0..]
+  int32_t **txdataF;
+} NR_gNB_COMMON;
+
+
+/// Context data structure for RX/TX portion of subframe processing
+typedef struct {
+  /// Component Carrier index
+  uint8_t              CC_id;
+  /// timestamp transmitted to HW
+  openair0_timestamp timestamp_tx;
+  /// subframe to act upon for transmission
+  int subframe_tx;
+  /// subframe to act upon for reception
+  int subframe_rx;
+  /// frame to act upon for transmission
+  int frame_tx;
+  /// frame to act upon for reception
+  int frame_rx;
+  /// \brief Instance count for RXn-TXnp4 processing thread.
+  /// \internal This variable is protected by \ref mutex_rxtx.
+  int instance_cnt_rxtx;
+  /// pthread structure for RXn-TXnp4 processing thread
+  pthread_t pthread_rxtx;
+  /// pthread attributes for RXn-TXnp4 processing thread
+  pthread_attr_t attr_rxtx;
+  /// condition variable for tx processing thread
+  pthread_cond_t cond_rxtx;
+  /// mutex for RXn-TXnp4 processing thread
+  pthread_mutex_t mutex_rxtx;
+  /// scheduling parameters for RXn-TXnp4 thread
+  struct sched_param sched_param_rxtx;
+} gNB_rxtx_proc_t;
+
+
+/// Context data structure for eNB subframe processing
+typedef struct gNB_proc_t_s {
+  /// Component Carrier index
+  uint8_t              CC_id;
+  /// thread index
+  int thread_index;
+  /// timestamp received from HW
+  openair0_timestamp timestamp_rx;
+  /// timestamp to send to "slave rru"
+  openair0_timestamp timestamp_tx;
+  /// subframe to act upon for reception
+  int subframe_rx;
+  /// subframe to act upon for PRACH
+  int subframe_prach;
+  /// frame to act upon for reception
+  int frame_rx;
+  /// frame to act upon for transmission
+  int frame_tx;
+  /// frame to act upon for PRACH
+  int frame_prach;
+  /// \internal This variable is protected by \ref mutex_td.
+  int instance_cnt_td;
+  /// \internal This variable is protected by \ref mutex_te.
+  int instance_cnt_te;
+  /// \internal This variable is protected by \ref mutex_prach.
+  int instance_cnt_prach;
+
+  // instance count for over-the-air gNB synchronization
+  int instance_cnt_synch;
+  /// \internal This variable is protected by \ref mutex_asynch_rxtx.
+  int instance_cnt_asynch_rxtx;
+  /// pthread structure for eNB single processing thread
+  pthread_t pthread_single;
+  /// pthread structure for asychronous RX/TX processing thread
+  pthread_t pthread_asynch_rxtx;
+  /// flag to indicate first RX acquisition
+  int first_rx;
+  /// flag to indicate first TX transmission
+  int first_tx;
+  /// pthread attributes for single gNB processing thread
+  pthread_attr_t attr_single;
+  /// pthread attributes for prach processing thread
+  pthread_attr_t attr_prach;
+  /// pthread attributes for asynchronous RX thread
+  pthread_attr_t attr_asynch_rxtx;
+  /// scheduling parameters for parallel turbo-decoder thread
+  struct sched_param sched_param_td;
+  /// scheduling parameters for parallel turbo-encoder thread
+  struct sched_param sched_param_te;
+  /// scheduling parameters for single eNB thread
+  struct sched_param sched_param_single;
+  /// scheduling parameters for prach thread
+  struct sched_param sched_param_prach;
+  /// scheduling parameters for asynch_rxtx thread
+  struct sched_param sched_param_asynch_rxtx;
+  pthread_cond_t cond_prach;
+  /// condition variable for asynch RX/TX thread
+  pthread_cond_t cond_asynch_rxtx;
+  /// mutex for parallel turbo-decoder thread
+  pthread_mutex_t mutex_td;
+  /// mutex for parallel turbo-encoder thread
+  pthread_mutex_t mutex_te;
+  /// mutex for PRACH thread
+  pthread_mutex_t mutex_prach;
+  /// mutex for asynch RX/TX thread
+  pthread_mutex_t mutex_asynch_rxtx;
+  /// mutex for RU access to eNB processing (PDSCH/PUSCH)
+  pthread_mutex_t mutex_RU;
+  /// mutex for RU access to eNB processing (PRACH)
+  pthread_mutex_t mutex_RU_PRACH;
+  /// mutex for RU access to eNB processing (PRACH BR)
+  pthread_mutex_t mutex_RU_PRACH_br;
+  /// mask for RUs serving eNB (PDSCH/PUSCH)
+  int RU_mask;
+  /// mask for RUs serving eNB (PRACH)
+  int RU_mask_prach;
+  /// set of scheduling variables RXn-TXnp4 threads
+  gNB_rxtx_proc_t proc_rxtx[2];
+} gNB_proc_t;
+
+
+
+typedef struct {
+  // common measurements
+  //! estimated noise power (linear)
+  unsigned int   n0_power[MAX_NUM_RU_PER_eNB];
+  //! estimated noise power (dB)
+  unsigned short n0_power_dB[MAX_NUM_RU_PER_eNB];
+  //! total estimated noise power (linear)
+  unsigned int   n0_power_tot;
+  //! estimated avg noise power (dB)
+  unsigned short n0_power_tot_dB;
+  //! estimated avg noise power (dB)
+  short n0_power_tot_dBm;
+  //! estimated avg noise power per RB per RX ant (lin)
+  unsigned short n0_subband_power[MAX_NUM_RU_PER_eNB][100];
+  //! estimated avg noise power per RB per RX ant (dB)
+  unsigned short n0_subband_power_dB[MAX_NUM_RU_PER_eNB][100];
+  //! estimated avg noise power per RB (dB)
+  short n0_subband_power_tot_dB[100];
+  //! estimated avg noise power per RB (dBm)
+  short n0_subband_power_tot_dBm[100];
+  // gNB measurements (per user)
+  //! estimated received spatial signal power (linear)
+  unsigned int   rx_spatial_power[NUMBER_OF_UE_MAX][2][2];
+  //! estimated received spatial signal power (dB)
+  unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2];
+  //! estimated rssi (dBm)
+  short          rx_rssi_dBm[NUMBER_OF_UE_MAX];
+  //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation[NUMBER_OF_UE_MAX][2];
+  //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation)
+  int            rx_correlation_dB[NUMBER_OF_UE_MAX][2];
+
+  /// Wideband CQI (= SINR)
+  int            wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
+  /// Wideband CQI in dB (= SINR dB)
+  int            wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB];
+  /// Wideband CQI (sum of all RX antennas, in dB)
+  char           wideband_cqi_tot[NUMBER_OF_UE_MAX];
+  /// Subband CQI per RX antenna and RB (= SINR)
+  int            subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
+  /// Total Subband CQI and RB (= SINR)
+  int            subband_cqi_tot[NUMBER_OF_UE_MAX][100];
+  /// Subband CQI in dB and RB (= SINR dB)
+  int            subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100];
+  /// Total Subband CQI and RB
+  int            subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100];
+  /// PRACH background noise level
+  int            prach_I0;
+} PHY_MEASUREMENTS_gNB;
+
+/// Top-level PHY Data Structure for gNB
+typedef struct PHY_VARS_gNB_s {
+  /// Module ID indicator for this instance
+  module_id_t          Mod_id;
+  uint8_t              CC_id;
+  uint8_t              configured;
+  gNB_proc_t           proc;
+  int                  single_thread_flag;
+  int                  abstraction_flag;
+  int                  num_RU;
+  RU_t                 *RU_list[MAX_NUM_RU_PER_eNB];
+  /// Ethernet parameters for northbound midhaul interface
+  eth_params_t         eth_params_n;
+  /// Ethernet parameters for fronthaul interface
+  eth_params_t         eth_params;
+  int                  rx_total_gain_dB;
+  int                  (*start_if)(struct RU_t_s *ru,struct PHY_VARS_gNB_s *gNB);
+  uint8_t              local_flag;
+  nfapi_config_request_t  gNB_config;
+  NR_DL_FRAME_PARMS   frame_parms;
+  PHY_MEASUREMENTS_gNB measurements;
+  IF_Module_t          *if_inst;
+  UL_IND_t             UL_INFO;
+  pthread_mutex_t      UL_INFO_mutex;
+  /// NFAPI RX ULSCH information
+  nfapi_rx_indication_pdu_t  rx_pdu_list[NFAPI_RX_IND_MAX_PDU];
+  /// NFAPI RX ULSCH CRC information
+  nfapi_crc_indication_pdu_t crc_pdu_list[NFAPI_CRC_IND_MAX_PDU];
+  /// NFAPI HARQ information
+  nfapi_harq_indication_pdu_t harq_pdu_list[NFAPI_HARQ_IND_MAX_PDU];
+  /// NFAPI SR information
+  nfapi_sr_indication_pdu_t sr_pdu_list[NFAPI_SR_IND_MAX_PDU];
+  /// NFAPI CQI information
+  nfapi_cqi_indication_pdu_t cqi_pdu_list[NFAPI_CQI_IND_MAX_PDU];
+  /// NFAPI CQI information (raw component)
+  nfapi_cqi_indication_raw_pdu_t cqi_raw_pdu_list[NFAPI_CQI_IND_MAX_PDU];
+  /// NFAPI PRACH information
+  nfapi_preamble_pdu_t preamble_list[MAX_NUM_RX_PRACH_PREAMBLES];
+
+  Sched_Rsp_t          Sched_INFO;
+  LTE_eNB_PDCCH        pdcch_vars[2];
+  LTE_eNB_PHICH        phich_vars[2];
+
+  NR_gNB_COMMON       common_vars;
+  LTE_eNB_UCI          uci_vars[NUMBER_OF_UE_MAX];
+  LTE_eNB_SRS          srs_vars[NUMBER_OF_UE_MAX];
+  LTE_eNB_PBCH         pbch;
+  LTE_eNB_PUSCH       *pusch_vars[NUMBER_OF_UE_MAX];
+  LTE_eNB_PRACH        prach_vars;
+  LTE_eNB_DLSCH_t     *dlsch[NUMBER_OF_UE_MAX][2];   // Nusers times two spatial streams
+  LTE_eNB_ULSCH_t     *ulsch[NUMBER_OF_UE_MAX+1];      // Nusers + number of RA
+  LTE_eNB_DLSCH_t     *dlsch_SI,*dlsch_ra,*dlsch_p;
+  LTE_eNB_DLSCH_t     *dlsch_MCH;
+  LTE_eNB_DLSCH_t     *dlsch_PCH;
+  LTE_eNB_UE_stats     UE_stats[NUMBER_OF_UE_MAX];
+  LTE_eNB_UE_stats    *UE_stats_ptr[NUMBER_OF_UE_MAX];
+
+  uint8_t pbch_configured;
+  uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE
+  char gNB_generate_rar;
+
+  /// NR synchronization sequences
+  int16_t d_pss[NR_PSS_LENGTH];
+  int16_t d_sss[NR_SSS_LENGTH];
+
+  /// PBCH DMRS sequence
+  uint32_t nr_gold_pbch_dmrs[2][64][NR_PBCH_DMRS_LENGTH_DWORD];
+
+  /// Indicator set to 0 after first SR
+  uint8_t first_sr[NUMBER_OF_UE_MAX];
+
+  uint32_t max_peak_val;
+
+  /// \brief sinr for all subcarriers of the current link (used only for abstraction).
+  /// first index: ? [0..N_RB_DL*12[
+  double *sinr_dB;
+
+  /// N0 (used for abstraction)
+  double N0;
+
+  unsigned char first_run_timing_advance[NUMBER_OF_UE_MAX];
+  unsigned char first_run_I0_measurements;
+
+  
+  unsigned char    is_secondary_gNB; // primary by default
+  unsigned char    is_init_sync;     /// Flag to tell if initial synchronization is performed. This affects how often the secondary eNB will listen to the PSS from the primary system.
+  unsigned char    has_valid_precoder; /// Flag to tell if secondary eNB has channel estimates to create NULL-beams from, and this B/F vector is created.
+  unsigned char    PgNB_id;          /// id of Primary eNB
+
+  /// hold the precoder for NULL beam to the primary user
+  int              **dl_precoder_SgNB[3];
+  char             log2_maxp; /// holds the maximum channel/precoder coefficient
+
+  /// if ==0 enables phy only test mode
+  int mac_enabled;
+  /// counter to average prach energh over first 100 prach opportunities
+  int prach_energy_counter;
+
+  // PDSCH Varaibles
+  PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX];
+
+  // PUSCH Varaibles
+  PUSCH_CONFIG_DEDICATED pusch_config_dedicated[NUMBER_OF_UE_MAX];
+
+  // PUCCH variables
+  PUCCH_CONFIG_DEDICATED pucch_config_dedicated[NUMBER_OF_UE_MAX];
+
+  // UL-POWER-Control
+  UL_POWER_CONTROL_DEDICATED ul_power_control_dedicated[NUMBER_OF_UE_MAX];
+
+  // TPC
+  TPC_PDCCH_CONFIG tpc_pdcch_config_pucch[NUMBER_OF_UE_MAX];
+  TPC_PDCCH_CONFIG tpc_pdcch_config_pusch[NUMBER_OF_UE_MAX];
+
+  // CQI reporting
+  CQI_REPORT_CONFIG cqi_report_config[NUMBER_OF_UE_MAX];
+
+  // SRS Variables
+  SOUNDINGRS_UL_CONFIG_DEDICATED soundingrs_ul_config_dedicated[NUMBER_OF_UE_MAX];
+  uint8_t ncs_cell[20][7];
+
+  // Scheduling Request Config
+  SCHEDULING_REQUEST_CONFIG scheduling_request_config[NUMBER_OF_UE_MAX];
+
+  // Transmission mode per UE
+  uint8_t transmission_mode[NUMBER_OF_UE_MAX];
+
+  /// cba_last successful reception for each group, used for collision detection
+  uint8_t cba_last_reception[4];
+
+  // Pointers for active physicalConfigDedicated to be applied in current subframe
+  struct PhysicalConfigDedicated *physicalConfigDedicated[NUMBER_OF_UE_MAX];
+
+
+  uint32_t rb_mask_ul[4];
+
+  /// Information regarding TM5
+  MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX];
+
+
+  /// target_ue_dl_mcs : only for debug purposes
+  uint32_t target_ue_dl_mcs;
+  /// target_ue_ul_mcs : only for debug purposes
+  uint32_t target_ue_ul_mcs;
+  /// target_ue_dl_rballoc : only for debug purposes
+  uint32_t ue_dl_rb_alloc;
+  /// target ul PRBs : only for debug
+  uint32_t ue_ul_nb_rb;
+
+  ///check for Total Transmissions
+  uint32_t check_for_total_transmissions;
+
+  ///check for MU-MIMO Transmissions
+  uint32_t check_for_MUMIMO_transmissions;
+
+  ///check for SU-MIMO Transmissions
+  uint32_t check_for_SUMIMO_transmissions;
+
+  ///check for FULL MU-MIMO Transmissions
+  uint32_t  FULL_MUMIMO_transmissions;
+
+  /// Counter for total bitrate, bits and throughput in downlink
+  uint32_t total_dlsch_bitrate;
+  uint32_t total_transmitted_bits;
+  uint32_t total_system_throughput;
+
+  int hw_timing_advance;
+
+  time_stats_t phy_proc;
+  time_stats_t phy_proc_tx;
+  time_stats_t phy_proc_rx;
+  time_stats_t rx_prach;
+
+  time_stats_t ofdm_mod_stats;
+  time_stats_t dlsch_encoding_stats;
+  time_stats_t dlsch_modulation_stats;
+  time_stats_t dlsch_scrambling_stats;
+  time_stats_t dlsch_rate_matching_stats;
+  time_stats_t dlsch_turbo_encoding_stats;
+  time_stats_t dlsch_interleaving_stats;
+
+  time_stats_t rx_dft_stats;
+  time_stats_t ulsch_channel_estimation_stats;
+  time_stats_t ulsch_freq_offset_estimation_stats;
+  time_stats_t ulsch_decoding_stats;
+  time_stats_t ulsch_demodulation_stats;
+  time_stats_t ulsch_rate_unmatching_stats;
+  time_stats_t ulsch_turbo_decoding_stats;
+  time_stats_t ulsch_deinterleaving_stats;
+  time_stats_t ulsch_demultiplexing_stats;
+  time_stats_t ulsch_llr_stats;
+  time_stats_t ulsch_tc_init_stats;
+  time_stats_t ulsch_tc_alpha_stats;
+  time_stats_t ulsch_tc_beta_stats;
+  time_stats_t ulsch_tc_gamma_stats;
+  time_stats_t ulsch_tc_ext_stats;
+  time_stats_t ulsch_tc_intl1_stats;
+  time_stats_t ulsch_tc_intl2_stats;
+
+#ifdef LOCALIZATION
+  /// time state for localization
+  time_stats_t localization_stats;
+#endif
+
+  int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX][10];
+  int32_t pucch1_stats[NUMBER_OF_UE_MAX][10*1024];
+  int32_t pucch1_stats_thres[NUMBER_OF_UE_MAX][10*1024];
+  int32_t pucch1ab_stats_cnt[NUMBER_OF_UE_MAX][10];
+  int32_t pucch1ab_stats[NUMBER_OF_UE_MAX][2*10*1024];
+  int32_t pusch_stats_rb[NUMBER_OF_UE_MAX][10240];
+  int32_t pusch_stats_round[NUMBER_OF_UE_MAX][10240];
+  int32_t pusch_stats_mcs[NUMBER_OF_UE_MAX][10240];
+  int32_t pusch_stats_bsr[NUMBER_OF_UE_MAX][10240];
+  int32_t pusch_stats_BO[NUMBER_OF_UE_MAX][10240];
+} PHY_VARS_gNB;
+
+
+
+#endif
diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/defs_nr_UE.h
similarity index 52%
rename from openair1/PHY/impl_defs_nr.h
rename to openair1/PHY/defs_nr_UE.h
index c74795065ea9f76391ff6b5e9523ffbae268c9a7..c4e83cc6a4243fe8350d192dbe28afcf196e8af3 100644
--- a/openair1/PHY/impl_defs_nr.h
+++ b/openair1/PHY/defs_nr_UE.h
@@ -19,26 +19,25 @@
  *      contact@openairinterface.org
  */
 
-#ifndef __PHY_IMPLEMENTATION_DEFS_NR_H__
-#define __PHY_IMPLEMENTATION_DEFS_NR_H__
-
-
-//#include "impl_defs_lte.h"
-
-typedef struct {
-  /// \brief Pointers (dynamic) to the received data in the time domain.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
-  int32_t **rxdata;
-  /// \brief Pointers (dynamic) to the received data in the frequency domain.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
-  int32_t **rxdataF;
-  /// \brief holds the transmit data in the frequency domain.
-  /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
-  /// - first index: eNB id [0..2] (hard coded)
-  /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
-  /// - third index: sample [0..]
-  int32_t **txdataF;
-} NR_gNB_COMMON;
+/*! \file PHY/defs_gNB.h
+ \brief Top-level defines and structure definitions for gNB
+ \author Guy De Souza
+ \date 2018
+ \version 0.1
+ \company Eurecom
+ \email: desouza@eurecom.fr
+ \note
+ \warning
+*/
+#ifndef __PHY_DEFS_GNB__H__
+#define __PHY_DEFS_GNB__H__
+
+
+#include "defs_nr_common.h"
+
+
+
+
+
+
 #endif
diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h
new file mode 100644
index 0000000000000000000000000000000000000000..b5b3943509dcbbfd6acbf89551ee85d194f512d7
--- /dev/null
+++ b/openair1/PHY/defs_nr_common.h
@@ -0,0 +1,117 @@
+/*
+ * 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 PHY/defs_nr_common.h
+ \brief Top-level defines and structure definitions
+ \author Guy De Souza
+ \date 2018
+ \version 0.1
+ \company Eurecom
+ \email: desouza@eurecom.fr
+ \note
+ \warning
+*/
+
+#ifndef __PHY_DEFS_NR_COMMON__H__
+#define __PHY_DEFS_NR_COMMON__H__
+
+#include "defs_common.h"
+
+
+#define nr_subframe_t lte_subframe_t
+
+#define NR_PBCH_DMRS_LENGTH 144
+#define NR_PBCH_DMRS_LENGTH_DWORD 5 // roundup(NR_PBCH_DMRS_LENGTH/32)
+
+#define MAX_NUM_SUBCARRIER_SPACING 5
+
+#define NR_SYMBOLS_PER_SLOT 14
+
+#define NR_PSS_LENGTH 127
+#define NR_SSS_LENGTH 127
+
+#define ONE_OVER_SQRT2_Q15 23170
+#define ONE_OVER_TWO_Q15 16384
+
+#define MOD_TABLE_SIZE_SHORT 6
+#define MOD_TABLE_BPSK_OFFSET 1
+
+typedef enum {
+  NR_MU_0=0,
+  NR_MU_1,
+  NR_MU_2,
+  NR_MU_3,
+  NR_MU_4,
+} nr_numerology_index_e;
+
+
+typedef enum{
+  nr_ssb_type_A = 0,
+  nr_ssb_type_B,
+  nr_ssb_type_C,
+  nr_ssb_type_D,
+  nr_ssb_type_E
+} nr_ssb_type_e;
+
+typedef struct NR_DL_FRAME_PARMS {
+  /// EUTRA Band
+  uint8_t eutra_band;
+  /// DL carrier frequency
+  uint32_t dl_CarrierFreq;
+  /// UL carrier frequency
+  uint32_t ul_CarrierFreq;
+  /// TX attenuation
+  uint32_t att_tx;
+  /// RX attenuation
+  uint32_t att_rx;
+  ///  total Number of Resource Block Groups: this is ceil(N_PRB/P)
+  uint32_t subcarrier_spacing;
+  /// 3/4 sampling
+  uint8_t threequarter_fs;
+  /// Size of FFT
+  uint16_t ofdm_symbol_size;
+  /// Number of prefix samples in all but first symbol of slot
+  uint16_t nb_prefix_samples;
+  /// Number of prefix samples in first symbol of slot
+  uint16_t nb_prefix_samples0;
+  /// Carrier offset in FFT buffer for first RE in PRB0
+  uint16_t first_carrier_offset;
+  /// Number of OFDM/SC-FDMA symbols in one slot
+  uint16_t symbols_per_slot;
+  /// Number of slots per subframe
+  uint16_t slots_per_subframe;
+  /// Number of samples in a subframe
+  uint32_t samples_per_subframe;
+  /// Number of samples in a radio frame
+  uint32_t samples_per_frame;
+  /// Number of samples in a subframe without CP
+  uint32_t samples_per_subframe_wCP;
+  /// Number of samples in a radio frame without CP
+  uint32_t samples_per_frame_wCP;
+
+    //SSB related params
+  /// Start in Subcarrier index of the SSB block
+  uint16_t ssb_start_subcarrier;
+  nr_ssb_type_e ssb_type;
+
+} NR_DL_FRAME_PARMS;
+
+#endif
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
deleted file mode 100644
index 8ffe1fabf40533f151ade91c194e6b906a2301b4..0000000000000000000000000000000000000000
--- a/openair1/PHY/impl_defs_lte.h
+++ /dev/null
@@ -1,81 +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 PHY/impl_defs_lte.h
-* \brief LTE Physical channel configuration and variable structure definitions
-* \author R. Knopp, F. Kaltenberger
-* \date 2011
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
-* \note
-* \warning
-*/
-
-#ifndef __PHY_IMPLEMENTATION_DEFS_LTE_H__
-#define __PHY_IMPLEMENTATION_DEFS_LTE_H__
-
-
-
-
-
-
-typedef struct {
-  /// \brief Holds the transmit data in the frequency domain.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
-  int32_t **txdata;
-  /// \brief holds the transmit data after beamforming in the frequency domain.
-  /// - first index: tx antenna [0..nb_antennas_tx[
-  /// - second index: sample [0..]
-  int32_t **txdataF_BF;
-  /// \brief holds the transmit data before beamforming for epdcch/mpdcch
-  /// - first index : tx antenna [0..nb_epdcch_antenna_ports[
-  /// - second index: sampl [0..]
-  int32_t **txdataF_epdcch;
-  /// \brief Holds the receive data in the frequency domain.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
-  int32_t **rxdata;
-  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: sample [0..samples_per_tti[
-  int32_t **rxdata_7_5kHz;
-  /// \brief Holds the received data in the frequency domain.
-  /// - first index: rx antenna [0..nb_antennas_rx[
-  /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
-  int32_t **rxdataF;
-  /// \brief Holds output of the sync correlator.
-  /// - first index: sample [0..samples_per_tti*10[
-  uint32_t *sync_corr;
-  /// \brief Holds the tdd reciprocity calibration coefficients 
-  /// - first index: eNB id [0..2] (hard coded) 
-  /// - second index: tx antenna [0..nb_antennas_tx[
-  /// - third index: frequency [0..]
-  int32_t **tdd_calib_coeffs;
-} RU_COMMON;
-
-
-
-
-
-
-#endif
diff --git a/openair1/README.TXT b/openair1/README.TXT
index 23c86e888e47f697adb8d1509630d5958e5be693..1d82033e013ab10c2b2d05f674342ce82e1ccfdc 100644
--- a/openair1/README.TXT
+++ b/openair1/README.TXT
@@ -16,7 +16,6 @@ General remarks: every directory contains at least defs.h (for declaration of st
 |   |-- defs.h		  // top level defs.h (includes spec_defs, impl_defs and all defs.h of subdirectories)
 |   |-- extern.h
 |   |-- impl_defs.h       // non-LTE openair implementation
-|   |-- impl_defs_lte.h   // lte implementation
 |   |-- impl_defs_top.h   // general implementaion defs
 |   |-- spec_defs.h
 |   |-- spec_defs_top.h
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index d5a78c7f98e05be2c8a72687643f9ba1c3e92313..754cbc4cabcbc5111731ac692e6a2e585de31bc3 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -60,7 +60,7 @@ extern int oai_exit;
 
 void feptx0(RU_t *ru,int slot) {
 
-  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
   //int dummy_tx_b[7680*2] __attribute__((aligned(32)));
 
   unsigned int aa,slot_offset;
@@ -174,7 +174,7 @@ static void *feptx_thread(void *param) {
 
 void feptx_ofdm_2thread(RU_t *ru) {
 
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
   RU_proc_t *proc = &ru->proc;
   struct timespec wait;
   int subframe = ru->proc.subframe_tx;
@@ -235,7 +235,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
 
 void feptx_ofdm(RU_t *ru) {
      
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
 
   unsigned int aa,slot_offset, slot_offset_F;
   int dummy_tx_b[7680*4] __attribute__((aligned(32)));
@@ -422,7 +422,7 @@ void feptx_prec(RU_t *ru) {
 void fep0(RU_t *ru,int slot) {
 
   RU_proc_t *proc       = &ru->proc;
-  LTE_DL_FRAME_PARMS *fp = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
   int l;
 
   //  printf("fep0: slot %d\n",slot);
@@ -515,7 +515,7 @@ void ru_fep_full_2thread(RU_t *ru) {
 
   struct timespec wait;
 
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
 
   if ((fp->frame_type == TDD) &&
      (subframe_select(fp,proc->subframe_rx) != SF_UL)) return;
@@ -574,7 +574,7 @@ void fep_full(RU_t *ru) {
 
   RU_proc_t *proc = &ru->proc;
   int l;
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
 
   if ((fp->frame_type == TDD) && 
      (subframe_select(fp,proc->subframe_rx) != SF_UL)) return;
@@ -607,7 +607,7 @@ void fep_full(RU_t *ru) {
 void do_prach_ru(RU_t *ru) {
 
   RU_proc_t *proc = &ru->proc;
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
 
   // check if we have to detect PRACH first
   if (is_prach_subframe(fp,proc->frame_prach,proc->subframe_prach)>0) { 
diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h
index 0ff778ca20da2014d3bcaef22f7add50541fa57a..30de6dbb4a3c201761b7158bdc863f4407590b81 100644
--- a/openair1/SCHED/sched_common.h
+++ b/openair1/SCHED/sched_common.h
@@ -28,194 +28,6 @@
 #ifndef __openair_SCHED_COMMON_H__
 #define __openair_SCHED_COMMON_H__
 
-#include "PHY/defs.h"
-#include "PHY_INTERFACE/defs.h"
-
-enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0,
-                    TOP_LEVEL_SCHEDULER_THREAD_INDEX,
-                    DLC_SCHED_THREAD_INDEX,
-                    openair_SCHED_NB_THREADS
-                  }; // do not modify this line
-
-
-#define OPENAIR_THREAD_PRIORITY        255
-
-
-#define OPENAIR_THREAD_STACK_SIZE     PTHREAD_STACK_MIN //4096 //RTL_PTHREAD_STACK_MIN*6
-//#define DLC_THREAD_STACK_SIZE        4096 //DLC stack size
-//#define UE_SLOT_PARALLELISATION
-
-enum openair_SCHED_STATUS {
-  openair_SCHED_STOPPED=1,
-  openair_SCHED_STARTING,
-  openair_SCHED_STARTED,
-  openair_SCHED_STOPPING
-};
-
-enum openair_ERROR {
-  // HARDWARE CAUSES
-  openair_ERROR_HARDWARE_CLOCK_STOPPED= 1,
-
-  // SCHEDULER CAUSE
-  openair_ERROR_OPENAIR_RUNNING_LATE,
-  openair_ERROR_OPENAIR_SCHEDULING_FAILED,
-
-  // OTHERS
-  openair_ERROR_OPENAIR_TIMING_OFFSET_OUT_OF_BOUNDS,
-};
-
-enum openair_SYNCH_STATUS {
-  openair_NOT_SYNCHED=1,
-  openair_SYNCHED,
-  openair_SCHED_EXIT
-};
-
-enum openair_HARQ_TYPE {
-  openair_harq_DL = 0,
-  openair_harq_UL,
-  openair_harq_RA
-};
-
-#define DAQ_AGC_ON 1
-#define DAQ_AGC_OFF 0
-
-
-/** @addtogroup _PHY_PROCEDURES_
- * @{
- */
-
-
-
-/*! \brief Top-level entry routine for eNB procedures.  Called every slot by process scheduler. In even slots, it performs RX functions from previous subframe (if required).  On odd slots, it generate TX waveform for the following subframe.
-  @param subframe Index of current subframe (0-9)
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-  @param *phy_vars_rn pointer to RN variables
-*/
-void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t abstraction_flag, relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn);
-
-/*! \brief Top-level entry routine for UE procedures.  Called every slot by process scheduler. In even slots, it performs RX functions from previous subframe (if required).  On odd slots, it generate TX waveform for the following subframe.
-  @param phy_vars_ue Pointer to UE variables on which to act
-  @param eNB_id ID of eNB on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param mode calibration/debug mode
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-  @param *phy_vars_rn pointer to RN variables
-*/
-void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
-
-#if defined(Rel10) || defined(Rel14)
-/*! \brief Top-level entry routine for relay node procedures when acting as eNB. This proc will make us of the existing eNB procs.
-  @param last_slot Index of last slot (0-19)
-  @param next_slot Index of next_slot (0-19)
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, relaying_type_t r_type);
-/*! \brief Top-level entry routine for relay node procedures actinf as UE. This proc will make us of the existing UE procs.
-  @param last_slot Index of last slot (0-19)
-  @param next_slot Index of next_slot (0-19)
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-int phy_procedures_RN_UE_RX(unsigned char last_slot, unsigned char next_slot, relaying_type_t r_type);
-#endif
-
-/*! \brief Scheduling for UE TX procedures in normal subframes.
-  @param phy_vars_ue Pointer to UE variables on which to act
-  @param proc Pointer to RXn-TXnp4 proc information
-  @param eNB_id Local id of eNB on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param mode calib/normal mode
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type);
-/*! \brief Scheduling for UE RX procedures in normal subframes.
-  @param last_slot Index of last slot (0-19)
-  @param phy_vars_ue Pointer to UE variables on which to act
-  @param proc Pointer to RXn_TXnp4 proc information
-  @param eNB_id Local id of eNB on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param mode calibration/debug mode
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-  @param phy_vars_rn pointer to RN variables
-*/
-int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
-int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,
-                                              uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,
-                                              relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
-#ifdef UE_SLOT_PARALLELISATION
-void *UE_thread_slot1_dl_processing(void *arg);
-#endif
-
-/*! \brief Scheduling for UE TX procedures in TDD S-subframes.
-  @param phy_vars_ue Pointer to UE variables on which to act
-  @param eNB_id Local id of eNB on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-void phy_procedures_UE_S_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag,relaying_type_t r_type);
-
-/*! \brief Scheduling for UE RX procedures in TDD S-subframes.
-  @param phy_vars_ue Pointer to UE variables on which to act
-  @param eNB_id Local id of eNB on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstraction_flag, relaying_type_t r_type);
-
-/*! \brief Scheduling for eNB/gNB TX procedures in normal subframes.
-  @param phy_vars_eNB/phy_vars_gNB Pointer to eNB/gNB variables on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying -- LTE only
-  @param phy_vars_rn pointer to the RN variables --LTE only
-  @param do_meas Do inline timing measurement
-*/
-void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn,int do_meas);
-void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, gNB_rxtx_proc_t *proc, int do_meas);
-
-/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes.
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param proc Pointer to RXn-TXnp4 proc information
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type);
-
-/*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param proc Pointer to RXn-TXnp4 proc information
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-
-/*! \brief Scheduling for eNB RX common procedures in normal subframes.
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param abstraction_flag Indicator of PHY abstraction
-*/
-void phy_procedures_eNB_common_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc);
-
-/*! \brief Scheduling for eNB TX procedures in TDD S-subframes.
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-
-void phy_procedures_eNB_S_TX(PHY_VARS_eNB *phy_vars_eNB,relaying_type_t r_type);
-
-/*! \brief Scheduling for eNB RX procedures in TDD S-subframes.
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
-*/
-void phy_procedures_eNB_S_RX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type);
-
-/*! \brief Scheduling for eNB PRACH RX procedures
-  @param phy_vars_eNB Pointer to eNB variables on which to act
-  @param br_flag indicator for eMTC PRACH
-*/
-#ifdef Rel14
-void prach_procedures(PHY_VARS_eNB *eNB,
-		      int br_flag);
-#else
-void prach_procedures(PHY_VARS_eNB *eNB);
-#endif
-
 #include "PHY/defs_eNB.h"
 #include "PHY/defs_UE.h"
 
diff --git a/openair1/SCHED_NR/defs.h b/openair1/SCHED_NR/defs.h
index a22b2886d27faabbef251fca29cc76a7600059ce..61d6b2461cf1e14052a53468ca014e512e064291 100644
--- a/openair1/SCHED_NR/defs.h
+++ b/openair1/SCHED_NR/defs.h
@@ -28,9 +28,9 @@
 #ifndef __openair_SCHED_NR_DEFS_H__
 #define __openair_SCHED_NR_DEFS_H__
 
-#include "PHY/defs.h"
-#include "PHY_INTERFACE/defs.h"
-#include "SCHED/defs.h"
+#include "PHY/defs_gNB.h"
+#include "PHY_INTERFACE/phy_interface.h"
+#include "SCHED/sched_eNB.h"
 
 lte_subframe_t nr_subframe_select (nfapi_config_request_t *cfg, unsigned char subframe);
 int nr_generate_pss(  int16_t *d_pss,
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index ffd1df6e8db244cd4ad6107392f0c4d9d153f877..e0be09aa9c282957d361b637f8370c78363616b9 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -30,15 +30,15 @@
  * \warning
  */
 
-#include "PHY/defs.h"
-#include "PHY/extern.h"
+#include "PHY/defs_gNB.h"
+#include "PHY/phy_extern.h"
 #include "SCHED_NR/defs.h"
 
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
 #include "PHY/LTE_TRANSPORT/if5_tools.h"
 
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/defs.h"
+#include "LAYER2/MAC/mac_extern.h"
+#include "LAYER2/MAC/mac.h"
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
@@ -59,7 +59,7 @@ extern int oai_exit;
 
 void nr_feptx0(RU_t *ru,int slot) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
 
   unsigned int aa,slot_offset;
   int slot_sizeF = fp->ofdm_symbol_size * fp->symbols_per_slot;
@@ -84,7 +84,7 @@ void nr_feptx0(RU_t *ru,int slot) {
 
 void nr_feptx_ofdm_2thread(RU_t *ru) {
 
-  NR_DL_FRAME_PARMS *fp=&ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
   RU_proc_t *proc = &ru->proc;
   struct timespec wait;
   int subframe = ru->proc.subframe_tx;
@@ -182,7 +182,7 @@ void nr_init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx) {
 
 void nr_feptx_ofdm(RU_t *ru) {
      
-  NR_DL_FRAME_PARMS *fp=&ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
   nfapi_config_request_t *cfg = &ru->gNB_list[0]->gNB_config;
 
   unsigned int aa,slot_offset, slot_offset_F;
diff --git a/openair1/SCHED_NR/phy_procedures_nr_common.c b/openair1/SCHED_NR/phy_procedures_nr_common.c
index 3699b2807c57c7a42bdff349978003d5df576c0b..4f06644ee8578df54399ebd420a20de2a0b99fd8 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_common.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_common.c
@@ -29,8 +29,8 @@
 * \note
 * \warning
 */
-#include "PHY/defs.h"
-#include "PHY/extern.h"
+#include "PHY/defs_gNB.h"
+#include "PHY/phy_extern.h"
 #include "SCHED_NR/defs.h"
 
 
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 4464168d2f5dfaa90ca872207182e9e8c451daac..9ecb02e5646f1bee119c78071394e7a839abab76 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -19,9 +19,10 @@
  *      contact@openairinterface.org
  */
 
-#include "PHY/extern.h"
-#include "SCHED/defs.h"
-#include "SCHED/extern.h"
+#include "PHY/phy_extern.h"
+#include "PHY/defs_gNB.h"
+#include "SCHED/sched_eNB.h"
+#include "SCHED/sched_common_extern.h"
 #include "nfapi_interface.h"
 #include "SCHED/fapi_l1.h"
 #include "UTIL/LOG/log.h"
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index 0cddad9dcc2d5ef12bbd2afeaae74cfd648f8797..82e86847bc1d8b3fde295f5260814832522bdab2 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -37,7 +37,6 @@
 #include "commonDef.h"
 #include "platform_types.h"
 #include "platform_constants.h"
-#include "PHY/impl_defs_lte.h"
 #include "PHY/defs_eNB.h"
 #include "s1ap_messages_types.h"
 #ifdef CMAKER
diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h
index b131d8053959f530d22dbb6d8d22d570490e89f4..7ad43804afa86b207df6c87d08ea55a2a4ce02fa 100644
--- a/openair2/UTIL/OPT/opt.h
+++ b/openair2/UTIL/OPT/opt.h
@@ -52,7 +52,6 @@ This header file must be included */
 // #include "UTIL/LOG/log_extern.h"
 //#include "PHY/defs.h"
 //#include "PHY/extern.h"
-#include "PHY/impl_defs_lte.h"
 #endif
 
 #ifdef OCP_FRAMEWORK
diff --git a/openair3/TEST/EPC_TEST/generate_scenario.h b/openair3/TEST/EPC_TEST/generate_scenario.h
index 09fa5318ef06dc9f9d17ba8898ea85b990bc80e9..c5f0c8692cf3d754e8c98d0bde024831aae2d342 100644
--- a/openair3/TEST/EPC_TEST/generate_scenario.h
+++ b/openair3/TEST/EPC_TEST/generate_scenario.h
@@ -36,7 +36,6 @@
 #include "commonDef.h"
 #include "platform_types.h"
 #include "platform_constants.h"
-#include "PHY/impl_defs_lte.h"
 #include "s1ap_messages_types.h"
 #ifdef CMAKER
 #include "SystemInformationBlockType2.h"
diff --git a/targets/DOCS/Doxyfile b/targets/DOCS/Doxyfile
index a060f6597ab894c046e427960ed42c2ba1084000..68c76f93fb6b31f142e8d8a23fba92744df3ec43 100644
--- a/targets/DOCS/Doxyfile
+++ b/targets/DOCS/Doxyfile
@@ -745,7 +745,6 @@ WARN_LOGFILE           = $(OPENAIR_TARGETS)/bin/doxy.log
 
 INPUT                  = $(OPENAIR1_DIR)/PHY/defs.h \
                          $(OPENAIR1_DIR)/PHY/impl_defs_top.h \
-                         $(OPENAIR1_DIR)/PHY/impl_defs_lte.h \
                          $(OPENAIR1_DIR)/PHY/CODING/defs.h \
                          $(OPENAIR1_DIR)/PHY/INIT/defs.h \
                          $(OPENAIR1_DIR)/PHY/TOOLS/defs.h \
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index dbea0cc80ff36539cf234e299afb610e28ddb8de..7edda675ae9b074f4769a9c7be9c002241397ca5 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -552,7 +552,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
   /// **** incoming IF4p5 from remote RCC/RAU **** ///             
   symbol_number = 0;
   symbol_mask = 0;
-  symbol_mask_full = (1<<ru->frame_parms.symbols_per_tti)-1;
+  symbol_mask_full = (1<<ru->frame_parms->symbols_per_tti)-1;
   
   do { 
     recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number);
@@ -1494,7 +1494,7 @@ static void* ru_thread( void* param ) {
 
   RU_t               *ru      = (RU_t*)param;
   RU_proc_t          *proc    = &ru->proc;
-  LTE_DL_FRAME_PARMS *fp      = &ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp      = ru->frame_parms;
   int                ret;
   int                subframe =9;
   int                frame    =1023; 
@@ -1518,7 +1518,7 @@ static void* ru_thread( void* param ) {
 
   if(emulate_rf){
     fill_rf_config(ru,ru->rf_config_file);
-    init_frame_parms(&ru->frame_parms,1);
+    init_frame_parms(ru->frame_parms,1);
     phy_init_RU(ru);
     if (setup_RU_buffers(ru)!=0) {
           printf("Exiting, cannot initialize RU Buffers\n");
@@ -1536,7 +1536,7 @@ static void* ru_thread( void* param ) {
     }
     if (ru->if_south == LOCAL_RF) { // configure RF parameters only 
           fill_rf_config(ru,ru->rf_config_file);
-          init_frame_parms(&ru->frame_parms,1);
+          init_frame_parms(ru->frame_parms,1);
           phy_init_RU(ru);
     
     
@@ -1679,7 +1679,7 @@ static void* ru_thread( void* param ) {
 void *ru_thread_synch(void *arg) {
 
   RU_t *ru = (RU_t*)arg;
-  LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
+  LTE_DL_FRAME_PARMS *fp=ru->frame_parms;
   int32_t sync_pos,sync_pos2;
   uint32_t peak_val;
   uint32_t sync_corr[307200] __attribute__((aligned(32)));
@@ -1691,7 +1691,7 @@ void *ru_thread_synch(void *arg) {
   wait_sync("ru_thread_synch");
 
   // initialize variables for PSS detection
-  lte_sync_time_init(&ru->frame_parms);
+  lte_sync_time_init(ru->frame_parms);
 
   while (!oai_exit) {
 
@@ -2021,17 +2021,17 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
   int i;
   int found_band=0;
 
-  LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->frame_parms.eutra_band);
+  LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->frame_parms->eutra_band);
   for (i=0;i<cap->num_bands;i++) {
     LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx);
-    if (ru->frame_parms.eutra_band == cap->band_list[i]) {
+    if (ru->frame_parms->eutra_band == cap->band_list[i]) {
       found_band=1;
       break;
     }
   }
 
   if (found_band == 0) {
-    LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->frame_parms.eutra_band,ru->idx);
+    LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->frame_parms->eutra_band,ru->idx);
     return(-1);
   }
 
@@ -2083,32 +2083,32 @@ void configure_ru(int idx,
   ru->nb_rx                      = capabilities->nb_rx[0];
 
   // Pass configuration to RRU
-  LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms.eutra_band);
+  LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->frame_parms->eutra_band);
   // wait for configuration 
   config->FH_fmt                 = ru->if_south;
   config->num_bands              = 1;
-  config->band_list[0]           = ru->frame_parms.eutra_band;
-  config->tx_freq[0]             = ru->frame_parms.dl_CarrierFreq;      
-  config->rx_freq[0]             = ru->frame_parms.ul_CarrierFreq;      
-  config->tdd_config[0]          = ru->frame_parms.tdd_config;
-  config->tdd_config_S[0]        = ru->frame_parms.tdd_config_S;
+  config->band_list[0]           = ru->frame_parms->eutra_band;
+  config->tx_freq[0]             = ru->frame_parms->dl_CarrierFreq;      
+  config->rx_freq[0]             = ru->frame_parms->ul_CarrierFreq;      
+  config->tdd_config[0]          = ru->frame_parms->tdd_config;
+  config->tdd_config_S[0]        = ru->frame_parms->tdd_config_S;
   config->att_tx[0]              = ru->att_tx;
   config->att_rx[0]              = ru->att_rx;
-  config->N_RB_DL[0]             = ru->frame_parms.N_RB_DL;
-  config->N_RB_UL[0]             = ru->frame_parms.N_RB_UL;
-  config->threequarter_fs[0]     = ru->frame_parms.threequarter_fs;
+  config->N_RB_DL[0]             = ru->frame_parms->N_RB_DL;
+  config->N_RB_UL[0]             = ru->frame_parms->N_RB_UL;
+  config->threequarter_fs[0]     = ru->frame_parms->threequarter_fs;
   if (ru->if_south==REMOTE_IF4p5) {
-    config->prach_FreqOffset[0]  = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
-    config->prach_ConfigIndex[0] = ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+    config->prach_FreqOffset[0]  = ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset;
+    config->prach_ConfigIndex[0] = ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
     LOG_I(PHY,"REMOTE_IF4p5: prach_FrequOffset %d, prach_ConfigIndex %d\n",
 	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);
     
 #ifdef Rel14
     int i;
     for (i=0;i<4;i++) {
-      config->emtc_prach_CElevel_enable[0][i]  = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
-      config->emtc_prach_FreqOffset[0][i]      = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
-      config->emtc_prach_ConfigIndex[0][i]     = ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i];
+      config->emtc_prach_CElevel_enable[0][i]  = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i];
+      config->emtc_prach_FreqOffset[0][i]      = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i];
+      config->emtc_prach_ConfigIndex[0][i]     = ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i];
     }
 #endif
   }
@@ -2123,35 +2123,35 @@ void configure_rru(int idx,
   RRU_config_t *config = (RRU_config_t *)arg;
   RU_t         *ru         = RC.ru[idx];
 
-  ru->frame_parms.eutra_band                                               = config->band_list[0];
-  ru->frame_parms.dl_CarrierFreq                                           = config->tx_freq[0];
-  ru->frame_parms.ul_CarrierFreq                                           = config->rx_freq[0];
-  if (ru->frame_parms.dl_CarrierFreq == ru->frame_parms.ul_CarrierFreq) {
-     ru->frame_parms.frame_type                                            = TDD;
-     ru->frame_parms.tdd_config                                            = config->tdd_config[0];
-     ru->frame_parms.tdd_config_S                                          = config->tdd_config_S[0]; 
+  ru->frame_parms->eutra_band                                               = config->band_list[0];
+  ru->frame_parms->dl_CarrierFreq                                           = config->tx_freq[0];
+  ru->frame_parms->ul_CarrierFreq                                           = config->rx_freq[0];
+  if (ru->frame_parms->dl_CarrierFreq == ru->frame_parms->ul_CarrierFreq) {
+     ru->frame_parms->frame_type                                            = TDD;
+     ru->frame_parms->tdd_config                                            = config->tdd_config[0];
+     ru->frame_parms->tdd_config_S                                          = config->tdd_config_S[0]; 
   }
   else
-     ru->frame_parms.frame_type                                            = FDD;
+     ru->frame_parms->frame_type                                            = FDD;
   ru->att_tx                                                               = config->att_tx[0];
   ru->att_rx                                                               = config->att_rx[0];
-  ru->frame_parms.N_RB_DL                                                  = config->N_RB_DL[0];
-  ru->frame_parms.N_RB_UL                                                  = config->N_RB_UL[0];
-  ru->frame_parms.threequarter_fs                                          = config->threequarter_fs[0];
-  ru->frame_parms.pdsch_config_common.referenceSignalPower                 = ru->max_pdschReferenceSignalPower-config->att_tx[0];
+  ru->frame_parms->N_RB_DL                                                  = config->N_RB_DL[0];
+  ru->frame_parms->N_RB_UL                                                  = config->N_RB_UL[0];
+  ru->frame_parms->threequarter_fs                                          = config->threequarter_fs[0];
+  ru->frame_parms->pdsch_config_common.referenceSignalPower                 = ru->max_pdschReferenceSignalPower-config->att_tx[0];
   if (ru->function==NGFI_RRU_IF4p5) {
-  ru->frame_parms.att_rx = ru->att_rx;
-  ru->frame_parms.att_tx = ru->att_tx;
+  ru->frame_parms->att_rx = ru->att_rx;
+  ru->frame_parms->att_tx = ru->att_tx;
 
     LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n",
 	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx);
-    ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset  = config->prach_FreqOffset[0]; 
-    ru->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; 
+    ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset  = config->prach_FreqOffset[0]; 
+    ru->frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; 
 #ifdef Rel14
     for (int i=0;i<4;i++) {
-      ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] = config->emtc_prach_CElevel_enable[0][i];
-      ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i]     = config->emtc_prach_FreqOffset[0][i];
-      ru->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i]    = config->emtc_prach_ConfigIndex[0][i];
+      ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] = config->emtc_prach_CElevel_enable[0][i];
+      ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[i]     = config->emtc_prach_FreqOffset[0][i];
+      ru->frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i]    = config->emtc_prach_ConfigIndex[0][i];
     }
 #endif
   }
@@ -2352,6 +2352,7 @@ void init_RU(char *rf_config_file) {
   int ru_id;
   RU_t *ru;
   PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
+  LTE_DL_FRAME_PARMS *fp = (LTE_DL_FRAME_PARMS *)NULL;
   int i;
   int CC_id;
 
@@ -2397,8 +2398,9 @@ void init_RU(char *rf_config_file) {
       }
     }
     eNB0             = ru->eNB_list[0];
+    fp               = ru->frame_parms;
     LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
-    LOG_D(PHY, "eNB0:%p\n", eNB0);
+    LOG_D(PHY, "eNB0:%p   fp:%d\n", eNB0, fp);
     if (eNB0)
     {
       if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
@@ -2406,7 +2408,7 @@ void init_RU(char *rf_config_file) {
 
       if (eNB0) {
         LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx);
-        memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+        memcpy((void*)fp,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
 
         // attach all RU to all eNBs in its list/
         LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU);
@@ -2463,9 +2465,6 @@ void RCconfig_RU(void) {
   if ( RUParamList.numelt > 0) {
 
     RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
-   
-
-
 
     RC.ru_mask=(1<<NB_RU) - 1;
     printf("Set RU mask to %lx\n",RC.ru_mask);
diff --git a/targets/RT/USER/nr-gnb.c b/targets/RT/USER/nr-gnb.c
index a8f3f7406985efcccd2c8d4324153b5da8ac14b4..8bc64d06bb2b9e493f4f78fe11374f97fe0c12b6 100644
--- a/targets/RT/USER/nr-gnb.c
+++ b/targets/RT/USER/nr-gnb.c
@@ -44,7 +44,12 @@
 
 #include "PHY/types.h"
 
-#include "PHY/defs.h"
+#include "PHY/INIT/phy_init.h"
+
+#include "PHY/defs_gNB.h"
+#include "SCHED/sched_eNB.h"
+#include "PHY/LTE_TRANSPORT/transport_proto.h"
+
 #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
 //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
 
@@ -55,22 +60,14 @@
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
 #include "PHY/LTE_TRANSPORT/if5_tools.h"
 
-#include "PHY/extern.h"
-#include "SCHED/extern.h"
-#include "LAYER2/MAC/extern.h"
-
-#include "../../SIMU/USER/init_lte.h"
-
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/proto.h"
-#include "RRC/LITE/extern.h"
-#include "PHY_INTERFACE/extern.h"
-#include "PHY_INTERFACE/defs.h"
-#ifdef SMBV
-#include "PHY/TOOLS/smbv.h"
-unsigned short config_frames[4] = {2,9,11,13};
-#endif
+#include "PHY/phy_extern.h"
+
+
+#include "LAYER2/MAC/mac.h"
+#include "LAYER2/MAC/mac_extern.h"
+#include "LAYER2/MAC/mac_proto.h"
+#include "RRC/LTE/rrc_extern.h"
+#include "PHY_INTERFACE/phy_interface.h"
 #include "UTIL/LOG/log_extern.h"
 #include "UTIL/OTG/otg_tx.h"
 #include "UTIL/OTG/otg_externs.h"
@@ -78,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 #include "enb_config.h"
-//#include "PHY/TOOLS/time_meas.h"
+
 
 #ifndef OPENAIR2
 #include "UTIL/OTG/otg_extern.h"
diff --git a/targets/RT/USER/nr-ru.c b/targets/RT/USER/nr-ru.c
index 3a63503c04fd9cd6d0b3b257ca8ef4a830576782..8ed38edc0563fc4c2c2be2693843e214996dc7a8 100644
--- a/targets/RT/USER/nr-ru.c
+++ b/targets/RT/USER/nr-ru.c
@@ -60,7 +60,7 @@
 
 #include "PHY/types.h"
 
-#include "PHY/defs.h"
+#include "PHY/defs_nr_common.h"
 #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
 
 
@@ -70,18 +70,26 @@
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
 #include "PHY/LTE_TRANSPORT/if5_tools.h"
 
-#include "PHY/extern.h"
-#include "SCHED/extern.h"
-#include "SCHED_NR/defs.h"
-#include "LAYER2/MAC/extern.h"
+#include "PHY/phy_extern.h"
+#include "LAYER2/MAC/mac_extern.h"
+#include "PHY/LTE_TRANSPORT/transport_proto.h"
+#include "SCHED/sched_eNB.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
+#include "PHY/INIT/phy_init.h"
 
-#include "../../SIMU/USER/init_lte.h"
+#include "LAYER2/MAC/mac.h"
+#include "LAYER2/MAC/mac_extern.h"
+#include "LAYER2/MAC/mac_proto.h"
+#include "RRC/LTE/rrc_extern.h"
+#include "PHY_INTERFACE/phy_interface.h"
 
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/extern.h"
-#include "LAYER2/MAC/proto.h"
-#include "RRC/LITE/extern.h"
-#include "PHY_INTERFACE/extern.h"
+#include "UTIL/LOG/log_extern.h"
+#include "UTIL/OTG/otg_tx.h"
+#include "UTIL/OTG/otg_externs.h"
+#include "UTIL/MATH/oml.h"
+#include "UTIL/LOG/vcd_signal_dumper.h"
+#include "UTIL/OPT/opt.h"
+#include "enb_config.h"
 
 #ifdef SMBV
 #include "PHY/TOOLS/smbv.h"
@@ -334,7 +342,7 @@ static inline void fh_if4p5_south_out(RU_t *ru) {
 // Synchronous if5 from south 
 void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   RU_proc_t *proc = &ru->proc;
 
   recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_RRH_GW_UL); 
@@ -365,7 +373,7 @@ void fh_if5_south_in(RU_t *ru,int *frame, int *subframe) {
 // Synchronous if4p5 from south 
 void fh_if4p5_south_in(RU_t *ru,int *frame,int *subframe) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   RU_proc_t *proc = &ru->proc;
   int f,sf;
 
@@ -449,7 +457,7 @@ void fh_slave_south_in(RU_t *ru,int *frame,int *subframe) {
 void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
 
   RU_proc_t *proc       = &ru->proc;
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
 
   recv_IF5(ru, &proc->timestamp_rx, *subframe, IF5_MOBIPASS); 
   pthread_mutex_lock(&proc->mutex_asynch_rxtx);
@@ -491,7 +499,7 @@ void fh_if5_south_asynch_in_mobipass(RU_t *ru,int *frame,int *subframe) {
 // asynchronous inbound if4p5 fronthaul from south
 void fh_if4p5_south_asynch_in(RU_t *ru,int *frame,int *subframe) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   RU_proc_t *proc       = &ru->proc;
 
   uint16_t packet_type;
@@ -548,7 +556,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
   /// **** incoming IF4p5 from remote RCC/RAU **** ///             
   symbol_number = 0;
   symbol_mask = 0;
-  symbol_mask_full = (1<<(ru->nr_frame_parms.symbols_per_slot* ru->nr_frame_parms.slots_per_subframe))-1;
+  symbol_mask_full = (1<<(ru->nr_frame_parms->symbols_per_slot* ru->nr_frame_parms->slots_per_subframe))-1;
   
   do { 
     recv_IF4p5(ru, frame, subframe, &packet_type, &symbol_number);
@@ -564,7 +572,7 @@ void fh_if4p5_north_in(RU_t *ru,int *frame,int *subframe) {
 
 void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   RU_proc_t *proc        = &ru->proc;
   int subframe_tx,frame_tx;
   openair0_timestamp timestamp_tx;
@@ -590,7 +598,7 @@ void fh_if5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
 
 void fh_if4p5_north_asynch_in(RU_t *ru,int *frame,int *subframe) {
 
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   nfapi_config_request_t *cfg = &ru->gNB_list[0]->gNB_config;
   RU_proc_t *proc        = &ru->proc;
 
@@ -661,7 +669,7 @@ void fh_if5_north_out(RU_t *ru) {
 void fh_if4p5_north_out(RU_t *ru) {
 
   RU_proc_t *proc=&ru->proc;
-  //NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  //NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   //const int subframe     = proc->subframe_rx;
   if (ru->idx==0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU, proc->subframe_rx );
 /*
@@ -680,7 +688,7 @@ void fh_if4p5_north_out(RU_t *ru) {
 void rx_rf(RU_t *ru,int *frame,int *subframe) {
 
   RU_proc_t *proc = &ru->proc;
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   void *rxp[ru->nb_rx];
   unsigned int rxs;
   int i;
@@ -772,7 +780,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
 void tx_rf(RU_t *ru) {
 
   RU_proc_t *proc = &ru->proc;
-  NR_DL_FRAME_PARMS *fp = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
   nfapi_config_request_t *cfg = &ru->gNB_list[0]->gNB_config;
   void *txp[ru->nb_tx]; 
   unsigned int txs;
@@ -1033,7 +1041,7 @@ int wakeup_synch(RU_t *ru){
 
 void do_ru_synch(RU_t *ru) {
 
-  NR_DL_FRAME_PARMS *fp  = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp  = ru->nr_frame_parms;
   RU_proc_t *proc         = &ru->proc;
   int i;
   void *rxp[2],*rxp2[2];
@@ -1169,7 +1177,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
 
   int i;
 
-  NR_DL_FRAME_PARMS *fp   = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp   = ru->nr_frame_parms;
   nfapi_config_request_t *gNB_config = &ru->gNB_list[0]->gNB_config; //tmp index
   openair0_config_t *cfg   = &ru->openair0_cfg;
   int N_RB = gNB_config->rf_config.dl_channel_bandwidth.value;
@@ -1275,7 +1283,7 @@ int setup_RU_buffers(RU_t *ru) {
   //nfapi_config_request_t *gNB_config = ru->gNB_list[0]->gNB_config; //tmp index
   
   if (ru) {
-    frame_parms = &ru->nr_frame_parms;
+    frame_parms = ru->nr_frame_parms;
     printf("setup_RU_buffers: frame_parms = %p\n",frame_parms);
   } else {
     printf("RU[%d] not initialized\n", ru->idx);
@@ -1354,7 +1362,7 @@ static void* ru_thread( void* param ) {
 
   RU_t               *ru      = (RU_t*)param;
   RU_proc_t          *proc    = &ru->proc;
-  NR_DL_FRAME_PARMS *fp      = &ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp      = ru->nr_frame_parms;
   int                ret;
   int                subframe =9;
   int                frame    =1023; 
@@ -1502,7 +1510,7 @@ static void* ru_thread( void* param ) {
 void *ru_thread_synch(void *arg) {
 
   RU_t *ru = (RU_t*)arg;
-  NR_DL_FRAME_PARMS *fp=&ru->nr_frame_parms;
+  NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
   int32_t sync_pos,sync_pos2;
   uint32_t peak_val;
   uint32_t sync_corr[307200] __attribute__((aligned(32)));
@@ -1514,7 +1522,7 @@ void *ru_thread_synch(void *arg) {
   wait_sync("ru_thread_synch");
 
   // initialize variables for PSS detection
-  lte_sync_time_init(&ru->nr_frame_parms);
+  lte_sync_time_init(ru->nr_frame_parms);
 
   while (!oai_exit) {
 
@@ -1784,17 +1792,17 @@ int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
   int i;
   int found_band=0;
 
-  LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms.eutra_band);
+  LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms->eutra_band);
   for (i=0;i<cap->num_bands;i++) {
     LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx);
-    if (ru->nr_frame_parms.eutra_band == cap->band_list[i]) {
+    if (ru->nr_frame_parms->eutra_band == cap->band_list[i]) {
       found_band=1;
       break;
     }
   }
 
   if (found_band == 0) {
-    LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->nr_frame_parms.eutra_band,ru->idx);
+    LOG_I(PHY,"Couldn't find target EUTRA band %d on RRU %d\n",ru->nr_frame_parms->eutra_band,ru->idx);
     return(-1);
   }
 
@@ -1847,27 +1855,27 @@ void configure_ru(int idx,
   ru->nb_rx                      = capabilities->nb_rx[0];
 
   // Pass configuration to RRU
-  LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms.eutra_band);
+  LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms->eutra_band);
   // wait for configuration 
   config->FH_fmt                 = ru->if_south;
   config->num_bands              = 1;
-  config->band_list[0]           = ru->nr_frame_parms.eutra_band;
-  config->tx_freq[0]             = ru->nr_frame_parms.dl_CarrierFreq;      
-  config->rx_freq[0]             = ru->nr_frame_parms.ul_CarrierFreq;      
-  //config->tdd_config[0]          = ru->nr_frame_parms.tdd_config;
-  //config->tdd_config_S[0]        = ru->nr_frame_parms.tdd_config_S;
+  config->band_list[0]           = ru->nr_frame_parms->eutra_band;
+  config->tx_freq[0]             = ru->nr_frame_parms->dl_CarrierFreq;      
+  config->rx_freq[0]             = ru->nr_frame_parms->ul_CarrierFreq;      
+  //config->tdd_config[0]          = ru->nr_frame_parms->tdd_config;
+  //config->tdd_config_S[0]        = ru->nr_frame_parms->tdd_config_S;
   config->att_tx[0]              = ru->att_tx;
   config->att_rx[0]              = ru->att_rx;
   config->N_RB_DL[0]             = gNB_config->rf_config.dl_channel_bandwidth.value;
   config->N_RB_UL[0]             = gNB_config->rf_config.ul_channel_bandwidth.value;
-  config->threequarter_fs[0]     = ru->nr_frame_parms.threequarter_fs;
+  config->threequarter_fs[0]     = ru->nr_frame_parms->threequarter_fs;
 /*  if (ru->if_south==REMOTE_IF4p5) {
-    config->prach_FreqOffset[0]  = ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset;
-    config->prach_ConfigIndex[0] = ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+    config->prach_FreqOffset[0]  = ru->nr_frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset;
+    config->prach_ConfigIndex[0] = ru->nr_frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
     LOG_I(PHY,"REMOTE_IF4p5: prach_FrequOffset %d, prach_ConfigIndex %d\n",
 	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0]);*/
 
-  nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, &ru->nr_frame_parms);
+  nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, ru->nr_frame_parms);
   nr_phy_init_RU(ru);
 }
 
@@ -1878,13 +1886,13 @@ void configure_rru(int idx,
   RU_t         *ru         = RC.ru[idx];
   nfapi_config_request_t *gNB_config = &ru->gNB_list[0]->gNB_config;
 
-  ru->nr_frame_parms.eutra_band                                               = config->band_list[0];
-  ru->nr_frame_parms.dl_CarrierFreq                                           = config->tx_freq[0];
-  ru->nr_frame_parms.ul_CarrierFreq                                           = config->rx_freq[0];
-  if (ru->nr_frame_parms.dl_CarrierFreq == ru->nr_frame_parms.ul_CarrierFreq) {
+  ru->nr_frame_parms->eutra_band                                               = config->band_list[0];
+  ru->nr_frame_parms->dl_CarrierFreq                                           = config->tx_freq[0];
+  ru->nr_frame_parms->ul_CarrierFreq                                           = config->rx_freq[0];
+  if (ru->nr_frame_parms->dl_CarrierFreq == ru->nr_frame_parms->ul_CarrierFreq) {
      gNB_config->subframe_config.duplex_mode.value                         = TDD;
-     //ru->nr_frame_parms.tdd_config                                            = config->tdd_config[0];
-     //ru->nr_frame_parms.tdd_config_S                                          = config->tdd_config_S[0]; 
+     //ru->nr_frame_parms->tdd_config                                            = config->tdd_config[0];
+     //ru->nr_frame_parms->tdd_config_S                                          = config->tdd_config_S[0]; 
   }
   else
   gNB_config->subframe_config.duplex_mode.value                            = FDD;
@@ -1892,20 +1900,20 @@ void configure_rru(int idx,
   ru->att_rx                                                               = config->att_rx[0];
   gNB_config->rf_config.dl_channel_bandwidth.value                         = config->N_RB_DL[0];
   gNB_config->rf_config.ul_channel_bandwidth.value                         = config->N_RB_UL[0];
-  ru->nr_frame_parms.threequarter_fs                                       = config->threequarter_fs[0];
-  //ru->nr_frame_parms.pdsch_config_common.referenceSignalPower                 = ru->max_pdschReferenceSignalPower-config->att_tx[0];
+  ru->nr_frame_parms->threequarter_fs                                       = config->threequarter_fs[0];
+  //ru->nr_frame_parms->pdsch_config_common.referenceSignalPower                 = ru->max_pdschReferenceSignalPower-config->att_tx[0];
   if (ru->function==NGFI_RRU_IF4p5) {
-  ru->nr_frame_parms.att_rx = ru->att_rx;
-  ru->nr_frame_parms.att_tx = ru->att_tx;
+  ru->nr_frame_parms->att_rx = ru->att_rx;
+  ru->nr_frame_parms->att_tx = ru->att_tx;
 /*
     LOG_I(PHY,"Setting ru->function to NGFI_RRU_IF4p5, prach_FrequOffset %d, prach_ConfigIndex %d, att (%d,%d)\n",
 	  config->prach_FreqOffset[0],config->prach_ConfigIndex[0],ru->att_tx,ru->att_rx);
-    ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset  = config->prach_FreqOffset[0]; 
-    ru->nr_frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; */
+    ru->nr_frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset  = config->prach_FreqOffset[0]; 
+    ru->nr_frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = config->prach_ConfigIndex[0]; */
 
   }
   fill_rf_config(ru,ru->rf_config_file);
-  nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, &ru->nr_frame_parms);
+  nr_init_frame_parms(&ru->gNB_list[0]->gNB_config, ru->nr_frame_parms);
 
   nr_phy_init_RU(ru);
 
@@ -2099,6 +2107,7 @@ void init_RU(char *rf_config_file) {
   int ru_id;
   RU_t *ru;
   PHY_VARS_gNB *gNB0= (PHY_VARS_gNB *)NULL;
+  NR_DL_FRAME_PARMS *fp = (NR_DL_FRAME_PARMS *)NULL;
   int i;
   int CC_id;
 
@@ -2144,8 +2153,9 @@ void init_RU(char *rf_config_file) {
       }
     }
     gNB0             = ru->gNB_list[0];
+    fp               = ru->nr_frame_parms;
     LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south);
-    LOG_D(PHY, "gNB0:%p\n", gNB0);
+    LOG_D(PHY, "gNB0:%p   fp:%d\n", gNB0, fp);
     if (gNB0)
     {
       if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5))
@@ -2153,7 +2163,8 @@ void init_RU(char *rf_config_file) {
 
       if (gNB0) {
         LOG_I(PHY,"Copying frame parms from gNB %d to ru %d\n",gNB0->Mod_id,ru->idx);
-        memcpy((void*)&ru->nr_frame_parms,(void*)&gNB0->frame_parms,sizeof(NR_DL_FRAME_PARMS));
+        memcpy((void*)fp,(void*)&gNB0->frame_parms,sizeof(NR_DL_FRAME_PARMS));
+        memset((void*)ru->frame_parms, 0, sizeof(LTE_DL_FRAME_PARMS));
 
         // attach all RU to all gNBs in its list/
         LOG_D(PHY,"ru->num_gNB:%d gNB0->num_RU:%d\n", ru->num_gNB, gNB0->num_RU);
@@ -2210,9 +2221,6 @@ void RCconfig_RU(void) {
   if ( RUParamList.numelt > 0) {
 
     RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
-   
-
-
 
     RC.ru_mask=(1<<NB_RU) - 1;
     printf("Set RU mask to %lx\n",RC.ru_mask);
diff --git a/targets/RT/USER/nr-softmodem.c b/targets/RT/USER/nr-softmodem.c
index b6d020500c55ac0f5eaf525daa9e6d44562c7bea..cca572f108832c5f9874419034e697cabb0b2fc6 100644
--- a/targets/RT/USER/nr-softmodem.c
+++ b/targets/RT/USER/nr-softmodem.c
@@ -22,14 +22,21 @@
 
 #define _GNU_SOURCE             /* See feature_test_macros(7) */
 #include <sched.h>
+
+
 #include "T.h"
+
 #include "rt_wrapper.h"
 
+
 #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
 
 #include "assertions.h"
 #include "msc.h"
 
+#include "PHY/types.h"
+
+#include "PHY/defs_gNB.h"
 #include "common/ran_context.h"
 #include "common/config/config_userapi.h"
 #include "common/utils/load_module_shlib.h"
@@ -41,19 +48,14 @@
 
 //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
 
-#include "PHY/types.h"
-#include "PHY/defs.h"
-#include "PHY/vars.h"
-#include "SCHED/vars.h"
-#include "LAYER2/MAC/vars.h"
-
-#include "../../SIMU/USER/init_lte.h"
+#include "PHY/phy_vars.h"
+#include "SCHED/sched_common_vars.h"
+#include "LAYER2/MAC/mac_vars.h"
 
-#include "LAYER2/MAC/defs.h"
-#include "LAYER2/MAC/vars.h"
-#include "LAYER2/MAC/proto.h"
-#include "RRC/LITE/vars.h"
-#include "PHY_INTERFACE/vars.h"
+#include "LAYER2/MAC/mac.h"
+#include "LAYER2/MAC/mac_proto.h"
+#include "RRC/LTE/rrc_vars.h"
+#include "PHY_INTERFACE/phy_interface_vars.h"
 
 #ifdef SMBV
 #include "PHY/TOOLS/smbv.h"
@@ -66,7 +68,7 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
 #include "enb_config.h"
-#include "PHY/TOOLS/time_meas.h"
+//#include "PHY/TOOLS/time_meas.h"
 
 #ifndef OPENAIR2
 #include "UTIL/OTG/otg_vars.h"
@@ -77,6 +79,8 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "create_tasks.h"
 #endif
 
+#include "PHY/INIT/phy_init.h"
+
 #include "system.h"
 
 #ifdef XFORMS
@@ -84,6 +88,7 @@ unsigned short config_frames[4] = {2,9,11,13};
 #include "stats.h"
 #endif
 #include "nr-softmodem.h"
+#include "NB_IoT_interface.h"
 
 #ifdef XFORMS
 // current status is that every UE has a DL scope for a SINGLE eNB (gnb_id=0)
@@ -200,7 +205,10 @@ extern void print_opp_meas(void);
 extern void init_eNB_afterRU(void);
 
 int transmission_mode=1;
-
+int emulate_rf = 0;
+//int numerology = 0;
+int codingw = 0;
+//int fepw = 0;
 
 
 /* struct for ethernet specific parameters given in eNB conf file */