From 8073aefe4c3202f457cd9e1d6805a3d75a5e7349 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Thu, 5 Feb 2015 17:33:48 +0000
Subject: [PATCH] applied patches from S. Held, addition of scansim.c and PHY
 files for UE band scanning

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6475 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 common/utils/itti/intertask_interface.c       |    4 +-
 common/utils/itti/intertask_interface.h       |    4 +-
 openair1/DOCS/DOXYGEN/Doxyfile                |    2 +-
 openair1/PHY/CODING/3gpplte_sse.c             |    4 +-
 openair1/PHY/CODING/lte_interleaver_inline.h  |    6 +-
 openair1/PHY/CODING/rate_matching.c           |    4 +-
 openair1/PHY/INIT/defs.h                      |   37 +-
 openair1/PHY/INIT/lte_init.c                  | 1592 ++++-------------
 openair1/PHY/LTE_ESTIMATION/defs.h            |   10 +
 openair1/PHY/LTE_ESTIMATION/lte_sync_time.c   |    2 +-
 .../PHY/LTE_ESTIMATION/lte_sync_timefreq.c    |  341 ++--
 openair1/PHY/LTE_ESTIMATION/pss6144.h         |   67 +
 openair1/PHY/defs.h                           |   62 +-
 openair1/PHY/impl_defs_lte.h                  |  573 ++++--
 openair1/SIMULATION/LTE_PHY/Makefile          |    8 +-
 openair1/SIMULATION/LTE_PHY/scansim.c         |  708 ++++++++
 openair1/SIMULATION/TOOLS/defs.h              |    4 +-
 openair1/SIMULATION/TOOLS/taus.c              |    2 +-
 openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c    |    2 +-
 openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h    |    6 +-
 openair2/RRC/LITE/rrc_common.c                |    2 +-
 .../C/MIH_C_F1_basic_data_types_codec.c       |   78 +-
 .../C/MIH_C_F3_data_types_for_address_codec.c |   12 +-
 .../C/MIH_C_F4_data_types_for_links_codec.c   |   82 +-
 .../C/MIH_C_F9_data_types_for_qos_codec.c     |   24 +-
 .../C/MIH_C_Medieval_extensions.c             |   24 +-
 .../INCLUDE/MIH_C_F1_basic_data_types_codec.h |   78 +-
 .../MIH_C_F3_data_types_for_address_codec.h   |   12 +-
 .../MIH_C_F4_data_types_for_links_codec.h     |   76 +-
 .../MIH_C_F9_data_types_for_qos_codec.h       |   24 +-
 .../INCLUDE/MIH_C_Medieval_extensions.h       |   34 +-
 .../INTERFACE-802.21/INCLUDE/MIH_C_Types.h    |  236 +--
 targets/Makefile.common                       |    4 +
 .../SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_enb |    2 +-
 .../SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_ue  |    2 +-
 targets/SIMU/USER/oaisim.c                    |   73 +-
 targets/SIMU/USER/oaisim_functions.c          |   15 +-
 targets/TEST/OAI/case01.py                    |   18 +-
 targets/TEST/OAI/case02.py                    |   17 +-
 targets/TEST/OAI/case03.py                    |    5 +
 targets/TEST/OAI/case04.py                    |    9 +
 targets/TEST/OAI/case05.py                    |    9 +
 targets/TEST/OAI/case11.py                    |    2 +
 targets/TEST/OAI/case12.py                    |    2 +
 targets/TEST/OAI/case13.py                    |    2 +
 targets/TEST/OAI/log.py                       |   39 +-
 targets/TEST/OAI/openair.py                   |   20 +-
 targets/TEST/OAI/test01.py                    |   47 +-
 targets/TEST/OAI/test02.py                    |   50 +-
 49 files changed, 2395 insertions(+), 2041 deletions(-)
 create mode 100644 openair1/PHY/LTE_ESTIMATION/pss6144.h
 create mode 100644 openair1/SIMULATION/LTE_PHY/scansim.c

diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c
index a8858eed1d..584493e0b8 100644
--- a/common/utils/itti/intertask_interface.c
+++ b/common/utils/itti/intertask_interface.c
@@ -350,7 +350,7 @@ int itti_send_broadcast_message(MessageDef *message_p) {
     return ret;
 }
 
-inline MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size)
+MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size)
 {
     MessageDef *temp = NULL;
 
@@ -379,7 +379,7 @@ inline MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, Messag
     return temp;
 }
 
-inline MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id)
+MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id)
 {
     return itti_alloc_new_message_sized(origin_task_id, message_id, itti_desc.messages_info[message_id].size);
 }
diff --git a/common/utils/itti/intertask_interface.h b/common/utils/itti/intertask_interface.h
index ccfc7e53cc..dfdb2c44e3 100644
--- a/common/utils/itti/intertask_interface.h
+++ b/common/utils/itti/intertask_interface.h
@@ -204,7 +204,7 @@ const char *itti_get_task_name(task_id_t task_id);
  * \param message_id Message ID
  * @returns NULL in case of failure or newly allocated mesage ref
  **/
-inline MessageDef *itti_alloc_new_message(
+MessageDef *itti_alloc_new_message(
     task_id_t         origin_task_id,
     MessagesIds       message_id);
 
@@ -214,7 +214,7 @@ inline MessageDef *itti_alloc_new_message(
  * \param size size of the payload to send
  * @returns NULL in case of failure or newly allocated mesage ref
  **/
-inline MessageDef *itti_alloc_new_message_sized(
+MessageDef *itti_alloc_new_message_sized(
     task_id_t         origin_task_id,
     MessagesIds       message_id,
     MessageHeaderSize size);
diff --git a/openair1/DOCS/DOXYGEN/Doxyfile b/openair1/DOCS/DOXYGEN/Doxyfile
index 8cda3df01b..b2b8b7a180 100755
--- a/openair1/DOCS/DOXYGEN/Doxyfile
+++ b/openair1/DOCS/DOXYGEN/Doxyfile
@@ -179,7 +179,7 @@ TAB_SIZE               = 8
 # will result in a user-defined paragraph with heading "Side Effects:". 
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
+ALIASES                += vr{1}="\details Value range: \1\n"
 
 # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
 # sources only. Doxygen will then generate output that is more tailored for C. 
diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c
index 32cc0ddbb9..c3197d3c16 100755
--- a/openair1/PHY/CODING/3gpplte_sse.c
+++ b/openair1/PHY/CODING/3gpplte_sse.c
@@ -62,14 +62,14 @@ struct treillis {
 struct treillis all_treillis[8][256];
 int all_treillis_initialized=0;
 
-inline unsigned char threegpplte_rsc(unsigned char input,unsigned char *state) {
+static inline unsigned char threegpplte_rsc(unsigned char input,unsigned char *state) {
   unsigned char output;
   output = (input ^ (*state>>2) ^ (*state>>1))&1;
   *state = (((input<<2)^(*state>>1))^((*state>>1)<<2)^((*state)<<2))&7;
   return(output);
 }
 
-inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z,unsigned char *state) {
+static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z,unsigned char *state) {
   *z     = ((*state>>2) ^ (*state))   &1;
   *x     = ((*state)    ^ (*state>>1))   &1;
   *state = (*state)>>1;
diff --git a/openair1/PHY/CODING/lte_interleaver_inline.h b/openair1/PHY/CODING/lte_interleaver_inline.h
index 1f6d60ba03..1e29cae9dd 100644
--- a/openair1/PHY/CODING/lte_interleaver_inline.h
+++ b/openair1/PHY/CODING/lte_interleaver_inline.h
@@ -29,12 +29,12 @@
 extern unsigned int threegpplte_interleaver_output;
 extern unsigned int threegpplte_interleaver_tmp;
 
-extern inline void threegpplte_interleaver_reset(void) {
+static inline void threegpplte_interleaver_reset(void) {
   threegpplte_interleaver_output = 0;
   threegpplte_interleaver_tmp    = 0;
 }
 
-extern inline unsigned short threegpplte_interleaver(unsigned short f1,
+static inline unsigned short threegpplte_interleaver(unsigned short f1,
 					      unsigned short f2,
 					      unsigned short K) {
 
@@ -49,7 +49,7 @@ extern inline unsigned short threegpplte_interleaver(unsigned short f1,
 }
 
 
-extern inline short threegpp_interleaver_parameters(unsigned short bytes_per_codeword) {
+static inline short threegpp_interleaver_parameters(unsigned short bytes_per_codeword) {
   if (bytes_per_codeword<=64)
     return (bytes_per_codeword-5);
   else if (bytes_per_codeword <=128)
diff --git a/openair1/PHY/CODING/rate_matching.c b/openair1/PHY/CODING/rate_matching.c
index 682c26bd0f..dc9cb8a4af 100644
--- a/openair1/PHY/CODING/rate_matching.c
+++ b/openair1/PHY/CODING/rate_matching.c
@@ -46,7 +46,7 @@ unsigned int ps0, ps1, ps2, pb;
 */
 //
 
-inline void pset_taus_seed(unsigned int off) {
+static inline void pset_taus_seed(unsigned int off) {
 
 
   ps0 = (unsigned int)0x1e23d852 + (off<<4);
@@ -55,7 +55,7 @@ inline void pset_taus_seed(unsigned int off) {
 
 }
 
-inline unsigned int ptaus(void) {
+static inline unsigned int ptaus(void) {
 
   pb = (((ps0 << 13) ^ ps0) >> 19);
   ps0 = (((ps0 & 0xFFFFFFFE) << 12)^  pb);
diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index a75ebb2969..d6edab54ef 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -67,30 +67,37 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
 
 
 /*!
-\brief Allocate and Initialize the PHY variables relevant to the LTE implementation
-@param phy_vars_ue Pointer to UE Variables
+\brief Allocate and Initialize the PHY variables relevant to the LTE implementation.
+\details Only a subset of phy_vars_ue is initialized.
+@param[out] phy_vars_ue Pointer to UE Variables
 @param nb_connected_eNB Number of eNB that UE can process in one PDSCH demodulation subframe
 @param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
 @returns 0 on success
+@returns -1 if any memory allocation failed
+@note The current implementation will never return -1, but segfault.
  */
 int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
                     int          nb_connected_eNB,
                     uint8_t         abstraction_flag);
 
 /*!
-\brief Allocate and Initialize the PHY variables relevant to the LTE implementation (eNB)
-@param phy_vars_eNb Pointer to eNB Variables
+\brief Allocate and initialize the PHY variables relevant to the LTE implementation (eNB).
+\details Only a subset of phy_vars_eNb is initialized.
+@param[out] phy_vars_eNb Pointer to eNB Variables
 @param is_secondary_eNb Flag to indicate this eNB gets synch from another
-@param cooperation_flag
+@param cooperation_flag 0 for no cooperation, 1 for Delay Diversity and 2 for Distributed Alamouti
 @param abstraction_flag 1 indicates memory should be allocated for abstracted MODEM
 @returns 0 on success
+@returns -1 if any memory allocation failed
+@note The current implementation will never return -1, but segfault.
  */
 int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNb,
                      unsigned char is_secondary_eNb,
                      unsigned char cooperation_flag,
                      unsigned char abstraction_flag);
 
-/** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).  The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id  \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$ 
+/** \brief Configure LTE_DL_FRAME_PARMS with components derived after initial synchronization (MIB decoding + primary/secondary synch).
+\details The basically allows configuration of \f$N_{\mathrm{RB}}^{\mathrm{DL}}\f$, the cell id  \f$N_{\mathrm{ID}}^{\mathrm{cell}}\f$, the normal/extended prefix mode, the frame type (FDD/TDD), \f$N_{\mathrm{cp}}\f$, the number of TX antennas at eNB (\f$p\f$) and the number of PHICH groups, \f$N_{\mathrm{group}}^{\mathrm{PHICH}}\f$
 @param lte_frame_parms pointer to LTE parameter structure
 @param N_RB_DL Number of DL resource blocks
 @param Nid_cell Cell ID
@@ -108,7 +115,8 @@ void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms,
                     PHICH_CONFIG_COMMON *phich_config);
 
 
-/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.  From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
+/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
+\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
 @param Mod_id Instance ID of eNB
 @param CC_id Component Carrier index
 @param tdd_Config TDD UL/DL and S-subframe configurations
@@ -120,7 +128,8 @@ void phy_config_sib1_eNB(module_id_t    Mod_id,
                          uint8_t           SIwindowsize,
                          uint16_t            SIperiod);
 
-/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.  From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
+/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1.
+\details From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
 @param Mod_id Instance ID of UE
 @param CC_id Component Carrier index
 @param CH_index Index of eNB for this configuration
@@ -205,7 +214,8 @@ void phy_config_sib2_eNB(module_id_t                            Mod_id,
 /*!
 \fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
  			         struct PhysicalConfigDedicated *physicalConfigDedicated)
-\brief Configure UE dedicated parameters. Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
+\brief Configure UE dedicated parameters.
+\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
 @param Mod_id Instance ID for eNB
 @param CC_id Component Carrier index
 @param CH_index Index of eNB for this configuration
@@ -219,7 +229,8 @@ void phy_config_dedicated_ue(module_id_t Mod_id,
 
 
 /**
-\brief Configure UE MBSFN common parameters. Invoked upon reception of SIB13 from eNB.
+\brief Configure UE MBSFN common parameters.
+\details Invoked upon reception of SIB13 from eNB.
 @param Mod_id Instance ID for UE
 @param CC_id Component Carrier Index
 @param CH_index eNB id (for multiple eNB reception)
@@ -232,7 +243,8 @@ void phy_config_sib13_ue(module_id_t Mod_id,
                          long mbsfn_AreaId_r9);
 
 /**
-\brief Configure eNB MBSFN common parameters. Invoked upon transmission of SIB13 from eNB.
+\brief Configure eNB MBSFN common parameters.
+\details Invoked upon transmission of SIB13 from eNB.
 @param Mod_id Instance ID for eNB
 @param CC_id Component Carrier index
 @param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@@ -270,7 +282,8 @@ void phy_config_meas_ue(module_id_t Mod_id,
 /*!
 \fn void phy_config_dedicated_eNB(module_id_t Mod_id,uint16_t rnti,
                                   struct PhysicalConfigDedicated *physicalConfigDedicated)
-\brief Prepare for configuration of PHY with dedicated parameters. Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
+\brief Prepare for configuration of PHY with dedicated parameters.
+\details Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
 @param Mod_id Instance ID for eNB
 @param CC_id Component Carrier index
 @param rnti rnti for UE context
diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c
index bf6bac3e4a..8e3141953d 100644
--- a/openair1/PHY/INIT/lte_init.c
+++ b/openair1/PHY/INIT/lte_init.c
@@ -51,6 +51,7 @@
 #include "MBSFN-SubframeConfigList.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 //#define DEBUG_PHY
+#include "assertions.h"
 
 #ifdef EXMIMO
 extern openair0_rf_map rf_map[MAX_NUM_CCs];
@@ -60,6 +61,7 @@ extern uint16_t prach_root_sequence_map0_3[838];
 extern uint16_t prach_root_sequence_map4[138];
 uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
 
+// FIXME not used anywhere
 void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms,
 		    uint8_t N_RB_DL,
 		    uint8_t Nid_cell,
@@ -865,27 +867,119 @@ void phy_init_lte_top(LTE_DL_FRAME_PARMS *lte_frame_parms) {
   
 }
 
+/*! \brief Helper function to allocate memory for DLSCH data structures.
+ * \param[out] pdsch Pointer to the LTE_UE_PDSCH structure to initialize.
+ * \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
+ * \note This function is optimistic in that it expects malloc() to succeed.
+ */
+void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS* const frame_parms )
+{
+  AssertFatal( pdsch, "pdsch==0" );
+
+  pdsch->pmi_ext = (uint8_t*)malloc16_clear( frame_parms->N_RB_DL );
+  pdsch->llr[0] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+  pdsch->llr128 = (int16_t**)malloc16_clear( sizeof(int16_t*) );
+  // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
+
+  pdsch->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->rxdataF_comp0       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->rho                 = (int32_t**)malloc16_clear( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+  pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_ch_mag0          = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch->dl_ch_magb0         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+
+  // the allocated memory size is fixed:
+  AssertFatal( frame_parms->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
+
+  for (int i=0; i<frame_parms->nb_antennas_rx; i++) {
+    pdsch->rho[i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*(frame_parms->N_RB_DL*12*7*2) );
+    for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
+      const int idx = (j<<1)+i;
+      const size_t num = 7*2*frame_parms->N_RB_DL*12;
+      pdsch->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->rxdataF_comp0[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_mag0[idx]          = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+      pdsch->dl_ch_magb0[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+    }
+  }
+}
+
+/*! \brief Helper function to allocate memory for DLSCH_FLP data structures.
+ * \param[out] pdsch_flp Pointer to the LTE_UE_PDSCH_FLP structure to initialize.
+ * \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
+ * \note This function is optimistic in that it expects malloc() to succeed.
+ */
+void phy_init_lte_ue__PDSCH_FLP( LTE_UE_PDSCH_FLP* const pdsch_flp, const LTE_DL_FRAME_PARMS* const frame_parms )
+{
+  AssertFatal( pdsch_flp, "pdsch==0" );
+
+  pdsch_flp->llr[0] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+  pdsch_flp->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+  pdsch_flp->llr128 = (int16_t**)malloc16_clear( sizeof(int16_t*) );
+  // FIXME! no further allocation for (int16_t*)pdsch_flp->llr128 !!! expect SIGSEGV
+
+  pdsch_flp->pmi_ext             = (uint8_t*)malloc16_clear( frame_parms->N_RB_DL );
+  pdsch_flp->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch_flp->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+  pdsch_flp->rxdataF_comp        = (double**)malloc16_clear( 8*sizeof(double*) );
+  pdsch_flp->dl_ch_rho_ext       = (double**)malloc16_clear( 8*sizeof(double*) );
+  pdsch_flp->dl_ch_mag           = (double**)malloc16_clear( 8*sizeof(double*) );
+  pdsch_flp->dl_ch_magb          = (double**)malloc16_clear( 8*sizeof(double*) );
+  pdsch_flp->rho                 = (double**)malloc16_clear( frame_parms->nb_antennas_rx*sizeof(double*) );
+
+  // the allocated memory size is fixed:
+  AssertFatal( frame_parms->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
+
+  for (int i=0; i<frame_parms->nb_antennas_rx; i++) {
+      pdsch_flp->rho[i] = (double*)malloc16_clear( sizeof(double)*(frame_parms->N_RB_DL*12*7*2) );
+      for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
+          const int idx = (j<<1)+i;
+          const size_t num = 7*2*frame_parms->N_RB_DL*12;
+          pdsch_flp->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+          pdsch_flp->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+          pdsch_flp->rxdataF_comp[idx]        = (double*)malloc16_clear( sizeof(double) * num );
+          pdsch_flp->dl_ch_rho_ext[idx]       = (double*)malloc16_clear( sizeof(double) * num );
+          pdsch_flp->dl_ch_mag[idx]           = (double*)malloc16_clear( sizeof(double) * num );
+          pdsch_flp->dl_ch_magb[idx]          = (double*)malloc16_clear( sizeof(double) * num );
+      }
+  }
+}
+
 int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
 		    int nb_connected_eNB,
 		    uint8_t abstraction_flag) {
 
-  LTE_DL_FRAME_PARMS *frame_parms     = &phy_vars_ue->lte_frame_parms;
-  LTE_UE_COMMON *ue_common_vars       = &phy_vars_ue->lte_ue_common_vars;
-  LTE_UE_PDSCH **ue_pdsch_vars        = phy_vars_ue->lte_ue_pdsch_vars;
-  LTE_UE_PDSCH_FLP **ue_pdsch_vars_flp= phy_vars_ue->lte_ue_pdsch_vars_flp;
-  LTE_UE_PDSCH **ue_pdsch_vars_SI     = phy_vars_ue->lte_ue_pdsch_vars_SI;
-  LTE_UE_PDSCH **ue_pdsch_vars_ra     = phy_vars_ue->lte_ue_pdsch_vars_ra;
-  LTE_UE_PDSCH **ue_pdsch_vars_mch    = phy_vars_ue->lte_ue_pdsch_vars_MCH;
-  LTE_UE_PBCH **ue_pbch_vars          = phy_vars_ue->lte_ue_pbch_vars;
-  LTE_UE_PDCCH **ue_pdcch_vars        = phy_vars_ue->lte_ue_pdcch_vars;
-  LTE_UE_PRACH **ue_prach_vars        = phy_vars_ue->lte_ue_prach_vars;
+  // create shortcuts
+  LTE_DL_FRAME_PARMS* const frame_parms      = &phy_vars_ue->lte_frame_parms;
+  LTE_UE_COMMON* const ue_common_vars        = &phy_vars_ue->lte_ue_common_vars;
+  LTE_UE_PDSCH** const ue_pdsch_vars         = phy_vars_ue->lte_ue_pdsch_vars;
+  LTE_UE_PDSCH_FLP** const ue_pdsch_vars_flp = phy_vars_ue->lte_ue_pdsch_vars_flp;
+  LTE_UE_PDSCH** const ue_pdsch_vars_SI      = phy_vars_ue->lte_ue_pdsch_vars_SI;
+  LTE_UE_PDSCH** const ue_pdsch_vars_ra      = phy_vars_ue->lte_ue_pdsch_vars_ra;
+  LTE_UE_PDSCH** const ue_pdsch_vars_mch     = phy_vars_ue->lte_ue_pdsch_vars_MCH;
+  LTE_UE_PBCH** const ue_pbch_vars           = phy_vars_ue->lte_ue_pbch_vars;
+  LTE_UE_PDCCH** const ue_pdcch_vars         = phy_vars_ue->lte_ue_pdcch_vars;
+  LTE_UE_PRACH** const ue_prach_vars         = phy_vars_ue->lte_ue_prach_vars;
 
   int i,j,k;
-  unsigned char eNB_id;
+  int eNB_id;
+
+  msg("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);
+  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", phy_vars_ue->Mod_id+NB_eNB_INST);
+
+  // many memory allocation sizes are hard coded
+  AssertFatal( frame_parms->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
+  AssertFatal( phy_vars_ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
+#ifndef USER_MODE
+  AssertFatal( frame_parms->nb_antennas_tx <= NB_ANTENNAS_TX, "nb_antennas_tx too large" );
+  AssertFatal( frame_parms->nb_antennas_rx <= NB_ANTENNAS_RX, "nb_antennas_rx too large" );
+#endif
+  // init phy_vars_ue
 
-  msg("Initializing UE vars (abstraction %d) for eNB TXant %d, UE RXant %d\n",abstraction_flag,frame_parms->nb_antennas_tx,frame_parms->nb_antennas_rx);
-  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02d][]\n", phy_vars_ue->Mod_id+NB_eNB_INST);
-  for (i=0;i<4;i++) {
+  for (i=0; i<4; i++) {
     phy_vars_ue->rx_gain_max[i] = 135;
     phy_vars_ue->rx_gain_med[i] = 128;
     phy_vars_ue->rx_gain_byp[i] = 120;
@@ -897,628 +991,165 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
     phy_vars_ue->total_TBS_last[eNB_id] = 0;
     phy_vars_ue->bitrate[eNB_id] = 0;
     phy_vars_ue->total_received_bits[eNB_id] = 0;
-    phy_vars_ue->tx_power_dBm=-127;
   }
+  phy_vars_ue->tx_power_dBm=-127;
 
   if (abstraction_flag == 0) {
 
-    ue_common_vars->txdata = (int **)malloc16(frame_parms->nb_antennas_tx*sizeof(int*));
-    for (i=0; i<frame_parms->nb_antennas_tx; i++) {
-#ifdef USER_MODE
-      ue_common_vars->txdata[i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
-      bzero(ue_common_vars->txdata[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
-#else //USER_MODE
-      ue_common_vars->txdata[i] = TX_DMA_BUFFER[0][i];
-#endif //USER_MODE
-    }
+    // init TX buffers
 
-    ue_common_vars->txdataF = (mod_sym_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t*));
+    ue_common_vars->txdata  = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) );
+    ue_common_vars->txdataF = (mod_sym_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(mod_sym_t*) );
     for (i=0; i<frame_parms->nb_antennas_tx; i++) {
 #ifdef USER_MODE
-      ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-      bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
+      ue_common_vars->txdata[i]  = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) );
 #else //USER_MODE
-      ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-      bzero(ue_common_vars->txdataF[i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
+      ue_common_vars->txdata[i]  = TX_DMA_BUFFER[0][i];
 #endif //USER_MODE
+      ue_common_vars->txdataF[i] = (mod_sym_t *)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) );
     }
-    
-    // RX buffers
-    ue_common_vars->rxdata = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-    if (ue_common_vars->rxdata) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdata allocated at %p\n", ue_common_vars->rxdata);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdata not allocated\n");
-      return(-1);
-    }
-    
+
+    // init RX buffers
+
+    ue_common_vars->rxdata   = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+    ue_common_vars->rxdataF  = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+    ue_common_vars->rxdataF2 = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
     for (i=0; i<frame_parms->nb_antennas_rx; i++) {
 #ifndef USER_MODE
-      ue_common_vars->rxdata[i] = (int*) RX_DMA_BUFFER[0][i];
+      ue_common_vars->rxdata[i] = (int32_t*) RX_DMA_BUFFER[0][i];
 #else //USER_MODE
-      ue_common_vars->rxdata[i] = (int*) malloc16((FRAME_LENGTH_COMPLEX_SAMPLES+2048)*sizeof(int));
+      ue_common_vars->rxdata[i] = (int32_t*) malloc16_clear( (FRAME_LENGTH_COMPLEX_SAMPLES+2048)*sizeof(int32_t) );
 #endif //USER_MODE
-      if (ue_common_vars->rxdata[i]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdata[%d] allocated at %p\n",i,ue_common_vars->rxdata[i]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdata[%d] not allocated\n",i);
-	return(-1);
-      }
-    }
-    
-    ue_common_vars->rxdataF = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-    if (ue_common_vars->rxdataF) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF allocated at %p\n", ue_common_vars->rxdataF);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF not allocated\n");
-      return(-1);
-    }
-    
-    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-      //RK 2 times because of output format of FFT!  We should get rid of this
-      ue_common_vars->rxdataF[i] = (int *)malloc16(2*sizeof(int)*(frame_parms->ofdm_symbol_size*14));
-      if (ue_common_vars->rxdataF[i]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF[%d] allocated at %p\n",i,ue_common_vars->rxdataF[i]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF[%d] not allocated\n",i);
-	return(-1);
-      }
-    }
-
-    ue_common_vars->rxdataF2 = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-    if (ue_common_vars->rxdataF2) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF2 allocated at %p\n", ue_common_vars->rxdataF2);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF2 not allocated\n");
-      return(-1);
-    }
-
-    
-    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-      //RK 2 times because of output format of FFT!  We should get rid of this
-      ue_common_vars->rxdataF2[i] = (int *)malloc16(2*sizeof(int)*(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*10));
-      if (ue_common_vars->rxdataF2[i]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF2[%d] allocated at %p\n",i,ue_common_vars->rxdataF2[i]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] ue_common_vars->rxdataF2[%d] not allocated\n",i);
-	return(-1);
-      }
+      // RK 2 times because of output format of FFT!
+      // FIXME We should get rid of this
+      ue_common_vars->rxdataF[i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*(frame_parms->ofdm_symbol_size*14) );
+      // RK 2 times because of output format of FFT!  We should get rid of this
+      // FIXME We should get rid of this
+      ue_common_vars->rxdataF2[i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti*10) );
     }
   }
-
     
   // Channel estimates  
-  for (eNB_id=0;eNB_id<7;eNB_id++) {
-    ue_common_vars->dl_ch_estimates[eNB_id] = (int **)malloc16(8*sizeof(int*));
-    if (ue_common_vars->dl_ch_estimates[eNB_id]) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates (eNB %d) allocated at %p\n",
-	  eNB_id,ue_common_vars->dl_ch_estimates[eNB_id]);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates not allocated\n");
-      return(-1);
-    }
-    
-    
+  for (eNB_id=0; eNB_id<7; eNB_id++) {
+    ue_common_vars->dl_ch_estimates[eNB_id]      = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
+    ue_common_vars->dl_ch_estimates_time[eNB_id] = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
+
     for (i=0; i<frame_parms->nb_antennas_rx; i++)
       for (j=0; j<4; j++) {
-	ue_common_vars->dl_ch_estimates[eNB_id][(j<<1) + i] = (int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*(frame_parms->ofdm_symbol_size)+LTE_CE_FILTER_LENGTH);
-	if (ue_common_vars->dl_ch_estimates[eNB_id][(j<<1)+i]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates[%d][%d] allocated at %p\n",eNB_id,(j<<1)+i,
-	      ue_common_vars->dl_ch_estimates[eNB_id][(j<<1)+i]);
-#endif
-	  
-	  memset(ue_common_vars->dl_ch_estimates[eNB_id][(j<<1)+i],0,frame_parms->symbols_per_tti*sizeof(int)*(frame_parms->ofdm_symbol_size)+LTE_CE_FILTER_LENGTH);
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates[%d] not allocated\n",i);
-	  return(-1);
-	}
+        int idx = (j<<1) + i;
+        ue_common_vars->dl_ch_estimates[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->symbols_per_tti*(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
+        ue_common_vars->dl_ch_estimates_time[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->ofdm_symbol_size*2 );
       }
   }
     
-  for (eNB_id=0;eNB_id<7;eNB_id++) {
-    ue_common_vars->dl_ch_estimates_time[eNB_id] = (int **)malloc16(8*sizeof(int*));
-    if (ue_common_vars->dl_ch_estimates_time[eNB_id]) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates_time[%d] allocated at %p\n",eNB_id,
-	  ue_common_vars->dl_ch_estimates_time[eNB_id]);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates_time not allocated_time\n");
-      return(-1);
-    }
-  
-  
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      for (j=0; j<4; j++) {
-	ue_common_vars->dl_ch_estimates_time[eNB_id][(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->ofdm_symbol_size)*2);
-	if (ue_common_vars->dl_ch_estimates_time[eNB_id][(j<<1)+i]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates_time[%d] allocated at %p\n",i,
-	      ue_common_vars->dl_ch_estimates_time[eNB_id][(j<<1)+i]);
-#endif
-	  
-	  memset(ue_common_vars->dl_ch_estimates_time[eNB_id][(j<<1)+i],0,sizeof(int)*(frame_parms->ofdm_symbol_size)*2);
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] ue_common_vars->dl_ch_estimates_time[%d] not allocated\n",i);
-	  return(-1);
-	}
-      }    
-  }
-    
-  //  lte_ue_pdsch_vars = (LTE_UE_PDSCH **)malloc16(3*sizeof(LTE_UE_PDSCH*));
-  //  lte_ue_pbch_vars = (LTE_UE_PBCH **)malloc16(3*sizeof(LTE_UE_PBCH*));
-
   // DLSCH
-  for (eNB_id=0;eNB_id<phy_vars_ue->n_connected_eNB;eNB_id++) {
-    ue_pdsch_vars[eNB_id]    = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
+  for (eNB_id=0; eNB_id<phy_vars_ue->n_connected_eNB; eNB_id++) {
+    ue_pdsch_vars[eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
 #ifdef ENABLE_FULL_FLP
-    ue_pdsch_vars_flp[eNB_id]= (LTE_UE_PDSCH_FLP *)malloc16(sizeof(LTE_UE_PDSCH_FLP));
-#endif
-    ue_pdsch_vars_SI[eNB_id] = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-    ue_pdsch_vars_ra[eNB_id] = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-    ue_pdsch_vars_mch[eNB_id] = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-    ue_pdcch_vars[eNB_id]    = (LTE_UE_PDCCH *)malloc16(sizeof(LTE_UE_PDCCH));
-    ue_prach_vars[eNB_id]    = (LTE_UE_PRACH *)malloc16(sizeof(LTE_UE_PRACH));
-
-#ifdef DEBUG_PHY
-    msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars[%d] = %p\n",eNB_id,ue_pdsch_vars[eNB_id]);
-    msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars_SI[%d] = %p\n",eNB_id,ue_pdsch_vars_SI[eNB_id]);
-    msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars_ra[%d] = %p\n",eNB_id,ue_pdsch_vars_ra[eNB_id]);
-    msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars_mch[%d] = %p\n",eNB_id,ue_pdsch_vars_mch[eNB_id]);
-    msg("[OPENAIR][LTE PHY][INIT] ue_pdcch_vars[%d] = %p\n",eNB_id,ue_pdcch_vars[eNB_id]);
-    msg("[OPENAIR][LTE PHY][INIT] ue_prach_vars[%d] = %p\n",eNB_id,ue_prach_vars[eNB_id]);
-    //msg("[OPENAIR][LTE PHY][INIT] prach_resources[%d] = %p\n",eNB_id,prach_resources[eNB_id]);
+    ue_pdsch_vars_flp[eNB_id] = (LTE_UE_PDSCH_FLP *)malloc16_clear(sizeof(LTE_UE_PDSCH_FLP));
+#else
+    ue_pdsch_vars_flp[eNB_id] = 0;
 #endif
+    ue_pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    ue_pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    ue_pdsch_vars_mch[eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
+    ue_pdcch_vars[eNB_id]     = (LTE_UE_PDCCH *)malloc16_clear(sizeof(LTE_UE_PDCCH));
+    ue_prach_vars[eNB_id]     = (LTE_UE_PRACH *)malloc16_clear(sizeof(LTE_UE_PRACH));
+    ue_pbch_vars[eNB_id]      = (LTE_UE_PBCH *)malloc16_clear(sizeof(LTE_UE_PBCH));
 
     if (abstraction_flag == 0) {
-      ue_pdsch_vars[eNB_id]->rxdataF_ext     = (int **)malloc16(8*sizeof(int*));
-      ue_pdsch_vars[eNB_id]->llr_shifts = (unsigned char *)malloc16(sizeof(unsigned char)*7*2*frame_parms->N_RB_DL*12);
-      ue_pdsch_vars[eNB_id]->llr_shifts_p = ue_pdsch_vars[eNB_id]->llr_shifts;
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4; j++) //frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars[eNB_id]->rxdataF_ext[(j<<1)+i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars[eNB_id]->rxdataF_comp0     = (int **)malloc16(8*sizeof(int*));
-      for (k=0;k<8;k++)
-	ue_pdsch_vars[eNB_id]->rxdataF_comp1[k]     = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++){
-	  ue_pdsch_vars[eNB_id]->rxdataF_comp0[(j<<1)+i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	  for (k=0;k<8;k++) 
-	    ue_pdsch_vars[eNB_id]->rxdataF_comp1[(j<<1)+i][k]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	}
-      // printf("rxdataF_comp[0] %p\n",ue_pdsch_vars[eNB_id]->rxdataF_comp[0]);
-      
-      ue_pdcch_vars[eNB_id]->rxdataF_comp    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdcch_vars[eNB_id]->rxdataF_comp[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*4));
-      
-      ue_pdcch_vars[eNB_id]->dl_ch_rho_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdcch_vars[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdcch_vars[eNB_id]->rho = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdcch_vars[eNB_id]->rho[i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
+      phy_init_lte_ue__PDSCH( ue_pdsch_vars[eNB_id], frame_parms );
 
-      ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++) {//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	}      
-      ue_pdsch_vars[eNB_id]->dl_ch_rho_ext     = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-            
-      ue_pdsch_vars[eNB_id]->dl_ch_mag0     = (int **)malloc16(8*sizeof(short*));
-      ue_pdsch_vars[eNB_id]->dl_ch_mag1     = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++) {
-	  ue_pdsch_vars[eNB_id]->dl_ch_mag0[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	  ue_pdsch_vars[eNB_id]->dl_ch_mag1[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	}
+      ue_pdsch_vars[eNB_id]->llr_shifts   = (uint8_t*)malloc16_clear(7*2*frame_parms->N_RB_DL*12);
+      ue_pdsch_vars[eNB_id]->llr_shifts_p = ue_pdsch_vars[eNB_id]->llr_shifts;
+      ue_pdsch_vars[eNB_id]->dl_ch_mag1   = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pdsch_vars[eNB_id]->dl_ch_magb1  = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pdsch_vars[eNB_id]->llr[1]       = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
 
-      ue_pdsch_vars[eNB_id]->dl_ch_magb0     = (int **)malloc16(8*sizeof(short*));
-      ue_pdsch_vars[eNB_id]->dl_ch_magb1     = (int **)malloc16(8*sizeof(short*));
+      for (k=0;k<8;k++)
+        ue_pdsch_vars[eNB_id]->rxdataF_comp1[k] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
       for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++) {
-	  ue_pdsch_vars[eNB_id]->dl_ch_magb0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	  ue_pdsch_vars[eNB_id]->dl_ch_magb1[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
+        for (j=0; j<4;j++) {
+          int idx = (j<<1)+i;
+          ue_pdsch_vars[eNB_id]->dl_ch_mag1[idx]  = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(frame_parms->N_RB_DL*12) );
+          ue_pdsch_vars[eNB_id]->dl_ch_magb1[idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(frame_parms->N_RB_DL*12) );
+          for (k=0;k<8;k++)
+            ue_pdsch_vars[eNB_id]->rxdataF_comp1[idx][k] = (int32_t*)malloc16_clear( sizeof(int32_t)*(frame_parms->N_RB_DL*12*14) );
 	}
-      
-      ue_pdsch_vars[eNB_id]->rho     = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdsch_vars[eNB_id]->rho[i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
-      
-      ue_pdsch_vars[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      ue_pdsch_vars[eNB_id]->llr[1] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      ue_pdsch_vars[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
- 
-
 
 #ifdef ENABLE_FULL_FLP
-      ue_pdsch_vars_flp[eNB_id]->rxdataF_ext = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4; j++) //frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_flp[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_flp[eNB_id]->rxdataF_comp = (double **)malloc16(8*sizeof(double*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_flp[eNB_id]->rxdataF_comp[(j<<1)+i] = (double *)malloc16(sizeof(double)*(frame_parms->N_RB_DL*12*14));
-      // printf("rxdataF_comp[0] %p\n",ue_pdsch_vars[eNB_id]->rxdataF_comp[0]);
-      
-      ue_pdsch_vars_flp[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++) {//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_flp[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	}      
-      ue_pdsch_vars_flp[eNB_id]->dl_ch_rho_ext = (double **)malloc16(8*sizeof(double*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_flp[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-     
-      ue_pdsch_vars_flp[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-      
-      ue_pdsch_vars_flp[eNB_id]->dl_ch_mag = (double **)malloc16(8*sizeof(double*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++) 
-	  ue_pdsch_vars_flp[eNB_id]->dl_ch_mag[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_flp[eNB_id]->dl_ch_magb = (double **)malloc16(8*sizeof(double*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_flp[eNB_id]->dl_ch_magb[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_flp[eNB_id]->rho = (double **)malloc16(frame_parms->nb_antennas_rx*sizeof(double*));
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdsch_vars_flp[eNB_id]->rho[i] = (double *)malloc16(sizeof(double)*(frame_parms->N_RB_DL*12*7*2));
-      
-      ue_pdsch_vars_flp[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      ue_pdsch_vars_flp[eNB_id]->llr[1] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      ue_pdsch_vars_flp[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
+      phy_init_lte_ue__PDSCH_FLP( ue_pdsch_vars_flp[eNB_id], frame_parms );
 #endif
 
-
-
-
-
-     
-     
-      ue_pdsch_vars_SI[eNB_id]->rxdataF_ext    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4; j++) //frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_SI[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_SI[eNB_id]->rxdataF_comp0    = (int **)malloc16(8*sizeof(int*));
-      
-      ue_pdsch_vars_SI[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-      
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_SI[eNB_id]->rxdataF_comp0[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_SI[eNB_id]->rho = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdsch_vars_SI[eNB_id]->rho[i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
-      
-      ue_pdsch_vars_SI[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      
-      /***/
-      
-      ue_pdsch_vars_ra[eNB_id]->rxdataF_ext    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_ra[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_ra[eNB_id]->rxdataF_comp0    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_ra[eNB_id]->rxdataF_comp0[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_ra[eNB_id]->rho = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      
-      ue_pdsch_vars_ra[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-      
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdsch_vars_ra[eNB_id]->rho[i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
-      
-      ue_pdsch_vars_ra[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-
-      
-      /***/
-
-      ue_pdsch_vars_mch[eNB_id]->rxdataF_ext    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_mch[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
+      phy_init_lte_ue__PDSCH( ue_pdsch_vars_SI[eNB_id], frame_parms );
+      phy_init_lte_ue__PDSCH( ue_pdsch_vars_ra[eNB_id], frame_parms );
+      phy_init_lte_ue__PDSCH( ue_pdsch_vars_mch[eNB_id], frame_parms );
       
-      ue_pdsch_vars_mch[eNB_id]->rxdataF_comp0    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_mch[eNB_id]->rxdataF_comp0[(j<<1)+i] = (int *)malloc16(sizeof(int)*(2+frame_parms->N_RB_DL*12*14));
-      
-      ue_pdsch_vars_mch[eNB_id]->rho = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      
-      ue_pdsch_vars_mch[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-      
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pdsch_vars_mch[eNB_id]->rho[i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
-      
-      ue_pdsch_vars_mch[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      
-      ue_pdcch_vars[eNB_id]->rxdataF_comp    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdcch_vars[eNB_id]->rxdataF_comp[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*4));
-      
-      /***/
-      
-      ue_pdsch_vars_SI[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_SI[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_SI[eNB_id]->dl_ch_rho_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_SI[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_SI[eNB_id]->dl_ch_mag0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++) 
-	  ue_pdsch_vars_SI[eNB_id]->dl_ch_mag0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-    
-      ue_pdsch_vars_SI[eNB_id]->dl_ch_magb0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_SI[eNB_id]->dl_ch_magb0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      ue_pdsch_vars_SI[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      /***/
-      
-      ue_pdsch_vars_SI[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
-      
-      ue_pdsch_vars_ra[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_ra[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_ra[eNB_id]->dl_ch_rho_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_ra[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_ra[eNB_id]->dl_ch_mag0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++) 
-	  ue_pdsch_vars_ra[eNB_id]->dl_ch_mag0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_ra[eNB_id]->dl_ch_magb0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_ra[eNB_id]->dl_ch_magb0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      //    ue_pdsch_vars_ra[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      ue_pdsch_vars_ra[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
+      ue_pdcch_vars[eNB_id]->llr   = (uint16_t*)malloc16_clear( 4*frame_parms->N_RB_DL*12*sizeof(uint16_t) );
+      ue_pdcch_vars[eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*frame_parms->N_RB_DL*12*sizeof(uint16_t) );
+      ue_pdcch_vars[eNB_id]->wbar  = (uint16_t*)malloc16_clear( 4*frame_parms->N_RB_DL*12*sizeof(uint16_t) );
+      ue_pdcch_vars[eNB_id]->e_rx  = (int8_t*)malloc16_clear( 4*2*frame_parms->N_RB_DL*12 );
 
-      /***/
+      ue_pdcch_vars[eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pdcch_vars[eNB_id]->dl_ch_rho_ext       = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pdcch_vars[eNB_id]->rho                 = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+      ue_pdcch_vars[eNB_id]->rxdataF_ext         = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
 
-      ue_pdsch_vars_mch[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_mch[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_mch[eNB_id]->dl_ch_rho_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_mch[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_mch[eNB_id]->dl_ch_mag0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++) 
-	  ue_pdsch_vars_mch[eNB_id]->dl_ch_mag0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      
-      ue_pdsch_vars_mch[eNB_id]->dl_ch_magb0 = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdsch_vars_mch[eNB_id]->dl_ch_magb0[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      //    ue_pdsch_vars_mch[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      
-      ue_pdsch_vars_mch[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
-      
-      ue_pdcch_vars[eNB_id]->rxdataF_ext    = (int **)malloc16(8*sizeof(int*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdcch_vars[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-      
-      ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(short*));
-      for (i=0; i<frame_parms->nb_antennas_rx; i++)
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-      ue_pdcch_vars[eNB_id]->llr = (unsigned short *)malloc16(4*frame_parms->N_RB_DL*12*sizeof(unsigned short));
-      ue_pdcch_vars[eNB_id]->llr16 = (unsigned short *)malloc16(2*4*frame_parms->N_RB_DL*12*sizeof(unsigned short));
-      ue_pdcch_vars[eNB_id]->wbar = (unsigned short *)malloc16(4*frame_parms->N_RB_DL*12*sizeof(unsigned short));
-      
-      ue_pdcch_vars[eNB_id]->e_rx = (int8_t *)malloc16(4*2*frame_parms->N_RB_DL*12*sizeof(unsigned char));
+      for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+        ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(frame_parms->N_RB_DL*12*7*2) );
+        for (j=0; j<4;j++) {//frame_parms->nb_antennas_tx; j++)
+          int idx = (j<<1)+i;
+          size_t num = 7*2*frame_parms->N_RB_DL*12;
+          ue_pdcch_vars[eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+          ue_pdcch_vars[eNB_id]->dl_ch_rho_ext[idx]       = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+          ue_pdcch_vars[eNB_id]->rxdataF_ext[idx]         = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+          ue_pdcch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
+        }
+      }
       
       // PBCH
-      ue_pbch_vars[eNB_id] = (LTE_UE_PBCH *)malloc16(sizeof(LTE_UE_PBCH));
-      ue_pbch_vars[eNB_id]->rxdataF_ext    = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	ue_pbch_vars[eNB_id]->rxdataF_ext[i] = (int *)malloc16(sizeof(int)*(6*12*4));
-      
-      ue_pbch_vars[eNB_id]->rxdataF_comp    = (int **)malloc16(8*sizeof(int*));
-      ue_pbch_vars[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(short*));
-      
-      for (i=0;i<frame_parms->nb_antennas_rx;i++)
-	for (j=0;j<4;j++){//frame_parms->nb_antennas_tx;j++) {
-	  ue_pbch_vars[eNB_id]->rxdataF_comp[(j<<1)+i]        = (int *)malloc16(sizeof(int)*(6*12*4));
-	  ue_pbch_vars[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*6*12*4);
+      ue_pbch_vars[eNB_id]->rxdataF_ext         = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+      ue_pbch_vars[eNB_id]->rxdataF_comp        = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
+      ue_pbch_vars[eNB_id]->llr                 = (int8_t*)malloc16_clear( 1920 );
+      ue_prach_vars[eNB_id]->prachF             = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(frame_parms->ofdm_symbol_size*12)) );
+      ue_prach_vars[eNB_id]->prach              = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(frame_parms->ofdm_symbol_size*12)) );
+
+      for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+        ue_pbch_vars[eNB_id]->rxdataF_ext[i]    = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
+        for (j=0; j<4; j++) {//frame_parms->nb_antennas_tx;j++) {
+          int idx = (j<<1)+i;
+          ue_pbch_vars[eNB_id]->rxdataF_comp[idx]        = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
+          ue_pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
 	}    
-      ue_pbch_vars[eNB_id]->llr = (int8_t *)malloc16(1920*sizeof(char));
-      
-      //    ue_pbch_vars[eNB_id]->channel_output = (short *)malloc16(*sizeof(short));
-      
-      ue_pbch_vars[eNB_id]->decoded_output = (unsigned char *)malloc16(64*sizeof(unsigned char));
-      
-      ue_pbch_vars[eNB_id]->pdu_errors_conseq=0;
-      ue_pbch_vars[eNB_id]->pdu_errors=0;
-      ue_pbch_vars[eNB_id]->pdu_errors_last=0;
-      ue_pbch_vars[eNB_id]->pdu_fer=0;
-    
-      ue_prach_vars[eNB_id]->prachF = (int16_t *)malloc16(sizeof(int)*(7*2*sizeof(int)*(frame_parms->ofdm_symbol_size*12)));
-      ue_prach_vars[eNB_id]->prach  = (int16_t *)malloc16(sizeof(int)*(7*2*sizeof(int)*(frame_parms->ofdm_symbol_size*12)));
+      }
     }
-    else {
-      ue_pbch_vars[eNB_id] = (LTE_UE_PBCH *)malloc16(sizeof(LTE_UE_PBCH));
-      ue_pbch_vars[eNB_id]->pdu_errors_conseq=0;
-      ue_pbch_vars[eNB_id]->pdu_errors=0;
-      ue_pbch_vars[eNB_id]->pdu_errors_last=0;
-      ue_pbch_vars[eNB_id]->pdu_fer=0;
-      ue_pbch_vars[eNB_id]->decoded_output = (unsigned char *)malloc16(64*sizeof(unsigned char));
-    } 
+
+    ue_pbch_vars[eNB_id]->decoded_output = (uint8_t*)malloc16_clear( 64 );
   }
-  //initialization for the last instance of ue_pdsch_vars (used for MU-MIMO)
-  ue_pdsch_vars[eNB_id]     = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-  ue_pdsch_vars_SI[eNB_id]     = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-  ue_pdsch_vars_ra[eNB_id]     = (LTE_UE_PDSCH *)malloc16(sizeof(LTE_UE_PDSCH));
-  ue_pdsch_vars_flp[eNB_id] = (LTE_UE_PDSCH_FLP *)malloc16(sizeof(LTE_UE_PDSCH_FLP));
-#ifdef DEBUG_PHY
-  msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars[%d] = %p\n",    eNB_id,ue_pdsch_vars[eNB_id]);
-  msg("[OPENAIR][LTE PHY][INIT] ue_pdsch_vars_flp[%d] = %p\n",eNB_id,ue_pdsch_vars_flp[eNB_id]);
-#endif
-  if(abstraction_flag == 0){
-    
-    ue_pdsch_vars[eNB_id]->rxdataF_ext     = (int **)malloc16(8*sizeof(int*));
-    ue_pdsch_vars_flp[eNB_id]->rxdataF_ext = (int **)malloc16(8*sizeof(int*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-	for (j=0; j<4; j++) //frame_parms->nb_antennas_tx; j++)
-	  {
-	    ue_pdsch_vars[eNB_id]->rxdataF_ext[(j<<1)+i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	    ue_pdsch_vars_flp[eNB_id]->rxdataF_ext[(j<<1)+i] = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	  }
-      }
 
-    ue_pdsch_vars[eNB_id]->rxdataF_comp0     = (int **)malloc16(8*sizeof(int*));
-    ue_pdsch_vars_flp[eNB_id]->rxdataF_comp = (double **)malloc16(8*sizeof(int*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  {
-	    ue_pdsch_vars[eNB_id]->rxdataF_comp0[(j<<1)+i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	    ue_pdsch_vars_flp[eNB_id]->rxdataF_comp[(j<<1)+i] = (double *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*14));
-	  }
-      }
-    //    printf("rxdataF_comp[0] %p\n",ue_pdsch_vars[eNB_id]->rxdataF_comp[0]);
-    
-    ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext     = (int **)malloc16(8*sizeof(int*));
-    ue_pdsch_vars_flp[eNB_id]->dl_ch_estimates_ext = (int **)malloc16(8*sizeof(int*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  {
-	    ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	    ue_pdsch_vars_flp[eNB_id]->dl_ch_estimates_ext[(j<<1)+i] = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	  }
-      }
-    
-    ue_pdsch_vars[eNB_id]->dl_ch_rho_ext     = (int **)malloc16(8*sizeof(short*));
-    ue_pdsch_vars_flp[eNB_id]->dl_ch_rho_ext = (double **)malloc16(8*sizeof(double*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	  {
-	    ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	    ue_pdsch_vars_flp[eNB_id]->dl_ch_rho_ext[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-	  }
-      }
+  // initialization for the last instance of ue_pdsch_vars (used for MU-MIMO)
 
-    ue_pdsch_vars[eNB_id]->pmi_ext     = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-    ue_pdsch_vars_flp[eNB_id]->pmi_ext = (unsigned char *)malloc16(frame_parms->N_RB_DL);
-        
-    ue_pdsch_vars[eNB_id]->dl_ch_mag0     = (int **)malloc16(8*sizeof(short*));
-    ue_pdsch_vars_flp[eNB_id]->dl_ch_mag = (double **)malloc16(8*sizeof(double*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-	for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++) 
-	  {
-	    ue_pdsch_vars[eNB_id]->dl_ch_mag0[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	    ue_pdsch_vars_flp[eNB_id]->dl_ch_mag[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-	  }
-      }
-    ue_pdsch_vars[eNB_id]->dl_ch_magb0     = (int **)malloc16(8*sizeof(short*));
-    ue_pdsch_vars_flp[eNB_id]->dl_ch_magb = (double **)malloc16(8*sizeof(double*));
-    for (i=0; i<frame_parms->nb_antennas_rx; i++)
-      {
-      for (j=0; j<4;j++)//frame_parms->nb_antennas_tx; j++)
-	{
-	  ue_pdsch_vars[eNB_id]->dl_ch_magb0[(j<<1)+i]     = (int *)malloc16(7*2*sizeof(int)*(frame_parms->N_RB_DL*12));
-	  ue_pdsch_vars_flp[eNB_id]->dl_ch_magb[(j<<1)+i] = (double *)malloc16(7*2*sizeof(double)*(frame_parms->N_RB_DL*12));
-	}
-      }
-    ue_pdsch_vars[eNB_id]->rho     = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-    ue_pdsch_vars_flp[eNB_id]->rho = (double **)malloc16(frame_parms->nb_antennas_rx*sizeof(double*));
-    for (i=0;i<frame_parms->nb_antennas_rx;i++)
-      {
-	ue_pdsch_vars[eNB_id]->rho[i]     = (int *)malloc16(sizeof(int)*(frame_parms->N_RB_DL*12*7*2));
-	ue_pdsch_vars_flp[eNB_id]->rho[i] = (double *)malloc16(sizeof(double)*(frame_parms->N_RB_DL*12*7*2));
-      }
-    
-    ue_pdsch_vars[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-    ue_pdsch_vars[eNB_id]->llr[1] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-    ue_pdsch_vars_flp[eNB_id]->llr[0] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-    ue_pdsch_vars_flp[eNB_id]->llr[1] = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-    
-    ue_pdsch_vars[eNB_id]->llr128     = (short **)malloc16(sizeof(short **));
-    ue_pdsch_vars_flp[eNB_id]->llr128 = (short **)malloc16(sizeof(short **));
+  ue_pdsch_vars[eNB_id]     = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  ue_pdsch_vars_SI[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  ue_pdsch_vars_ra[eNB_id]  = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
+  ue_pdsch_vars_flp[eNB_id] = (LTE_UE_PDSCH_FLP *)malloc16_clear( sizeof(LTE_UE_PDSCH_FLP) );
+
+  if (abstraction_flag == 0) {
+    phy_init_lte_ue__PDSCH( ue_pdsch_vars[eNB_id], frame_parms );
+    ue_pdsch_vars[eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
+
+    phy_init_lte_ue__PDSCH_FLP( ue_pdsch_vars_flp[eNB_id], frame_parms );
   }
   else { //abstraction == 1
-    phy_vars_ue->sinr_dB = (double*) malloc16(frame_parms->N_RB_DL*12*sizeof(double));
+    phy_vars_ue->sinr_dB = (double*) malloc16_clear( frame_parms->N_RB_DL*12*sizeof(double) );
   }
 
-  phy_vars_ue->sinr_CQI_dB = (double*) malloc16(frame_parms->N_RB_DL*12*sizeof(double));
-#if defined(OAI_EMU)
-  memset(phy_vars_ue->sinr_CQI_dB, 0, frame_parms->N_RB_DL*12*sizeof(double));
-#endif
-  phy_vars_ue->init_averaging = 1;
+  phy_vars_ue->sinr_CQI_dB = (double*) malloc16_clear( frame_parms->N_RB_DL*12*sizeof(double) );
 
-  phy_vars_ue->pdsch_config_dedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; //defaul value until overwritten by RRCConnectionReconfiguration
+  phy_vars_ue->init_averaging = 1;
+  phy_vars_ue->pdsch_config_dedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; // default value until overwritten by RRCConnectionReconfiguration
 
   // set channel estimation to do linear interpolation in time
   phy_vars_ue->high_speed_flag = 1;
@@ -1526,787 +1157,204 @@ int phy_init_lte_ue(PHY_VARS_UE *phy_vars_ue,
 
   init_prach_tables(839);
 
-  return(0);
+  return 0;
 }
 
 int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB,
 		     unsigned char is_secondary_eNB,
-		     uint8_t cooperation_flag,// 0 for no cooperation,1 for Delay Diversity and 2 for Distributed Alamouti
+                     uint8_t cooperation_flag,
 		     unsigned char abstraction_flag)
 {
 
-  LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms;
-  LTE_eNB_COMMON *eNB_common_vars = &phy_vars_eNB->lte_eNB_common_vars;
-  LTE_eNB_PUSCH **eNB_pusch_vars  = phy_vars_eNB->lte_eNB_pusch_vars;
-  LTE_eNB_SRS *eNB_srs_vars       = phy_vars_eNB->lte_eNB_srs_vars;
-  LTE_eNB_PRACH *eNB_prach_vars   = &phy_vars_eNB->lte_eNB_prach_vars;
+  // shortcuts
+  LTE_DL_FRAME_PARMS* const frame_parms = &phy_vars_eNB->lte_frame_parms;
+  LTE_eNB_COMMON* const eNB_common_vars = &phy_vars_eNB->lte_eNB_common_vars;
+  LTE_eNB_PUSCH** const eNB_pusch_vars  = phy_vars_eNB->lte_eNB_pusch_vars;
+  LTE_eNB_SRS* const eNB_srs_vars       = phy_vars_eNB->lte_eNB_srs_vars;
+  LTE_eNB_PRACH* const eNB_prach_vars   = &phy_vars_eNB->lte_eNB_prach_vars;
   int i, j, eNB_id, UE_id;
 
-  //phy_vars_eNB->lte_frame_parms.nb_antennas_tx = 2;
-  //phy_vars_eNB->lte_frame_parms.nb_antennas_rx = 2;
-
   phy_vars_eNB->total_dlsch_bitrate = 0;
   phy_vars_eNB->total_transmitted_bits = 0;
   phy_vars_eNB->total_system_throughput = 0;
   phy_vars_eNB->check_for_MUMIMO_transmissions=0;
 
-  LOG_I(PHY,"[eNB %d] Initializing DL_FRAME_PARMS : N_RB_DL %d, PHICH Resource %d, PHICH Duration %d\n",
+  LOG_I(PHY,"[eNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d\n",
       phy_vars_eNB->Mod_id,
       frame_parms->N_RB_DL,frame_parms->phich_config_common.phich_resource,
       frame_parms->phich_config_common.phich_duration);
-  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02d][]\n", phy_vars_eNB->Mod_id);
+  LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_eNB][MOD %02"PRIu8"][]\n", phy_vars_eNB->Mod_id);
+
   lte_gold(frame_parms,phy_vars_eNB->lte_gold_table,frame_parms->Nid_cell);
   generate_pcfich_reg_mapping(frame_parms);
   generate_phich_reg_mapping(frame_parms);
-  //  init_prach625(frame_parms);
 
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
     phy_vars_eNB->first_run_timing_advance[UE_id] = 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
 
-    memset(&phy_vars_eNB->eNB_UE_stats[UE_id],0,sizeof(LTE_eNB_UE_stats));
-
-    phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS = 0;
-    phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS_last = 0;
-    //    phy_vars_eNB->eNB_UE_stats[UE_id].total_TBS_MAC = 0;
-    phy_vars_eNB->eNB_UE_stats[UE_id].dlsch_bitrate = 0;
+    // clear whole structure
+    bzero( &phy_vars_eNB->eNB_UE_stats[UE_id], sizeof(LTE_eNB_UE_stats) );
 
     phy_vars_eNB->physicalConfigDedicated[UE_id] = NULL;
   }
+
   phy_vars_eNB->first_run_I0_measurements = 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
 
+#ifndef USER_MODE
+  AssertFatal( frame_parms->nb_antennas_tx <= NB_ANTENNAS_TX, "nb_antennas_tx too large" );
+  AssertFatal( frame_parms->nb_antennas_rx <= NB_ANTENNAS_RX, "nb_antennas_rx too large" );
+#endif
+
   for (eNB_id=0; eNB_id<3; eNB_id++) {
 
     if (abstraction_flag==0) {
+
       // TX vars
-      eNB_common_vars->txdata[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_tx*sizeof(int*));
-      if (eNB_common_vars->txdata[eNB_id]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d] allocated at %p\n",eNB_id,
-	    eNB_common_vars->txdata[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d] not allocated\n",eNB_id);
-	return(-1);
-      }
-      
+      eNB_common_vars->txdata[eNB_id]  = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) );
+      eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(mod_sym_t*) );
       for (i=0; i<frame_parms->nb_antennas_tx; i++) {
 #ifdef USER_MODE
-	eNB_common_vars->txdata[eNB_id][i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
-	bzero(eNB_common_vars->txdata[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
+        eNB_common_vars->txdata[eNB_id][i]  = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) );
+        eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) );
 #else // USER_MODE
-	eNB_common_vars->txdata[eNB_id][i] = TX_DMA_BUFFER[eNB_id][i];
+        eNB_common_vars->txdata[eNB_id][i]  = TX_DMA_BUFFER[eNB_id][i];
+        eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) );
 #endif //USER_MODE
 #ifdef DEBUG_PHY
 	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]);
-#endif
-      }
-      
-      eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t*));
-      if (eNB_common_vars->txdataF[eNB_id]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d] allocated at %p\n",eNB_id,
-	    eNB_common_vars->txdataF[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d] not allocated\n",eNB_id);
-	return(-1);
-      }
-
-      for (i=0; i<frame_parms->nb_antennas_tx; i++) {
-#ifdef USER_MODE
-	eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-	bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-#else //USER_MODE
-	eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-	bzero(eNB_common_vars->txdataF[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
-#endif //USER_MODE
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n",
-	    eNB_id,i,eNB_common_vars->txdataF[eNB_id][i],
-	    FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
+        msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n",
+            eNB_id,i,eNB_common_vars->txdataF[eNB_id][i],
+            FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t));
 #endif
       }
 
-      //RX vars
-      eNB_common_vars->rxdata[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      if (eNB_common_vars->rxdata[eNB_id]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata[%d] allocated at %p\n",eNB_id,
-	    eNB_common_vars->rxdata[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata[%d] not allocated\n",eNB_id);
-	return(-1);
-      }
-
-      //RX vars
-      eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      if (eNB_common_vars->rxdata_7_5kHz[eNB_id]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata_7_5kHz[%d] allocated at %p\n",eNB_id,
-	    eNB_common_vars->rxdata_7_5kHz[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata_7_5kHz[%d] not allocated\n",eNB_id);
-	return(-1);
-      }
-      
+      // RX vars
+      eNB_common_vars->rxdata[eNB_id]        = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+      eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+      eNB_common_vars->rxdataF[eNB_id]       = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
       for (i=0; i<frame_parms->nb_antennas_rx; i++) {
 #ifndef USER_MODE
-	eNB_common_vars->rxdata[eNB_id][i] = (int *)RX_DMA_BUFFER[eNB_id][i];
+        eNB_common_vars->rxdata[eNB_id][i] = (int32_t*)RX_DMA_BUFFER[eNB_id][i];
 #else //USER_MODE
-	eNB_common_vars->rxdata[eNB_id][i] = (int *)malloc16(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
-	bzero(eNB_common_vars->rxdata[eNB_id][i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int));
+        eNB_common_vars->rxdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) );
 #endif //USER_MODE
+        eNB_common_vars->rxdata_7_5kHz[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->samples_per_tti*sizeof(int32_t) );
+        // RK 2 times because of output format of FFT!
+        // FIXME We should get rid of this
+        eNB_common_vars->rxdataF[eNB_id][i] = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti) );
 #ifdef DEBUG_PHY
 	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->rxdata[eNB_id][i]);
-#endif
-	eNB_common_vars->rxdata_7_5kHz[eNB_id][i] = (int *)malloc16(frame_parms->samples_per_tti*sizeof(int));
-	bzero(eNB_common_vars->rxdata_7_5kHz[eNB_id][i],frame_parms->samples_per_tti*sizeof(int));
-#ifdef DEBUG_PHY
 	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdata_7_5kHz[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->rxdata_7_5kHz[eNB_id][i]);
 #endif
       }
       
-      eNB_common_vars->rxdataF[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-      if (eNB_common_vars->rxdataF[eNB_id]) {
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdataF[%d] allocated at %p\n",eNB_id,
-	    eNB_common_vars->rxdataF[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdataF[%d] not allocated\n",eNB_id);
-	return(-1);
-      }
-      
-      for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	//RK 2 times because of output format of FFT!  We should get rid of this
-	eNB_common_vars->rxdataF[eNB_id][i] = (int *)malloc16(2*sizeof(int)*(frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti));
-	if (eNB_common_vars->rxdataF[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdataF[%d][%d] allocated at %p\n",eNB_id,i,
-	      eNB_common_vars->rxdataF[eNB_id][i]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->rxdataF[%d][%d] not allocated\n",eNB_id,i);
-	  return(-1);
-	}
-      }
-      
       // Channel estimates for SRS
-      for (UE_id=0;UE_id<NUMBER_OF_UE_MAX;UE_id++) {
-	
-	eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d].srs_ch_estimates[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d].srs_ch_estimates[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id][i] = (int *)malloc16(sizeof(int)*(frame_parms->ofdm_symbol_size));
-	  if (eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d]->srs_ch_estimates[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id][i],0,sizeof(int)*(frame_parms->ofdm_symbol_size));
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d]->srs_ch_estimates[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	// Channel estimates for SRS (time)
-	eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d]->srs_ch_estimates_time[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d]->srs_ch_estimates_time[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
+      for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
 	
+        eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id]      = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+
 	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i] = (int *)malloc16(sizeof(int)*(frame_parms->ofdm_symbol_size)*2);
-	  if (eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d].srs_ch_estimates_time[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i],0,sizeof(int)*(frame_parms->ofdm_symbol_size)*2);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_srs_vars[%d]->srs_ch_estimates_time[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
+          eNB_srs_vars[UE_id].srs_ch_estimates[eNB_id][i]      = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->ofdm_symbol_size );
+          eNB_srs_vars[UE_id].srs_ch_estimates_time[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->ofdm_symbol_size*2 );
+        }
       } //UE_id
       
-      eNB_common_vars->sync_corr[eNB_id] = (unsigned int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
-      if (eNB_common_vars->sync_corr[eNB_id]) {
-	bzero(eNB_common_vars->sync_corr[eNB_id],LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->sync_corr[%d] allocated at %p\n", eNB_id, eNB_common_vars->sync_corr[eNB_id]);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->sync_corr[%d] not allocated\n", eNB_id);
-	return(-1);
-      }
+      eNB_common_vars->sync_corr[eNB_id] = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*frame_parms->samples_per_tti );
     }
     else //UPLINK abstraction = 1
     {
-		
-	 	phy_vars_eNB->sinr_dB = (double*) malloc16(frame_parms->N_RB_DL*12*sizeof(double));
-	}
+      phy_vars_eNB->sinr_dB = (double*) malloc16_clear( frame_parms->N_RB_DL*12*sizeof(double) );
+    }
   } //eNB_id
     
-  
 #ifndef NO_UL_REF 
   if (abstraction_flag==0) {
     generate_ul_ref_sigs_rx();
     
     // SRS
-    for (UE_id=0;UE_id<NUMBER_OF_UE_MAX;UE_id++) {
-      eNB_srs_vars[UE_id].srs = (int *)malloc16(2*frame_parms->ofdm_symbol_size*sizeof(int*));
-      if (eNB_srs_vars[UE_id].srs) { 
-#ifdef DEBUG_PHY
-	msg("[openair][LTE_PHY][INIT] eNB_srs_vars[%d].srs allocated at %p\n",UE_id,eNB_srs_vars[UE_id].srs);
-#endif
-      }
-      else {
-	msg("[openair][LTE_PHY][INIT] eNB_srs_vars[%d].srs not allocated\n",UE_id);
-	return(-1);
-      }
+    for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
+      eNB_srs_vars[UE_id].srs = (int32_t*)malloc16_clear(2*frame_parms->ofdm_symbol_size*sizeof(int32_t));
     }
   }
 #endif
     
-    // ULSCH VARS
+  // ULSCH VARS
 
-  eNB_prach_vars->prachF = (int16_t*)malloc16(1024*4);
-  memset(eNB_prach_vars->prachF,0,1024*4);
+  eNB_prach_vars->prachF = (int16_t*)malloc16_clear( 1024*sizeof(int16_t) );
  
+  AssertFatal( frame_parms->nb_antennas_rx <= sizeof(eNB_prach_vars->rxsigF), "nb_antennas_rx too large" );
   for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-    eNB_prach_vars->rxsigF[i] = (int16_t*)malloc16(frame_parms->ofdm_symbol_size*12*2*2);
+    eNB_prach_vars->rxsigF[i] = (int16_t*)malloc16_clear( frame_parms->ofdm_symbol_size*12*2*sizeof(int16_t) );
 #ifdef DEBUG_PHY
     msg("[openair][LTE_PHY][INIT] prach_vars->rxsigF[%d] = %p\n",i,eNB_prach_vars->rxsigF[i]);
 #endif
-    //    memset(eNB_prach_vars->rxsigF[i],0,frame_parms->ofdm_symbol_size*12*2*2);
   }
 
-
   for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
 
     //FIXME
-    eNB_pusch_vars[UE_id] = (LTE_eNB_PUSCH *)malloc16(NUMBER_OF_UE_MAX*sizeof(LTE_eNB_PUSCH));
-    if (eNB_pusch_vars[UE_id]) {
-#ifdef DEBUG_PHY
-      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d] allocated at %p\n",UE_id,eNB_pusch_vars[UE_id]);
-#endif
-    }
-    else {
-      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d] not allocated\n",UE_id);
-      return(-1);
-    }
+    eNB_pusch_vars[UE_id] = (LTE_eNB_PUSCH*)malloc16_clear( NUMBER_OF_UE_MAX*sizeof(LTE_eNB_PUSCH) );
 
     if (abstraction_flag==0) {
       for (eNB_id=0; eNB_id<3; eNB_id++) {
 	
-	eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  //RK 2 times because of output format of FFT!  We should get rid of this
-	  eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id][i] = 
-	    (int *)malloc16(2*sizeof(int)*(frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti));
-	  if (eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id][i]);
-#endif
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext2[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id][i] = 
-	    (int *)malloc16(sizeof(int)*(frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti));
-	  if (eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext2[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id][i]);
-#endif
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_ext[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	// Channel estimates for DRS
-	eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id][i] = 
-	    (int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  if (eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	// Channel estimates for time domain DRS
-	eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	if (eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_time[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_time[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id][i] = 
-	    (int *)malloc16(2*2*sizeof(int)*frame_parms->ofdm_symbol_size);
-	  if (eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_time[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id][i],0,2*sizeof(int)*frame_parms->ofdm_symbol_size);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_time[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
+        eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id]      = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id]     = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id]     = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id]  = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+        eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+
+        for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+          // RK 2 times because of output format of FFT!
+          // FIXME We should get rid of this
+          eNB_pusch_vars[UE_id]->rxdataF_ext[eNB_id][i]      = (int32_t*)malloc16_clear( 2*sizeof(int32_t)*frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti );
+          eNB_pusch_vars[UE_id]->rxdataF_ext2[eNB_id][i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti );
+          eNB_pusch_vars[UE_id]->drs_ch_estimates[eNB_id][i] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti );
+          eNB_pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id][i] = (int32_t*)malloc16_clear( 2*2*sizeof(int32_t)*frame_parms->ofdm_symbol_size );
+          eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id][i]     = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->N_RB_UL*12*frame_parms->symbols_per_tti );
+          eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id][i]  = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+          eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+        }
 	
 	// In case of Distributed Alamouti Collabrative scheme separate channel estimates are required for both the UEs
-	if(cooperation_flag == 2)
-	  //if (1)
-	  {
-	    //UE 0 DRS estimates
-	    eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	    if (eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_0[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_0[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_0[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_0[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	    
-	    //UE 1 DRS estimates
-	    eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id] = (int **)malloc16(frame_parms->nb_antennas_rx*sizeof(int*));
-	    if (eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_1[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_1[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_1[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->drs_ch_estimates_1[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	  }// cooperation_flag
-
-	
-	eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	if (eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id][i] = 
-	    (int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  if (eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_pusch_vars[UE_id]->rxdataF_comp[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
+        if (cooperation_flag == 2) {
+            eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); // UE 0 DRS estimates
+            eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); // UE 1 DRS estimates
+            for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+              eNB_pusch_vars[UE_id]->drs_ch_estimates_0[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+              eNB_pusch_vars[UE_id]->drs_ch_estimates_1[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+            }
 	
-	
-	// Compensated data for the case of Distributed Alamouti Scheme
-	if(cooperation_flag == 2)
-	  {
-	    
-	    // it will contain(y)*(h0*)
-	    eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_0[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_0[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_0[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_0[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	    
-	    
-	    // it will contain(y*)*(h1)
-	    eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_1[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_1[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_1[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->rxdataF_comp_1[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	  }// cooperation_flag
-
-	
-	
-	
-	eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	if (eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id][i] = 
-	    (int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  if (eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_pusch_vars[UE_id]->ul_ch_mag[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	if (eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id]) {
-#ifdef DEBUG_PHY
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb[%d] allocated at %p\n",UE_id,eNB_id,
-	      eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id]);
-#endif
-	}
-	else {
-	  msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb[%d] not allocated\n",UE_id,eNB_id);
-	  return(-1);
-	}
-	
-	for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	  eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id][i] = 
-	    (int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  if (eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id][i]) {
-#ifdef DEBUG_PHY
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id][i]);
-#endif
-	    
-	    memset(eNB_pusch_vars[UE_id]->ul_ch_magb[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	  }
-	  else {
-	    msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb[%d][%d] not allocated\n",UE_id,eNB_id,i);
-	    return(-1);
-	  }
-	}
-	
-	if(cooperation_flag == 2) // for Distributed Alamouti Scheme
-	  {
-	    // UE 0
-	    eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_0[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_0[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_0[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_0[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	    
-	    eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_0[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_0[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_0[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_0[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	    
-	    
+            // Compensated data for the case of Distributed Alamouti Scheme
+            eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); // it will contain(y)*(h0*)
+            eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); // it will contain(y*)*(h1)
+            for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+              eNB_pusch_vars[UE_id]->rxdataF_comp_0[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+              eNB_pusch_vars[UE_id]->rxdataF_comp_1[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+            }
+
+            // UE 0
+            eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id]  = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+            eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+            for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+              eNB_pusch_vars[UE_id]->ul_ch_mag_0[eNB_id][i]  = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+              eNB_pusch_vars[UE_id]->ul_ch_magb_0[eNB_id][i] = (int32_t*)malloc16_clear( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+            }
 	    
 	    // UE 1
-	    eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_1[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_1[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_1[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_mag_1[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
-	    
-	    eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id] = malloc16(frame_parms->nb_antennas_rx*sizeof(int**));
-	    if (eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id]) {
-#ifdef DEBUG_PHY
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_1[%d] allocated at %p\n",UE_id,eNB_id,
-		  eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id]);
-#endif
-	    }
-	    else {
-	      msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_1[%d] not allocated\n",UE_id,eNB_id);
-	      return(-1);
-	    }
-	    
-	    for (i=0; i<frame_parms->nb_antennas_rx; i++) {
-	      eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id][i] = 
-		(int *)malloc16(frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      if (eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id][i]) {
-#ifdef DEBUG_PHY
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_1[%d][%d] allocated at %p\n",UE_id,eNB_id,i,
-		    eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id][i]);
-#endif
-		
-		memset(eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id][i],0,frame_parms->symbols_per_tti*sizeof(int)*frame_parms->N_RB_UL*12);
-	      }
-	      else {
-		msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->ul_ch_magb_1[%d][%d] not allocated\n",UE_id,eNB_id,i);
-		return(-1);
-	      }
-	    }
+            eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id]  = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+            eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) );
+            for (i=0; i<frame_parms->nb_antennas_rx; i++) {
+              eNB_pusch_vars[UE_id]->ul_ch_mag_1[eNB_id][i]  = (int32_t*)malloc16( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+              eNB_pusch_vars[UE_id]->ul_ch_magb_1[eNB_id][i] = (int32_t*)malloc16( frame_parms->symbols_per_tti*sizeof(int32_t)*frame_parms->N_RB_UL*12 );
+            }
 	  }//cooperation_flag 
-	
-      
-
       } //eNB_id
     
-      eNB_pusch_vars[UE_id]->llr = (short *)malloc16((8*((3*8*6144)+12))*sizeof(short));
-      if (! eNB_pusch_vars[UE_id]->llr) {
-	msg("[openair][LTE_PHY][INIT] lte_eNB_pusch_vars[%d]->llr not allocated\n",UE_id);
-	return(-1);
-      }
+      eNB_pusch_vars[UE_id]->llr = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
     } // abstraction_flag
   } //UE_id 
 
diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h
index 6da65b0c27..ef1500761a 100644
--- a/openair1/PHY/LTE_ESTIMATION/defs.h
+++ b/openair1/PHY/LTE_ESTIMATION/defs.h
@@ -75,6 +75,16 @@ int lte_sync_time(int **rxdata,
     LTE_DL_FRAME_PARMS *frame_parms,
     int *eNB_id);
 
+/*! 
+\brief This function performs the coarse frequency and PSS synchronization.
+The algorithm uses a frequency-domain correlation.  It scans over 20 MHz/10ms signal chunks using each of the 3 PSS finding the most likely (strongest) carriers and their frequency offset (+-2.5 kHz).
+\param ue Pointer to UE data structure
+\param band index of band in scan_info structure, used to store statistics
+\param DL_freq center frequency of band being scanned, used when storing statistics
+*/
+void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq);
+
+
 /*! 
 \brief This function performs detection of the PRACH (=SRS) at the eNb to estimate the timing advance
 The algorithm uses a time domain correlation with a downsampled version of the received signal. 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 2d2e9fc8a9..3627486ca2 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -259,7 +259,7 @@ void lte_sync_time_free(void) {
 
 }
 
-inline int abs32(int x) { 
+static inline int abs32(int x) {
   return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1]));
 }
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
index e7587ce697..dc96fd80d7 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
@@ -46,19 +46,16 @@
 //#include "defs.h"
 #include "PHY/defs.h"
 #include "PHY/extern.h"
+#include "pss6144.h"
 
-int16_t pss6144_0[512]__attribute__((aligned(16))) ={-1,0,220,902,897,257,0,0,234,912,911,249,-1,-1,250,918,925,237,0,-1,270,920,934,218,-1,-1,295,913,939,189,0,0,327,892,933,145,-1,0,370,847,908,75,-1,0,431,758,845,-41,-1,0,523,578,700,-251,-1,-1,684,186,346,-688,-1,-1,1042,-842,-727,-1906,0,-1,2570,-5411,-8606,-11078,-18707,2819,-6900,13704,-2921,4880,-13868,12867,3212,31675,29080,13411,14492,-12161,-4346,380,9189,12659,18918,-1,13137,-8312,9729,-13278,-4210,-18444,-17822,-503,-308,18095,18542,3748,8014,-10063,3677,-477,18077,-5577,9518,-28369,-18568,-23434,-18707,2819,1866,3765,402,-13074,-15081,-11423,-17312,158,-15211,6289,-9460,16383,10422,15058,14327,-9459,-9460,-16384,-14800,2480,-1627,222,-15081,-11423,-30899,10197,-9093,31103,11795,14790,298,-1071,-10964,8476,-4210,18443,4468,18297,12087,15225,18542,3748,9032,-11975,-12015,-8164,-13868,12867,2703,16345,1145,4949,-9460,16383,10290,32065,32121,10735,14492,-12161,-3895,1841,8412,14854,18077,5576,15706,-414,17019,-6205,6911,-17611,-12957,-9364,-10719,13397,8630,16834,13163,4191,4947,4300,11795,14790,30157,4933,23119,-20716,-4210,-18444,-3763,5826,16581,4209,14492,-12161,5021,-11782,4494,-13565,-9460,-16384,-19234,4948,1759,20734,18077,5576,8599,-5126,5405,3659,18542,3748,22881,-14000,5014,-26653,-13868,-12868,-4043,7370,14695,-1146,6911,-17611,-4867,-12748,-3775,-10738,-15081,-11423,-20274,10778,5370,21891,18918,0,3825,-11116,-2642,-2520,-1,-1,-734,3537,7768,8755,18918,-1,16401,-15607,857,-23063,-15081,-11423,-7284,8627,13528,2043,6911,-17611,-8213,-12164,-4307,-7302,-13868,-12868,-25462,8974,738,26700,18542,3748,593,-6522,194,9894,18077,5576,17204,-11901,5387,-19247,-9460,-16384,-13867,2880,7748,10123,14492,-12161,-4518,-16475,-3109,-6287,-4210,-18444,-29373,-9674,-19296,23535,11795,14790,1378,-6445,-10157,9188,8630,16834,17089,2574,14642,-6655,6911,-17611,-13757,-11647,-7440,13694,18077,5576,8785,-14723,408,-4409,14492,-12161,-6636,-32768,-32768,-7236,-9460,16383,3840,-3477,-15453,-5947,-13868,12867,-936,14477,5909,13694,18542,3748,7269,-18091,-18025,-5395,-4210,18443,12950,5246,833,678,11795,14790,31610,-7688,6673,-31973,-15081,-11423,1133,1287,5307,-14173,-9460,-16384,-15227,-7689,-18198,1381,-9460,16383,13180,10017,8574,-15187,-15081,-11423,-11396,6178,-4139,-382,-18707,2819,-10883,27787,19864,22312,18077,-5577,-2124,-2956,4762,11856,18542,3748,15952,-8792,9401,-15298,-4210,-18444,-16236,-1797,684,15418,18918,-1,6496,-14298,1898,-4069,14492,-12161,-2799,-31900,-28984,-13171,-13868,12867,5814,79,-8363,-12943,-18707,2819,-5164,12981,3456,4816,-1,0,-1159,1572,263,1207,-1,-1,-642,33,-449,384,0,-1,-440,-492,-708,49,-1,-1,-330,-722,-817,-121,0,-1,-261,-834,-864,-218,-1,-1,-214,-891,-882,-278,-1,0,-178,-918,-884,-316,-1,-1,-151,-929,-877,-341,0,-1,-130,-930,-866,-358,0,0,-112,-925,-852,-369,-1,0}; 
+#define DEBUG_TF 1
 
-int16_t pss6144_1[512]__attribute__((aligned(16))) = {0,0,-75,-703,-641,-284,-1,-1,-77,-682,-622,-269,0,0,-81,-650,-592,-247,0,0,-87,-604,-550,-216,0,0,-94,-536,-488,-170,0,-1,-105,-438,-398,-103,0,0,-121,-291,-260,-3,0,-1,-146,-64,-44,154,-1,0,-183,308,320,416,-1,-1,-248,979,1012,908,0,0,-385,2438,2687,2103,-1,0,-1029,7780,12580,10062,18077,-5577,6808,-12074,5571,-9136,1413,-18866,-20051,-12000,-14063,16643,14492,12160,9180,-9248,-739,1189,18918,0,11581,-29398,-22453,-21889,-17045,8208,2659,1930,-9344,-7587,-15081,11422,6001,20595,20667,5444,15630,-10657,2688,-12056,2550,-1019,18077,-5577,12734,-29346,-15053,-28505,-18334,-4669,-1915,-1922,-1177,-13323,-9460,-16384,-19264,-13938,-26108,1564,-9460,16383,8111,1321,-5134,-14849,-18334,-4669,-14428,3684,-14417,7858,-4210,18443,15161,6283,4109,-16836,-17045,-8209,-11025,5771,-8448,1046,-15081,11422,5322,23247,22499,-674,1413,-18866,-10967,-3156,1594,-2038,-9460,-16384,-29439,2511,-9786,27468,14492,12160,2879,-4565,-3994,8819,15630,10656,20286,-13171,-171,-24168,-13868,-12868,-9897,-1934,-1535,-5328,-7781,-17244,-27765,-11606,-27629,13566,-4210,18443,848,317,-13296,-2621,-17045,8208,-12988,16121,-1931,22720,14492,12160,6065,-9110,-15296,-1993,-9460,16383,2388,13523,3104,12712,15630,10656,15155,-12654,-12784,-14450,-15081,11422,3202,11354,-2572,4187,1413,18865,25769,7933,13949,-22090,-13868,-12868,-5746,5444,754,-6292,-18334,-4669,-15498,21223,12113,22762,18918,0,4780,-8566,-1382,-2244,-1,0,-1380,2321,4966,8534,18918,0,13528,-21869,-10693,-23921,-18334,-4669,-5954,2495,-1904,-7586,-13868,-12868,-26234,-1033,-19817,18462,1413,18865,4783,136,-11497,-2792,-15081,11422,-6250,18298,3319,19564,15630,10656,9329,-9042,-12967,-4581,-9460,16383,5794,14245,4795,9919,14492,12160,20513,-9686,-7530,-19197,-17045,8208,4250,12828,-761,688,-4210,18443,25435,17146,23871,-18131,-7781,-17244,-3975,3996,6561,-7492,-13868,-12868,-20972,12234,1201,24266,15630,10656,9506,-948,2451,4888,14492,12160,28553,-5257,12482,-26639,-9460,-16384,-2690,-359,8155,-7807,1413,-18866,-11961,-19146,-22855,-6903,-15081,11422,5002,6796,453,-12322,-17045,-8209,-16763,4862,-13084,10100,-4210,18443,13885,8559,3961,-14225,-18334,-4669,-10421,11873,-5262,6476,-9460,16383,14280,21830,21641,-9602,-9460,-16384,-11078,7683,2560,-585,-18334,-4669,-17288,27291,18985,25813,18077,-5577,-2285,-1696,9035,8468,15630,-10657,-5747,-20618,-20899,-4988,-15081,11422,-2027,11888,-3063,1450,-17045,8208,-7859,30392,19607,24841,18918,-1,1271,47,3357,12686,14492,12160,21317,3859,20355,-11253,1413,-18866,-10826,-254,6990,12044,18077,-5577,2296,-15923,-6286,-4669,0,-1,349,-3376,-1982,-1440,0,0,151,-1328,-786,-592,-1,0,72,-483,-237,-200,-1,-1,27,-37,66,18,0,0,-1,229,251,153,0,-1,-19,398,370,240,-1,-1,-31,510,449,299,-1,0,-40,586,504,339,-1,-1,-46,639,541,367,0,0,-50,675,567,386,0,0};
-
-int16_t pss6144_2[512]__attribute__((aligned(16))) = {0,0,584,-400,-53,-700,-1,0,567,-387,-50,-676,-1,-1,541,-368,-46,-640,-1,0,504,-340,-40,-587,-1,-1,449,-300,-31,-511,0,-1,370,-241,-19,-399,0,-1,251,-154,-1,-230,-1,0,66,-19,27,36,0,0,-237,199,72,482,0,0,-786,591,151,1327,0,0,-1982,1439,349,3375,-1,0,-6286,4668,2296,15922,18077,5576,6990,-12045,-10826,253,1413,18865,20355,11252,21317,-3860,14492,-12161,3357,-12687,1271,-48,18918,0,19607,-24842,-7859,-30393,-17045,-8209,-3063,-1451,-2027,-11889,-15081,-11423,-20899,4987,-5747,20617,15630,10656,9035,-8469,-2285,1695,18077,5576,18985,-25814,-17288,-27292,-18334,4668,2560,584,-11078,-7684,-9460,16383,21641,9601,14280,-21831,-9460,-16384,-5262,-6477,-10421,-11874,-18334,4668,3961,14224,13885,-8560,-4210,-18444,-13084,-10101,-16763,-4863,-17045,8208,453,12321,5002,-6797,-15081,-11423,-22855,6902,-11961,19145,1413,18865,8155,7806,-2690,358,-9460,16383,12482,26638,28553,5256,14492,-12161,2451,-4889,9506,947,15630,-10657,1201,-24267,-20972,-12235,-13868,12867,6561,7491,-3975,-3997,-7781,17243,23871,18130,25435,-17147,-4210,-18444,-761,-689,4250,-12829,-17045,-8209,-7530,19196,20513,9685,14492,-12161,4795,-9920,5794,-14246,-9460,-16384,-12967,4580,9329,9041,15630,-10657,3319,-19565,-6250,-18299,-15081,-11423,-11497,2791,4783,-137,1413,-18866,-19817,-18463,-26234,1032,-13868,12867,-1904,7585,-5954,-2496,-18334,4668,-10693,23920,13528,21868,18918,-1,4966,-8535,-1380,-2322,-1,0,-1382,2243,4780,8565,18918,-1,12113,-22763,-15498,-21224,-18334,4668,754,6291,-5746,-5445,-13868,12867,13949,22089,25769,-7934,1413,-18866,-2572,-4188,3202,-11355,-15081,-11423,-12784,14449,15155,12653,15630,-10657,3104,-12713,2388,-13524,-9460,-16384,-15296,1992,6065,9109,14492,-12161,-1931,-22721,-12988,-16122,-17045,-8209,-13296,2620,848,-318,-4210,-18444,-27629,-13567,-27765,11605,-7781,17243,-1535,5327,-9897,1933,-13868,12867,-171,24167,20286,13170,15630,-10657,-3994,-8820,2879,4564,14492,-12161,-9786,-27469,-29439,-2512,-9460,16383,1594,2037,-10967,3155,1413,18865,22499,673,5322,-23248,-15081,-11423,-8448,-1047,-11025,-5772,-17045,8208,4109,16835,15161,-6284,-4210,-18444,-14417,-7859,-14428,-3685,-18334,4668,-5134,14848,8111,-1322,-9460,-16384,-26108,-1565,-19264,13937,-9460,16383,-1177,13322,-1915,1921,-18334,4668,-15053,28504,12734,29345,18077,5576,2550,1018,2688,12055,15630,10656,20667,-5445,6001,-20596,-15081,-11423,-9344,7586,2659,-1931,-17045,-8209,-22453,21888,11581,29397,18918,0,-739,-1190,9180,9247,14492,-12161,-14063,-16644,-20051,11999,1413,18865,5571,9135,6808,12073,18077,5576,12580,-10063,-1029,-7781,-1,-1,2687,-2104,-385,-2439,0,-1,1012,-909,-248,-980,-1,-1,320,-417,-183,-309,-1,0,-44,-155,-146,63,-1,0,-260,2,-121,290,-1,0,-398,102,-105,437,-1,0,-488,169,-94,535,0,0,-550,215,-87,603,-1,-1,-592,246,-81,649,0,0,-622,268,-77,681,0,0};
-
-void lte_sync_timefreq(PHY_VARS_UE *ue,int band,int DL_freq) {
+void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq) {
 
   UE_SCAN_INFO_t *scan_info = &ue->scan_info[band];
   int16_t spectrum[12288] __attribute__((aligned(16)));
   int16_t spectrum_p5ms[12288] __attribute__((aligned(16)));
-  int i,f,f2;
+  int i,f,f2,band_idx;
   __m128i autocorr0[256/4],autocorr1[256/4],autocorr2[256/4];
   __m128i autocorr0_t[256/4],autocorr1_t[256/4],autocorr2_t[256/4];
   __m128i tmp_t[256/4];
@@ -69,123 +66,241 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,int DL_freq) {
   int re;
   __m128i mmtmp00,mmtmp01,mmtmp02,mmtmp10,mmtmp11,mmtmp12;
   int maxcorr[3],minamp,pos,pssind;
+  int16_t *pss6144_0,*pss6144_1,*pss6144_2;
+  
+  
+  
+  //    for (i=0;i<38400*4;i+=3072)   // steps of 200 us with 100 us overlap, 0 to 5s
+
+  for (i = 15360-3072*2;i<15360+3072+1;i+=3072)  {
 
-  for (f = -2000;f<1999;f++){  // this is -10MHz to 10 MHz in 5 kHz steps
-    
-    for (i=0;i<38400*4;i+=3072) {  // steps of 200 us with 100 us overlap, 0 to 5s
+ 
       //compute frequency-domain representation of 6144-sample chunk
       
-      
-      for (rxp = &ue->lte_ue_common_vars.rxdata[0][i],sp=spectrum;;rxp = &ue->lte_ue_common_vars.rxdata[0][i+38400*4],sp=spectrum_p5ms) { 
+      rxp = &ue->lte_ue_common_vars.rxdata[0][i];
+      sp=spectrum;
+      while (1) {
+
 	//compute frequency-domain representation of 6144-sample chunk
 	fft6144((int16_t *)rxp,
 		sp);
-	
-	
-	
-	
-	if ((f<-256)||(f>=0)) { // no split around DC
-	  sp2 = (f<0) ? (__m128i*)&sp[6144] : (__m128i*)sp;
-	  for (re = 0; re<256/4; re++) {  // loop over 256 points of upsampled PSS
-	    f2 = f>>2;
-	    s = sp2[f2];
-	    mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
-	    
-	    s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
-	    mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
-	    
-	    autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
-	    autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
-	    autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
-	    
-	  }
-	}
-	else {
-	  sp2 = (__m128i*)&sp[6144];
-	  for (re = 0; re<(256+f)/4; re++) {  // loop over 256 points of upsampled PSS
-	    f2 = f>>2;
-	    s = sp2[f2];
-	    mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
-	    
-	    s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
-	    mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+	printf("sp %p\n",sp);
+	if (i==12288)
+	  write_output("scan6144F.m","s6144F",sp,6144,1,1);
+	  for (f = -130;f<-125;f++) {  // this is -10MHz to 10 MHz in 5 kHz steps
 	    
-	    autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
-	    autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
-	    autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
+	    if ((f<-256)||(f>=0)) { // no split around DC
+	      printf("No split, f %d\n",f);
+	      // align filters and input buffer pointer to 128-bit
+	      switch (f&3) {
+	      case 0: 
+		pss6144_0 = &pss6144_0_0[0];
+		pss6144_1 = &pss6144_1_0[0];
+		pss6144_2 = &pss6144_2_0[0];
+		sp2 = (f<0) ? (__m128i*)&sp[12288+(f<<1)] : (__m128i*)&sp;
+		break;
+	      case 1: 
+		pss6144_0 = &pss6144_0_1[0];
+		pss6144_1 = &pss6144_1_1[0];
+		pss6144_2 = &pss6144_2_1[0];
+		sp2 = (f<0) ? (__m128i*)&sp[12286+(f<<1)] : (__m128i*)sp;
+		break;
+	      case 2: 
+		pss6144_0 = &pss6144_0_2[0];
+		pss6144_1 = &pss6144_1_2[0];
+		pss6144_2 = &pss6144_2_2[0];
+		sp2 = (f<0) ? (__m128i*)&sp[12284+(f<<1)] : (__m128i*)sp;
+		break;
+	      case 3: 
+		pss6144_0 = &pss6144_0_3[0];
+		pss6144_1 = &pss6144_1_3[0];
+		pss6144_2 = &pss6144_2_3[0];
+		sp2 = (f<0) ? (__m128i*)&sp[12282+(f<<1)] : (__m128i*)sp;
+		break;
+	      } 
+
+	      for (re = 0; re<256/4; re++) {  // loop over 256 points of upsampled PSS
+		s = sp2[re];
+		mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
+		mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
+		autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
+		autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
+		
+	      }
+	    }
+	    else { // Split around DC, this is the negative frequencies
+	      printf("split around DC, f %d (f/4 %d)\n",f,f>>2);
+	      // align filters and input buffer pointer to 128-bit	      
+	      switch (f&3) {
+	      case 0: 
+		pss6144_0 = &pss6144_0_0[0];
+		pss6144_1 = &pss6144_1_0[0];
+		pss6144_2 = &pss6144_2_0[0];
+		sp2 = (__m128i*)&sp[12288+(f<<1)];
+		break;
+	      case 1: 
+		pss6144_0 = &pss6144_0_1[0];
+		pss6144_1 = &pss6144_1_1[0];
+		pss6144_2 = &pss6144_2_1[0];
+		sp2 = (__m128i*)&sp[12286+(f<<1)];
+		break;
+	      case 2: 
+		pss6144_0 = &pss6144_0_2[0];
+		pss6144_1 = &pss6144_1_2[0];
+		pss6144_2 = &pss6144_2_2[0];
+		sp2 = (__m128i*)&sp[12284+(f<<1)];
+		break;
+	      case 3: 
+		pss6144_0 = &pss6144_0_3[0];
+		pss6144_1 = &pss6144_1_3[0];
+		pss6144_2 = &pss6144_2_3[0];
+		sp2 = (__m128i*)&sp[12282+(f<<1)];
+		break;
+	      } 
+	      for (re = 0; re<(256+f)/4; re++) {  // loop over 256 points of upsampled PSS
+		s = sp2[re];
+		printf("re %d, %p\n",re,&sp2[re]);
+		print_shorts("s",&s);
+		print_shorts("pss",&pss6144_0[re]);
+
+		mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
+		mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
+		autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
+		autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
+		
+		
+	      }
+	      // This is the +ve frequencies
+
+	      // align filters to 128-bit
+	      sp2 = (__m128i*)&sp[0];
+	      switch (f&3) {
+	      case 0: 
+		pss6144_0 = &pss6144_0_0[256];
+		pss6144_1 = &pss6144_1_0[256];
+		pss6144_2 = &pss6144_2_0[256];
+		break;
+	      case 1: 
+		pss6144_0 = &pss6144_0_1[256];
+		pss6144_1 = &pss6144_1_1[256];
+		pss6144_2 = &pss6144_2_1[256];
+		break;
+	      case 2: 
+		pss6144_0 = &pss6144_0_2[256];
+		pss6144_1 = &pss6144_1_2[256];
+		pss6144_2 = &pss6144_2_2[256];
+		break;
+	      case 3: 
+		pss6144_0 = &pss6144_0_3[256];
+		pss6144_1 = &pss6144_1_3[256];
+		pss6144_2 = &pss6144_2_3[256];
+		break;
+	      } 
+	      for (re = 0; re<-f/4; re++) {  // loop over 256 points of upsampled PSS
+		s = sp2[re];
+		printf("re %d %p\n",re,&sp2[re]);
+		print_shorts("s",&s);
+		print_shorts("pss",&pss6144_0[re]);
+		mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
+		s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
+		mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
+		mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
+		mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
+		
+		autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
+		autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
+		autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
+		
+	      }
+	      
+	    }
+	    // ifft, accumulate energy over two half-frames
+	    idft256((int16_t*)autocorr0,(int16_t*)tmp_t,1);
+	    memset((void*)autocorr0_t,0,256*4);
+	    memset((void*)autocorr1_t,0,256*4);
+	    memset((void*)autocorr2_t,0,256*4);
+	    for (re=0;re<(256/4);re++)
+	      autocorr0_t[re] = _mm_add_epi32(autocorr0_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
+	    idft256((int16_t*)autocorr1,(int16_t*)autocorr1_t,1);
+	    for (re=0;re<(256/4);re++)
+	      autocorr1_t[re] = _mm_add_epi32(autocorr1_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
+	    idft256((int16_t*)autocorr2,(int16_t*)autocorr2_t,1);
+	    for (re=0;re<(256/4);re++)
+	      autocorr2_t[re] = _mm_add_epi32(autocorr2_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
+
+	  
+	    //compute max correlation over time window
+	    maxcorr[0] = 0;
+	    maxcorr[1] = 0;
+	    maxcorr[2] = 0;
+	    for (re=0;re<256;re++) {
+#ifdef DEBUG_TF
+	      printf("%d,",((int32_t*)autocorr0_t)[re]);
+#endif
+	      if (((int32_t*)autocorr0_t)[re] > maxcorr[0]) {
+		maxcorr[0]=((int32_t*)autocorr0_t)[re];
+		printf("*");
+	      }
+	      if (((int32_t*)autocorr1_t)[re] > maxcorr[1])
+		maxcorr[1]=((int32_t*)autocorr1_t)[re];
+	      if (((int32_t*)autocorr2_t)[re] > maxcorr[2])
+		maxcorr[2]=((int32_t*)autocorr2_t)[re];
+	    }
+#ifdef DEBUG_TF
+	    printf("\n");
+#endif
 	    
 	    
+	    for (pssind=0;pssind<3;pssind++) {
+	      printf("pss %d, amp %d freq %u, i %d\n",pssind,maxcorr[pssind],((f+128)*5000)+DL_freq,i);
+	      minamp=(int)((1<<30)-1);
+	      for (band_idx=0;band_idx<10;band_idx++)
+		if (minamp > scan_info->amp[pssind][band_idx]) {
+		  minamp = scan_info->amp[pssind][band_idx];
+		  pos    = band_idx;
+		}
+	      if (maxcorr[pssind]>minamp) {
+		scan_info->amp[pssind][pos]=maxcorr[pssind];
+		scan_info->freq_offset_Hz[pssind][pos]=(f*5000)+DL_freq;
+	      }
+	    } // loop on pss index
 	  }
-	  sp2 = (__m128i*)sp;
-	  for (re = (256+f)/4; re<256/4; re++) {  // loop over 256 points of upsampled PSS
-	    f2 = f>>2;
-	    s = sp2[f2];
-	    mmtmp00 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp01 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp02 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
-	    
-	    s = _mm_shufflelo_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_shufflehi_epi16(s,_MM_SHUFFLE(2,3,0,1));
-	    s = _mm_sign_epi16(s,*(__m128i*)&conjugate[0]);
-	    mmtmp10 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_0)[re],s),15);
-	    mmtmp11 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_1)[re],s),15);
-	    mmtmp12 = _mm_srai_epi32(_mm_madd_epi16(((__m128i*)pss6144_2)[re],s),15);
-	    
-	    autocorr0[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp00,mmtmp10),_mm_unpackhi_epi32(mmtmp00,mmtmp10));
-	    autocorr1[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp01,mmtmp11),_mm_unpackhi_epi32(mmtmp01,mmtmp11));
-	    autocorr2[re] = _mm_packs_epi32(_mm_unpacklo_epi32(mmtmp02,mmtmp12),_mm_unpackhi_epi32(mmtmp02,mmtmp12));
-	    
+	  if (rxp == &ue->lte_ue_common_vars.rxdata[0][i+38400*4]) {
+	    rxp = &ue->lte_ue_common_vars.rxdata[0][i+38400*4];
+	    sp=spectrum_p5ms; 
 	  }
-	  
-	}
-	// ifft, accumulate energy over two half-frames
-	idft256((int16_t*)autocorr0,(int16_t*)tmp_t,1);
-	for (re=0;re<(256/4);re++)
-	  autocorr0_t[re] = _mm_adds_epi16(autocorr0_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
-	idft256((int16_t*)autocorr1,(int16_t*)autocorr1_t,1);
-	for (re=0;re<(256/4);re++)
-	  autocorr1_t[re] = _mm_adds_epi16(autocorr1_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
-	idft256((int16_t*)autocorr2,(int16_t*)autocorr2_t,1);
-	for (re=0;re<(256/4);re++)
-	  autocorr2_t[re] = _mm_adds_epi16(autocorr2_t[re],_mm_madd_epi16(tmp_t[re],tmp_t[re]));
-      } 
-      //compute max correlation over time window
-      maxcorr[0] = 0;
-      maxcorr[1] = 0;
-      maxcorr[2] = 0;
-      for (re=0;re<256;re++) {
-	if (((int32_t*)autocorr0_t)[re] > maxcorr[0])
-	  maxcorr[0]=((int32_t*)autocorr0_t)[re];
-	if (((int32_t*)autocorr1_t)[re] > maxcorr[1])
-	  maxcorr[1]=((int32_t*)autocorr1_t)[re];
-	if (((int32_t*)autocorr2_t)[re] > maxcorr[2])
-	  maxcorr[2]=((int32_t*)autocorr2_t)[re];
-      }
-      for (pssind=0;pssind<3;pssind++) {
-	minamp=(int)((1<<30)-1);
-	for (i=0;i<10;i++)
-	  if (minamp < scan_info->amp[pssind][i]) {
-	    minamp = scan_info->amp[pssind][i];
-	    pos    = i;
+	  else {
+	    break;
 	  }
-	if (maxcorr[pssind]>minamp) {
-	  scan_info->amp[pssind][pos]=maxcorr[pssind];
-	  scan_info->freq_offset_Hz[pssind][pos]=(f*5000)+DL_freq;
-	}
-      } // loop on pss index
-    }   // loop on time index i
-  }  // loop on frequency shift f
+      }   
+      }// loop on time index i
+#ifdef DEBUG_TF
+      exit(-1);
+#endif
 }
 
diff --git a/openair1/PHY/LTE_ESTIMATION/pss6144.h b/openair1/PHY/LTE_ESTIMATION/pss6144.h
new file mode 100644
index 0000000000..dba27e1311
--- /dev/null
+++ b/openair1/PHY/LTE_ESTIMATION/pss6144.h
@@ -0,0 +1,67 @@
+/*******************************************************************************
+    OpenAirInterface 
+    Copyright(c) 1999 - 2014 Eurecom
+
+    OpenAirInterface is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+
+    OpenAirInterface is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenAirInterface.The full GNU General Public License is 
+   included in this distribution in the file called "COPYING". If not, 
+   see <http://www.gnu.org/licenses/>.
+
+  Contact Information
+  OpenAirInterface Admin: openair_admin@eurecom.fr
+  OpenAirInterface Tech : openair_tech@eurecom.fr
+  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
+  
+  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+
+ *******************************************************************************/
+
+/*! \file PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+* \brief Initial time frequency scan of entire LTE band
+* \author R. Knopp
+* \date 2014
+* \version 0.1
+* \company Eurecom
+* \email: raymond.knopp@eurecom.fr
+* \note
+* \warning
+*/
+/* file: lte_sync_timefreq.c
+   purpose: scan for likely cells over entire LTE band using PSS. Provides coarse frequency offset in addtition to 10 top likelihoods per PSS sequence
+   author: raymond.knopp@eurecom.fr
+   date: 23.01.2015
+*/
+static int16_t pss6144_0_0[512]__attribute__((aligned(16))) ={-1,0,220,902,897,257,0,0,234,912,911,249,-1,-1,250,918,925,237,0,-1,270,920,934,218,-1,-1,295,913,939,189,0,0,327,892,933,145,-1,0,370,847,908,75,-1,0,431,758,845,-41,-1,0,523,578,700,-251,-1,-1,684,186,346,-688,-1,-1,1042,-842,-727,-1906,0,-1,2570,-5411,-8606,-11078,-18707,2819,-6900,13704,-2921,4880,-13868,12867,3212,31675,29080,13411,14492,-12161,-4346,380,9189,12659,18918,-1,13137,-8312,9729,-13278,-4210,-18444,-17822,-503,-308,18095,18542,3748,8014,-10063,3677,-477,18077,-5577,9518,-28369,-18568,-23434,-18707,2819,1866,3765,402,-13074,-15081,-11423,-17312,158,-15211,6289,-9460,16383,10422,15058,14327,-9459,-9460,-16384,-14800,2480,-1627,222,-15081,-11423,-30899,10197,-9093,31103,11795,14790,298,-1071,-10964,8476,-4210,18443,4468,18297,12087,15225,18542,3748,9032,-11975,-12015,-8164,-13868,12867,2703,16345,1145,4949,-9460,16383,10290,32065,32121,10735,14492,-12161,-3895,1841,8412,14854,18077,5576,15706,-414,17019,-6205,6911,-17611,-12957,-9364,-10719,13397,8630,16834,13163,4191,4947,4300,11795,14790,30157,4933,23119,-20716,-4210,-18444,-3763,5826,16581,4209,14492,-12161,5021,-11782,4494,-13565,-9460,-16384,-19234,4948,1759,20734,18077,5576,8599,-5126,5405,3659,18542,3748,22881,-14000,5014,-26653,-13868,-12868,-4043,7370,14695,-1146,6911,-17611,-4867,-12748,-3775,-10738,-15081,-11423,-20274,10778,5370,21891,18918,0,3825,-11116,-2642,-2520,-1,-1,-734,3537,7768,8755,18918,-1,16401,-15607,857,-23063,-15081,-11423,-7284,8627,13528,2043,6911,-17611,-8213,-12164,-4307,-7302,-13868,-12868,-25462,8974,738,26700,18542,3748,593,-6522,194,9894,18077,5576,17204,-11901,5387,-19247,-9460,-16384,-13867,2880,7748,10123,14492,-12161,-4518,-16475,-3109,-6287,-4210,-18444,-29373,-9674,-19296,23535,11795,14790,1378,-6445,-10157,9188,8630,16834,17089,2574,14642,-6655,6911,-17611,-13757,-11647,-7440,13694,18077,5576,8785,-14723,408,-4409,14492,-12161,-6636,-32768,-32768,-7236,-9460,16383,3840,-3477,-15453,-5947,-13868,12867,-936,14477,5909,13694,18542,3748,7269,-18091,-18025,-5395,-4210,18443,12950,5246,833,678,11795,14790,31610,-7688,6673,-31973,-15081,-11423,1133,1287,5307,-14173,-9460,-16384,-15227,-7689,-18198,1381,-9460,16383,13180,10017,8574,-15187,-15081,-11423,-11396,6178,-4139,-382,-18707,2819,-10883,27787,19864,22312,18077,-5577,-2124,-2956,4762,11856,18542,3748,15952,-8792,9401,-15298,-4210,-18444,-16236,-1797,684,15418,18918,-1,6496,-14298,1898,-4069,14492,-12161,-2799,-31900,-28984,-13171,-13868,12867,5814,79,-8363,-12943,-18707,2819,-5164,12981,3456,4816,-1,0,-1159,1572,263,1207,-1,-1,-642,33,-449,384,0,-1,-440,-492,-708,49,-1,-1,-330,-722,-817,-121,0,-1,-261,-834,-864,-218,-1,-1,-214,-891,-882,-278,-1,0,-178,-918,-884,-316,-1,-1,-151,-929,-877,-341,0,-1,-130,-930,-866,-358,0,0,-112,-925,-852,-369,-1,0}; 
+
+static int16_t pss6144_0_1[512]__attribute__((aligned(16))) ={0,0,-1,0,220,902,897,257,0,0,234,912,911,249,-1,-1,250,918,925,237,0,-1,270,920,934,218,-1,-1,295,913,939,189,0,0,327,892,933,145,-1,0,370,847,908,75,-1,0,431,758,845,-41,-1,0,523,578,700,-251,-1,-1,684,186,346,-688,-1,-1,1042,-842,-727,-1906,0,-1,2570,-5411,-8606,-11078,-18707,2819,-6900,13704,-2921,4880,-13868,12867,3212,31675,29080,13411,14492,-12161,-4346,380,9189,12659,18918,-1,13137,-8312,9729,-13278,-4210,-18444,-17822,-503,-308,18095,18542,3748,8014,-10063,3677,-477,18077,-5577,9518,-28369,-18568,-23434,-18707,2819,1866,3765,402,-13074,-15081,-11423,-17312,158,-15211,6289,-9460,16383,10422,15058,14327,-9459,-9460,-16384,-14800,2480,-1627,222,-15081,-11423,-30899,10197,-9093,31103,11795,14790,298,-1071,-10964,8476,-4210,18443,4468,18297,12087,15225,18542,3748,9032,-11975,-12015,-8164,-13868,12867,2703,16345,1145,4949,-9460,16383,10290,32065,32121,10735,14492,-12161,-3895,1841,8412,14854,18077,5576,15706,-414,17019,-6205,6911,-17611,-12957,-9364,-10719,13397,8630,16834,13163,4191,4947,4300,11795,14790,30157,4933,23119,-20716,-4210,-18444,-3763,5826,16581,4209,14492,-12161,5021,-11782,4494,-13565,-9460,-16384,-19234,4948,1759,20734,18077,5576,8599,-5126,5405,3659,18542,3748,22881,-14000,5014,-26653,-13868,-12868,-4043,7370,14695,-1146,6911,-17611,-4867,-12748,-3775,-10738,-15081,-11423,-20274,10778,5370,21891,18918,0,3825,-11116,-2642,-2520,-1,-1,-734,3537,7768,8755,18918,-1,16401,-15607,857,-23063,-15081,-11423,-7284,8627,13528,2043,6911,-17611,-8213,-12164,-4307,-7302,-13868,-12868,-25462,8974,738,26700,18542,3748,593,-6522,194,9894,18077,5576,17204,-11901,5387,-19247,-9460,-16384,-13867,2880,7748,10123,14492,-12161,-4518,-16475,-3109,-6287,-4210,-18444,-29373,-9674,-19296,23535,11795,14790,1378,-6445,-10157,9188,8630,16834,17089,2574,14642,-6655,6911,-17611,-13757,-11647,-7440,13694,18077,5576,8785,-14723,408,-4409,14492,-12161,-6636,-32768,-32768,-7236,-9460,16383,3840,-3477,-15453,-5947,-13868,12867,-936,14477,5909,13694,18542,3748,7269,-18091,-18025,-5395,-4210,18443,12950,5246,833,678,11795,14790,31610,-7688,6673,-31973,-15081,-11423,1133,1287,5307,-14173,-9460,-16384,-15227,-7689,-18198,1381,-9460,16383,13180,10017,8574,-15187,-15081,-11423,-11396,6178,-4139,-382,-18707,2819,-10883,27787,19864,22312,18077,-5577,-2124,-2956,4762,11856,18542,3748,15952,-8792,9401,-15298,-4210,-18444,-16236,-1797,684,15418,18918,-1,6496,-14298,1898,-4069,14492,-12161,-2799,-31900,-28984,-13171,-13868,12867,5814,79,-8363,-12943,-18707,2819,-5164,12981,3456,4816,-1,0,-1159,1572,263,1207,-1,-1,-642,33,-449,384,0,-1,-440,-492,-708,49,-1,-1,-330,-722,-817,-121,0,-1,-261,-834,-864,-218,-1,-1,-214,-891,-882,-278,-1,0,-178,-918,-884,-316,-1,-1,-151,-929,-877,-341,0,-1,-130,-930,-866,-358,0,0,-112,-925,-852,-369}; 
+
+static int16_t pss6144_0_2[512]__attribute__((aligned(16))) ={0,0,0,0,-1,0,220,902,897,257,0,0,234,912,911,249,-1,-1,250,918,925,237,0,-1,270,920,934,218,-1,-1,295,913,939,189,0,0,327,892,933,145,-1,0,370,847,908,75,-1,0,431,758,845,-41,-1,0,523,578,700,-251,-1,-1,684,186,346,-688,-1,-1,1042,-842,-727,-1906,0,-1,2570,-5411,-8606,-11078,-18707,2819,-6900,13704,-2921,4880,-13868,12867,3212,31675,29080,13411,14492,-12161,-4346,380,9189,12659,18918,-1,13137,-8312,9729,-13278,-4210,-18444,-17822,-503,-308,18095,18542,3748,8014,-10063,3677,-477,18077,-5577,9518,-28369,-18568,-23434,-18707,2819,1866,3765,402,-13074,-15081,-11423,-17312,158,-15211,6289,-9460,16383,10422,15058,14327,-9459,-9460,-16384,-14800,2480,-1627,222,-15081,-11423,-30899,10197,-9093,31103,11795,14790,298,-1071,-10964,8476,-4210,18443,4468,18297,12087,15225,18542,3748,9032,-11975,-12015,-8164,-13868,12867,2703,16345,1145,4949,-9460,16383,10290,32065,32121,10735,14492,-12161,-3895,1841,8412,14854,18077,5576,15706,-414,17019,-6205,6911,-17611,-12957,-9364,-10719,13397,8630,16834,13163,4191,4947,4300,11795,14790,30157,4933,23119,-20716,-4210,-18444,-3763,5826,16581,4209,14492,-12161,5021,-11782,4494,-13565,-9460,-16384,-19234,4948,1759,20734,18077,5576,8599,-5126,5405,3659,18542,3748,22881,-14000,5014,-26653,-13868,-12868,-4043,7370,14695,-1146,6911,-17611,-4867,-12748,-3775,-10738,-15081,-11423,-20274,10778,5370,21891,18918,0,3825,-11116,-2642,-2520,-1,-1,-734,3537,7768,8755,18918,-1,16401,-15607,857,-23063,-15081,-11423,-7284,8627,13528,2043,6911,-17611,-8213,-12164,-4307,-7302,-13868,-12868,-25462,8974,738,26700,18542,3748,593,-6522,194,9894,18077,5576,17204,-11901,5387,-19247,-9460,-16384,-13867,2880,7748,10123,14492,-12161,-4518,-16475,-3109,-6287,-4210,-18444,-29373,-9674,-19296,23535,11795,14790,1378,-6445,-10157,9188,8630,16834,17089,2574,14642,-6655,6911,-17611,-13757,-11647,-7440,13694,18077,5576,8785,-14723,408,-4409,14492,-12161,-6636,-32768,-32768,-7236,-9460,16383,3840,-3477,-15453,-5947,-13868,12867,-936,14477,5909,13694,18542,3748,7269,-18091,-18025,-5395,-4210,18443,12950,5246,833,678,11795,14790,31610,-7688,6673,-31973,-15081,-11423,1133,1287,5307,-14173,-9460,-16384,-15227,-7689,-18198,1381,-9460,16383,13180,10017,8574,-15187,-15081,-11423,-11396,6178,-4139,-382,-18707,2819,-10883,27787,19864,22312,18077,-5577,-2124,-2956,4762,11856,18542,3748,15952,-8792,9401,-15298,-4210,-18444,-16236,-1797,684,15418,18918,-1,6496,-14298,1898,-4069,14492,-12161,-2799,-31900,-28984,-13171,-13868,12867,5814,79,-8363,-12943,-18707,2819,-5164,12981,3456,4816,-1,0,-1159,1572,263,1207,-1,-1,-642,33,-449,384,0,-1,-440,-492,-708,49,-1,-1,-330,-722,-817,-121,0,-1,-261,-834,-864,-218,-1,-1,-214,-891,-882,-278,-1,0,-178,-918,-884,-316,-1,-1,-151,-929,-877,-341,0,-1,-130,-930,-866,-358,0,0,-112,-925}; 
+
+static int16_t pss6144_0_3[512]__attribute__((aligned(16))) ={0,0,0,0,0,0,-1,0,220,902,897,257,0,0,234,912,911,249,-1,-1,250,918,925,237,0,-1,270,920,934,218,-1,-1,295,913,939,189,0,0,327,892,933,145,-1,0,370,847,908,75,-1,0,431,758,845,-41,-1,0,523,578,700,-251,-1,-1,684,186,346,-688,-1,-1,1042,-842,-727,-1906,0,-1,2570,-5411,-8606,-11078,-18707,2819,-6900,13704,-2921,4880,-13868,12867,3212,31675,29080,13411,14492,-12161,-4346,380,9189,12659,18918,-1,13137,-8312,9729,-13278,-4210,-18444,-17822,-503,-308,18095,18542,3748,8014,-10063,3677,-477,18077,-5577,9518,-28369,-18568,-23434,-18707,2819,1866,3765,402,-13074,-15081,-11423,-17312,158,-15211,6289,-9460,16383,10422,15058,14327,-9459,-9460,-16384,-14800,2480,-1627,222,-15081,-11423,-30899,10197,-9093,31103,11795,14790,298,-1071,-10964,8476,-4210,18443,4468,18297,12087,15225,18542,3748,9032,-11975,-12015,-8164,-13868,12867,2703,16345,1145,4949,-9460,16383,10290,32065,32121,10735,14492,-12161,-3895,1841,8412,14854,18077,5576,15706,-414,17019,-6205,6911,-17611,-12957,-9364,-10719,13397,8630,16834,13163,4191,4947,4300,11795,14790,30157,4933,23119,-20716,-4210,-18444,-3763,5826,16581,4209,14492,-12161,5021,-11782,4494,-13565,-9460,-16384,-19234,4948,1759,20734,18077,5576,8599,-5126,5405,3659,18542,3748,22881,-14000,5014,-26653,-13868,-12868,-4043,7370,14695,-1146,6911,-17611,-4867,-12748,-3775,-10738,-15081,-11423,-20274,10778,5370,21891,18918,0,3825,-11116,-2642,-2520,-1,-1,-734,3537,7768,8755,18918,-1,16401,-15607,857,-23063,-15081,-11423,-7284,8627,13528,2043,6911,-17611,-8213,-12164,-4307,-7302,-13868,-12868,-25462,8974,738,26700,18542,3748,593,-6522,194,9894,18077,5576,17204,-11901,5387,-19247,-9460,-16384,-13867,2880,7748,10123,14492,-12161,-4518,-16475,-3109,-6287,-4210,-18444,-29373,-9674,-19296,23535,11795,14790,1378,-6445,-10157,9188,8630,16834,17089,2574,14642,-6655,6911,-17611,-13757,-11647,-7440,13694,18077,5576,8785,-14723,408,-4409,14492,-12161,-6636,-32768,-32768,-7236,-9460,16383,3840,-3477,-15453,-5947,-13868,12867,-936,14477,5909,13694,18542,3748,7269,-18091,-18025,-5395,-4210,18443,12950,5246,833,678,11795,14790,31610,-7688,6673,-31973,-15081,-11423,1133,1287,5307,-14173,-9460,-16384,-15227,-7689,-18198,1381,-9460,16383,13180,10017,8574,-15187,-15081,-11423,-11396,6178,-4139,-382,-18707,2819,-10883,27787,19864,22312,18077,-5577,-2124,-2956,4762,11856,18542,3748,15952,-8792,9401,-15298,-4210,-18444,-16236,-1797,684,15418,18918,-1,6496,-14298,1898,-4069,14492,-12161,-2799,-31900,-28984,-13171,-13868,12867,5814,79,-8363,-12943,-18707,2819,-5164,12981,3456,4816,-1,0,-1159,1572,263,1207,-1,-1,-642,33,-449,384,0,-1,-440,-492,-708,49,-1,-1,-330,-722,-817,-121,0,-1,-261,-834,-864,-218,-1,-1,-214,-891,-882,-278,-1,0,-178,-918,-884,-316,-1,-1,-151,-929,-877,-341,0,-1,-130,-930,-866,-358,0,0}; 
+
+static int16_t pss6144_1_0[512]__attribute__((aligned(16))) = {0,0,-75,-703,-641,-284,-1,-1,-77,-682,-622,-269,0,0,-81,-650,-592,-247,0,0,-87,-604,-550,-216,0,0,-94,-536,-488,-170,0,-1,-105,-438,-398,-103,0,0,-121,-291,-260,-3,0,-1,-146,-64,-44,154,-1,0,-183,308,320,416,-1,-1,-248,979,1012,908,0,0,-385,2438,2687,2103,-1,0,-1029,7780,12580,10062,18077,-5577,6808,-12074,5571,-9136,1413,-18866,-20051,-12000,-14063,16643,14492,12160,9180,-9248,-739,1189,18918,0,11581,-29398,-22453,-21889,-17045,8208,2659,1930,-9344,-7587,-15081,11422,6001,20595,20667,5444,15630,-10657,2688,-12056,2550,-1019,18077,-5577,12734,-29346,-15053,-28505,-18334,-4669,-1915,-1922,-1177,-13323,-9460,-16384,-19264,-13938,-26108,1564,-9460,16383,8111,1321,-5134,-14849,-18334,-4669,-14428,3684,-14417,7858,-4210,18443,15161,6283,4109,-16836,-17045,-8209,-11025,5771,-8448,1046,-15081,11422,5322,23247,22499,-674,1413,-18866,-10967,-3156,1594,-2038,-9460,-16384,-29439,2511,-9786,27468,14492,12160,2879,-4565,-3994,8819,15630,10656,20286,-13171,-171,-24168,-13868,-12868,-9897,-1934,-1535,-5328,-7781,-17244,-27765,-11606,-27629,13566,-4210,18443,848,317,-13296,-2621,-17045,8208,-12988,16121,-1931,22720,14492,12160,6065,-9110,-15296,-1993,-9460,16383,2388,13523,3104,12712,15630,10656,15155,-12654,-12784,-14450,-15081,11422,3202,11354,-2572,4187,1413,18865,25769,7933,13949,-22090,-13868,-12868,-5746,5444,754,-6292,-18334,-4669,-15498,21223,12113,22762,18918,0,4780,-8566,-1382,-2244,-1,0,-1380,2321,4966,8534,18918,0,13528,-21869,-10693,-23921,-18334,-4669,-5954,2495,-1904,-7586,-13868,-12868,-26234,-1033,-19817,18462,1413,18865,4783,136,-11497,-2792,-15081,11422,-6250,18298,3319,19564,15630,10656,9329,-9042,-12967,-4581,-9460,16383,5794,14245,4795,9919,14492,12160,20513,-9686,-7530,-19197,-17045,8208,4250,12828,-761,688,-4210,18443,25435,17146,23871,-18131,-7781,-17244,-3975,3996,6561,-7492,-13868,-12868,-20972,12234,1201,24266,15630,10656,9506,-948,2451,4888,14492,12160,28553,-5257,12482,-26639,-9460,-16384,-2690,-359,8155,-7807,1413,-18866,-11961,-19146,-22855,-6903,-15081,11422,5002,6796,453,-12322,-17045,-8209,-16763,4862,-13084,10100,-4210,18443,13885,8559,3961,-14225,-18334,-4669,-10421,11873,-5262,6476,-9460,16383,14280,21830,21641,-9602,-9460,-16384,-11078,7683,2560,-585,-18334,-4669,-17288,27291,18985,25813,18077,-5577,-2285,-1696,9035,8468,15630,-10657,-5747,-20618,-20899,-4988,-15081,11422,-2027,11888,-3063,1450,-17045,8208,-7859,30392,19607,24841,18918,-1,1271,47,3357,12686,14492,12160,21317,3859,20355,-11253,1413,-18866,-10826,-254,6990,12044,18077,-5577,2296,-15923,-6286,-4669,0,-1,349,-3376,-1982,-1440,0,0,151,-1328,-786,-592,-1,0,72,-483,-237,-200,-1,-1,27,-37,66,18,0,0,-1,229,251,153,0,-1,-19,398,370,240,-1,-1,-31,510,449,299,-1,0,-40,586,504,339,-1,-1,-46,639,541,367,0,0,-50,675,567,386,0,0};
+
+static int16_t pss6144_1_1[512]__attribute__((aligned(16))) = {0,0,0,0,-75,-703,-641,-284,-1,-1,-77,-682,-622,-269,0,0,-81,-650,-592,-247,0,0,-87,-604,-550,-216,0,0,-94,-536,-488,-170,0,-1,-105,-438,-398,-103,0,0,-121,-291,-260,-3,0,-1,-146,-64,-44,154,-1,0,-183,308,320,416,-1,-1,-248,979,1012,908,0,0,-385,2438,2687,2103,-1,0,-1029,7780,12580,10062,18077,-5577,6808,-12074,5571,-9136,1413,-18866,-20051,-12000,-14063,16643,14492,12160,9180,-9248,-739,1189,18918,0,11581,-29398,-22453,-21889,-17045,8208,2659,1930,-9344,-7587,-15081,11422,6001,20595,20667,5444,15630,-10657,2688,-12056,2550,-1019,18077,-5577,12734,-29346,-15053,-28505,-18334,-4669,-1915,-1922,-1177,-13323,-9460,-16384,-19264,-13938,-26108,1564,-9460,16383,8111,1321,-5134,-14849,-18334,-4669,-14428,3684,-14417,7858,-4210,18443,15161,6283,4109,-16836,-17045,-8209,-11025,5771,-8448,1046,-15081,11422,5322,23247,22499,-674,1413,-18866,-10967,-3156,1594,-2038,-9460,-16384,-29439,2511,-9786,27468,14492,12160,2879,-4565,-3994,8819,15630,10656,20286,-13171,-171,-24168,-13868,-12868,-9897,-1934,-1535,-5328,-7781,-17244,-27765,-11606,-27629,13566,-4210,18443,848,317,-13296,-2621,-17045,8208,-12988,16121,-1931,22720,14492,12160,6065,-9110,-15296,-1993,-9460,16383,2388,13523,3104,12712,15630,10656,15155,-12654,-12784,-14450,-15081,11422,3202,11354,-2572,4187,1413,18865,25769,7933,13949,-22090,-13868,-12868,-5746,5444,754,-6292,-18334,-4669,-15498,21223,12113,22762,18918,0,4780,-8566,-1382,-2244,-1,0,-1380,2321,4966,8534,18918,0,13528,-21869,-10693,-23921,-18334,-4669,-5954,2495,-1904,-7586,-13868,-12868,-26234,-1033,-19817,18462,1413,18865,4783,136,-11497,-2792,-15081,11422,-6250,18298,3319,19564,15630,10656,9329,-9042,-12967,-4581,-9460,16383,5794,14245,4795,9919,14492,12160,20513,-9686,-7530,-19197,-17045,8208,4250,12828,-761,688,-4210,18443,25435,17146,23871,-18131,-7781,-17244,-3975,3996,6561,-7492,-13868,-12868,-20972,12234,1201,24266,15630,10656,9506,-948,2451,4888,14492,12160,28553,-5257,12482,-26639,-9460,-16384,-2690,-359,8155,-7807,1413,-18866,-11961,-19146,-22855,-6903,-15081,11422,5002,6796,453,-12322,-17045,-8209,-16763,4862,-13084,10100,-4210,18443,13885,8559,3961,-14225,-18334,-4669,-10421,11873,-5262,6476,-9460,16383,14280,21830,21641,-9602,-9460,-16384,-11078,7683,2560,-585,-18334,-4669,-17288,27291,18985,25813,18077,-5577,-2285,-1696,9035,8468,15630,-10657,-5747,-20618,-20899,-4988,-15081,11422,-2027,11888,-3063,1450,-17045,8208,-7859,30392,19607,24841,18918,-1,1271,47,3357,12686,14492,12160,21317,3859,20355,-11253,1413,-18866,-10826,-254,6990,12044,18077,-5577,2296,-15923,-6286,-4669,0,-1,349,-3376,-1982,-1440,0,0,151,-1328,-786,-592,-1,0,72,-483,-237,-200,-1,-1,27,-37,66,18,0,0,-1,229,251,153,0,-1,-19,398,370,240,-1,-1,-31,510,449,299,-1,0,-40,586,504,339,-1,-1,-46,639,541,367,0,0,-50,675,567,386};
+
+static int16_t pss6144_1_2[512]__attribute__((aligned(16))) = {0,0,0,0,0,0,-75,-703,-641,-284,-1,-1,-77,-682,-622,-269,0,0,-81,-650,-592,-247,0,0,-87,-604,-550,-216,0,0,-94,-536,-488,-170,0,-1,-105,-438,-398,-103,0,0,-121,-291,-260,-3,0,-1,-146,-64,-44,154,-1,0,-183,308,320,416,-1,-1,-248,979,1012,908,0,0,-385,2438,2687,2103,-1,0,-1029,7780,12580,10062,18077,-5577,6808,-12074,5571,-9136,1413,-18866,-20051,-12000,-14063,16643,14492,12160,9180,-9248,-739,1189,18918,0,11581,-29398,-22453,-21889,-17045,8208,2659,1930,-9344,-7587,-15081,11422,6001,20595,20667,5444,15630,-10657,2688,-12056,2550,-1019,18077,-5577,12734,-29346,-15053,-28505,-18334,-4669,-1915,-1922,-1177,-13323,-9460,-16384,-19264,-13938,-26108,1564,-9460,16383,8111,1321,-5134,-14849,-18334,-4669,-14428,3684,-14417,7858,-4210,18443,15161,6283,4109,-16836,-17045,-8209,-11025,5771,-8448,1046,-15081,11422,5322,23247,22499,-674,1413,-18866,-10967,-3156,1594,-2038,-9460,-16384,-29439,2511,-9786,27468,14492,12160,2879,-4565,-3994,8819,15630,10656,20286,-13171,-171,-24168,-13868,-12868,-9897,-1934,-1535,-5328,-7781,-17244,-27765,-11606,-27629,13566,-4210,18443,848,317,-13296,-2621,-17045,8208,-12988,16121,-1931,22720,14492,12160,6065,-9110,-15296,-1993,-9460,16383,2388,13523,3104,12712,15630,10656,15155,-12654,-12784,-14450,-15081,11422,3202,11354,-2572,4187,1413,18865,25769,7933,13949,-22090,-13868,-12868,-5746,5444,754,-6292,-18334,-4669,-15498,21223,12113,22762,18918,0,4780,-8566,-1382,-2244,-1,0,-1380,2321,4966,8534,18918,0,13528,-21869,-10693,-23921,-18334,-4669,-5954,2495,-1904,-7586,-13868,-12868,-26234,-1033,-19817,18462,1413,18865,4783,136,-11497,-2792,-15081,11422,-6250,18298,3319,19564,15630,10656,9329,-9042,-12967,-4581,-9460,16383,5794,14245,4795,9919,14492,12160,20513,-9686,-7530,-19197,-17045,8208,4250,12828,-761,688,-4210,18443,25435,17146,23871,-18131,-7781,-17244,-3975,3996,6561,-7492,-13868,-12868,-20972,12234,1201,24266,15630,10656,9506,-948,2451,4888,14492,12160,28553,-5257,12482,-26639,-9460,-16384,-2690,-359,8155,-7807,1413,-18866,-11961,-19146,-22855,-6903,-15081,11422,5002,6796,453,-12322,-17045,-8209,-16763,4862,-13084,10100,-4210,18443,13885,8559,3961,-14225,-18334,-4669,-10421,11873,-5262,6476,-9460,16383,14280,21830,21641,-9602,-9460,-16384,-11078,7683,2560,-585,-18334,-4669,-17288,27291,18985,25813,18077,-5577,-2285,-1696,9035,8468,15630,-10657,-5747,-20618,-20899,-4988,-15081,11422,-2027,11888,-3063,1450,-17045,8208,-7859,30392,19607,24841,18918,-1,1271,47,3357,12686,14492,12160,21317,3859,20355,-11253,1413,-18866,-10826,-254,6990,12044,18077,-5577,2296,-15923,-6286,-4669,0,-1,349,-3376,-1982,-1440,0,0,151,-1328,-786,-592,-1,0,72,-483,-237,-200,-1,-1,27,-37,66,18,0,0,-1,229,251,153,0,-1,-19,398,370,240,-1,-1,-31,510,449,299,-1,0,-40,586,504,339,-1,-1,-46,639,541,367,0,0,-50,675};
+
+static int16_t pss6144_1_3[512]__attribute__((aligned(16))) = {0,0,0,0,0,0,0,0,-75,-703,-641,-284,-1,-1,-77,-682,-622,-269,0,0,-81,-650,-592,-247,0,0,-87,-604,-550,-216,0,0,-94,-536,-488,-170,0,-1,-105,-438,-398,-103,0,0,-121,-291,-260,-3,0,-1,-146,-64,-44,154,-1,0,-183,308,320,416,-1,-1,-248,979,1012,908,0,0,-385,2438,2687,2103,-1,0,-1029,7780,12580,10062,18077,-5577,6808,-12074,5571,-9136,1413,-18866,-20051,-12000,-14063,16643,14492,12160,9180,-9248,-739,1189,18918,0,11581,-29398,-22453,-21889,-17045,8208,2659,1930,-9344,-7587,-15081,11422,6001,20595,20667,5444,15630,-10657,2688,-12056,2550,-1019,18077,-5577,12734,-29346,-15053,-28505,-18334,-4669,-1915,-1922,-1177,-13323,-9460,-16384,-19264,-13938,-26108,1564,-9460,16383,8111,1321,-5134,-14849,-18334,-4669,-14428,3684,-14417,7858,-4210,18443,15161,6283,4109,-16836,-17045,-8209,-11025,5771,-8448,1046,-15081,11422,5322,23247,22499,-674,1413,-18866,-10967,-3156,1594,-2038,-9460,-16384,-29439,2511,-9786,27468,14492,12160,2879,-4565,-3994,8819,15630,10656,20286,-13171,-171,-24168,-13868,-12868,-9897,-1934,-1535,-5328,-7781,-17244,-27765,-11606,-27629,13566,-4210,18443,848,317,-13296,-2621,-17045,8208,-12988,16121,-1931,22720,14492,12160,6065,-9110,-15296,-1993,-9460,16383,2388,13523,3104,12712,15630,10656,15155,-12654,-12784,-14450,-15081,11422,3202,11354,-2572,4187,1413,18865,25769,7933,13949,-22090,-13868,-12868,-5746,5444,754,-6292,-18334,-4669,-15498,21223,12113,22762,18918,0,4780,-8566,-1382,-2244,-1,0,-1380,2321,4966,8534,18918,0,13528,-21869,-10693,-23921,-18334,-4669,-5954,2495,-1904,-7586,-13868,-12868,-26234,-1033,-19817,18462,1413,18865,4783,136,-11497,-2792,-15081,11422,-6250,18298,3319,19564,15630,10656,9329,-9042,-12967,-4581,-9460,16383,5794,14245,4795,9919,14492,12160,20513,-9686,-7530,-19197,-17045,8208,4250,12828,-761,688,-4210,18443,25435,17146,23871,-18131,-7781,-17244,-3975,3996,6561,-7492,-13868,-12868,-20972,12234,1201,24266,15630,10656,9506,-948,2451,4888,14492,12160,28553,-5257,12482,-26639,-9460,-16384,-2690,-359,8155,-7807,1413,-18866,-11961,-19146,-22855,-6903,-15081,11422,5002,6796,453,-12322,-17045,-8209,-16763,4862,-13084,10100,-4210,18443,13885,8559,3961,-14225,-18334,-4669,-10421,11873,-5262,6476,-9460,16383,14280,21830,21641,-9602,-9460,-16384,-11078,7683,2560,-585,-18334,-4669,-17288,27291,18985,25813,18077,-5577,-2285,-1696,9035,8468,15630,-10657,-5747,-20618,-20899,-4988,-15081,11422,-2027,11888,-3063,1450,-17045,8208,-7859,30392,19607,24841,18918,-1,1271,47,3357,12686,14492,12160,21317,3859,20355,-11253,1413,-18866,-10826,-254,6990,12044,18077,-5577,2296,-15923,-6286,-4669,0,-1,349,-3376,-1982,-1440,0,0,151,-1328,-786,-592,-1,0,72,-483,-237,-200,-1,-1,27,-37,66,18,0,0,-1,229,251,153,0,-1,-19,398,370,240,-1,-1,-31,510,449,299,-1,0,-40,586,504,339,-1,-1,-46,639,541,367,0,0};
+
+static int16_t pss6144_2_0[512]__attribute__((aligned(16))) = {0,0,584,-400,-53,-700,-1,0,567,-387,-50,-676,-1,-1,541,-368,-46,-640,-1,0,504,-340,-40,-587,-1,-1,449,-300,-31,-511,0,-1,370,-241,-19,-399,0,-1,251,-154,-1,-230,-1,0,66,-19,27,36,0,0,-237,199,72,482,0,0,-786,591,151,1327,0,0,-1982,1439,349,3375,-1,0,-6286,4668,2296,15922,18077,5576,6990,-12045,-10826,253,1413,18865,20355,11252,21317,-3860,14492,-12161,3357,-12687,1271,-48,18918,0,19607,-24842,-7859,-30393,-17045,-8209,-3063,-1451,-2027,-11889,-15081,-11423,-20899,4987,-5747,20617,15630,10656,9035,-8469,-2285,1695,18077,5576,18985,-25814,-17288,-27292,-18334,4668,2560,584,-11078,-7684,-9460,16383,21641,9601,14280,-21831,-9460,-16384,-5262,-6477,-10421,-11874,-18334,4668,3961,14224,13885,-8560,-4210,-18444,-13084,-10101,-16763,-4863,-17045,8208,453,12321,5002,-6797,-15081,-11423,-22855,6902,-11961,19145,1413,18865,8155,7806,-2690,358,-9460,16383,12482,26638,28553,5256,14492,-12161,2451,-4889,9506,947,15630,-10657,1201,-24267,-20972,-12235,-13868,12867,6561,7491,-3975,-3997,-7781,17243,23871,18130,25435,-17147,-4210,-18444,-761,-689,4250,-12829,-17045,-8209,-7530,19196,20513,9685,14492,-12161,4795,-9920,5794,-14246,-9460,-16384,-12967,4580,9329,9041,15630,-10657,3319,-19565,-6250,-18299,-15081,-11423,-11497,2791,4783,-137,1413,-18866,-19817,-18463,-26234,1032,-13868,12867,-1904,7585,-5954,-2496,-18334,4668,-10693,23920,13528,21868,18918,-1,4966,-8535,-1380,-2322,-1,0,-1382,2243,4780,8565,18918,-1,12113,-22763,-15498,-21224,-18334,4668,754,6291,-5746,-5445,-13868,12867,13949,22089,25769,-7934,1413,-18866,-2572,-4188,3202,-11355,-15081,-11423,-12784,14449,15155,12653,15630,-10657,3104,-12713,2388,-13524,-9460,-16384,-15296,1992,6065,9109,14492,-12161,-1931,-22721,-12988,-16122,-17045,-8209,-13296,2620,848,-318,-4210,-18444,-27629,-13567,-27765,11605,-7781,17243,-1535,5327,-9897,1933,-13868,12867,-171,24167,20286,13170,15630,-10657,-3994,-8820,2879,4564,14492,-12161,-9786,-27469,-29439,-2512,-9460,16383,1594,2037,-10967,3155,1413,18865,22499,673,5322,-23248,-15081,-11423,-8448,-1047,-11025,-5772,-17045,8208,4109,16835,15161,-6284,-4210,-18444,-14417,-7859,-14428,-3685,-18334,4668,-5134,14848,8111,-1322,-9460,-16384,-26108,-1565,-19264,13937,-9460,16383,-1177,13322,-1915,1921,-18334,4668,-15053,28504,12734,29345,18077,5576,2550,1018,2688,12055,15630,10656,20667,-5445,6001,-20596,-15081,-11423,-9344,7586,2659,-1931,-17045,-8209,-22453,21888,11581,29397,18918,0,-739,-1190,9180,9247,14492,-12161,-14063,-16644,-20051,11999,1413,18865,5571,9135,6808,12073,18077,5576,12580,-10063,-1029,-7781,-1,-1,2687,-2104,-385,-2439,0,-1,1012,-909,-248,-980,-1,-1,320,-417,-183,-309,-1,0,-44,-155,-146,63,-1,0,-260,2,-121,290,-1,0,-398,102,-105,437,-1,0,-488,169,-94,535,0,0,-550,215,-87,603,-1,-1,-592,246,-81,649,0,0,-622,268,-77,681,0,0};
+
+static int16_t pss6144_2_1[512]__attribute__((aligned(16))) = {0,0,0,0,584,-400,-53,-700,-1,0,567,-387,-50,-676,-1,-1,541,-368,-46,-640,-1,0,504,-340,-40,-587,-1,-1,449,-300,-31,-511,0,-1,370,-241,-19,-399,0,-1,251,-154,-1,-230,-1,0,66,-19,27,36,0,0,-237,199,72,482,0,0,-786,591,151,1327,0,0,-1982,1439,349,3375,-1,0,-6286,4668,2296,15922,18077,5576,6990,-12045,-10826,253,1413,18865,20355,11252,21317,-3860,14492,-12161,3357,-12687,1271,-48,18918,0,19607,-24842,-7859,-30393,-17045,-8209,-3063,-1451,-2027,-11889,-15081,-11423,-20899,4987,-5747,20617,15630,10656,9035,-8469,-2285,1695,18077,5576,18985,-25814,-17288,-27292,-18334,4668,2560,584,-11078,-7684,-9460,16383,21641,9601,14280,-21831,-9460,-16384,-5262,-6477,-10421,-11874,-18334,4668,3961,14224,13885,-8560,-4210,-18444,-13084,-10101,-16763,-4863,-17045,8208,453,12321,5002,-6797,-15081,-11423,-22855,6902,-11961,19145,1413,18865,8155,7806,-2690,358,-9460,16383,12482,26638,28553,5256,14492,-12161,2451,-4889,9506,947,15630,-10657,1201,-24267,-20972,-12235,-13868,12867,6561,7491,-3975,-3997,-7781,17243,23871,18130,25435,-17147,-4210,-18444,-761,-689,4250,-12829,-17045,-8209,-7530,19196,20513,9685,14492,-12161,4795,-9920,5794,-14246,-9460,-16384,-12967,4580,9329,9041,15630,-10657,3319,-19565,-6250,-18299,-15081,-11423,-11497,2791,4783,-137,1413,-18866,-19817,-18463,-26234,1032,-13868,12867,-1904,7585,-5954,-2496,-18334,4668,-10693,23920,13528,21868,18918,-1,4966,-8535,-1380,-2322,-1,0,-1382,2243,4780,8565,18918,-1,12113,-22763,-15498,-21224,-18334,4668,754,6291,-5746,-5445,-13868,12867,13949,22089,25769,-7934,1413,-18866,-2572,-4188,3202,-11355,-15081,-11423,-12784,14449,15155,12653,15630,-10657,3104,-12713,2388,-13524,-9460,-16384,-15296,1992,6065,9109,14492,-12161,-1931,-22721,-12988,-16122,-17045,-8209,-13296,2620,848,-318,-4210,-18444,-27629,-13567,-27765,11605,-7781,17243,-1535,5327,-9897,1933,-13868,12867,-171,24167,20286,13170,15630,-10657,-3994,-8820,2879,4564,14492,-12161,-9786,-27469,-29439,-2512,-9460,16383,1594,2037,-10967,3155,1413,18865,22499,673,5322,-23248,-15081,-11423,-8448,-1047,-11025,-5772,-17045,8208,4109,16835,15161,-6284,-4210,-18444,-14417,-7859,-14428,-3685,-18334,4668,-5134,14848,8111,-1322,-9460,-16384,-26108,-1565,-19264,13937,-9460,16383,-1177,13322,-1915,1921,-18334,4668,-15053,28504,12734,29345,18077,5576,2550,1018,2688,12055,15630,10656,20667,-5445,6001,-20596,-15081,-11423,-9344,7586,2659,-1931,-17045,-8209,-22453,21888,11581,29397,18918,0,-739,-1190,9180,9247,14492,-12161,-14063,-16644,-20051,11999,1413,18865,5571,9135,6808,12073,18077,5576,12580,-10063,-1029,-7781,-1,-1,2687,-2104,-385,-2439,0,-1,1012,-909,-248,-980,-1,-1,320,-417,-183,-309,-1,0,-44,-155,-146,63,-1,0,-260,2,-121,290,-1,0,-398,102,-105,437,-1,0,-488,169,-94,535,0,0,-550,215,-87,603,-1,-1,-592,246,-81,649,0,0,-622,268,-77,681};
+
+static int16_t pss6144_2_2[512]__attribute__((aligned(16))) = {0,0,0,0,0,0,584,-400,-53,-700,-1,0,567,-387,-50,-676,-1,-1,541,-368,-46,-640,-1,0,504,-340,-40,-587,-1,-1,449,-300,-31,-511,0,-1,370,-241,-19,-399,0,-1,251,-154,-1,-230,-1,0,66,-19,27,36,0,0,-237,199,72,482,0,0,-786,591,151,1327,0,0,-1982,1439,349,3375,-1,0,-6286,4668,2296,15922,18077,5576,6990,-12045,-10826,253,1413,18865,20355,11252,21317,-3860,14492,-12161,3357,-12687,1271,-48,18918,0,19607,-24842,-7859,-30393,-17045,-8209,-3063,-1451,-2027,-11889,-15081,-11423,-20899,4987,-5747,20617,15630,10656,9035,-8469,-2285,1695,18077,5576,18985,-25814,-17288,-27292,-18334,4668,2560,584,-11078,-7684,-9460,16383,21641,9601,14280,-21831,-9460,-16384,-5262,-6477,-10421,-11874,-18334,4668,3961,14224,13885,-8560,-4210,-18444,-13084,-10101,-16763,-4863,-17045,8208,453,12321,5002,-6797,-15081,-11423,-22855,6902,-11961,19145,1413,18865,8155,7806,-2690,358,-9460,16383,12482,26638,28553,5256,14492,-12161,2451,-4889,9506,947,15630,-10657,1201,-24267,-20972,-12235,-13868,12867,6561,7491,-3975,-3997,-7781,17243,23871,18130,25435,-17147,-4210,-18444,-761,-689,4250,-12829,-17045,-8209,-7530,19196,20513,9685,14492,-12161,4795,-9920,5794,-14246,-9460,-16384,-12967,4580,9329,9041,15630,-10657,3319,-19565,-6250,-18299,-15081,-11423,-11497,2791,4783,-137,1413,-18866,-19817,-18463,-26234,1032,-13868,12867,-1904,7585,-5954,-2496,-18334,4668,-10693,23920,13528,21868,18918,-1,4966,-8535,-1380,-2322,-1,0,-1382,2243,4780,8565,18918,-1,12113,-22763,-15498,-21224,-18334,4668,754,6291,-5746,-5445,-13868,12867,13949,22089,25769,-7934,1413,-18866,-2572,-4188,3202,-11355,-15081,-11423,-12784,14449,15155,12653,15630,-10657,3104,-12713,2388,-13524,-9460,-16384,-15296,1992,6065,9109,14492,-12161,-1931,-22721,-12988,-16122,-17045,-8209,-13296,2620,848,-318,-4210,-18444,-27629,-13567,-27765,11605,-7781,17243,-1535,5327,-9897,1933,-13868,12867,-171,24167,20286,13170,15630,-10657,-3994,-8820,2879,4564,14492,-12161,-9786,-27469,-29439,-2512,-9460,16383,1594,2037,-10967,3155,1413,18865,22499,673,5322,-23248,-15081,-11423,-8448,-1047,-11025,-5772,-17045,8208,4109,16835,15161,-6284,-4210,-18444,-14417,-7859,-14428,-3685,-18334,4668,-5134,14848,8111,-1322,-9460,-16384,-26108,-1565,-19264,13937,-9460,16383,-1177,13322,-1915,1921,-18334,4668,-15053,28504,12734,29345,18077,5576,2550,1018,2688,12055,15630,10656,20667,-5445,6001,-20596,-15081,-11423,-9344,7586,2659,-1931,-17045,-8209,-22453,21888,11581,29397,18918,0,-739,-1190,9180,9247,14492,-12161,-14063,-16644,-20051,11999,1413,18865,5571,9135,6808,12073,18077,5576,12580,-10063,-1029,-7781,-1,-1,2687,-2104,-385,-2439,0,-1,1012,-909,-248,-980,-1,-1,320,-417,-183,-309,-1,0,-44,-155,-146,63,-1,0,-260,2,-121,290,-1,0,-398,102,-105,437,-1,0,-488,169,-94,535,0,0,-550,215,-87,603,-1,-1,-592,246,-81,649,0,0,-622,268};
+
+static int16_t pss6144_2_3[512]__attribute__((aligned(16))) = {0,0,0,0,0,0,0,0,584,-400,-53,-700,-1,0,567,-387,-50,-676,-1,-1,541,-368,-46,-640,-1,0,504,-340,-40,-587,-1,-1,449,-300,-31,-511,0,-1,370,-241,-19,-399,0,-1,251,-154,-1,-230,-1,0,66,-19,27,36,0,0,-237,199,72,482,0,0,-786,591,151,1327,0,0,-1982,1439,349,3375,-1,0,-6286,4668,2296,15922,18077,5576,6990,-12045,-10826,253,1413,18865,20355,11252,21317,-3860,14492,-12161,3357,-12687,1271,-48,18918,0,19607,-24842,-7859,-30393,-17045,-8209,-3063,-1451,-2027,-11889,-15081,-11423,-20899,4987,-5747,20617,15630,10656,9035,-8469,-2285,1695,18077,5576,18985,-25814,-17288,-27292,-18334,4668,2560,584,-11078,-7684,-9460,16383,21641,9601,14280,-21831,-9460,-16384,-5262,-6477,-10421,-11874,-18334,4668,3961,14224,13885,-8560,-4210,-18444,-13084,-10101,-16763,-4863,-17045,8208,453,12321,5002,-6797,-15081,-11423,-22855,6902,-11961,19145,1413,18865,8155,7806,-2690,358,-9460,16383,12482,26638,28553,5256,14492,-12161,2451,-4889,9506,947,15630,-10657,1201,-24267,-20972,-12235,-13868,12867,6561,7491,-3975,-3997,-7781,17243,23871,18130,25435,-17147,-4210,-18444,-761,-689,4250,-12829,-17045,-8209,-7530,19196,20513,9685,14492,-12161,4795,-9920,5794,-14246,-9460,-16384,-12967,4580,9329,9041,15630,-10657,3319,-19565,-6250,-18299,-15081,-11423,-11497,2791,4783,-137,1413,-18866,-19817,-18463,-26234,1032,-13868,12867,-1904,7585,-5954,-2496,-18334,4668,-10693,23920,13528,21868,18918,-1,4966,-8535,-1380,-2322,-1,0,-1382,2243,4780,8565,18918,-1,12113,-22763,-15498,-21224,-18334,4668,754,6291,-5746,-5445,-13868,12867,13949,22089,25769,-7934,1413,-18866,-2572,-4188,3202,-11355,-15081,-11423,-12784,14449,15155,12653,15630,-10657,3104,-12713,2388,-13524,-9460,-16384,-15296,1992,6065,9109,14492,-12161,-1931,-22721,-12988,-16122,-17045,-8209,-13296,2620,848,-318,-4210,-18444,-27629,-13567,-27765,11605,-7781,17243,-1535,5327,-9897,1933,-13868,12867,-171,24167,20286,13170,15630,-10657,-3994,-8820,2879,4564,14492,-12161,-9786,-27469,-29439,-2512,-9460,16383,1594,2037,-10967,3155,1413,18865,22499,673,5322,-23248,-15081,-11423,-8448,-1047,-11025,-5772,-17045,8208,4109,16835,15161,-6284,-4210,-18444,-14417,-7859,-14428,-3685,-18334,4668,-5134,14848,8111,-1322,-9460,-16384,-26108,-1565,-19264,13937,-9460,16383,-1177,13322,-1915,1921,-18334,4668,-15053,28504,12734,29345,18077,5576,2550,1018,2688,12055,15630,10656,20667,-5445,6001,-20596,-15081,-11423,-9344,7586,2659,-1931,-17045,-8209,-22453,21888,11581,29397,18918,0,-739,-1190,9180,9247,14492,-12161,-14063,-16644,-20051,11999,1413,18865,5571,9135,6808,12073,18077,5576,12580,-10063,-1029,-7781,-1,-1,2687,-2104,-385,-2439,0,-1,1012,-909,-248,-980,-1,-1,320,-417,-183,-309,-1,0,-44,-155,-146,63,-1,0,-260,2,-121,290,-1,0,-398,102,-105,437,-1,0,-488,169,-94,535,0,0,-550,215,-87,603,-1,-1,-592,246,-81,649,0,0};
diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index f9b12ee8ac..297cc28467 100755
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -46,6 +46,7 @@
 #include <string.h>
 #include <math.h>
 //#include <complex.h>
+#include "assertions.h"
 #ifdef MEX
 # define msg mexPrintf
 #else
@@ -75,6 +76,27 @@
 #define openair_free(y,x) free((y))
 #define PAGE_SIZE 4096
 
+#ifdef EXPRESSMIMO_TARGET
+    //! \brief Allocate \c size bytes of memory on the heap and zero it afterwards.
+    //! If no more memory is available, this function will terminate the program with an assertion error.
+    static inline void* malloc16_clear( size_t size ) {
+        void* ptr = malloc(size);
+        DevAssert(ptr);
+        memset( ptr, 0, size );
+        return ptr;
+    }
+#else //EXPRESSMIMO_TARGET
+    //! \brief Allocate \c size bytes of memory on the heap with alignment 16 and zero it afterwards.
+    //! If no more memory is available, this function will terminate the program with an assertion error.
+    static inline void* malloc16_clear( size_t size ) {
+        void* ptr = memalign(16, size);
+        DevAssert(ptr);
+        memset( ptr, 0, size );
+        return ptr;
+    }
+#endif //EXPRESSMIMO_TARGET
+
+
 #define PAGE_MASK 0xfffff000
 #define virt_to_phys(x) (x)
 
@@ -135,9 +157,9 @@ enum transmission_access_mode{
 
 typedef struct UE_SCAN_INFO_s {
   /// 10 best amplitudes (linear) for each pss signals
-  int32_t amp[2][10];
+  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[2][10];
+  int32_t freq_offset_Hz[3][10];
 } UE_SCAN_INFO_t;
 
 #if defined(ENABLE_RAL)
@@ -195,6 +217,9 @@ typedef struct PHY_VARS_eNB_s{
   LTE_eNB_COMMON       lte_eNB_common_vars;
   LTE_eNB_SRS          lte_eNB_srs_vars[NUMBER_OF_UE_MAX];
   LTE_eNB_PBCH         lte_eNB_pbch;
+  /// \brief ?.
+  /// - first index: UE [0..NUMBER_OF_UE_MAX[ (hard coded)
+  /// - second index: UE [0..NUMBER_OF_UE_MAX[
   LTE_eNB_PUSCH       *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX];
   LTE_eNB_PRACH        lte_eNB_prach_vars;
   LTE_eNB_DLSCH_t     *dlsch_eNB[NUMBER_OF_UE_MAX][2];   // Nusers times two spatial streams
@@ -227,7 +252,8 @@ typedef struct PHY_VARS_eNB_s{
 
   int              N_TA_offset; ///timing offset used in TDD
 
-  /// sinr for all subcarriers of the current link (used only for abstraction)
+  /// \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)
@@ -390,12 +416,20 @@ typedef struct
   pthread_t       thread_tx;
   pthread_t       thread_synch;
   uint32_t tx_total_gain_dB;
-  uint32_t rx_total_gain_dB; ///this is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card
+  /// \brief This is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card.
+  uint32_t rx_total_gain_dB;
+  /// \brief ?.
+  /// - first index: ? [0..3] (hard coded)
   uint32_t rx_gain_max[4];
   /*
     rx_gain_t rx_gain_mode[4];*/
+  /// \brief ?.
+  /// - first index: ? [0..3] (hard coded)
   uint32_t rx_gain_med[4];
+  /// \brief ?.
+  /// - first index: ? [0..3] (hard coded)
   uint32_t rx_gain_byp[4];
+  /// \brief ?.
   int8_t tx_power_dBm;
   int tx_total_RE;
   int8_t tx_power_max_dBm;
@@ -405,9 +439,11 @@ typedef struct
   uint8_t n_connected_eNB;
   uint8_t ho_initiated;
   uint8_t ho_triggered;
-  PHY_MEASUREMENTS PHY_measurements; /// Measurement variables 
+  /// \brief Measurement variables.
+  PHY_MEASUREMENTS PHY_measurements;
   LTE_DL_FRAME_PARMS  lte_frame_parms;
-  LTE_DL_FRAME_PARMS  lte_frame_parms_before_ho; // frame parame before ho used to recover if ho fails
+  /// \brief Frame parame before ho used to recover if ho fails.
+  LTE_DL_FRAME_PARMS  lte_frame_parms_before_ho;
   LTE_UE_COMMON    lte_ue_common_vars;
 
   LTE_UE_PDSCH     *lte_ue_pdsch_vars[NUMBER_OF_CONNECTED_eNB_MAX+1];
@@ -459,9 +495,17 @@ typedef struct
   //unsigned char *Msg3_ptr[NUMBER_OF_CONNECTED_eNB_MAX];
   PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_eNB_MAX];
   int turbo_iterations, turbo_cntl_iterations;
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
   uint32_t total_TBS[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
   uint32_t total_TBS_last[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
   uint32_t bitrate[NUMBER_OF_CONNECTED_eNB_MAX];
+  /// \brief ?.
+  /// - first index: eNB [0..NUMBER_OF_CONNECTED_eNB_MAX[ (hard coded)
   uint32_t total_received_bits[NUMBER_OF_CONNECTED_eNB_MAX];
   int dlsch_errors[NUMBER_OF_CONNECTED_eNB_MAX];
   int dlsch_errors_last[NUMBER_OF_CONNECTED_eNB_MAX];
@@ -501,10 +545,12 @@ typedef struct
   /// Flag to initialize averaging of PHY measurements
   int init_averaging; 
 
-  /// sinr for all subcarriers of the current link (used only for abstraction)
+  /// \brief sinr for all subcarriers of the current link (used only for abstraction).
+  /// - first index: ? [0..12*N_RB_DL[
   double *sinr_dB;
   
-   /// sinr for all subcarriers of first symbol for the CQI Calculation 
+  /// \brief sinr for all subcarriers of first symbol for the CQI Calculation.
+  /// - first index: ? [0..12*N_RB_DL[
   double *sinr_CQI_dB;
 
   /// sinr_effective used for CQI calulcation
diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h
index 58bb9a2d8c..44e0303f32 100644
--- a/openair1/PHY/impl_defs_lte.h
+++ b/openair1/PHY/impl_defs_lte.h
@@ -68,11 +68,13 @@ typedef enum {TDD=1,FDD=0} lte_frame_type_t;
 
 typedef enum {EXTENDED=1,NORMAL=0} lte_prefix_type_t;
 
+/// Enumeration for parameter PHICH-Duration \ref PHICH_CONFIG_COMMON::phich_duration.
 typedef enum {
   normal=0,
   extended=1
 } PHICH_DURATION_t;
 
+/// Enumeration for parameter Ng \ref PHICH_CONFIG_COMMON::phich_resource.
 typedef enum {
   oneSixth=1,
   half=3,
@@ -80,111 +82,118 @@ typedef enum {
   two=12
 } PHICH_RESOURCE_t;
 
+/// PHICH-Config from 36.331 RRC spec
 typedef struct {
-  /// phich Duration, see 36.211 (Table 6.9.3-1)
+  /// Parameter: PHICH-Duration, see TS 36.211 (Table 6.9.3-1).
   PHICH_DURATION_t phich_duration;
-  /// phich_resource, see 36.211 (6.9)
+  /// Parameter: Ng, see TS 36.211 (6.9). \details Value oneSixth corresponds to 1/6, half corresponds to 1/2 and so on.
   PHICH_RESOURCE_t phich_resource;
 } PHICH_CONFIG_COMMON;
 
+/// PRACH-ConfigInfo from 36.331 RRC spec
 typedef struct {
-  /// Config Index
+  /// Parameter: prach-ConfigurationIndex, see TS 36.211 (5.7.1). \vr{[0..63]}
   uint8_t prach_ConfigIndex;
-  /// High Speed Flag (0,1)
+  /// Parameter: High-speed-flag, see TS 36.211 (5.7.2). \vr{[0..1]} 1 corresponds to Restricted set and 0 to Unrestricted set.
   uint8_t highSpeedFlag;
-  /// Zero correlation zone
+  /// Parameter: \f$N_\text{CS}\f$, see TS 36.211 (5.7.2). \vr{[0..15]}\n Refer to table 5.7.2-2 for preamble format 0..3 and to table 5.7.2-3 for preamble format 4.
   uint8_t zeroCorrelationZoneConfig;
-  /// Frequency offset
+  /// Parameter: prach-FrequencyOffset, see TS 36.211 (5.7.1). \vr{[0..94]}\n For TDD the value range is dependent on the value of \ref prach_ConfigIndex.
   uint8_t prach_FreqOffset;
 } PRACH_CONFIG_INFO;
 
+/// PRACH-ConfigSIB or PRACH-Config from 36.331 RRC spec
 typedef struct {
-  ///Root Sequence Index (0...837)
+  /// Parameter: RACH_ROOT_SEQUENCE, see TS 36.211 (5.7.1). \vr{[0..837]}
   uint16_t rootSequenceIndex;
-  /// prach_Config_enabled=1 means enabled
+  /// prach_Config_enabled=1 means enabled. \vr{[0..1]}
   uint8_t prach_Config_enabled;
-  ///PRACH Configuration Information
+  /// PRACH Configuration Information
   PRACH_CONFIG_INFO prach_ConfigInfo;
 } PRACH_CONFIG_COMMON;
 
+/// Enumeration for parameter \f$N_\text{ANRep}\f$ \ref PUCCH_CONFIG_DEDICATED::repetitionFactor.
 typedef enum {
   n2=0,
   n4,
   n6
 } ACKNAKREP_t;
 
+/// Enumeration for \ref PUCCH_CONFIG_DEDICATED::tdd_AckNackFeedbackMode.
 typedef enum {
   bundling=0,
   multiplexing
 } ANFBmode_t;
 
-/// PUCCH-ConfigCommon Structure from 36.331 RRC spec
+/// PUCCH-ConfigDedicated from 36.331 RRC spec
 typedef struct {
-  /// Flag to indicate ACK NAK repetition activation, see 36.213 (10.1)
+  /// Flag to indicate ACK NAK repetition activation, see TS 36.213 (10.1). \vr{[0..1]}
   uint8_t ackNackRepetition;
-  /// NANRep, see 36.213 (10.1)
+  /// Parameter: \f$N_\text{ANRep}\f$, see TS 36.213 (10.1).
   ACKNAKREP_t repetitionFactor;
-  /// n1PUCCH-AN-Rep, see 36.213 (10.1)
+  /// Parameter: \f$n^{(1)}_\text{PUCCH,ANRep}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
   uint16_t n1PUCCH_AN_Rep;
-  /// Feedback mode, see 36.213 (7.3).  Applied to both PUCCH and PUSCH feedback.  For TDD, should always be set to bundling.
+  /// Feedback mode, see TS 36.213 (7.3). \details Applied to both PUCCH and PUSCH feedback. For TDD, should always be set to bundling.
   ANFBmode_t tdd_AckNackFeedbackMode;
 } PUCCH_CONFIG_DEDICATED;
 
 /// PUCCH-ConfigCommon from 36.331 RRC spec
 typedef struct {
-  /// Parameter rom 36.211, 5.4.1, values 1,2,3
+  /// Parameter: \f$\Delta^\text{PUCCH}_\text{shift}\f$, see TS 36.211 (5.4.1). \vr{[1..3]} \note the specification sais it is an enumerated value.
   uint8_t deltaPUCCH_Shift;
-  /// NRB2 from 36.211, 5.4
+  /// Parameter: \f$N^{(2)}_\text{RB}\f$, see TS 36.211 (5.4). \vr{[0..98]}
   uint8_t nRB_CQI;
-  /// NCS1 from 36.211, 5.4
+  /// Parameter: \f$N^{(1)}_\text{CS}\f$, see TS 36.211 (5.4). \vr{[0..7]}
   uint8_t nCS_AN;
-  /// N1PUCCH from 36.213, 10.1
+  /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]}
   uint16_t n1PUCCH_AN;
 } PUCCH_CONFIG_COMMON;
 
 /// UL-ReferenceSignalsPUSCH from 36.331 RRC spec
 typedef struct {
-  /// See 36.211 (5.5.1.3) (0,1)
+  /// Parameter: Group-hopping-enabled, see TS 36.211 (5.5.1.3). \vr{[0..1]}
   uint8_t groupHoppingEnabled;
-  ///deltaSS see 36.211 (5.5.1.3)
+  /// Parameter: \f$\Delta SS\f$, see TS 36.211 (5.5.1.3). \vr{[0..29]}
   uint8_t groupAssignmentPUSCH;
-  /// See 36.211 (5.5.1.4) (0,1)
+  /// Parameter: Sequence-hopping-enabled, see TS 36.211 (5.5.1.4). \vr{[0..1]}
   uint8_t sequenceHoppingEnabled;
-  /// cyclicShift from 36.211 (see Table 5.5.2.1.1-2) (0...7) n_DMRS1
+  /// Parameter: cyclicShift, see TS 36.211 (Table 5.5.2.1.1-2). \vr{[0..7]}
   uint8_t cyclicShift;
-  /// nPRS for cyclic shift of DRS
+  /// nPRS for cyclic shift of DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
   uint8_t nPRS[20];
-  /// group hopping sequence for DRS
+  /// group hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
   uint8_t grouphop[20];
-  /// sequence hopping sequence for DRS
+  /// sequence hopping sequence for DRS \note not part of offical UL-ReferenceSignalsPUSCH ASN1 specification.
   uint8_t seqhop[20];
 } UL_REFERENCE_SIGNALS_PUSCH_t;
  
+/// Enumeration for parameter Hopping-mode \ref PUSCH_CONFIG_COMMON::hoppingMode.
 typedef enum {
   interSubFrame=0, 
   intraAndInterSubFrame=1
 } PUSCH_HOPPING_t;
 
-/// PUSCH-ConfigCommon from 36.331 RRC spec
+/// PUSCH-ConfigCommon from 36.331 RRC spec.
 typedef struct {
-  /// Nsb from 36.211 (5.3.4)
+  /// Parameter: \f$N_{sb}\f$, see TS 36.211 (5.3.4). \vr{[1..4]}
   uint8_t n_SB;
-  /// Hopping mode, see 36.211 (5.3.4)
+  /// Parameter: Hopping-mode, see TS 36.211 (5.3.4).
   PUSCH_HOPPING_t hoppingMode;
-  /// NRBHO from 36.211 (5.3.4)
+  /// Parameter: \f$N^{HO}_{RB}\f$, see TS 36.211 (5.3.4). \vr{[0..98]}
   uint8_t pusch_HoppingOffset;
-  /// 1 indicates 64QAM is allowed, 0 not allowed, see 36.213
+  /// See TS 36.213 (8.6.1). \vr{[0..1]} 1 indicates 64QAM is allowed, 0 not allowed.
   uint8_t enable64QAM;
   /// Ref signals configuration
   UL_REFERENCE_SIGNALS_PUSCH_t ul_ReferenceSignalsPUSCH;
 } PUSCH_CONFIG_COMMON;
 
+/// UE specific PUSCH configuration.
 typedef struct {
-  /// 
+  /// Parameter: \f$I^\text{HARQ-ACK}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-1). \vr{[0..15]}
   uint16_t betaOffset_ACK_Index;
-  ///
+  /// Parameter: \f$I^{RI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-2). \vr{[0..15]}
   uint16_t betaOffset_RI_Index;
-  /// 
+  /// Parameter: \f$I^{CQI}_\text{offset}\f$, see TS 36.213 (Table 8.6.3-3). \vr{[0..15]}
   uint16_t betaOffset_CQI_Index;
 } PUSCH_CONFIG_DEDICATED;
 
@@ -198,43 +207,45 @@ typedef struct {
 
 /// PDSCH-ConfigCommon from 36.331 RRC spec
 typedef struct {
-  /// Donwlink Reference Signal EPRE (-60... 50), 36.213 (5.2)
+  /// Parameter: Reference-signal power, see TS 36.213 (5.2). \vr{[-60..50]}\n Provides the downlink reference-signal EPRE. The actual value in dBm.
   int8_t referenceSignalPower;
-  /// Parameter PB, 36.213 (Table 5.2-1)
+  /// Parameter: \f$P_B\f$, see TS 36.213 (Table 5.2-1). \vr{[0..3]}
   uint8_t p_b;
 } PDSCH_CONFIG_COMMON;
 
+/// Enumeration for Parameter \f$P_A\f$ \ref PDSCH_CONFIG_DEDICATED::p_a.
 typedef enum {
-  dBm6=0,
-  dBm477,
-  dBm3,
-  dBm177,
-  dB0,
-  dB1,
-  dB2,
-  dB3
+  dBm6=0, ///< (dB-6) corresponds to -6 dB
+  dBm477, ///< (dB-4dot77) corresponds to -4.77 dB
+  dBm3,   ///< (dB-3) corresponds to -3 dB
+  dBm177, ///< (dB-1dot77) corresponds to -1.77 dB
+  dB0,    ///< corresponds to 0 dB
+  dB1,    ///< corresponds to 1 dB
+  dB2,    ///< corresponds to 2 dB
+  dB3     ///< corresponds to 3 dB
 } PA_t;
 
-/// PDSCH-ConfigCommon from 36.331 RRC spec
+/// PDSCH-ConfigDedicated from 36.331 RRC spec
 typedef struct {
-  /// Parameter PA in dB, 36.213 (5.2)
-   PA_t p_a;
+  /// Parameter: \f$P_A\f$, see TS 36.213 (5.2).
+  PA_t p_a;
 } PDSCH_CONFIG_DEDICATED;
 
 /// SoundingRS-UL-ConfigCommon Information Element from 36.331 RRC spec
 typedef struct {
-  /// enabled flag=1 means SRS is enabled
+  /// enabled flag=1 means SRS is enabled. \vr{[0..1]}
   uint8_t enabled_flag;
-  ///SRS BandwidthConfiguration \f$\in\{0,1,...,7\}\f$ see 36.211 (Table 5.5.3.2-1,5.5.3.2-2,5.5.3-2.3 and 5.5.3.2-4). Actual configuration depends on UL bandwidth.
+  /// Parameter: SRS Bandwidth Configuration, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..7]}\n Actual configuration depends on UL bandwidth. \note the specification sais it is an enumerated value.
   uint8_t srs_BandwidthConfig;
-  ///SRS Subframe configuration \f$\in\{0,...,15\}\f$ see 36.211 (Table 5.5.3.3-1 FDD, Table 5.5.3.3-2 TDD)
+  /// Parameter: SRS SubframeConfiguration, see TS 36.211 (table 5.5.3.3-1 for FDD, table 5.5.3.3-2 for TDD). \vr{[0..15]} \note the specification sais it is an enumerated value.
   uint8_t srs_SubframeConfig;
-  ///SRS Simultaneous-AN-and-SRS, see 36.213 (8.2)
+  /// Parameter: Simultaneous-AN-and-SRS, see TS 36.213 (8.2). \vr{[0..1]}
   uint8_t ackNackSRS_SimultaneousTransmission;
-  ///srsMaxUpPts \f$\in\{0,1\}\f$, see 36.211 (5.5.3.2).  If this field is 1, reconfiguration of mmax_SRS0 applies for UpPts, otherwise reconfiguration does not apply
+  /// Parameter: srsMaxUpPts, see TS 36.211 (5.5.3.2). \details If this field is present, reconfiguration of \f$m^\text{max}_\text{SRS,0}\f$ applies for UpPts, otherwise reconfiguration does not apply.
   uint8_t srs_MaxUpPts;
 } SOUNDINGRS_UL_CONFIG_COMMON;
 
+/// \note UNUSED
 typedef enum {
   ulpc_al0=0,
   ulpc_al04=1,
@@ -246,33 +257,43 @@ typedef enum {
   ulpc_al11=7
 } UL_POWER_CONTROL_COMMON_alpha_t;
 
+/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1.
 typedef enum {
-        deltaF_PUCCH_Format1_deltaF_2 = 0,
-        deltaF_PUCCH_Format1_deltaF0  = 1,
-        deltaF_PUCCH_Format1_deltaF2  = 2
+        deltaF_PUCCH_Format1_deltaF_2  = 0,
+        deltaF_PUCCH_Format1_deltaF0   = 1,
+        deltaF_PUCCH_Format1_deltaF2   = 2
 } deltaF_PUCCH_Format1_t;
+
+/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format1b.
 typedef enum {
-        deltaF_PUCCH_Format1b_deltaF1 = 0,
-        deltaF_PUCCH_Format1b_deltaF3 = 1,
-        deltaF_PUCCH_Format1b_deltaF5 = 2
+        deltaF_PUCCH_Format1b_deltaF1  = 0,
+        deltaF_PUCCH_Format1b_deltaF3  = 1,
+        deltaF_PUCCH_Format1b_deltaF5  = 2
 } deltaF_PUCCH_Format1b_t;
+
+/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2.
 typedef enum {
-        deltaF_PUCCH_Format2_deltaF_2 = 0,
-        deltaF_PUCCH_Format2_deltaF0  = 1,
-        deltaF_PUCCH_Format2_deltaF1  = 2,
-        deltaF_PUCCH_Format2_deltaF2  = 3
+        deltaF_PUCCH_Format2_deltaF_2  = 0,
+        deltaF_PUCCH_Format2_deltaF0   = 1,
+        deltaF_PUCCH_Format2_deltaF1   = 2,
+        deltaF_PUCCH_Format2_deltaF2   = 3
 } deltaF_PUCCH_Format2_t;
+
+/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2a.
 typedef enum {
-        deltaF_PUCCH_Format2a_deltaF_2        = 0,
-        deltaF_PUCCH_Format2a_deltaF0 = 1,
-        deltaF_PUCCH_Format2a_deltaF2 = 2
+        deltaF_PUCCH_Format2a_deltaF_2 = 0,
+        deltaF_PUCCH_Format2a_deltaF0  = 1,
+        deltaF_PUCCH_Format2a_deltaF2  = 2
 } deltaF_PUCCH_Format2a_t;
+
+/// Enumeration for \ref deltaFList_PUCCH_t::deltaF_PUCCH_Format2b.
 typedef enum {
-        deltaF_PUCCH_Format2b_deltaF_2        = 0,
-        deltaF_PUCCH_Format2b_deltaF0         = 1,
-        deltaF_PUCCH_Format2b_deltaF2         = 2
+        deltaF_PUCCH_Format2b_deltaF_2 = 0,
+        deltaF_PUCCH_Format2b_deltaF0  = 1,
+        deltaF_PUCCH_Format2b_deltaF2  = 2
 } deltaF_PUCCH_Format2b_t;
 
+/// DeltaFList-PUCCH from 36.331 RRC spec
 typedef struct {
         deltaF_PUCCH_Format1_t   deltaF_PUCCH_Format1;
         deltaF_PUCCH_Format1b_t  deltaF_PUCCH_Format1b;
@@ -283,31 +304,39 @@ typedef struct {
 
 /// SoundingRS-UL-ConfigDedicated Information Element from 36.331 RRC spec
 typedef struct {
-  ///SRS Bandwidth b \f$\in\{0,1,2,3\}\f$
+  /// Parameter: \f$B_\text{SRS}\f$, see TS 36.211 (table 5.5.3.2-1, 5.5.3.2-2, 5.5.3.2-3 and 5.5.3.2-4). \vr{[0..3]} \note the specification sais it is an enumerated value.
   uint8_t srs_Bandwidth;
-  ///SRS Hopping bandwidth bhop \f$\in\{0,1,2,3\}\f$
+  /// Parameter: SRS hopping bandwidth \f$b_\text{hop}\in\{0,1,2,3\}\f$, see TS 36.211 (5.5.3.2) \vr{[0..3]} \note the specification sais it is an enumerated value.
   uint8_t srs_HoppingBandwidth;
-  ///SRS n_RRC Frequency Domain Position \f$\in\{0,1,...,23\}\f$, see 36.211 (5.5.3.2)
+  /// Parameter: \f$n_\text{RRC}\f$, see TS 36.211 (5.5.3.2). \vr{[0..23]}
   uint8_t freqDomainPosition;
-  ///SRS duration, see 36.213 (8.2), 0 corresponds to "single" and 1 to "indefinite"
+  /// Parameter: Duration, see TS 36.213 (8.2). \vr{[0..1]} 0 corresponds to "single" and 1 to "indefinite".
   uint8_t duration;
-  ///SRS Transmission comb kTC \f$\in\{0,1\}\f$, see 36.211 (5.5.3.2)
+  /// Parameter: \f$k_\text{TC}\in\{0,1\}\f$, see TS 36.211 (5.5.3.2). \vr{[0..1]}
   uint8_t transmissionComb;
-  ///SRS Config Index (Isrs) \f$\in\{0,1,...,1023\}\f$, see 36.213 (8.2)
+  /// Parameter: \f$I_\text{SRS}\f$, see TS 36.213 (table 8.2-1). \vr{[0..1023]}
   uint16_t srs_ConfigIndex;
-  ///cyclicShift, n_SRS \f$\in\{0,1,...,7\}\f$, see 36.211 (5.5.3.1)
+  /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value.
   uint8_t cyclicShift;
 } SOUNDINGRS_UL_CONFIG_DEDICATED;
 
+/// UplinkPowerControlDedicated Information Element from 36.331 RRC spec
 typedef struct {
+  /// Parameter: \f$P_\text{0\_UE\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dB. \vr{[-8..7]}\n This field is applicable for non-persistent scheduling, only.
   int8_t p0_UE_PUSCH;
+  /// Parameter: Ks, see TS 36.213 (5.1.1.1). \vr{[0..1]}\n en0 corresponds to value 0 corresponding to state “disabled”. en1 corresponds to value 1.25 corresponding to “enabled”. \note the specification sais it is an enumerated value. \warning the enumeration values do not correspond to the given values in the specification (en1 should be 1.25).
   uint8_t deltaMCS_Enabled;
+  /// Parameter: Accumulation-enabled, see TS 36.213 (5.1.1.1). \vr{[0..1]} 1 corresponds to "enabled" whereas 0 corresponds to "disabled".
   uint8_t accumulationEnabled;
+  /// Parameter: \f$P_\text{0\_UE\_PUCCH}(1)\f$, see TS 36.213 (5.1.2.1), unit dB. \vr{[-8..7]}
   int8_t p0_UE_PUCCH;
+  /// Parameter: \f$P_\text{SRS\_OFFSET}\f$, see TS 36.213 (5.1.3.1). \vr{[0..15]}\n For Ks=1.25 (\ref deltaMCS_Enabled), the actual parameter value is pSRS_Offset value - 3. For Ks=0, the actual parameter value is -10.5 + 1.5*pSRS_Offset value.
   int8_t pSRS_Offset;
+  /// Specifies the filtering coefficient for RSRP measurements used to calculate path loss, as specified in TS 36.213 (5.1.1.1).\details The same filtering mechanism applies as for quantityConfig described in 5.5.3.2. \note the specification sais it is an enumerated value.
   uint8_t filterCoefficient;
 } UL_POWER_CONTROL_DEDICATED;
 
+/// Enumeration for parameter \f$\alpha\f$ \ref UL_POWER_CONTROL_CONFIG_COMMON::alpha.
 typedef enum {
   al0=0,
   al04=1,
@@ -319,6 +348,7 @@ typedef enum {
   al1=7
 } PUSCH_alpha_t;
 
+/// \note UNUSED
 typedef enum {
   deltaFm2=0,
   deltaF0,
@@ -328,51 +358,48 @@ typedef enum {
   deltaF5  
 } deltaF_PUCCH_t;
 
-/// UplinkPowerControlCommon Information Element from 36.331 RRC spec
+/// UplinkPowerControlCommon Information Element from 36.331 RRC spec \note this structure does not currently make use of \ref deltaFList_PUCCH_t.
 typedef struct {
-  /// p0-NominalPUSCH \f$\in\{-126,...24\}\f$, see 36.213 (5.1.1)
+  /// Parameter: \f$P_\text{0\_NOMINAL\_PUSCH}(1)\f$, see TS 36.213 (5.1.1.1), unit dBm. \vr{[-126..24]}\n This field is applicable for non-persistent scheduling, only.
   int8_t p0_NominalPUSCH;
-  /// alpha, See 36.213 (5.1.1.1)
+  /// Parameter: \f$\alpha\f$, see TS 36.213 (5.1.1.1) \warning the enumeration values do not correspond to the given values in the specification (al04 should be 0.4, ...)!
   PUSCH_alpha_t alpha;
-  /// p0-NominalPUCCH \f$\in\{-127,...,-96\}\f$, see 36.213 (5.1.1)
+  /// Parameter: \f$P_\text{0\_NOMINAL\_PUCCH}\f$ See TS 36.213 (5.1.2.1), unit dBm. \vr{[-127..-96]}
   int8_t p0_NominalPUCCH;
-  /// Power parameter for RRCConnectionRequest
+  /// Parameter: \f$\Delta_\text{PREAMBLE\_Msg3}\f$ see TS 36.213 (5.1.1.1). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
   int8_t deltaPreambleMsg3;
-  /// deltaF-PUCCH-Format1, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format1;
-  /// deltaF-PUCCH-Format1a, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format1a;
-  /// deltaF-PUCCH-Format1b, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 1b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format1b;
-  /// deltaF-PUCCH-Format2, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2, see TS 36.213 (5.1.2). \vr{[0..3]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format2;
-  /// deltaF-PUCCH-Format2a, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2a, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format2a;
-  /// deltaF-PUCCH-Format2b, see 36.213 (5.1.2)
+  /// Parameter: \f$\Delta_\text{F\_PUCCH}(F)\f$ for the PUCCH format 2b, see TS 36.213 (5.1.2). \vr{[0..2]} \warning check value range, why is this a long? \note the specification sais it is an enumerated value.
   long deltaF_PUCCH_Format2b;
 } UL_POWER_CONTROL_CONFIG_COMMON;
 
+/// Union for \ref TPC_PDCCH_CONFIG::tpc_Index.
 typedef union {
-    /// indexOfFormat3 \f$\in\{1,...,15\}\f$
+    /// Index of N when DCI format 3 is used. See TS 36.212 (5.3.3.1.6). \vr{[1..15]}
     uint8_t indexOfFormat3;
-    /// indexOfFormat3A \f$\in\{1,...,31\}\f$
+    /// Index of M when DCI format 3A is used. See TS 36.212 (5.3.3.1.7). \vr{[1..31]}
     uint8_t indexOfFormat3A;
 } TPC_INDEX_t;
 
+/// TPC-PDCCH-Config Information Element from 36.331 RRC spec
 typedef struct
 {
+  /// RNTI for power control using DCI format 3/3A, see TS 36.212. \vr{[0..65535]}
   uint16_t rnti;
+  /// Index of N or M, see TS 36.212 (5.3.3.1.6 and 5.3.3.1.7), where N or M is dependent on the used DCI format (i.e. format 3 or 3a).
   TPC_INDEX_t tpc_Index;
 } TPC_PDCCH_CONFIG;
 
-typedef enum {
-  rm12=0,
-  rm20=1,
-  rm22=2,
-  rm30=3,
-  rm31=4
-} CQI_REPORTMODEAPERIODIC;
-
+/// Enumeration for parameter SR transmission \ref SCHEDULING_REQUEST_CONFIG::dsr_TransMax.
 typedef enum {
   sr_n4=0,
   sr_n8=1,
@@ -381,36 +408,61 @@ typedef enum {
   sr_n64=4
 } DSR_TRANSMAX_t;
 
+/// SchedulingRequestConfig Information Element from 36.331 RRC spec
 typedef struct {
+  /// Parameter: \f$n^{(1)}_\text{PUCCH,SRI}\f$, see TS 36.213 (10.1). \vr{[0..2047]}
   uint16_t sr_PUCCH_ResourceIndex;
+  /// Parameter: \f$I_\text{SR}\f$, see TS 36.213 (10.1). \vr{[0..155]}
   uint8_t sr_ConfigIndex;
+  /// Parameter for SR transmission in TS 36.321 (5.4.4). \details The value n4 corresponds to 4 transmissions, n8 corresponds to 8 transmissions and so on.
   DSR_TRANSMAX_t dsr_TransMax;
 } SCHEDULING_REQUEST_CONFIG;
 
+/// CQI-ReportPeriodic
 typedef struct {
-  /// Parameter n2pucch, see 36.213 (7.2)
+  /// Parameter: \f$n^{(2)}_\text{PUCCH}\f$, see TS 36.213 (7.2). \vr{[0..1185]}
   uint16_t cqi_PUCCH_ResourceIndex;
-  /// Parameter Icqi/pmi, see 36.213 (tables 7.2.2-1A and 7.2.2-1C)
+  /// Parameter: CQI/PMI Periodicity and Offset Configuration Index \f$I_\text{CQI/PMI}\f$, see TS 36.213 (tables 7.2.2-1A and 7.2.2-1C). \vr{[0..1023]}
   uint16_t cqi_PMI_ConfigIndex;
-  /// Parameter K from 36.213 (4.2.2)
+  /// Parameter: K, see 36.213 (4.2.2). \vr{[1..4]}
   uint8_t K;
-  /// Parameter IRI, 36.213 (7.2.2-1B)
+  /// Parameter: RI Config Index \f$I_\text{RI}\f$, see TS 36.213 (7.2.2-1B). \vr{[0..1023]}
   uint16_t ri_ConfigIndex;
-  /// Parameter simultaneousAckNackAndCQI
+  /// Parameter: Simultaneous-AN-and-CQI, see TS 36.213 (10.1). \vr{[0..1]} 1 indicates that simultaneous transmission of ACK/NACK and CQI is allowed.
   uint8_t simultaneousAckNackAndCQI;
 } CQI_REPORTPERIODIC;
 
- 
+/// Enumeration for parameter reporting mode \ref CQI_REPORT_CONFIG::cqi_ReportModeAperiodic.
+typedef enum {
+  rm12=0,
+  rm20=1,
+  rm22=2,
+  rm30=3,
+  rm31=4
+} CQI_REPORTMODEAPERIODIC;
+
+/// CQI-ReportConfig Information Element from 36.331 RRC spec
 typedef struct {
+  /// Parameter: reporting mode. Value rm12 corresponds to Mode 1-2, rm20 corresponds to Mode 2-0, rm22 corresponds to Mode 2-2 etc. PUSCH reporting modes are described in TS 36.213 [23, 7.2.1].
   CQI_REPORTMODEAPERIODIC cqi_ReportModeAperiodic;
+  /// Parameter: \f$\Delta_\text{offset}\f$, see TS 36.213 (7.2.3). \vr{[-1..6]}\n Actual value = IE value * 2 [dB].
   int8_t nomPDSCH_RS_EPRE_Offset;
   CQI_REPORTPERIODIC CQI_ReportPeriodic;
 } CQI_REPORT_CONFIG;
 
+/// MBSFN-SubframeConfig Information Element from 36.331 RRC spec \note deviates from specification.
 typedef struct {
+  /// MBSFN subframe occurance. \details Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used. \note the specification sais it is an enumerated value {n1, n2, n4, n8, n16, n32}.
   int radioframeAllocationPeriod;
+  /// MBSFN subframe occurance. \vr{[0..7]}\n Radio-frames that contain MBSFN subframes occur when equation SFN mod radioFrameAllocationPeriod = radioFrameAllocationOffset is satisfied. When fourFrames is used for subframeAllocation, the equation defines the first radio frame referred to in the description below. Values n1 and n2 are not applicable when fourFrames is used.
   int radioframeAllocationOffset;
+  /// oneFrame or fourFrames. \vr{[0..1]}
   int fourFrames_flag;
+  /// Subframe configuration. \vr{[0..63]} (\ref fourFrames_flag == 0) or \vr{[0..16777215]} (\ref fourFrames_flag == 1)
+  /// \par fourFrames_flag == 0
+  /// "1" denotes that the corresponding subframe is allocated for MBSFN. The following mapping applies:\n FDD: The first/leftmost bit defines the MBSFN allocation for subframe #1, the second bit for #2, third bit for #3 , fourth bit for #6, fifth bit for #7, sixth bit for #8.\n TDD: The first/leftmost bit defines the allocation for subframe #3, the second bit for #4, third bit for #7, fourth bit for #8, fifth bit for #9. Uplink subframes are not allocated. The last bit is not used.
+  /// \par fourFrames_flag == 1
+  /// A bit-map indicating MBSFN subframe allocation in four consecutive radio frames, "1" denotes that the corresponding subframe is allocated for MBSFN. The bitmap is interpreted as follows:\n FDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #1, #2, #3 , #6, #7, and #8 in the sequence of the four radio-frames.\n TDD: Starting from the first radioframe and from the first/leftmost bit in the bitmap, the allocation applies to subframes #3, #4, #7, #8, and #9 in the sequence of the four radio-frames. The last four bits are not used. Uplink subframes are not allocated.
   int mbsfn_SubframeConfig;
 } MBSFN_config_t;
 
@@ -505,7 +557,7 @@ typedef struct {
   UL_POWER_CONTROL_CONFIG_COMMON ul_power_control_config_common;
   /// Number of MBSFN Configurations
   int num_MBSFN_config;
-  /// Array of MBSFN Configurations (max 8 elements as per 36.331)
+  /// Array of MBSFN Configurations (max 8 (maxMBSFN-Allocations) elements as per 36.331)
   MBSFN_config_t MBSFN_config[8];
   /// Maximum Number of Retransmissions of RRCConnectionRequest (from 36-331 RRC Spec)
   uint8_t maxHARQ_Msg3Tx;
@@ -542,57 +594,133 @@ typedef enum {
 } MIMO_mode_t;
 
 typedef struct{
-  ///holds the transmit data in time domain (for IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER)
+  /// \brief Holds the transmit data in time 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..nb_antennas_tx[
+  /// - third index:
   int32_t **txdata[3];
-  ///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)
+  /// \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..nb_antennas_tx[
+  /// - third index: sample [0..]
   mod_sym_t **txdataF[3];    
-  ///holds the received data in time domain (should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER)
+  /// \brief Holds the received data in time domain.
+  /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna [0..nb_antennas_rx[
+  /// - third index: sample [0..]
   int32_t **rxdata[3];
-  ///holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset
+  /// \brief Holds the last subframe of received data in time domain after removal of 7.5kHz frequency offset.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna [0..nb_antennas_rx[
+  /// - third index: sample [0..samples_per_tti[
   int32_t **rxdata_7_5kHz[3];
-  ///holds the received data in the frequency domain
+  /// \brief Holds the received data in the frequency domain.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna [0..nb_antennas_rx[
+  /// - third index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
   int32_t **rxdataF[3];
-  /// holds output of the sync correlator
+  /// \brief Holds output of the sync correlator.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: sample [0..samples_per_tti*10[
   uint32_t *sync_corr[3];
 } LTE_eNB_COMMON;
 
 typedef struct{
-  /// hold the channel estimates in frequency domain based on SRS
+  /// \brief Hold the channel estimates in frequency domain based on SRS.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..ofdm_symbol_size[
   int32_t **srs_ch_estimates[3];
-  /// hold the channel estimates in time domain based on SRS
+  /// \brief Hold the channel estimates in time domain based on SRS.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..2*ofdm_symbol_size[
   int32_t **srs_ch_estimates_time[3];
-  /// holds the SRS for channel estimation at the RX    
+  /// \brief Holds the SRS for channel estimation at the RX.
+  /// - first index: ? [0..ofdm_symbol_size[
   int32_t *srs;
 } LTE_eNB_SRS;
 
 typedef struct{
-  ///holds the received data in the frequency domain for the allocated RBs in repeated format
+  /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..2*ofdm_symbol_size[
+  /// - third index (definition from phy_init_lte_eNB()): ? [0..24*N_RB_UL*frame_parms->symbols_per_tti[
+  /// \warning inconsistent third index definition
   int32_t **rxdataF_ext[3];
-  ///holds the received data in the frequency domain for the allocated RBs in normal format
+  /// \brief Holds the received data in the frequency domain for the allocated RBs in normal format.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index (definition from phy_init_lte_eNB()): ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **rxdataF_ext2[3];
-  /// hold the channel estimates in time domain based on DRS   
+  /// \brief Hold the channel estimates in time domain based on DRS.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..4*ofdm_symbol_size[
   int32_t **drs_ch_estimates_time[3];
-  /// hold the channel estimates in frequency domain based on DRS   
+  /// \brief Hold the channel estimates in frequency domain based on DRS.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **drs_ch_estimates[3];
-  /// hold the channel estimates for UE0 in case of Distributed Alamouti Scheme
+  /// \brief Hold the channel estimates for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **drs_ch_estimates_0[3];
-  /// hold the channel estimates for UE1 in case of Distributed Almouti Scheme 
+  /// \brief Hold the channel estimates for UE1 in case of Distributed Almouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **drs_ch_estimates_1[3];
-  /// holds the compensated signal
+  /// \brief Holds the compensated signal.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **rxdataF_comp[3];
-  /// hold the compensated data (y)*(h0*) in case of Distributed Alamouti Scheme
+  /// \brief Hold the compensated data (y)*(h0*) in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **rxdataF_comp_0[3];
-  /// hold the compensated data (y*)*(h1) in case of Distributed Alamouti Scheme
+  /// \brief Hold the compensated data (y*)*(h1) in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **rxdataF_comp_1[3];
+  /// \brief ?.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_mag[3];
+  /// \brief ?.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_magb[3];
-  /// hold the channel mag for UE0 in case of Distributed Alamouti Scheme
+  /// \brief Hold the channel mag for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_mag_0[3];
-  /// hold the channel magb for UE0 in case of Distributed Alamouti Scheme
+  /// \brief Hold the channel magb for UE0 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_magb_0[3];
-  /// hold the channel mag for UE1 in case of Distributed Alamouti Scheme
+  /// \brief Hold the channel mag for UE1 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_mag_1[3];
-  /// hold the channel magb for UE1 in case of Distributed Alamouti Scheme
+  /// \brief Hold the channel magb for UE1 in case of Distributed Alamouti Scheme.
+  /// - first index: eNB id [0..2] (hard coded)
+  /// - second index: rx antenna id [0..nb_antennas_rx[
+  /// - third index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[
   int32_t **ul_ch_magb_1[3];
   /// measured RX power based on DRS
   int ulsch_power[2];
@@ -600,7 +728,8 @@ typedef struct{
   int ulsch_power_0[2];
   /// measured RX power based on DRS for UE0 in case of Distributed Alamouti Scheme
   int ulsch_power_1[2];
-  /// llr values
+  /// \brief llr values.
+  /// - first index: ? [0..1179743] (hard coded)
   int16_t *llr;
 #ifdef LOCALIZATION
   /// number of active subcarrier for a specific UE
@@ -611,18 +740,38 @@ typedef struct{
 } LTE_eNB_PUSCH;
 
 typedef struct {
-  ///holds the transmit data in time domain (for IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER)
+  /// \brief Holds the transmit data in time domain.
+  /// For IFFT_FPGA this points to the same memory as PHY_vars->tx_vars[a].TX_DMA_BUFFER.
+  /// - first index: tx antenna [0..nb_antennas_tx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES[
   int32_t **txdata;
-  ///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)
-  mod_sym_t **txdataF;    
-  ///holds the received data in time domain (should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER)
+  /// \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: tx antenna [0..nb_antennas_tx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX[
+  mod_sym_t **txdataF;
+  /// \brief Holds the received data in time domain.
+  /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: sample [0..FRAME_LENGTH_COMPLEX_SAMPLES+2048[
   int32_t **rxdata;
-  ///holds the received data in the frequency domain
+  /// \brief Holds the received data in the frequency domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: symbol [0..28*ofdm_symbol_size[
   int32_t **rxdataF;
+  /// \brief ?.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..20*ofdm_symbol_size*symbols_per_tti[
   int32_t **rxdataF2;
-  /// hold the channel estimates in frequency domain
+  /// \brief Hold the channel estimates in frequency domain.
+  /// - first index: eNB id [0..6] (hard coded)
+  /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - third index: samples? [0..symbols_per_tti*(ofdm_symbol_size+LTE_CE_FILTER_LENGTH)[
   int32_t **dl_ch_estimates[7];
-  /// hold the channel estimates in time domain (used for tracking)
+  /// \brief Hold the channel estimates in time domain (used for tracking).
+  /// - first index: eNB id [0..6] (hard coded)
+  /// - second index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - third index: samples? [0..2*ofdm_symbol_size[
   int32_t **dl_ch_estimates_time[7];
   /// holds output of the sync correlator  
   int32_t *sync_corr;
@@ -633,39 +782,67 @@ typedef struct {
 } LTE_UE_COMMON;
 
 typedef struct {
-  /// Received frequency-domain signal after extraction
+  /// \brief Received frequency-domain signal after extraction.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **rxdataF_ext;
-  /// Received frequency-domain signal after extraction and channel compensation
+  /// \brief Received frequency-domain signal after extraction and channel compensation.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **rxdataF_comp0;
-  /// Received frequency-domain signal after extraction and channel compensation
+  /// \brief Received frequency-domain signal after extraction and channel compensation.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..7] (hard coded)
+  /// - third index: ? [0..168*N_RB_DL[
   int32_t **rxdataF_comp1[8];
-  /// Downlink channel estimates extracted in PRBS
+  /// \brief Downlink channel estimates extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_estimates_ext;
-  /// Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS
+  /// \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_rho_ext;
-  /// Downlink PMIs extracted in PRBS and grouped in subbands
+  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
+  /// - first index: ressource block [0..N_RB_DL[
   uint8_t *pmi_ext;
-  /// Magnitude of Downlink Channel first layer (16QAM level/First 64QAM level)
+  /// \brief Magnitude of Downlink Channel first layer (16QAM level/First 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_mag0;
-  /// Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level)
+  /// \brief Magnitude of Downlink Channel second layer (16QAM level/First 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_mag1;
-  /// Magnitude of Downlink Channel, first layer (2nd 64QAM level)
+  /// \brief Magnitude of Downlink Channel, first layer (2nd 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_magb0;
-  /// Magnitude of Downlink Channel second layer (2nd 64QAM level)
+  /// \brief Magnitude of Downlink Channel second layer (2nd 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_magb1;
-  /// Cross-correlation of two eNB signals
+  /// \brief Cross-correlation of two eNB signals.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: symbol [0..]
   int32_t **rho;
   /// never used... always send dl_ch_rho_ext instead...
   int32_t **rho_i;
-  /// Pointers to llr vectors (2 TBs)
+  /// \brief Pointers to llr vectors (2 TBs).
+  /// - first index: ? [0..1] (hard coded)
+  /// - second index: ? [0..1179743] (hard coded)
   int16_t *llr[2];
   /// \f$\log_2(\max|H_i|^2)\f$
   int16_t log2_maxh;
-  /// LLR shifts for subband scaling
+  /// \brief LLR shifts for subband scaling.
+  /// - first index: ? [0..168*N_RB_DL[
   uint8_t *llr_shifts;
-  /// Pointer to LLR shifts
+  /// \brief Pointer to LLR shifts.
+  /// - first index: ? [0..168*N_RB_DL[
   uint8_t *llr_shifts_p;
-  /// Pointers to llr vectors (128-bit alignment)
+  /// \brief Pointers to llr vectors (128-bit alignment).
+  /// - first index: ? [0..0] (hard coded)
+  /// - second index: ? [0..]
   int16_t **llr128;
   //uint32_t *rb_alloc;
   //uint8_t Qm[2];
@@ -673,29 +850,48 @@ typedef struct {
 } LTE_UE_PDSCH;
 
 typedef struct {
-  /// Received frequency-domain signal after extraction
+  /// \brief Received frequency-domain signal after extraction.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   int32_t **rxdataF_ext;
-  /// Received frequency-domain signal after extraction and channel compensation
+  /// \brief Received frequency-domain signal after extraction and channel compensation.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   double **rxdataF_comp;
-  /// Downlink channel estimates extracted in PRBS
+  /// \brief Downlink channel estimates extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   int32_t **dl_ch_estimates_ext;
-  /// Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS
+  ///  \brief Downlink cross-correlation of MIMO channel estimates (unquantized PMI) extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   double **dl_ch_rho_ext;
-  /// Downlink PMIs extracted in PRBS and grouped in subbands
+  /// \brief Downlink PMIs extracted in PRBS and grouped in subbands.
+  /// - first index: ressource block [0..N_RB_DL[
   uint8_t *pmi_ext;
-  /// Magnitude of Downlink Channel (16QAM level/First 64QAM level)
+  /// \brief Magnitude of Downlink Channel (16QAM level/First 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   double **dl_ch_mag;
-  /// Magnitude of Downlink Channel (2nd 64QAM level)
+  /// \brief Magnitude of Downlink Channel (2nd 64QAM level).
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..]
   double **dl_ch_magb;
-  /// Cross-correlation of two eNB signals
+  /// \brief Cross-correlation of two eNB signals.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..]
   double **rho;
   /// never used... always send dl_ch_rho_ext instead...
   double **rho_i;  
-  /// Pointers to llr vectors (2 TBs)
+  /// \brief Pointers to llr vectors (2 TBs).
+  /// - first index: ? [0..1] (hard coded)
+  /// - second index: ? [0..1179743] (hard coded)
   int16_t *llr[2];
   /// \f$\log_2(\max|H_i|^2)\f$
   uint8_t log2_maxh;
-  /// Pointers to llr vectors (128-bit alignment)
+  /// \brief Pointers to llr vectors (128-bit alignment).
+  /// - first index: ? [0..0] (hard coded)
+  /// - second index: ? [0..]
   int16_t **llr128;
   //uint32_t *rb_alloc;
   //uint8_t Qm[2];
@@ -703,23 +899,37 @@ typedef struct {
 } LTE_UE_PDSCH_FLP;
 
 typedef struct {
-  /// pointers to extracted PDCCH symbols in frequency-domain
+  /// \brief Pointers to extracted PDCCH symbols in frequency-domain.
+    /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+    /// - second index: ? [0..168*N_RB_DL[
   int32_t **rxdataF_ext;
-  /// pointers to extracted and compensated PDCCH symbols in frequency-domain
+  /// \brief Pointers to extracted and compensated PDCCH symbols in frequency-domain.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **rxdataF_comp;
-  /// pointers to extracted channel estimates of PDCCH symbols
+  /// \brief Pointers to extracted channel estimates of PDCCH symbols.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_estimates_ext;
-  /// pointers to channel cross-correlation vectors for multi-eNB detection
+  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..168*N_RB_DL[
   int32_t **dl_ch_rho_ext;
-  /// pointers to channel cross-correlation vectors for multi-eNB detection
+  /// \brief Pointers to channel cross-correlation vectors for multi-eNB detection.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..]
   int32_t **rho;
-  /// pointer to llrs, 4-bit resolution
+  /// \brief Pointer to llrs, 4-bit resolution.
+  /// - first index: ? [0..48*N_RB_DL[
   uint16_t *llr;
-  /// pointer to llrs, 16-bit resolution
+  /// \brief Pointer to llrs, 16-bit resolution.
+  /// - first index: ? [0..96*N_RB_DL[
   uint16_t *llr16;
-  /// \f$\overline{w}\f$ from 36-211
+  /// \brief \f$\overline{w}\f$ from 36-211.
+  /// - first index: ? [0..48*N_RB_DL[
   uint16_t *wbar;
-  /// PDCCH/DCI e-sequence (input to rate matching)
+  /// \brief PDCCH/DCI e-sequence (input to rate matching).
+  /// - first index: ? [0..96*N_RB_DL[
   int8_t *e_rx;
   /// number of PDCCH symbols in current subframe
   uint8_t num_pdcch_symbols;
@@ -745,23 +955,31 @@ typedef struct {
 } LTE_eNB_PBCH;
 
 typedef struct {
-  /// Pointers to extracted PBCH symbols in frequency-domain
+  /// \brief Pointers to extracted PBCH symbols in frequency-domain.
+  /// - first index: rx antenna [0..nb_antennas_rx[
+  /// - second index: ? [0..287] (hard coded)
   int32_t **rxdataF_ext;
-  /// Pointers to extracted and compensated PBCH symbols in frequency-domain
+  /// \brief Pointers to extracted and compensated PBCH symbols in frequency-domain.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..287] (hard coded)
   int32_t **rxdataF_comp;
-  /// Pointers to downlink channel estimates in frequency-domain extracted in PRBS
+  /// \brief Pointers to downlink channel estimates in frequency-domain extracted in PRBS.
+  /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx
+  /// - second index: ? [0..287] (hard coded)
   int32_t **dl_ch_estimates_ext;
-  /// Pointer to PBCH llrs
+  /// \brief Pointer to PBCH llrs.
+  /// - first index: ? [0..1919] (hard coded)
   int8_t *llr;
-  /// Pointer to PBCH decoded output
+  /// \brief Pointer to PBCH decoded output.
+  /// - first index: ? [0..63] (hard coded)
   uint8_t *decoded_output;
-  /// Total number of PDU errors
+  /// \brief Total number of PDU errors.
   uint32_t pdu_errors;
-  /// Total number of PDU errors 128 frames ago
+  /// \brief Total number of PDU errors 128 frames ago.
   uint32_t pdu_errors_last;
-  /// Total number of consecutive PDU errors
+  /// \brief Total number of consecutive PDU errors.
   uint32_t pdu_errors_conseq;
-  /// FER (in percent) 
+  /// \brief FER (in percent) .
   uint32_t pdu_fer;
 } LTE_UE_PBCH;
 
@@ -772,7 +990,12 @@ typedef struct {
 } LTE_UE_PRACH;
 
 typedef struct {
+  /// \brief ?.
+  /// first index: ? [0..1023] (hard coded)
   int16_t *prachF;
+  /// \brief ?.
+  /// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
+  /// second index: ? [0..ofdm_symbol_size*12[
   int16_t *rxsigF[4];
 } LTE_eNB_PRACH;
 
diff --git a/openair1/SIMULATION/LTE_PHY/Makefile b/openair1/SIMULATION/LTE_PHY/Makefile
index b8ef97a98a..ebed4a94ef 100644
--- a/openair1/SIMULATION/LTE_PHY/Makefile
+++ b/openair1/SIMULATION/LTE_PHY/Makefile
@@ -8,6 +8,8 @@ OPENAIR3 = $(OPENAIR3_DIR)
 
 CFLAGS += -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO -DLOG_NO_THREAD # -Wno-packed-bitfield-compat
 
+# enable C99 mode
+CFLAGS += -std=gnu99
 
 # DCI Debug
 # CFLAGS += -DDEBUG_DCI_ENCODING
@@ -122,7 +124,7 @@ ifdef STATIC
 LFLAGS += -static -L/usr/lib/libblas
 endif
 
-all: dlsim pbchsim pdcchsim ulsim pucchsim prachsim mbmssim
+all: dlsim pbchsim pdcchsim ulsim pucchsim prachsim mbmssim scansim
 
 $(LFDS_DIR)/bin/liblfds611.a:
 	$(MAKE) -C $(LFDS_DIR) -f makefile.linux
@@ -152,6 +154,10 @@ pbchsim : $(OBJ) pbchsim.c $(LFDS_DIR)/bin/liblfds611.a
 	@echo "Compiling pbchsim.c"
 	@$(CC) pbchsim.c  -o pbchsim $(CFLAGS) $(OBJ) $(LFLAGS) 
 
+scansim : $(OBJ) scansim.c $(LFDS_DIR)/bin/liblfds611.a
+	@echo "Compiling scansim.c"
+	@$(CC) scansim.c -o scansim $(CFLAGS) $(OBJ) $(LFLAGS)
+
 mbmssim : $(OBJ) mbmssim.c $(LFDS_DIR)/bin/liblfds611.a
 	@echo "Compiling mbmssim.c"
 	@$(CC) mbmssim.c  -o mbmssim $(CFLAGS) $(OBJ) $(LFLAGS) 
diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c
new file mode 100644
index 0000000000..4f08ee8362
--- /dev/null
+++ b/openair1/SIMULATION/LTE_PHY/scansim.c
@@ -0,0 +1,708 @@
+/*******************************************************************************
+    OpenAirInterface 
+    Copyright(c) 1999 - 2014 Eurecom
+
+    OpenAirInterface is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+
+    OpenAirInterface is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenAirInterface.The full GNU General Public License is 
+   included in this distribution in the file called "COPYING". If not, 
+   see <http://www.gnu.org/licenses/>.
+
+  Contact Information
+  OpenAirInterface Admin: openair_admin@eurecom.fr
+  OpenAirInterface Tech : openair_tech@eurecom.fr
+  OpenAirInterface Dev  : openair4g-devel@eurecom.fr
+  
+  Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
+
+*******************************************************************************/
+#include <string.h>
+#include <math.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include "SIMULATION/TOOLS/defs.h"
+#include "SIMULATION/RF/defs.h"
+#include "PHY/types.h"
+#include "PHY/defs.h"
+#include "PHY/vars.h"
+#include "MAC_INTERFACE/vars.h"
+
+#ifdef EMOS
+#include "SCHED/phy_procedures_emos.h"
+#endif
+#include "SCHED/defs.h"
+#include "SCHED/vars.h"
+#include "LAYER2/MAC/vars.h"
+
+#ifdef XFORMS
+#include "PHY/TOOLS/lte_phy_scope.h"
+#endif
+
+#include "OCG_vars.h"
+
+#define BW 20.0
+
+
+PHY_VARS_eNB *PHY_vars_eNb,*PHY_vars_eNb1,*PHY_vars_eNb2;
+PHY_VARS_UE *PHY_vars_UE;
+
+#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
+
+void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,unsigned char frame_type, uint16_t Nid_cell,uint8_t N_RB_DL,uint8_t osf) {
+
+  //  unsigned int ind;
+  LTE_DL_FRAME_PARMS *lte_frame_parms;
+  int i;
+
+  printf("Start lte_param_init\n");
+  PHY_vars_eNb = malloc(sizeof(PHY_VARS_eNB));
+  PHY_vars_eNb1 = malloc(sizeof(PHY_VARS_eNB));
+  PHY_vars_eNb2 = malloc(sizeof(PHY_VARS_eNB));
+
+  PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
+  //PHY_config = malloc(sizeof(PHY_CONFIG));
+  mac_xface = malloc(sizeof(MAC_xface));
+
+  randominit(0);
+  set_taus_seed(0);
+  
+  lte_frame_parms = &(PHY_vars_eNb->lte_frame_parms);
+
+  lte_frame_parms->N_RB_DL            = N_RB_DL;   //50 for 10MHz and 25 for 5 MHz
+  lte_frame_parms->N_RB_UL            = N_RB_DL;   
+  lte_frame_parms->Ncp                = extended_prefix_flag;
+  lte_frame_parms->Nid_cell           = Nid_cell;
+  lte_frame_parms->nushift            = Nid_cell%6;
+  lte_frame_parms->nb_antennas_tx     = N_tx;
+  lte_frame_parms->nb_antennas_tx_eNB = N_tx;
+  lte_frame_parms->nb_antennas_rx     = N_rx;
+  //  lte_frame_parms->Csrs = 2;
+  //  lte_frame_parms->Bsrs = 0;
+  //  lte_frame_parms->kTC = 0;
+  //  lte_frame_parms->n_RRC = 0;
+  lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
+  lte_frame_parms->tdd_config = 3;
+  lte_frame_parms->frame_type = frame_type;
+  init_frame_parms(lte_frame_parms,osf);
+  
+  //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
+  
+  phy_init_top(lte_frame_parms); //allocation
+  
+  lte_frame_parms->twiddle_fft      = twiddle_fft;
+  lte_frame_parms->twiddle_ifft     = twiddle_ifft;
+  lte_frame_parms->rev              = rev;
+  
+  PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
+
+  phy_init_lte_top(lte_frame_parms);
+
+  PHY_vars_UE->PHY_measurements.n_adj_cells=2;
+  PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
+  PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
+  for (i=0;i<3;i++)
+    lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);    
+
+  phy_init_lte_ue(PHY_vars_UE,1,0);
+
+  phy_init_lte_eNB(PHY_vars_eNb,0,0,0);
+
+  for (i=0;i<10;i++) {
+    PHY_vars_UE->scan_info[0].amp[0][i] = 0;
+    PHY_vars_UE->scan_info[0].amp[1][i] = 0;
+    PHY_vars_UE->scan_info[0].amp[2][i] = 0;
+  }
+  memcpy((void*)&PHY_vars_eNb1->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+  PHY_vars_eNb1->lte_frame_parms.Nid_cell=Nid_cell+1;
+  PHY_vars_eNb1->lte_frame_parms.nushift=(Nid_cell+1)%6;
+  PHY_vars_eNb1->Mod_id=1;
+
+  memcpy((void*)&PHY_vars_eNb2->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
+  PHY_vars_eNb2->lte_frame_parms.Nid_cell=Nid_cell+2;
+  PHY_vars_eNb2->lte_frame_parms.nushift=(Nid_cell+2)%6;
+  PHY_vars_eNb2->Mod_id=2;
+
+  phy_init_lte_eNB(PHY_vars_eNb1,0,0,0);
+ 
+  phy_init_lte_eNB(PHY_vars_eNb2,0,0,0);
+
+  phy_init_lte_top(lte_frame_parms);
+
+  printf("Done lte_param_init\n");
+
+
+}
+
+mod_sym_t *dummybuf[4];
+mod_sym_t dummy0[2048*14];
+mod_sym_t dummy1[2048*14];
+mod_sym_t dummy2[2048*14];
+mod_sym_t dummy3[2048*14];
+
+
+int main(int argc, char **argv) {
+
+  char c;
+
+  int i,l,aa;
+  double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
+  uint8_t snr1set=0;
+  //mod_sym_t **txdataF;
+  int **txdata,**txdata1,**txdata2;
+  double **s_re,**s_im,**s_re1,**s_im1,**s_re2,**s_im2,**r_re,**r_im,**r_re1,**r_im1,**r_re2,**r_im2;
+  double iqim = 0.0;
+  unsigned char pbch_pdu[6];
+  //  int sync_pos, sync_pos_slot;
+  //  FILE *rx_frame_file;
+  FILE *output_fd;
+  uint8_t write_output_file=0;
+  int result;
+  int freq_offset;
+  //  int subframe_offset;
+  //  char fname[40], vname[40];
+  int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
+  uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
+  uint16_t Nid_cell=0;
+
+  int n_frames=1;
+  channel_desc_t *eNB2UE,*eNB2UE1,*eNB2UE2;
+  uint32_t nsymb,tx_lev,tx_lev1,tx_lev2;
+  uint8_t extended_prefix_flag=0;
+  LTE_DL_FRAME_PARMS *frame_parms;
+#ifdef EMOS
+  fifo_dump_emos emos_dump;
+#endif
+
+  FILE *input_fd=NULL,*pbch_file_fd=NULL;
+  char input_val_str[50],input_val_str2[50];
+  //  double input_val1,input_val2;
+  //  uint16_t amask=0;
+  uint8_t frame_mod4,num_pdcch_symbols;
+  uint16_t NB_RB=25;
+
+  SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
+
+  DCI_ALLOC_t dci_alloc[8];
+  uint8_t abstraction_flag=0;//,calibration_flag=0;
+  int pbch_tx_ant;
+  uint8_t N_RB_DL=100,osf=1;
+
+  unsigned char frame_type = FDD;
+  unsigned char pbch_phase = 0;
+
+#ifdef XFORMS
+  FD_lte_phy_scope_ue *form_ue;
+  char title[255];
+#endif
+
+  logInit();
+  number_of_cards = 1;
+  openair_daq_vars.rx_rf_mode = 1;
+  
+  /*
+    rxdataF    = (int **)malloc16(2*sizeof(int*));
+    rxdataF[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
+    rxdataF[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
+    
+    rxdata    = (int **)malloc16(2*sizeof(int*));
+    rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
+    rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
+  */
+  while ((c = getopt (argc, argv, "f:hpf:g:n:s:S:t:x:y:z:N:F:GdP:")) != -1)
+    {
+      switch (c)
+	{
+	case 'f':
+	  write_output_file=1;
+	  output_fd = fopen(optarg,"w");
+	  if (output_fd==NULL) {
+	    printf("Error opening %s\n",optarg);
+	    exit(-1);
+	  }
+	  break;
+	case 'd':
+	  frame_type = TDD;
+	  break;
+	case 'g':
+	  switch((char)*optarg) {
+	  case 'A': 
+	    channel_model=SCM_A;
+	    break;
+	  case 'B': 
+	    channel_model=SCM_B;
+	    break;
+	  case 'C': 
+	    channel_model=SCM_C;
+	    break;
+	  case 'D': 
+	    channel_model=SCM_D;
+	    break;
+	  case 'E': 
+	    channel_model=EPA;
+	    break;
+	  case 'F': 
+	    channel_model=EVA;
+	    break;
+	  case 'G': 
+	    channel_model=ETU;
+	    break;
+	  default:
+	    msg("Unsupported channel model!\n");
+	    exit(-1);
+	  }
+	  break;
+	case 'n':
+	  n_frames = atoi(optarg);
+	  break;
+	case 's':
+	  snr0 = atof(optarg);
+	  msg("Setting SNR0 to %f\n",snr0);
+	  break;
+	case 'S':
+	  snr1 = atof(optarg);
+	  snr1set=1;
+	  msg("Setting SNR1 to %f\n",snr1);
+	  break;
+	  /*
+	    case 't':
+	    Td= atof(optarg);
+	    break;
+	  */
+	case 'p':
+	  extended_prefix_flag=1;
+	  break;
+	  /*
+	    case 'r':
+	    ricean_factor = pow(10,-.1*atof(optarg));
+	    if (ricean_factor>1) {
+	    printf("Ricean factor must be between 0 and 1\n");
+	    exit(-1);
+	    }
+	    break;
+	  */
+	case 'x':
+	  transmission_mode=atoi(optarg);
+	  if ((transmission_mode!=1) &&
+	      (transmission_mode!=2) &&
+	      (transmission_mode!=6)) {
+	    msg("Unsupported transmission mode %d\n",transmission_mode);
+	    exit(-1);
+	  }
+	  break;
+	case 'y':
+	  n_tx=atoi(optarg);
+	  if ((n_tx==0) || (n_tx>2)) {
+	    msg("Unsupported number of tx antennas %d\n",n_tx);
+	    exit(-1);
+	  }
+	  break;
+	case 'z':
+	  n_rx=atoi(optarg);
+	  if ((n_rx==0) || (n_rx>2)) {
+	    msg("Unsupported number of rx antennas %d\n",n_rx);
+	    exit(-1);
+	  }
+	  break;
+	case 'A':
+	  abstraction_flag=1;
+	  ntrials=10000;
+	  msg("Running Abstraction test\n");
+	  pbch_file_fd=fopen(optarg,"r");
+	  if (pbch_file_fd==NULL) {
+	    printf("Problem with filename %s\n",optarg);
+	    exit(-1);
+	  }
+	  break;
+	  //	case 'C':
+	  //	  calibration_flag=1;
+	  //	  msg("Running Abstraction calibration for Bias removal\n");
+	  //	  break;
+	case 'N':
+	  Nid_cell = atoi(optarg);
+	  break;
+	case 'F':
+	  input_fd = fopen(optarg,"r");
+	  if (input_fd==NULL) {
+	    printf("Problem with filename %s\n",optarg);
+	    exit(-1);
+	  }
+	  break;
+	case 'P':
+	  pbch_phase = atoi(optarg);
+	  if (pbch_phase>3)
+	    printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
+	  break;
+	default:
+	case 'h':
+	  printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",argv[0]);
+	  printf("-h This message\n");
+	  printf("-p Use extended prefix mode\n");
+	  printf("-d Use TDD\n");
+	  printf("-n Number of frames to simulate\n");
+	  printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB.  If n_frames is 1 then just SNR is simulated\n");
+	  printf("-S Ending SNR, runs from SNR0 to SNR1\n");
+	  printf("-t Delay spread for multipath channel\n");
+	  printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
+	  printf("-x Transmission mode (1,2,6 for the moment)\n");
+	  printf("-y Number of TX antennas used in eNB\n");
+	  printf("-z Number of RX antennas used in UE\n");
+	  printf("-N Nid_cell\n");
+	  printf("-f Output filename (.txt format) for Pe/SNR results\n");
+	  printf("-F Input filename (.txt format) for RX conformance testing\n");
+	  exit (-1);
+	  break;
+	}
+    }
+
+  if (transmission_mode>=2)
+    n_tx=2;
+
+  lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,N_RB_DL,osf);
+
+#ifdef XFORMS
+  fl_initialize (&argc, argv, NULL, 0, 0);
+  form_ue = create_lte_phy_scope_ue();
+  sprintf (title, "LTE PHY SCOPE UE");
+  fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);  
+#endif
+
+  if (snr1set==0) {
+    if (n_frames==1)
+      snr1 = snr0+.1;
+    else
+      snr1 = snr0+5.0;
+  }
+
+  printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
+
+  frame_parms = &PHY_vars_eNb->lte_frame_parms;
+
+
+
+  txdata = PHY_vars_eNb->lte_eNB_common_vars.txdata[0];
+  txdata1 = PHY_vars_eNb1->lte_eNB_common_vars.txdata[0];
+  txdata2 = PHY_vars_eNb2->lte_eNB_common_vars.txdata[0];
+
+  
+  s_re = malloc(2*sizeof(double*));
+  s_im = malloc(2*sizeof(double*));
+  s_re1 = malloc(2*sizeof(double*));
+  s_im1 = malloc(2*sizeof(double*));
+  s_re2 = malloc(2*sizeof(double*));
+  s_im2 = malloc(2*sizeof(double*));
+  r_re = malloc(2*sizeof(double*));
+  r_im = malloc(2*sizeof(double*));
+  r_re1 = malloc(2*sizeof(double*));
+  r_im1 = malloc(2*sizeof(double*));
+  r_re2 = malloc(2*sizeof(double*));
+  r_im2 = malloc(2*sizeof(double*));
+
+  nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
+
+  printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
+	 frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
+
+  printf("PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
+	 PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0]);
+
+
+  DLSCH_alloc_pdu2.rah              = 0;
+  DLSCH_alloc_pdu2.rballoc          = DLSCH_RB_ALLOC;
+  DLSCH_alloc_pdu2.TPC              = 0;
+  DLSCH_alloc_pdu2.dai              = 0;
+  DLSCH_alloc_pdu2.harq_pid         = 0;
+  DLSCH_alloc_pdu2.tb_swap          = 0;
+  DLSCH_alloc_pdu2.mcs1             = 0;  
+  DLSCH_alloc_pdu2.ndi1             = 1;
+  DLSCH_alloc_pdu2.rv1              = 0;
+  // Forget second codeword
+  DLSCH_alloc_pdu2.tpmi             = (transmission_mode==6 ? 5 : 0) ;  // precoding
+
+  eNB2UE = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
+				PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
+				channel_model,
+				BW,
+				0,
+				0,
+				0);
+
+
+  if (eNB2UE==NULL) {
+    msg("Problem generating channel model. Exiting.\n");
+    exit(-1);
+  }
+
+  for (i=0;i<2;i++) {
+
+    s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    s_re1[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_re1[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    s_im1[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_im1[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));    
+    s_re2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+
+    r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_re1[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_re1[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_im1[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_im1[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_re2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+  }
+  pbch_pdu[0]=100;
+  pbch_pdu[1]=1;
+  pbch_pdu[2]=0;
+  
+  if (PHY_vars_eNb->lte_frame_parms.frame_type == FDD) {
+    generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==NORMAL) ? 6 : 5,
+		 0);
+    generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
+		 0);
+    generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
+		 10);
+    generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
+		 10);
+    
+  }
+  else {
+    generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
+		 1);
+    generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 2,
+		 2);
+    generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 (PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
+		 11);
+    generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		 AMP,
+		 &PHY_vars_eNb->lte_frame_parms,
+		 2,
+		 12);
+    
+    
+  }
+  
+  
+  /*
+  generate_pilots(PHY_vars_eNb,
+		  PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		  AMP,
+		  LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
+  
+  
+   
+     num_pdcch_symbols = generate_dci_top(1,
+     0,
+     dci_alloc,
+     0,
+     1024,
+     &PHY_vars_eNb->lte_frame_parms,
+     PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+     0);
+  */
+  
+  /*  
+  if (num_pdcch_symbols<3) {
+    printf("Less than 3 pdcch symbols\n");
+    //  exit(-1);
+  }
+  
+  if (pbch_phase>0) {
+    dummybuf[0] = dummy0;
+    dummybuf[1] = dummy1;
+    dummybuf[2] = dummy2;
+    dummybuf[3] = dummy3;
+    generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
+		  (mod_sym_t**)dummybuf,
+		  AMP,
+		  &PHY_vars_eNb->lte_frame_parms,
+		  pbch_pdu,
+		  0);
+  }
+  
+  generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
+		PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
+		AMP,
+		&PHY_vars_eNb->lte_frame_parms,
+		pbch_pdu,
+		pbch_phase);
+  */
+  write_output("txsigF0.m","txsF0", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
+  if (PHY_vars_eNb->lte_frame_parms.nb_antennas_tx>1)
+    write_output("txsigF1.m","txsF1", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
+    
+  tx_lev = 0;
+  tx_lev1 = 0;
+  tx_lev2 = 0;
+
+    
+    
+    
+  for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx; aa++) {
+    if (frame_parms->Ncp == 1) 
+      PHY_ofdm_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa],        // input,
+		   txdata[aa],         // output
+		   frame_parms->log2_symbol_size,                // log2_fft_size
+		   LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb,                 // number of symbols
+		   frame_parms->nb_prefix_samples,               // number of prefix samples
+		   frame_parms->twiddle_ifft,  // IFFT twiddle factors
+		   frame_parms->rev,           // bit-reversal permutation
+		   CYCLIC_PREFIX);
+    else {
+      normal_prefix_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa],
+			txdata[aa],
+			LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb,
+			frame_parms);
+    }
+      
+    tx_lev += signal_energy(&txdata[aa][frame_parms->samples_per_tti/2],
+			    OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
+  }
+
+    
+  write_output("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
+  if (frame_parms->nb_antennas_tx>1)
+    write_output("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
+
+  // multipath channel
+  
+  for (i=0;i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES;i++) {
+    for (aa=0;aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx;aa++) {
+      s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
+      s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
+    }
+  }
+
+
+  for (SNR=snr0;SNR<snr1;SNR+=.2) {
+
+
+    n_errors = 0;
+    n_errors2 = 0;
+    n_alamouti = 0;
+    for (trial=0; trial<n_frames; trial++) {
+
+      multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
+			  2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
+      
+      sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNb->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
+      if (n_frames==1)
+	printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f,%f,%f\n",sigma2_dB,SNR,
+	       10*log10((double)tx_lev),
+	       10*log10((double)tx_lev1),
+	       10*log10((double)tx_lev2));
+      //AWGN
+      sigma2 = pow(10,sigma2_dB/10);
+        
+      /*    
+	    if (n_frames==1) {
+	    printf("rx_level data symbol %f, tx_lev %f\n",
+	    10*log10(signal_energy_fp(r_re,r_im,1,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0)),
+	    10*log10(tx_lev));
+	    }
+      */
+      
+      for (n_trials=0;n_trials<ntrials;n_trials++) {
+	//printf("n_trial %d\n",n_trials);
+	for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
+	  for (aa=0;aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_rx;aa++) {
+	    ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+	    ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+	  }
+	}    
+
+	lte_sync_timefreq(PHY_vars_UE,0,2680000000);
+
+	if (n_frames==1) {
+	  printf("rx_level data symbol %f\n",
+		 10*log10(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
+	}
+	
+
+      } //noise trials
+    } // trials
+    if (abstraction_flag==0) {
+      printf("SNR %f : n_errors2 = %d/%d (BLER %e,40ms BLER %e,%d,%d), n_alamouti %d\n", SNR,n_errors2,ntrials*(1+trial),(double)n_errors2/(ntrials*(1+trial)),pow((double)n_errors2/(ntrials*(1+trial)),4),ntrials,trial,n_alamouti);
+      if (write_output_file==1)
+	fprintf(output_fd,"%f %e\n",SNR,(double)n_errors2/(ntrials*(1+trial)));
+    }
+  } // NSR
+
+  if (n_frames==1) {
+
+  }
+
+
+  for (i=0;i<2;i++) {
+    free(s_re[i]);
+    free(s_im[i]);
+    free(r_re[i]);
+    free(r_im[i]);
+  }
+  free(s_re);
+  free(s_im);
+  free(r_re);
+  free(r_im);
+
+
+  lte_sync_time_free();
+
+  if (write_output_file)
+    fclose(output_fd);
+
+  return(n_errors);
+
+}
+   
+
+
+/*  
+    for (i=1;i<4;i++)
+    memcpy((void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[i*12*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*2],
+    (void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[0],
+    12*OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX*2);
+*/
+
diff --git a/openair1/SIMULATION/TOOLS/defs.h b/openair1/SIMULATION/TOOLS/defs.h
index 1aa943041d..af1b3a81a2 100644
--- a/openair1/SIMULATION/TOOLS/defs.h
+++ b/openair1/SIMULATION/TOOLS/defs.h
@@ -281,11 +281,11 @@ void load_pbch_desc(FILE *pbch_file_fd);
  * @defgroup _taus_ Tausworthe Uniform Random Variable Generator
  * @ingroup _numerical_ 
  * @{
-\fn inline unsigned int taus()
+\fn unsigned int taus()
 \brief Tausworthe Uniform Random Generator.  This is based on the hardware implementation described in 
   Lee et al, "A Hardware Gaussian Noise Generator Usign the Box-Muller Method and its Error Analysis," IEEE Trans. on Computers, 2006.
 */
-inline unsigned int taus(void);
+unsigned int taus(void);
 
 
 /** 
diff --git a/openair1/SIMULATION/TOOLS/taus.c b/openair1/SIMULATION/TOOLS/taus.c
index 628b1f0c85..54323ebfd0 100644
--- a/openair1/SIMULATION/TOOLS/taus.c
+++ b/openair1/SIMULATION/TOOLS/taus.c
@@ -47,7 +47,7 @@ unsigned int s0, s1, s2, b;
 */
 //
 
-inline unsigned int taus(void) {
+unsigned int taus(void) {
 
   b = (((s0 << 13) ^ s0) >> 19);
   s0 = (((s0 & 0xFFFFFFFE) << 12)^  b);
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
index dbf0e79a82..16a5a8b117 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c
@@ -855,7 +855,7 @@ rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_enti
     return rlc_pP->dar_buffer[snP];
 }
 //-----------------------------------------------------------------------------
-inline void
+static inline void
 rlc_um_store_pdu_in_dar_buffer(
                 const protocol_ctxt_t* const ctxt_pP,
                 rlc_um_entity_t * const rlc_pP,
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
index 63ef77fbd2..fd6f9e5852 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.h
@@ -154,7 +154,7 @@ private_rlc_um_dar(  mem_block_t *rlc_um_remove_pdu_from_dar_buffer(const protoc
 * \param[in]  snP           Sequence number.
 * \return     The PDU stored in the DAR buffer having sequence number snP, else return NULL.
 */
-protected_rlc_um_dar(  inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP));
+protected_rlc_um_dar(mem_block_t* rlc_um_get_pdu_from_dar_buffer(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const uint16_t snP));
 
 /*! \fn signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,rlc_sn_t lower_boundP, rlc_sn_t snP, rlc_sn_t higher_boundP)
 * \brief    Compute if the sequence number of a PDU is in a window .
@@ -165,7 +165,7 @@ protected_rlc_um_dar(  inline mem_block_t* rlc_um_get_pdu_from_dar_buffer(const
 * \param[in]  higher_boundP  Higher bound of a window.
 * \return     -2 if lower_boundP  > sn, -1 if higher_boundP < sn, 0 if lower_boundP  < sn < higher_boundP, 1 if lower_boundP  == sn, 2 if higher_boundP == sn, 3 if higher_boundP == sn == lower_boundP.
 */
-protected_rlc_um_dar(inline signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP));
+protected_rlc_um_dar(signed int rlc_um_in_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t lower_boundP, const rlc_sn_t snP, const rlc_sn_t higher_boundP));
 
 /*! \fn signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const rlc_sn_t snP)
 * \brief    Compute if the sequence number of a PDU is in a window .
@@ -174,7 +174,7 @@ protected_rlc_um_dar(inline signed int rlc_um_in_window(const protocol_ctxt_t* c
 * \param[in]  snP            Sequence number of a theorical PDU.
 * \return     0 if snP is in reordering window, else -1.
 */
-protected_rlc_um_dar(inline signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,  const rlc_sn_t snP));
+protected_rlc_um_dar(signed int rlc_um_in_reordering_window(const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP,  const rlc_sn_t snP));
 
 /*! \fn void rlc_um_receive_process_dar (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, mem_block_t *pdu_mem_pP,rlc_um_pdu_sn_10_t * const pdu_pP, const sdu_size_t tb_sizeP)
 * \brief    Apply the DAR process for a PDU: put it in DAR buffer and try to reassembly or discard it.
diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c
index 512b695cc8..8c1d0a388a 100644
--- a/openair2/RRC/LITE/rrc_common.c
+++ b/openair2/RRC/LITE/rrc_common.c
@@ -222,9 +222,9 @@ void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_a
 
     // fill UE capability
     UECap = fill_ue_capability (uecap_xer);
-    UE_rrc_inst[module_id].UECap = UECap;
 
     for (module_id = 0; module_id < NB_UE_INST; module_id++) {
+      UE_rrc_inst[module_id].UECap = UECap;
       UE_rrc_inst[module_id].UECapability = UECap->sdu;
       UE_rrc_inst[module_id].UECapability_size = UECap->sdu_size;
     }
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c
index 7b82de1dbc..6e3d494daa 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c
+++ b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c
@@ -37,12 +37,12 @@ unsigned int MIH_C_BITMAP82String(MIH_C_BITMAP8_T* dataP, char* bufP) {
     return sprintf(bufP, "0x%02X", *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP) {
+void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP) {
     printf("[MIH_C] %s: %02X\n", __FUNCTION__, *dataP);
     BitBuffer_write8(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP) {
+void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP) {
     printf("[MIH_C] %s: %04X\n", __FUNCTION__, *dataP);
     BitBuffer_write16(bbP, *dataP);
 }
@@ -52,7 +52,7 @@ unsigned int MIH_C_BITMAP162String(MIH_C_BITMAP16_T* dataP, char* bufP) {
     return sprintf(bufP, "0x%04X", *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP) {
+void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP) {
 //-----------------------------------------------------------------------------
     printf("[MIH_C] %s: %02X%02X%02X\n", __FUNCTION__, dataP->val[0],dataP->val[1], dataP->val[2]);
     MIH_C_BITMAP8_encode(bbP, &dataP->val[0]);
@@ -65,26 +65,26 @@ unsigned int MIH_C_BITMAP242String(MIH_C_BITMAP24_T* dataP, char* bufP) {
     return sprintf(bufP, "0x%02X%02X%02X", dataP->val[0], dataP->val[1], dataP->val[2]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP) {
+void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP) {
     printf("[MIH_C] %s: %08X\n", __FUNCTION__, *dataP);
     BitBuffer_write32(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP) {
+void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP) {
 //-----------------------------------------------------------------------------
     printf("[MIH_C] %s: %16X\n", __FUNCTION__, *dataP);
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)*dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP) {
+void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP) {
 //-----------------------------------------------------------------------------
     printf("[MIH_C] %s: %16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1]);
     MIH_C_BITMAP64_encode(bbP, &dataP->val[0]);
     MIH_C_BITMAP64_encode(bbP, &dataP->val[1]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP) {
+void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP) {
 //-----------------------------------------------------------------------------
     printf("[MIH_C] %s: %16X%16X%16X%16X\n", __FUNCTION__, dataP->val[0], dataP->val[1], dataP->val[2], dataP->val[3]);
     MIH_C_BITMAP64_encode(bbP, &dataP->val[0]);
@@ -93,40 +93,40 @@ inline void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP)
     MIH_C_BITMAP64_encode(bbP, &dataP->val[3]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_CHOICE_encode(Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP) {
+void MIH_C_CHOICE_encode(Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write8(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER1_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP) {
+void MIH_C_INTEGER1_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write8(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER2_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP) {
+void MIH_C_INTEGER2_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write16(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER4_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP) {
+void MIH_C_INTEGER4_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write32(bbP, *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER8_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP) {
+void MIH_C_INTEGER8_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)*dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_NULL_encode(Bit_Buffer_t* bbP, MIH_C_NULL_T* dataP) {;}
+void MIH_C_NULL_encode(Bit_Buffer_t* bbP, MIH_C_NULL_T* dataP) {;}
 //-----------------------------------------------------------------------------
-inline void MIH_C_OCTET_encode(Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP) {
+void MIH_C_OCTET_encode(Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP) {
 //-----------------------------------------------------------------------------
     BitBuffer_writeMem(bbP, dataP->val, lengthP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP) {
+void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP) {
     printf("[MIH_C] %s: %02X\n", __FUNCTION__, *dataP);
     BitBuffer_write8(bbP, *dataP);
 }
@@ -136,7 +136,7 @@ unsigned int MIH_C_UNSIGNED_INT12String(MIH_C_UNSIGNED_INT1_T* dataP, char* bufP
     return sprintf(bufP, "0x%02X", *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP) {
+void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write16(bbP, *dataP);
 }
@@ -146,7 +146,7 @@ unsigned int MIH_C_UNSIGNED_INT22String(MIH_C_UNSIGNED_INT2_T* dataP, char* bufP
     return sprintf(bufP, "0x%04X", *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP) {
+void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write32(bbP, *dataP);
 }
@@ -156,7 +156,7 @@ unsigned int MIH_C_UNSIGNED_INT42String(MIH_C_UNSIGNED_INT4_T* dataP, char* bufP
     return sprintf(bufP, "0x%08X", *dataP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP) {
+void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP) {
 //-----------------------------------------------------------------------------
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));
     BitBuffer_write32(bbP, (MIH_C_UNSIGNED_INT4_T)*dataP);
@@ -170,33 +170,33 @@ unsigned int MIH_C_UNSIGNED_INT82String(MIH_C_UNSIGNED_INT8_T* dataP, char* bufP
     return buffer_index;\
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP) {*dataP = BitBuffer_read(bbP, 8);}
+void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP) {*dataP = BitBuffer_read(bbP, 8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP16_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP) {*dataP = BitBuffer_read(bbP, 16);}
+void MIH_C_BITMAP16_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP) {*dataP = BitBuffer_read(bbP, 16);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP24_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP) {
+void MIH_C_BITMAP24_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_BITMAP8_decode(bbP, &dataP->val[0]);
     MIH_C_BITMAP8_decode(bbP, &dataP->val[1]);
     MIH_C_BITMAP8_decode(bbP, &dataP->val[2]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP32_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP) {*dataP = BitBuffer_read(bbP, 32);}
+void MIH_C_BITMAP32_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP) {*dataP = BitBuffer_read(bbP, 32);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP64_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP) {
+void MIH_C_BITMAP64_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP) {
 //-----------------------------------------------------------------------------
     *dataP = BitBuffer_read(bbP, 32);
     *dataP = *dataP << 32;
     *dataP = *dataP | BitBuffer_read(bbP, 32);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP128_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP) {
+void MIH_C_BITMAP128_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_BITMAP64_decode(bbP, &dataP->val[0]);
     MIH_C_BITMAP64_decode(bbP, &dataP->val[1]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP) {
+void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_BITMAP64_decode(bbP, &dataP->val[0]);
     MIH_C_BITMAP64_decode(bbP, &dataP->val[1]);
@@ -204,42 +204,42 @@ inline void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP)
     MIH_C_BITMAP64_decode(bbP, &dataP->val[3]);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_CHOICE_decode(Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_CHOICE_T)*8);}
+void MIH_C_CHOICE_decode(Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_CHOICE_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER1_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER1_T)*8);}
+void MIH_C_INTEGER1_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER1_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER2_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER2_T)*8);}
+void MIH_C_INTEGER2_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER2_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER4_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER4_T)*8);}
+void MIH_C_INTEGER4_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER4_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_INTEGER8_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP) {
+void MIH_C_INTEGER8_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP) {
 //-----------------------------------------------------------------------------
     *dataP = BitBuffer_read(bbP, sizeof(MIH_C_INTEGER4_T)*8);
     *dataP = *dataP << (sizeof(MIH_C_INTEGER4_T)*8);
     *dataP = *dataP | BitBuffer_read(bbP, sizeof(MIH_C_INTEGER4_T)*8);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_NULL_decode(Bit_Buffer_t* bbP) {;}
+void MIH_C_NULL_decode(Bit_Buffer_t* bbP) {;}
 //-----------------------------------------------------------------------------
-inline void MIH_C_OCTET_decode(Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP) {
+void MIH_C_OCTET_decode(Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP) {
 //-----------------------------------------------------------------------------
     BitBuffer_readMem(bbP, dataP->val, lengthP);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT1_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT1_T)*8);}
+void MIH_C_UNSIGNED_INT1_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT1_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT2_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT2_T)*8);}
+void MIH_C_UNSIGNED_INT2_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT2_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT4_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT4_T)*8);}
+void MIH_C_UNSIGNED_INT4_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP) {*dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT4_T)*8);}
 //-----------------------------------------------------------------------------
-inline void MIH_C_UNSIGNED_INT8_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP) {
+void MIH_C_UNSIGNED_INT8_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP) {
 //-----------------------------------------------------------------------------
     *dataP = BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT4_T)*8);
     *dataP = *dataP << 32;
     *dataP = *dataP | BitBuffer_read(bbP, sizeof(MIH_C_UNSIGNED_INT4_T)*8);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LIST_LENGTH_encode(Bit_Buffer_t* bbP, u_int16_t lengthP) {
+void MIH_C_LIST_LENGTH_encode(Bit_Buffer_t* bbP, u_int16_t lengthP) {
 //-----------------------------------------------------------------------------
     unsigned int num_more_bytes;
     int          length;
@@ -268,7 +268,7 @@ inline void MIH_C_LIST_LENGTH_encode(Bit_Buffer_t* bbP, u_int16_t lengthP) {
     }
 }
 //-----------------------------------------------------------------------------
-inline u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP) {
+u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP) {
 //-----------------------------------------------------------------------------
     unsigned int num_more_bytes;
     if (lengthP <= 128) {
@@ -283,7 +283,7 @@ inline u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP) {
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LIST_LENGTH_decode(Bit_Buffer_t* bbP, u_int16_t *lengthP) {
+void MIH_C_LIST_LENGTH_decode(Bit_Buffer_t* bbP, u_int16_t *lengthP) {
 //-----------------------------------------------------------------------------
     unsigned int              num_more_bytes;
     MIH_C_UNSIGNED_INT1_T     byte1;
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c
index ab68d45a4b..7bc05c5ba4 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c
+++ b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c
@@ -44,14 +44,14 @@ unsigned int  MIH_C_3GPP_2G_CELL_ID2String(MIH_C_3GPP_2G_CELL_ID_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_3GPP_2G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP) {
+void MIH_C_3GPP_2G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_PLMN_ID_encode(bbP, &dataP->plmn_id);
     MIH_C_LAC_encode(bbP, &dataP->lac);
     MIH_C_CI_encode(bbP, &dataP->ci);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_3GPP_2G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP) {
+void MIH_C_3GPP_2G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_PLMN_ID_decode(bbP, &dataP->plmn_id);
     MIH_C_LAC_decode(bbP, &dataP->lac);
@@ -66,13 +66,13 @@ unsigned int  MIH_C_3GPP_3G_CELL_ID2String(MIH_C_3GPP_3G_CELL_ID_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_3GPP_3G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP) {
+void MIH_C_3GPP_3G_CELL_ID_encode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_PLMN_ID_encode(bbP, &dataP->plmn_id);
     MIH_C_CELL_ID_encode(bbP, &dataP->cell_id);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_3GPP_3G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP) {
+void MIH_C_3GPP_3G_CELL_ID_decode(Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_PLMN_ID_decode(bbP, &dataP->plmn_id);
     MIH_C_CELL_ID_decode(bbP, &dataP->cell_id);
@@ -112,7 +112,7 @@ unsigned int MIH_C_LINK_ADDR2String(MIH_C_LINK_ADDR_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ADDR_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP) {
+void MIH_C_LINK_ADDR_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -139,7 +139,7 @@ inline void MIH_C_LINK_ADDR_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP)
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ADDR_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP) {
+void MIH_C_LINK_ADDR_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c
index 4e1a65665b..82fe02c802 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c
+++ b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c
@@ -56,7 +56,7 @@ unsigned int MIH_C_OPMODE2String2(MIH_C_OPMODE_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP) {
+void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -71,7 +71,7 @@ inline void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_DEV_STATE_RSP_decode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP) {
+void MIH_C_DEV_STATE_RSP_decode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -149,13 +149,13 @@ unsigned int MIH_C_LINK_ID2String(MIH_C_LINK_ID_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP) {
+void MIH_C_LINK_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_TYPE_encode(bbP, &dataP->link_type);
     MIH_C_LINK_ADDR_encode(bbP, &dataP->link_addr);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP) {
+void MIH_C_LINK_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_TYPE_decode(bbP, &dataP->link_type);
     MIH_C_LINK_ADDR_decode(bbP, &dataP->link_addr);
@@ -206,7 +206,7 @@ unsigned int MIH_C_LINK_AC_TYPE2String2(MIH_C_LINK_AC_TYPE_T *dataP, char* bufP)
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
+void MIH_C_LINK_ACTION_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_AC_TYPE_encode(bbP, &dataP->link_ac_type);
     MIH_C_LINK_AC_ATTR_encode(bbP, &dataP->link_ac_attr);
@@ -215,7 +215,7 @@ inline void MIH_C_LINK_ACTION_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dat
 #endif
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
+void MIH_C_LINK_ACTION_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_AC_TYPE_decode(bbP, &dataP->link_ac_type);
     MIH_C_LINK_AC_ATTR_decode(bbP, &dataP->link_ac_attr);
@@ -226,7 +226,7 @@ inline void MIH_C_LINK_ACTION_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dat
 
 //-----------------------------------------------------------------------------
 // MW Function to bypass ODTONE problem
-inline void MIH_C_LINK_ACTION_short_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
+void MIH_C_LINK_ACTION_short_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_AC_TYPE_decode(bbP, &dataP->link_ac_type);
     MIH_C_LINK_AC_ATTR_decode(bbP, &dataP->link_ac_attr);
@@ -236,7 +236,7 @@ inline void MIH_C_LINK_ACTION_short_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_
 }
 
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP) {
+void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_encode(bbP, &dataP->link_id);
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
@@ -253,7 +253,7 @@ inline void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RE
     MIH_C_LINK_AC_EX_TIME_encode(bbP, &dataP->link_action_ex_time);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP) {
+void MIH_C_LINK_ACTION_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_decode(bbP, &dataP->link_id);
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
@@ -286,7 +286,7 @@ unsigned int MIH_C_SIG_STRENGTH2String(MIH_C_SIG_STRENGTH_T *dataP, char* bufP)
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP) {
+void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -301,7 +301,7 @@ inline void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *d
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_SIG_STRENGTH_decode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP) {
+void MIH_C_SIG_STRENGTH_decode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -329,14 +329,14 @@ unsigned int MIH_C_LINK_SCAN_RSP2String(MIH_C_LINK_SCAN_RSP_T *dataP, char* bufP
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_SCAN_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP) {
+void MIH_C_LINK_SCAN_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ADDR_encode(bbP, &dataP->link_addr);
     MIH_C_NETWORK_ID_encode(bbP, &dataP->network_id);
     MIH_C_SIG_STRENGTH_encode(bbP, &dataP->sig_strength);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_SCAN_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP) {
+void MIH_C_LINK_SCAN_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ADDR_decode(bbP, &dataP->link_addr);
     MIH_C_NETWORK_ID_decode(bbP, &dataP->network_id);
@@ -344,7 +344,7 @@ inline void MIH_C_LINK_SCAN_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T
 }
 
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP) {
+void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_encode(bbP, &dataP->link_id);
     MIH_C_LINK_AC_RESULT_encode(bbP, &dataP->link_ac_result);
@@ -360,7 +360,7 @@ inline void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RS
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_ACTION_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP) {
+void MIH_C_LINK_ACTION_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_decode(bbP, &dataP->link_id);
     MIH_C_LINK_AC_RESULT_decode(bbP, &dataP->link_ac_result);
@@ -386,13 +386,13 @@ unsigned int MIH_C_THRESHOLD2String(MIH_C_THRESHOLD_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_THRESHOLD_encode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP) {
+void MIH_C_THRESHOLD_encode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_THRESHOLD_VAL_encode(bbP, &dataP->threshold_val);
     MIH_C_THRESHOLD_XDIR_encode(bbP, &dataP->threshold_xdir);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_THRESHOLD_decode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP) {
+void MIH_C_THRESHOLD_decode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_THRESHOLD_VAL_decode(bbP, &dataP->threshold_val);
     MIH_C_THRESHOLD_XDIR_decode(bbP, &dataP->threshold_xdir);
@@ -424,7 +424,7 @@ unsigned int MIH_C_LINK_PARAM_TYPE2String( MIH_C_LINK_PARAM_TYPE_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP) {
+void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -446,7 +446,7 @@ inline void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYP
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_TYPE_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP) {
+void MIH_C_LINK_PARAM_TYPE_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -500,7 +500,7 @@ unsigned int MIH_C_LINK_CFG_PARAM2String(MIH_C_LINK_CFG_PARAM_T *dataP, char* bu
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP) {
+void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_encode(bbP, &dataP->link_param_type);
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
@@ -522,7 +522,7 @@ inline void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_
     MIH_C_THRESHOLD_LIST_encode(bbP, &dataP->threshold_list);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_CFG_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP) {
+void MIH_C_LINK_CFG_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_decode(bbP, &dataP->link_param_type);
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
@@ -558,14 +558,14 @@ unsigned int MIH_C_LINK_CFG_STATUS2String(MIH_C_LINK_CFG_STATUS_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_CFG_STATUS_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP) {
+void MIH_C_LINK_CFG_STATUS_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_encode(bbP, &dataP->link_param_type);
     MIH_C_THRESHOLD_encode(bbP, &dataP->threshold);
     MIH_C_CONFIG_STATUS_encode(bbP, &dataP->config_status);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_CFG_STATUS_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP) {
+void MIH_C_LINK_CFG_STATUS_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_decode(bbP, &dataP->link_param_type);
     MIH_C_THRESHOLD_decode(bbP, &dataP->threshold);
@@ -590,7 +590,7 @@ unsigned int MIH_C_LINK_DESC_RSP2String(MIH_C_LINK_DESC_RSP_T *dataP, char* bufP
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP) {
+void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -605,7 +605,7 @@ inline void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_DESC_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP) {
+void MIH_C_LINK_DESC_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -640,7 +640,7 @@ unsigned int MIH_C_LINK_PARAM2String(MIH_C_LINK_PARAM_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP) {
+void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_encode(bbP, &dataP->link_param_type);
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
@@ -652,7 +652,7 @@ inline void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP) {
+void MIH_C_LINK_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_TYPE_decode(bbP, &dataP->link_param_type);
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
@@ -683,7 +683,7 @@ unsigned int MIH_C_LINK_PARAM_RPT2String(MIH_C_LINK_PARAM_RPT_T *dataP, char* bu
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP) {
+void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_encode(bbP, &dataP->link_param);
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
@@ -695,7 +695,7 @@ inline void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP) {
+void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_PARAM_decode(bbP, &dataP->link_param);
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
@@ -707,13 +707,13 @@ inline void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_POA_LIST_encode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP) {
+void MIH_C_LINK_POA_LIST_encode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_encode(bbP, &dataP->link_id);
     MIH_C_LINK_ADDR_LIST_encode(bbP, &dataP->link_addr_list);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_POA_LIST_decode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP) {
+void MIH_C_LINK_POA_LIST_decode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_decode(bbP, &dataP->link_id);
     MIH_C_LINK_ADDR_LIST_decode(bbP, &dataP->link_addr_list);
@@ -737,7 +737,7 @@ unsigned int MIH_C_LINK_STATES_RSP2String(MIH_C_LINK_STATES_RSP_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP) {
+void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -748,7 +748,7 @@ inline void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RS
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATES_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP) {
+void MIH_C_LINK_STATES_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -775,35 +775,35 @@ unsigned int MIH_C_LINK_DESC_REQ2String2(MIH_C_LINK_DESC_REQ_T *dataP, char* buf
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATUS_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP) {
+void MIH_C_LINK_STATUS_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_STATES_REQ_encode(bbP, &dataP->link_states_req);
     MIH_C_LINK_PARAM_TYPE_LIST_encode(bbP, &dataP->link_param_type_list);
     MIH_C_LINK_DESC_RSP_encode(bbP, &dataP->link_desc_rsp);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATUS_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP) {
+void MIH_C_LINK_STATUS_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_STATES_REQ_decode(bbP, &dataP->link_states_req);
     MIH_C_LINK_PARAM_TYPE_LIST_decode(bbP, &dataP->link_param_type_list);
     MIH_C_LINK_DESC_RSP_decode(bbP, &dataP->link_desc_rsp);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATUS_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP) {
+void MIH_C_LINK_STATUS_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_STATES_RSP_LIST_encode(bbP, &dataP->link_states_rsp_list);
     MIH_C_LINK_PARAM_LIST_encode(bbP, &dataP->link_param_list);
     MIH_C_LINK_DESC_RSP_LIST_encode(bbP, &dataP->link_desc_rsp_list);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_STATUS_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP) {
+void MIH_C_LINK_STATUS_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_STATES_RSP_LIST_decode(bbP, &dataP->link_states_rsp_list);
     MIH_C_LINK_PARAM_LIST_decode(bbP, &dataP->link_param_list);
     MIH_C_LINK_DESC_RSP_LIST_decode(bbP, &dataP->link_desc_rsp_list);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP) {
+void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_encode(bbP, &dataP->link_id);
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
@@ -815,7 +815,7 @@ inline void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP) {
+void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_decode(bbP, &dataP->link_id);
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
@@ -827,7 +827,7 @@ inline void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_DET_INFO_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP) {
+void MIH_C_LINK_DET_INFO_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_TUPLE_ID_encode(bbP,    &dataP->link_tuple_id);
     MIH_C_NETWORK_ID_encode(bbP,       &dataP->network_id);
@@ -840,7 +840,7 @@ inline void MIH_C_LINK_DET_INFO_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T
 
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_DET_INFO_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP) {
+void MIH_C_LINK_DET_INFO_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_TUPLE_ID_decode(bbP,    &dataP->link_tuple_id);
     MIH_C_NETWORK_ID_decode(bbP,       &dataP->network_id);
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c
index fffc9e05f9..35779372f4 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c
+++ b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c
@@ -42,13 +42,13 @@ unsigned int MIH_C_MIN_PK_TX_DELAY2String(MIH_C_MIN_PK_TX_DELAY_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MIN_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP) {
+void MIH_C_MIN_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_encode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_encode(bbP, &dataP->value);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MIN_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP) {
+void MIH_C_MIN_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_decode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_decode(bbP, &dataP->value);
@@ -64,13 +64,13 @@ unsigned int MIH_C_AVG_PK_TX_DELAY2String(MIH_C_AVG_PK_TX_DELAY_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_AVG_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP) {
+void MIH_C_AVG_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_encode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_encode(bbP, &dataP->value);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_AVG_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP) {
+void MIH_C_AVG_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_decode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_decode(bbP, &dataP->value);
@@ -86,13 +86,13 @@ unsigned int MIH_C_MAX_PK_TX_DELAY2String(MIH_C_MAX_PK_TX_DELAY_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MAX_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP) {
+void MIH_C_MAX_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_encode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_encode(bbP, &dataP->value);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MAX_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP) {
+void MIH_C_MAX_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_decode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_decode(bbP, &dataP->value);
@@ -108,13 +108,13 @@ unsigned int MIH_C_PK_DELAY_JITTER2String(MIH_C_PK_DELAY_JITTER_T *dataP, char*
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_PK_DELAY_JITTER_encode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP) {
+void MIH_C_PK_DELAY_JITTER_encode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_encode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_encode(bbP, &dataP->value);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_PK_DELAY_JITTER_decode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP) {
+void MIH_C_PK_DELAY_JITTER_decode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_decode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_decode(bbP, &dataP->value);
@@ -130,13 +130,13 @@ unsigned int MIH_C_PK_LOSS_RATE2String(MIH_C_PK_LOSS_RATE_T *dataP, char* bufP)
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_PK_LOSS_RATE_encode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP) {
+void MIH_C_PK_LOSS_RATE_encode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_encode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_encode(bbP, &dataP->value);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_PK_LOSS_RATE_decode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP) {
+void MIH_C_PK_LOSS_RATE_decode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_COS_ID_decode(bbP, &dataP->cos_id);
     MIH_C_UNSIGNED_INT2_decode(bbP, &dataP->value);
@@ -177,7 +177,7 @@ unsigned int MIH_C_QOS_PARAM_VAL2String(MIH_C_QOS_PARAM_VAL_T *dataP, char* bufP
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP) {
+void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -192,7 +192,7 @@ inline void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_QOS_PARAM_VAL_decode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP) {
+void MIH_C_QOS_PARAM_VAL_decode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_Medieval_extensions.c b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_Medieval_extensions.c
index 2c1a620be4..3382c30160 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_Medieval_extensions.c
+++ b/openair3/RAL-LTE/INTERFACE-802.21/C/MIH_C_Medieval_extensions.c
@@ -57,13 +57,13 @@ unsigned int MIH_C_IP_TUPLE2String(MIH_C_IP_TUPLE_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_IP_TUPLE_encode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP) {
+void MIH_C_IP_TUPLE_encode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_IP_ADDR_encode(bbP, &dataP->ip_addr);
     MIH_C_PORT_encode(bbP, &dataP->port);
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_IP_TUPLE_decode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP) {
+void MIH_C_IP_TUPLE_decode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_IP_ADDR_decode(bbP, &dataP->ip_addr);
     MIH_C_PORT_decode(bbP, &dataP->port);
@@ -117,7 +117,7 @@ unsigned int MIH_C_MARK2String(MIH_C_MARK_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
+void MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -132,7 +132,7 @@ inline void MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_MARK_decode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
+void MIH_C_MARK_decode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -175,7 +175,7 @@ unsigned int MIH_C_QOS2String(MIH_C_QOS_T *dataP, char* bufP) {
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
+void MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -193,7 +193,7 @@ inline void MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_QOS_decode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
+void MIH_C_QOS_decode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -266,7 +266,7 @@ unsigned int MIH_C_RESOURCE_DESC2String(MIH_C_RESOURCE_DESC_T *dataP, char* bufP
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP) {
+void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_encode(bbP, &dataP->link_id);
     MIH_C_FLOW_ID_encode(bbP, &dataP->flow_id);
@@ -313,7 +313,7 @@ inline void MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP) {
+void MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_LINK_ID_decode(bbP, &dataP->link_id);
     MIH_C_FLOW_ID_decode(bbP, &dataP->flow_id);
@@ -403,7 +403,7 @@ unsigned int MIH_C_FLOW_ATTRIBUTE2String(MIH_C_FLOW_ATTRIBUTE_T *dataP, char* bu
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP) {
+void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_FLOW_ID_encode(bbP, &dataP->flow_id);
 
@@ -441,7 +441,7 @@ inline void MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP) {
+void MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_FLOW_ID_decode(bbP, &dataP->flow_id);
 
@@ -500,7 +500,7 @@ unsigned int MIH_C_LINK_AC_PARAM2String(MIH_C_LINK_AC_PARAM_T *dataP, char* bufP
     return buffer_index;
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP) {
+void MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_encode(bbP, &dataP->choice);
     switch (dataP->choice) {
@@ -517,7 +517,7 @@ inline void MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T
     }
 }
 //-----------------------------------------------------------------------------
-inline void MIH_C_LINK_AC_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP) {
+void MIH_C_LINK_AC_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP) {
 //-----------------------------------------------------------------------------
     MIH_C_CHOICE_decode(bbP, &dataP->choice);
     switch (dataP->choice) {
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F1_basic_data_types_codec.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F1_basic_data_types_codec.h
index 50df6261d2..1338114ad6 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F1_basic_data_types_codec.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F1_basic_data_types_codec.h
@@ -79,45 +79,45 @@ typedef struct MIH_C_F1_Generic_Octet {
     u_int8_t  val[2];
 }MIH_C_F1_Generic_Octet_t;
 //-----------------------------------------------------------------------------
-public_F1_codec( inline void MIH_C_BITMAP8_encode      (Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP16_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP24_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP32_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP64_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP128_encode    (Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP256_encode    (Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);)
-public_F1_codec( inline void MIH_C_CHOICE_encode       (Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER1_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER2_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER4_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER8_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);)
-public_F1_codec( inline void MIH_C_NULL_encode         (Bit_Buffer_t* bbP, MIH_C_NULL_T* dataP);)
-public_F1_codec( inline void MIH_C_OCTET_encode        (Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);)
-public_F1_codec( inline void MIH_C_LIST_LENGTH_encode  (Bit_Buffer_t* bbP, u_int16_t lengthP);)
+public_F1_codec( void MIH_C_BITMAP8_encode      (Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP16_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP24_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP32_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP64_encode     (Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP128_encode    (Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP256_encode    (Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);)
+public_F1_codec( void MIH_C_CHOICE_encode       (Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER1_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER2_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER4_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER8_encode     (Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);)
+public_F1_codec( void MIH_C_NULL_encode         (Bit_Buffer_t* bbP, MIH_C_NULL_T* dataP);)
+public_F1_codec( void MIH_C_OCTET_encode        (Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);)
+public_F1_codec( void MIH_C_LIST_LENGTH_encode  (Bit_Buffer_t* bbP, u_int16_t lengthP);)
 //-----------------------------------------------------------------------------
-public_F1_codec( inline void MIH_C_BITMAP8_decode       (Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP16_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP24_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP32_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP64_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP128_decode     (Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);)
-public_F1_codec( inline void MIH_C_BITMAP256_decode     (Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);)
-public_F1_codec( inline void MIH_C_CHOICE_decode        (Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER1_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER2_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER4_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);)
-public_F1_codec( inline void MIH_C_INTEGER8_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);)
-public_F1_codec( inline void MIH_C_NULL_decode          (Bit_Buffer_t* bbP);)
-public_F1_codec( inline void MIH_C_OCTET_decode         (Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT1_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT2_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT4_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);)
-public_F1_codec( inline void MIH_C_UNSIGNED_INT8_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);)
-public_F1_codec( inline void MIH_C_LIST_LENGTH_decode   (Bit_Buffer_t* bbP, u_int16_t *lengthP);)
+public_F1_codec( void MIH_C_BITMAP8_decode       (Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP16_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP24_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP32_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP64_decode      (Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP128_decode     (Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);)
+public_F1_codec( void MIH_C_BITMAP256_decode     (Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);)
+public_F1_codec( void MIH_C_CHOICE_decode        (Bit_Buffer_t* bbP, MIH_C_CHOICE_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER1_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER2_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER4_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);)
+public_F1_codec( void MIH_C_INTEGER8_decode      (Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);)
+public_F1_codec( void MIH_C_NULL_decode          (Bit_Buffer_t* bbP);)
+public_F1_codec( void MIH_C_OCTET_decode         (Bit_Buffer_t* bbP, MIH_C_F1_Generic_Octet_t *dataP, int lengthP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT1_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT2_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT4_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);)
+public_F1_codec( void MIH_C_UNSIGNED_INT8_decode (Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);)
+public_F1_codec( void MIH_C_LIST_LENGTH_decode   (Bit_Buffer_t* bbP, u_int16_t *lengthP);)
 //-----------------------------------------------------------------------------
 public_F1_codec( unsigned int MIH_C_BITMAP82String(MIH_C_BITMAP8_T* dataP, char* bufP);)
 public_F1_codec( unsigned int MIH_C_BITMAP162String(MIH_C_BITMAP16_T* dataP, char* bufP);)
@@ -127,7 +127,7 @@ public_F1_codec( unsigned int MIH_C_UNSIGNED_INT22String(MIH_C_UNSIGNED_INT2_T*
 public_F1_codec( unsigned int MIH_C_UNSIGNED_INT42String(MIH_C_UNSIGNED_INT4_T* dataP, char* bufP);)
 public_F1_codec( unsigned int MIH_C_UNSIGNED_INT82String(MIH_C_UNSIGNED_INT8_T* dataP, char* bufP);)
 //-----------------------------------------------------------------------------
-public_F1_codec(inline u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP);)
+public_F1_codec(u_int16_t MIH_C_LIST_LENGTH_get_encode_num_bytes(u_int16_t lengthP);)
 
 #endif
 /** @}*/
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F3_data_types_for_address_codec.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F3_data_types_for_address_codec.h
index a29f12ac23..47ae28a91b 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F3_data_types_for_address_codec.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F3_data_types_for_address_codec.h
@@ -71,13 +71,13 @@
 #include "MIH_C.h"
 //-----------------------------------------------------------------------------
 public_F3_codec(unsigned int  MIH_C_3GPP_2G_CELL_ID2String(MIH_C_3GPP_2G_CELL_ID_T *dataP, char* bufP);)
-public_F3_codec(inline void MIH_C_3GPP_2G_CELL_ID_encode     (Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP);)
-public_F3_codec(inline void MIH_C_3GPP_2G_CELL_ID_decode     (Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP);)
+public_F3_codec(void MIH_C_3GPP_2G_CELL_ID_encode     (Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP);)
+public_F3_codec(void MIH_C_3GPP_2G_CELL_ID_decode     (Bit_Buffer_t* bbP, MIH_C_3GPP_2G_CELL_ID_T *dataP);)
 public_F3_codec(unsigned int  MIH_C_3GPP_3G_CELL_ID2String(MIH_C_3GPP_3G_CELL_ID_T *dataP, char* bufP);)
-public_F3_codec(inline void MIH_C_3GPP_3G_CELL_ID_encode     (Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP);)
-public_F3_codec(inline void MIH_C_3GPP_3G_CELL_ID_decode     (Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP);)
+public_F3_codec(void MIH_C_3GPP_3G_CELL_ID_encode     (Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP);)
+public_F3_codec(void MIH_C_3GPP_3G_CELL_ID_decode     (Bit_Buffer_t* bbP, MIH_C_3GPP_3G_CELL_ID_T *dataP);)
 public_F3_codec(unsigned int MIH_C_LINK_ADDR2String(MIH_C_LINK_ADDR_T *dataP, char* bufP);)
-public_F3_codec(inline void MIH_C_LINK_ADDR_encode           (Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T       *dataP);)
-public_F3_codec(inline void MIH_C_LINK_ADDR_decode           (Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T       *dataP);)
+public_F3_codec(void MIH_C_LINK_ADDR_encode           (Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T       *dataP);)
+public_F3_codec(void MIH_C_LINK_ADDR_decode           (Bit_Buffer_t* bbP, MIH_C_LINK_ADDR_T       *dataP);)
 #endif
 /** @}*/
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F4_data_types_for_links_codec.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F4_data_types_for_links_codec.h
index 43b9941f05..5fa498f61d 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F4_data_types_for_links_codec.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F4_data_types_for_links_codec.h
@@ -71,60 +71,60 @@
 #include "MIH_C.h"
 //-----------------------------------------------------------------------------
 public_F4_codec(unsigned int MIH_C_OPMODE2String2(MIH_C_OPMODE_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_DEV_STATE_RSP_decode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP);)
+public_F4_codec(void MIH_C_DEV_STATE_RSP_encode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP);)
+public_F4_codec(void MIH_C_DEV_STATE_RSP_decode(Bit_Buffer_t* bbP, MIH_C_DEV_STATE_RSP_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_EVENT_LIST2String2(MIH_C_LINK_EVENT_LIST_T *dataP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_LINK_CMD_LIST2String2(MIH_C_LINK_CMD_LIST_T *dataP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_LINK_TYPE2String2(MIH_C_LINK_TYPE_T *dataP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_LINK_ID2String(MIH_C_LINK_ID_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_ACTION_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ID_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ACTION_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ACTION_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_REQ_T *dataP);)
 public_F4_codec(unsigned int MIH_C_SIG_STRENGTH2String(MIH_C_SIG_STRENGTH_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP);)
-public_F4_codec(inline void MIH_C_SIG_STRENGTH_decode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP);)
+public_F4_codec(void MIH_C_SIG_STRENGTH_encode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP);)
+public_F4_codec(void MIH_C_SIG_STRENGTH_decode(Bit_Buffer_t* bbP, MIH_C_SIG_STRENGTH_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_SCAN_RSP2String(MIH_C_LINK_SCAN_RSP_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_SCAN_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_SCAN_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_ACTION_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_SCAN_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_SCAN_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_SCAN_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ACTION_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_ACTION_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_RSP_T *dataP);)
 public_F4_codec(unsigned int MIH_C_THRESHOLD2String(MIH_C_THRESHOLD_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_THRESHOLD_encode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP);)
-public_F4_codec(inline void MIH_C_THRESHOLD_decode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP);)
+public_F4_codec(void MIH_C_THRESHOLD_encode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP);)
+public_F4_codec(void MIH_C_THRESHOLD_decode(Bit_Buffer_t* bbP, MIH_C_THRESHOLD_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_PARAM_TYPE2String( MIH_C_LINK_PARAM_TYPE_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_TYPE_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_TYPE_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_TYPE_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_TYPE_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_CFG_PARAM2String(MIH_C_LINK_CFG_PARAM_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_CFG_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP);)
+public_F4_codec(void MIH_C_LINK_CFG_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP);)
+public_F4_codec(void MIH_C_LINK_CFG_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_PARAM_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_CFG_STATUS2String(MIH_C_LINK_CFG_STATUS_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_CFG_STATUS_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_CFG_STATUS_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP);)
+public_F4_codec(void MIH_C_LINK_CFG_STATUS_encode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP);)
+public_F4_codec(void MIH_C_LINK_CFG_STATUS_decode(Bit_Buffer_t* bbP, MIH_C_LINK_CFG_STATUS_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_DESC_RSP2String(MIH_C_LINK_DESC_RSP_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_DESC_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_DESC_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_DESC_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DESC_RSP_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_PARAM2String(MIH_C_LINK_PARAM_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_PARAM_RPT2String(MIH_C_LINK_PARAM_RPT_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_POA_LIST_encode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_POA_LIST_decode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_RPT_encode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP);)
+public_F4_codec(void MIH_C_LINK_PARAM_RPT_decode(Bit_Buffer_t* bbP, MIH_C_LINK_PARAM_RPT_T *dataP);)
+public_F4_codec(void MIH_C_LINK_POA_LIST_encode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP);)
+public_F4_codec(void MIH_C_LINK_POA_LIST_decode(Bit_Buffer_t* bbP, MIH_C_LINK_POA_LIST_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_STATES_RSP2String(MIH_C_LINK_STATES_RSP_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_STATES_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_STATUS_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_STATUS_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_STATUS_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_STATUS_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATES_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATES_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATES_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATUS_REQ_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATUS_REQ_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_REQ_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATUS_RSP_encode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP);)
+public_F4_codec(void MIH_C_LINK_STATUS_RSP_decode(Bit_Buffer_t* bbP, MIH_C_LINK_STATUS_RSP_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_STATES_REQ2String2(MIH_C_LINK_STATES_REQ_T *dataP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_LINK_DESC_REQ2String2(MIH_C_LINK_DESC_REQ_T *dataP, char* bufP);)
-public_F4_codec(inline void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_DET_INFO_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP);)
-public_F4_codec(inline void MIH_C_LINK_DET_INFO_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP);)
+public_F4_codec(void MIH_C_LINK_TUPLE_ID_encode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP);)
+public_F4_codec(void MIH_C_LINK_TUPLE_ID_decode(Bit_Buffer_t* bbP, MIH_C_LINK_TUPLE_ID_T *dataP);)
+public_F4_codec(void MIH_C_LINK_DET_INFO_encode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP);)
+public_F4_codec(void MIH_C_LINK_DET_INFO_decode(Bit_Buffer_t* bbP, MIH_C_LINK_DET_INFO_T *dataP);)
 public_F4_codec(unsigned int MIH_C_LINK_AC_ATTR2String2(MIH_C_LINK_AC_ATTR_T *dataP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_TH_ACTION2String2(MIH_C_TH_ACTION_T *actionP, char* bufP);)
 public_F4_codec(unsigned int MIH_C_LINK_AC_TYPE2String2(MIH_C_LINK_AC_TYPE_T *dataP, char* bufP);)
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F9_data_types_for_qos_codec.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F9_data_types_for_qos_codec.h
index 8d74b80a94..3d1a971d47 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F9_data_types_for_qos_codec.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_F9_data_types_for_qos_codec.h
@@ -71,28 +71,28 @@
 #include "MIH_C.h"
 //-----------------------------------------------------------------------------
 public_F9_codec(unsigned int MIH_C_MIN_PK_TX_DELAY2String(MIH_C_MIN_PK_TX_DELAY_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_MIN_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP);)
-public_F9_codec(inline void MIH_C_MIN_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_MIN_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_MIN_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MIN_PK_TX_DELAY_T *dataP);)
 
 public_F9_codec(unsigned int MIH_C_AVG_PK_TX_DELAY2String(MIH_C_AVG_PK_TX_DELAY_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_AVG_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP);)
-public_F9_codec(inline void MIH_C_AVG_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_AVG_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_AVG_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_AVG_PK_TX_DELAY_T *dataP);)
 
 public_F9_codec(unsigned int MIH_C_MAX_PK_TX_DELAY2String(MIH_C_MAX_PK_TX_DELAY_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_MAX_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP);)
-public_F9_codec(inline void MIH_C_MAX_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_MAX_PK_TX_DELAY_encode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP);)
+public_F9_codec(void MIH_C_MAX_PK_TX_DELAY_decode(Bit_Buffer_t* bbP, MIH_C_MAX_PK_TX_DELAY_T *dataP);)
 
 public_F9_codec(unsigned int MIH_C_PK_DELAY_JITTER2String(MIH_C_PK_DELAY_JITTER_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_PK_DELAY_JITTER_encode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP);)
-public_F9_codec(inline void MIH_C_PK_DELAY_JITTER_decode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP);)
+public_F9_codec(void MIH_C_PK_DELAY_JITTER_encode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP);)
+public_F9_codec(void MIH_C_PK_DELAY_JITTER_decode(Bit_Buffer_t* bbP, MIH_C_PK_DELAY_JITTER_T *dataP);)
 
 public_F9_codec(unsigned int MIH_C_PK_LOSS_RATE2String(MIH_C_PK_LOSS_RATE_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_PK_LOSS_RATE_encode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP);)
-public_F9_codec(inline void MIH_C_PK_LOSS_RATE_decode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP);)
+public_F9_codec(void MIH_C_PK_LOSS_RATE_encode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP);)
+public_F9_codec(void MIH_C_PK_LOSS_RATE_decode(Bit_Buffer_t* bbP, MIH_C_PK_LOSS_RATE_T *dataP);)
 
 public_F9_codec(unsigned int MIH_C_QOS_PARAM_VAL2String(MIH_C_QOS_PARAM_VAL_T *dataP, char* bufP);)
-public_F9_codec(inline void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP);)
-public_F9_codec(inline void MIH_C_QOS_PARAM_VAL_decode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP);)
+public_F9_codec(void MIH_C_QOS_PARAM_VAL_encode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP);)
+public_F9_codec(void MIH_C_QOS_PARAM_VAL_decode(Bit_Buffer_t* bbP, MIH_C_QOS_PARAM_VAL_T *dataP);)
 
 #endif
 /** @}*/
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Medieval_extensions.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Medieval_extensions.h
index b32611070e..5b1b178b36 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Medieval_extensions.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Medieval_extensions.h
@@ -72,30 +72,30 @@
 #ifdef MIH_C_MEDIEVAL_EXTENSIONS
 public_Medieval_extensions(unsigned int        MIH_C_PROTO2String   (MIH_C_PROTO_T    *protoP,char* bufP);)
 public_Medieval_extensions(unsigned int        MIH_C_IP_TUPLE2String(MIH_C_IP_TUPLE_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_IP_TUPLE_encode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_IP_TUPLE_decode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP);)
+public_Medieval_extensions(void         MIH_C_IP_TUPLE_encode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP);)
+public_Medieval_extensions(void         MIH_C_IP_TUPLE_decode(Bit_Buffer_t* bbP, MIH_C_IP_TUPLE_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_FLOW_ID2String(MIH_C_FLOW_ID_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_FLOW_ID_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ID_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_FLOW_ID_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ID_T *dataP);)
+public_Medieval_extensions(void         MIH_C_FLOW_ID_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ID_T *dataP);)
+public_Medieval_extensions(void         MIH_C_FLOW_ID_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ID_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_MARK2String(MIH_C_MARK_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_MARK_decode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP);)
+public_Medieval_extensions(void         MIH_C_MARK_encode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP);)
+public_Medieval_extensions(void         MIH_C_MARK_decode(Bit_Buffer_t* bbP, MIH_C_MARK_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_QOS2String(MIH_C_QOS_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_QOS_decode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP);)
+public_Medieval_extensions(void         MIH_C_QOS_encode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP);)
+public_Medieval_extensions(void         MIH_C_QOS_decode(Bit_Buffer_t* bbP, MIH_C_QOS_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_RESOURCE_DESC2String(MIH_C_RESOURCE_DESC_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP);)
+public_Medieval_extensions(void         MIH_C_RESOURCE_DESC_encode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP);)
+public_Medieval_extensions(void         MIH_C_RESOURCE_DESC_decode(Bit_Buffer_t* bbP, MIH_C_RESOURCE_DESC_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_FLOW_ATTRIBUTE2String(MIH_C_FLOW_ATTRIBUTE_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP);)
+public_Medieval_extensions(void         MIH_C_FLOW_ATTRIBUTE_encode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP);)
+public_Medieval_extensions(void         MIH_C_FLOW_ATTRIBUTE_decode(Bit_Buffer_t* bbP, MIH_C_FLOW_ATTRIBUTE_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_LINK_AC_PARAM2String(MIH_C_LINK_AC_PARAM_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_LINK_AC_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP);)
+public_Medieval_extensions(void         MIH_C_LINK_AC_PARAM_encode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP);)
+public_Medieval_extensions(void         MIH_C_LINK_AC_PARAM_decode(Bit_Buffer_t* bbP, MIH_C_LINK_AC_PARAM_T *dataP);)
 public_Medieval_extensions(unsigned int        MIH_C_LINK_ACTION2String(MIH_C_LINK_ACTION_T *dataP, char* bufP);)
-public_Medieval_extensions(inline void         MIH_C_LINK_ACTION_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_LINK_ACTION_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
-public_Medieval_extensions(inline void         MIH_C_LINK_ACTION_short_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
+public_Medieval_extensions(void         MIH_C_LINK_ACTION_encode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
+public_Medieval_extensions(void         MIH_C_LINK_ACTION_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
+public_Medieval_extensions(void         MIH_C_LINK_ACTION_short_decode(Bit_Buffer_t* bbP, MIH_C_LINK_ACTION_T *dataP);)
 
 #endif
 #endif
diff --git a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
index 976adb5ce7..bd809242be 100755
--- a/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
+++ b/openair3/RAL-LTE/INTERFACE-802.21/INCLUDE/MIH_C_Types.h
@@ -103,146 +103,146 @@ typedef struct MIH_C_BITMAP256 {u_int64_t val[4];}__attribute__((__packed__)) MI
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP8_T.
      */
     #define TYPEDEF_BITMAP6(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
-        extern inline void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
+        void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
+        void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
         inline unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             return sprintf(buffP, "0x%02X", *bitmapP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP8_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP8(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP8_T.
      */
     #define TYPEDEF_BITMAP8(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
-        extern inline void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
+        void MIH_C_BITMAP8_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
+        void MIH_C_BITMAP8_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP8_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             return sprintf(buffP, "0x%02X", *bitmapP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP8_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP8_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP16(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP16_T.
      */
     #define TYPEDEF_BITMAP16(DATA_TYPE_NAME)            typedef MIH_C_BITMAP16_T DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
-        extern inline void MIH_C_BITMAP16_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
+        void MIH_C_BITMAP16_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
+        void MIH_C_BITMAP16_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP16_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             return sprintf(buffP, "0x%04X", *bitmapP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP16_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP16_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP16_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP20(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP24_T.
      */
     #define TYPEDEF_BITMAP20(DATA_TYPE_NAME)            typedef MIH_C_BITMAP24_T DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
-        extern inline void MIH_C_BITMAP24_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
+        void MIH_C_BITMAP24_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
+        void MIH_C_BITMAP24_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP24_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             return sprintf(buffP, "0x%02X%02X%02X", bitmapP->val[0], bitmapP->val[1], bitmapP->val[2]);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP24_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP24_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP24_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP32(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP32_T.
      */
     #define TYPEDEF_BITMAP32(DATA_TYPE_NAME)            typedef MIH_C_BITMAP32_T DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
-        extern inline void MIH_C_BITMAP32_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
+        void MIH_C_BITMAP32_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
+        void MIH_C_BITMAP32_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP32_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             return sprintf(buffP, "0x%08X", *bitmapP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP32_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP32_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP32_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP64(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP64_T.
      */
     #define TYPEDEF_BITMAP64(DATA_TYPE_NAME)            typedef MIH_C_BITMAP64_T DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
-        extern inline void MIH_C_BITMAP64_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
+        void MIH_C_BITMAP64_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
+        void MIH_C_BITMAP64_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP64_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP) {\
             unsigned int buffer_index = 0;\
             buffer_index = sprintf(buffP, "0x%08x", (MIH_C_UNSIGNED_INT4_T)(*bitmapP>>32));\
             buffer_index = sprintf(&buffP[buffer_index], "%08x", (MIH_C_UNSIGNED_INT4_T)(*bitmapP));\
             return buffer_index;\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {\
             MIH_C_BITMAP64_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP64_decode(bbP, bitmapP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP64_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP128(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP128_T.
      */
     #define TYPEDEF_BITMAP128(DATA_TYPE_NAME)           typedef MIH_C_BITMAP128_T DATA_TYPE_NAME  ## _T;\
-        inline void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
-        inline void MIH_C_BITMAP128_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_decode(bbP, bitmapP);};
+        void MIH_C_BITMAP128_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
+        void MIH_C_BITMAP128_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP128_T* dataP);\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_encode(bbP, bitmapP);};\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP128_decode(bbP, bitmapP);};
 
     /*! \def TYPEDEF_BITMAP256(DATA_TYPE_NAME)
      * \ingroup MIH_C_F1_BASIC_DATA_TYPES
      * \brief Defines DATA_TYPE_NAME as a MIH_C_BITMAP256_T.
      */
     #define TYPEDEF_BITMAP256(DATA_TYPE_NAME)           typedef MIH_C_BITMAP256_T DATA_TYPE_NAME  ## _T;\
-        inline void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
-        inline void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_encode(bbP, bitmapP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_decode(bbP, bitmapP);};
+        void MIH_C_BITMAP256_encode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
+        void MIH_C_BITMAP256_decode(Bit_Buffer_t* bbP, MIH_C_BITMAP256_T* dataP);\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_encode(bbP, bitmapP);};\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *bitmapP) {MIH_C_BITMAP256_decode(bbP, bitmapP);};
 
 #else
     #define TYPEDEF_BITMAP6(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP8(DATA_TYPE_NAME)             typedef MIH_C_BITMAP8_T  DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP16(DATA_TYPE_NAME)            typedef MIH_C_BITMAP16_T DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP20(DATA_TYPE_NAME)            typedef MIH_C_BITMAP24_T DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP32(DATA_TYPE_NAME)            typedef MIH_C_BITMAP32_T DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP64(DATA_TYPE_NAME)            typedef MIH_C_BITMAP64_T DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *bitmapP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP128(DATA_TYPE_NAME)           typedef MIH_C_BITMAP128_T DATA_TYPE_NAME  ## _T;\
-        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 
     #define TYPEDEF_BITMAP256(DATA_TYPE_NAME)           typedef MIH_C_BITMAP256_T DATA_TYPE_NAME  ## _T;\
-        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
-        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T* bitmapP);
 #endif
 
 #define BITMAP6(VAR_NAME)                                   MIH_C_BITMAP8_T   VAR_NAME;
@@ -290,14 +290,14 @@ typedef int64_t                            MIH_C_INTEGER8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER1_T.
      */
     #define TYPEDEF_INTEGER1(DATA_TYPE_NAME)            typedef MIH_C_INTEGER1_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_INTEGER1_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
-        extern inline void MIH_C_INTEGER1_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
+        void MIH_C_INTEGER1_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
+        void MIH_C_INTEGER1_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER1_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%02X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER1_encode(bbP, (MIH_C_INTEGER1_T*)dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER1_decode(bbP, (MIH_C_INTEGER1_T*)dataP);\
         };
 
@@ -306,14 +306,14 @@ typedef int64_t                            MIH_C_INTEGER8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER2_T.
      */
     #define TYPEDEF_INTEGER2(DATA_TYPE_NAME)            typedef MIH_C_INTEGER2_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_INTEGER2_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
-        extern inline void MIH_C_INTEGER2_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
+        void MIH_C_INTEGER2_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
+        void MIH_C_INTEGER2_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER2_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%04X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER2_encode(bbP, (MIH_C_INTEGER2_T*)dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER2_decode(bbP, (MIH_C_INTEGER2_T*)dataP);\
         };
 
@@ -322,14 +322,14 @@ typedef int64_t                            MIH_C_INTEGER8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER4_T.
      */
     #define TYPEDEF_INTEGER4(DATA_TYPE_NAME)            typedef MIH_C_INTEGER4_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_INTEGER4_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
-        extern inline void MIH_C_INTEGER4_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
+        void MIH_C_INTEGER4_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
+        void MIH_C_INTEGER4_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER4_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%08X", (MIH_C_INTEGER4_T)*dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER4_encode(bbP, (MIH_C_INTEGER4_T*)dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER4_decode(bbP, (MIH_C_INTEGER4_T*)dataP);\
         };
 
@@ -338,39 +338,39 @@ typedef int64_t                            MIH_C_INTEGER8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_INTEGER48T.
      */
     #define TYPEDEF_INTEGER8(DATA_TYPE_NAME)            typedef MIH_C_INTEGER8_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_INTEGER8_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
-        extern inline void MIH_C_INTEGER8_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
+        void MIH_C_INTEGER8_encode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
+        void MIH_C_INTEGER8_decode(Bit_Buffer_t* bbP, MIH_C_INTEGER8_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             unsigned int buffer_index = 0;\
             buffer_index = sprintf(buffP, "0x%08x", (MIH_C_UNSIGNED_INT4_T)(*dataP>>32));\
             buffer_index = sprintf(&buffP[buffer_index], "%08x", (MIH_C_UNSIGNED_INT4_T)(*dataP));\
             return buffer_index;\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER8_encode(bbP, (MIH_C_INTEGER8_T*)dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_INTEGER8_decode(bbP, (MIH_C_INTEGER8_T*)dataP);\
         };
 #else
     #define TYPEDEF_INTEGER1(DATA_TYPE_NAME)            typedef MIH_C_INTEGER1_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_INTEGER2(DATA_TYPE_NAME)            typedef MIH_C_INTEGER2_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_INTEGER4(DATA_TYPE_NAME)            typedef MIH_C_INTEGER4_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_INTEGER8(DATA_TYPE_NAME)            typedef MIH_C_INTEGER8_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int  DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void   DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void   DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 #endif
 
 /*! \def INTEGER1(VAR_NAME)
@@ -419,14 +419,14 @@ typedef u_int64_t                          MIH_C_UNSIGNED_INT8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT1_T.
      */
     #define TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT1_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
-        extern inline void MIH_C_UNSIGNED_INT1_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
+        void MIH_C_UNSIGNED_INT1_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
+        void MIH_C_UNSIGNED_INT1_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT1_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%02X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT1_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT1_decode(bbP, dataP);\
         };
 
@@ -435,14 +435,14 @@ typedef u_int64_t                          MIH_C_UNSIGNED_INT8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT2_T.
      */
     #define TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT2_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
-        extern inline void MIH_C_UNSIGNED_INT2_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
+        void MIH_C_UNSIGNED_INT2_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
+        void MIH_C_UNSIGNED_INT2_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT2_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%04X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT2_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT2_decode(bbP, dataP);\
         };
 
@@ -451,14 +451,14 @@ typedef u_int64_t                          MIH_C_UNSIGNED_INT8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT4_T.
      */
     #define TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT4_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
-        extern inline void MIH_C_UNSIGNED_INT4_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
+        void MIH_C_UNSIGNED_INT4_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
+        void MIH_C_UNSIGNED_INT4_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT4_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%08X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT4_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT4_decode(bbP, dataP);\
         };
 
@@ -467,36 +467,36 @@ typedef u_int64_t                          MIH_C_UNSIGNED_INT8_T;
      * \brief Defines DATA_TYPE_NAME as a MIH_C_UNSIGNED_INT8_T.
      */
     #define TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT8_T   DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
-        extern inline void MIH_C_UNSIGNED_INT8_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
+        void MIH_C_UNSIGNED_INT8_encode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
+        void MIH_C_UNSIGNED_INT8_decode(Bit_Buffer_t* bbP, MIH_C_UNSIGNED_INT8_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP) {\
             return sprintf(buffP, "0x%16X", *dataP);\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT8_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_UNSIGNED_INT8_decode(bbP, dataP);\
         };
 #else
     #define TYPEDEF_UNSIGNED_INT1(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT1_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_UNSIGNED_INT2(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT2_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_UNSIGNED_INT4(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT4_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 
     #define TYPEDEF_UNSIGNED_INT8(DATA_TYPE_NAME)            typedef MIH_C_UNSIGNED_INT8_T   DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* buffP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 #endif
 
 /*! \def UNSIGNED_INT1(VAR_NAME)
@@ -545,7 +545,7 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
         }\
         return buffer_index;\
     };\
-    inline void DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
+    void DATA_TYPE_NAME ## _LIST_decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
         int index = 0;\
         MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
         if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_decode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
@@ -555,7 +555,7 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
             }\
         }\
     };\
-    inline void DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
+    void DATA_TYPE_NAME ## _LIST_encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _LIST_T *listP) {\
         int index = 0;\
         if (listP->length > MAX_LENGTH) {\
             printf("[MIH_C] ERROR DATA_TYPE_NAME ## _LIST_encode num elements in list out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
@@ -566,7 +566,7 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
             }\
         }\
     };\
-    inline void DATA_TYPE_NAME ## _LIST_init(DATA_TYPE_NAME ## _LIST_T *listP) {\
+    void DATA_TYPE_NAME ## _LIST_init(DATA_TYPE_NAME ## _LIST_T *listP) {\
         listP->length = 0;\
         memset(listP->val, 0, MAX_LENGTH*sizeof(DATA_TYPE_NAME ## _T));\
     };
@@ -601,8 +601,8 @@ u_int16_t MIH_C_LIST_LENGTH_get_encode_length(u_int16_t lengthP);
         }\
         return buffer_index;\
     };\
-    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_readMem(bbP, &dataP->val[0], LENGTH);};\
-    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_writeMem(bbP, &dataP->val[0], LENGTH);};
+    void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_readMem(bbP, &dataP->val[0], LENGTH);};\
+    void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) { BitBuffer_writeMem(bbP, &dataP->val[0], LENGTH);};
 #else
 #define TYPEDEF_OCTET(DATA_TYPE_NAME, LENGTH)       typedef struct DATA_TYPE_NAME {u_int8_t val[LENGTH];} DATA_TYPE_NAME  ## _T;\
     extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP);\
@@ -625,15 +625,15 @@ TYPEDEF_UNSIGNED_INT1(MIH_C_ENUMERATED)
      * \brief Defines DATA_TYPE_NAME as MIH_C_ENUMERATED_T, and its functions for de/serializing this type.
      */
     #define TYPEDEF_ENUMERATED(DATA_TYPE_NAME)          typedef MIH_C_ENUMERATED_T  DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_ENUMERATED_encode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
-        extern inline void MIH_C_ENUMERATED_decode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void MIH_C_ENUMERATED_encode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
+        void MIH_C_ENUMERATED_decode(Bit_Buffer_t* bbP, MIH_C_ENUMERATED_T* dataP);\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_ENUMERATED_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
 #else
     #define TYPEDEF_ENUMERATED(DATA_TYPE_NAME)          typedef MIH_C_ENUMERATED_T  DATA_TYPE_NAME  ## _T;\
-        extern inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 #endif
 
 /*! \def ENUMERATED(VAR_NAME)
@@ -654,8 +654,8 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
      * \brief Defines DATA_TYPE_NAME as MIH_C_BOOLEAN_T, and its functions for de/serializing this type.
      */
     #define TYPEDEF_BOOLEAN(DATA_TYPE_NAME)          typedef MIH_C_BOOLEAN_T  DATA_TYPE_NAME  ## _T;\
-        extern inline void MIH_C_BOOLEAN_encode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
-        extern inline void MIH_C_BOOLEAN_decode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
+        void MIH_C_BOOLEAN_encode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
+        void MIH_C_BOOLEAN_decode(Bit_Buffer_t* bbP, MIH_C_BOOLEAN_T* dataP);\
         unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP) {\
             unsigned int buffer_index = 0;\
             if (*dataP != MIH_C_BOOLEAN_FALSE) {\
@@ -665,14 +665,14 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
             }\
             return buffer_index;\
         };\
-        inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+        void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
             MIH_C_BOOLEAN_encode(bbP, dataP);};\
-        inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
+        void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {MIH_C_ENUMERATED_decode(bbP, dataP);};
 #else
     #define TYPEDEF_BOOLEAN(DATA_TYPE_NAME)          typedef MIH_C_BOOLEAN_T  DATA_TYPE_NAME  ## _T;\
         extern unsigned int DATA_TYPE_NAME ## 2String(DATA_TYPE_NAME ## _T *dataP, char* bufP);\
-        extern inline void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
-        extern inline void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
+        void  DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);\
+        void  DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP);
 #endif
 
 /*! \def BOOLEAN(VAR_NAME)
@@ -694,14 +694,14 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
         bufP[listP->length] = 0;\
         return listP->length;\
     };\
-    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
+    void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
         MIH_C_LIST_LENGTH_decode(bbP, &listP->length);\
         if (listP->length > MAX_LENGTH) {printf("[MIH_C] ERROR DATA_TYPE_NAME ## _decode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
         } else {\
             BitBuffer_readMem(bbP, listP->val, listP->length);\
         }\
     };\
-    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
+    void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *listP) {\
         if (listP->length > MAX_LENGTH) {\
             printf("[MIH_C] ERROR DATA_TYPE_NAME ## _encode String length out of bounds: %d, max is %d\n", listP->length, MAX_LENGTH);\
         } else {\
@@ -709,7 +709,7 @@ TYPEDEF_ENUMERATED(MIH_C_BOOLEAN)
             BitBuffer_writeMem(bbP, listP->val, listP->length);\
         }\
     };\
-    inline void DATA_TYPE_NAME ## _set(DATA_TYPE_NAME ## _T *octet_strP, u_int8_t* strP, u_int16_t lengthP) {\
+    void DATA_TYPE_NAME ## _set(DATA_TYPE_NAME ## _T *octet_strP, u_int8_t* strP, u_int16_t lengthP) {\
         if (lengthP > MAX_LENGTH) {\
             printf("[MIH_C] ERROR DATA_TYPE_NAME ## _set String length out of bounds\n");\
             octet_strP->length = 0;\
@@ -842,11 +842,11 @@ TYPEDEF_OCTET_STRING(MIH_C_TRANSPORT_ADDR_VALUE, 128)
         buffer_index += MIH_C_TRANSPORT_ADDR_VALUE2String(&dataP->address, &bufP[buffer_index]);\
         return buffer_index;\
     };\
-    inline void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+    void DATA_TYPE_NAME ## _decode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
         MIH_C_IANA_ADDR_decode(bbP, &dataP->address_family);\
         MIH_C_TRANSPORT_ADDR_VALUE_decode(bbP, &dataP->address);\
     };\
-    inline void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
+    void DATA_TYPE_NAME ## _encode(Bit_Buffer_t *bbP, DATA_TYPE_NAME ## _T *dataP) {\
         MIH_C_IANA_ADDR_encode(bbP, &dataP->address_family);\
         MIH_C_TRANSPORT_ADDR_VALUE_encode(bbP, &dataP->address);\
     };
diff --git a/targets/Makefile.common b/targets/Makefile.common
index d703c31c09..e7b1b02402 100644
--- a/targets/Makefile.common
+++ b/targets/Makefile.common
@@ -24,6 +24,10 @@ COMMON_CFLAGS		= \
 	-O2                         \
 	-Werror=implicit-function-declaration
 
+# the code already uses C99 integer type (like int32_t)
+# switch on full support for C99 + GNU extensions
+CFLAGS += -std=gnu99
+
 ITTI_MESSAGES_H		= messages_xml.h
 ITTI_MESSAGES_XML	= messages.xml
 ITTI_MESSAGES_FILE	= $(ITTI_DIR)/intertask_interface_types.h
diff --git a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_enb b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_enb
index 92b984cd36..9274c93ca9 100755
--- a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_enb
+++ b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_enb
@@ -10,7 +10,7 @@ EMULATION_LOG_LEVEL=7 # 3 = error, 5 info, 7 debug, trace= 9
 #OAI_LOCAL_ADDRESS="10.0.1.1"
 #OAI_REMOTE_ADDRESS="10.0.1.2"
 #EMULATION_DEV_ADDRESS= `hostname -I cut -f1 -d' '`
-EMULATION_DEV_ADDRESS=`ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
+EMULATION_DEV_ADDRESS=`LC_ALL=C ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
 
 echo "Setting Emulation Interface to $EMULATION_DEV_INTERFACE ($EMULATION_DEV_ADDRESS)"
 
diff --git a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_ue b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_ue
index 951488efa3..b014717b31 100755
--- a/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_ue
+++ b/targets/SIMU/EXAMPLES/ETH_EMUL_1eNB_1UE/start_ue
@@ -10,7 +10,7 @@ EMULATION_LOG_LEVEL=7 # 3 = error, 5 info, 7 debug, trace= 9
 #OAI_LOCAL_ADDRESS="10.0.1.2"
 #OAI_REMOTE_ADDRESS="10.0.1.1"
 #EMULATION_DEV_ADDRESS= `hostname -I cut -f1 -d' '`
-EMULATION_DEV_ADDRESS=`ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
+EMULATION_DEV_ADDRESS=`LC_ALL=C ifconfig $EMULATION_DEV_INTERFACE | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
 
 echo "Setting Emulation Interface to $EMULATION_DEV_INTERFACE ($EMULATION_DEV_ADDRESS)"
 
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index a0ed9dbcac..2cefa82e50 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -70,6 +70,7 @@
 #endif
 
 #ifdef SMBV
+// Rohde&Schwarz SMBV100A vector signal generator
 #include "PHY/TOOLS/smbv.h"
 char smbv_fname[] = "smbv_config_file.smbv";
 unsigned short smbv_nframes = 4; // how many frames to configure 1,..,4
@@ -87,13 +88,12 @@ char smbv_ip[16];
 #include "cor_SF_sim.h"
 #include "UTIL/OMG/omg_constants.h"
 #include "UTIL/FIFO/pad_list.h"
+#include "enb_app.h"
 
-//#ifdef PROC
 #include "../PROC/interface.h"
 #include "../PROC/channel_sim_proc.h"
 #include "../PROC/Tsync.h"
 #include "../PROC/Process.h"
-//#endif
 
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "UTIL/OTG/otg_kpi.h"
@@ -104,10 +104,6 @@ char smbv_ip[16];
 # include "create_tasks.h"
 #endif
 
-#define RF                    1
-#define MCS_COUNT             24 /*added for PHY abstraction */
-#define N_TRIALS              1
-
 /*
  DCI0_5MHz_TDD0_t          UL_alloc_pdu;
  DCI1A_5MHz_TDD_1_6_t      CCCH_alloc_pdu;
@@ -149,10 +145,8 @@ extern double snr_step;
 extern uint8_t set_sinr;
 extern uint8_t ue_connection_test;
 extern uint8_t set_seed;
-uint8_t cooperation_flag; // for cooperative communication
 extern uint8_t target_dl_mcs;
 extern uint8_t target_ul_mcs;
-uint8_t rate_adaptation_flag;
 extern uint8_t abstraction_flag;
 extern uint8_t ethernet_flag;
 extern uint16_t Nid_cell;
@@ -230,7 +224,11 @@ help (void) {
     printf ("-U Set the mobility model for UE, options are: STATIC, RWP, RWALK\n");
     printf ("-V [vcd_file] Enable VCD dump into vcd_file\n");
     printf ("-w number of CBA groups, if not specified or zero, CBA is inactive\n");
-    printf ("-W IP address to connect to SMBV and configure SMBV from config file. Requires compilation with SMBV=1, -W0 uses default IP 192.168.12.201\n");
+#ifdef SMBV
+    printf ("-W IP address to connect to Rohde&Schwarz SMBV100A and configure SMBV from config file. -W0 uses default IP 192.168.12.201\n");
+#else
+    printf ("-W [Rohde&Schwarz SMBV100A functions disabled. Recompile with SMBV=1]\n");
+#endif
     printf ("-x Set the transmission mode (1,2,5,6 supported for now)\n");
     printf ("-Y Set the global log verbosity (none, low, medium, high, full) \n");
     printf ("-z Set the cooperation flag (0 for no cooperation, 1 for delay diversity and 2 for distributed alamouti\n");
@@ -240,7 +238,7 @@ help (void) {
 pthread_t log_thread;
 
 void
-log_thread_init () {
+log_thread_init (void) {
     //create log_list
     //log_list_init(&log_list);
 #ifndef LOG_NO_THREAD
@@ -263,7 +261,7 @@ log_thread_init () {
 
 //Call it after the last LOG call
 int
-log_thread_finalize () {
+log_thread_finalize (void) {
     int err = 0;
 
 #ifndef LOG_NO_THREAD
@@ -404,7 +402,6 @@ l2l1_task_state_t l2l1_state = L2L1_WAITTING;
 void *
 l2l1_task (void *args_p) {
 
-    clock_t t;
     int CC_id;
 
     // Framing variables
@@ -603,14 +600,6 @@ l2l1_task (void *args_p) {
         if (oai_emulation.info.oeh_enabled == 1)
             execute_events (frame);
 
-        /*
-         // Handling the cooperation Flag
-         if (cooperation_flag == 2)
-         {
-         if ((PHY_vars_eNB_g[0]->eNB_UE_stats[0].mode == PUSCH) && (PHY_vars_eNB_g[0]->eNB_UE_stats[1].mode == PUSCH))
-         PHY_vars_eNB_g[0]->cooperation_flag = 2;
-         }
-         */
         if (ue_connection_test == 1) {
             if ((frame % 20) == 0) {
                 snr_dB += snr_direction;
@@ -1124,6 +1113,7 @@ l2l1_task (void *args_p) {
 #endif
 
 #ifdef SMBV
+        // Rohde&Schwarz SMBV100A vector signal generator
         if ((frame == config_frames[0]) || (frame == config_frames[1]) || (frame == config_frames[2]) || (frame == config_frames[3])) {
             smbv_frame_cnt++;
         }
@@ -1164,36 +1154,21 @@ l2l1_task (void *args_p) {
 int
 main (int argc, char **argv) {
 
-    int32_t i;
-    // pointers signal buffers (s = transmit, r,r0 = receive)
     clock_t t;
 
-    //FILE *SINRpost;
-    //char SINRpost_fname[512];
-    // sprintf(SINRpost_fname,"postprocSINR.m");
-    //SINRpost = fopen(SINRpost_fname,"w");
-    // variables/flags which are set by user on command-line
-
 #ifdef SMBV
+    // Rohde&Schwarz SMBV100A vector signal generator
     strcpy(smbv_ip,DEFAULT_SMBV_IP);
 #endif
 
-    // time calibration for soft realtime mode  
-    char pbch_file_path[512];
-    FILE *pbch_file_fd;
-
 #ifdef PROC
     int node_id;
     int port,Process_Flag=0,wgt,Channel_Flag=0,temp;
 #endif
-    //double **s_re2[MAX_eNB+MAX_UE], **s_im2[MAX_eNB+MAX_UE], **r_re2[MAX_eNB+MAX_UE], **r_im2[MAX_eNB+MAX_UE], **r_re02, **r_im02;
-    //double **r_re0_d[MAX_UE][MAX_eNB], **r_im0_d[MAX_UE][MAX_eNB], **r_re0_u[MAX_eNB][MAX_UE],**r_im0_u[MAX_eNB][MAX_UE];
     //default parameters
-    rate_adaptation_flag = 0;
     oai_emulation.info.n_frames = 0xffff; //1024;          //10;
     oai_emulation.info.n_frames_flag = 0; //fixme
     snr_dB = 30;
-    cooperation_flag = 0; // default value 0 for no cooperation, 1 for Delay diversity, 2 for Distributed Alamouti
 
     //Default values if not changed by the user in get_simulation_options();
     pdcp_period = 1;
@@ -1259,6 +1234,7 @@ main (int argc, char **argv) {
     init_ocm ();
 
 #ifdef SMBV
+    // Rohde&Schwarz SMBV100A vector signal generator
     smbv_init_config(smbv_fname, smbv_nframes);
     smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms);
 #endif
@@ -1297,7 +1273,6 @@ main (int argc, char **argv) {
     LOG_I(EMU, "Duration of the simulation: %f seconds\n",
           ((float) t) / CLOCKS_PER_SEC);
 
-    //  fclose(SINRpost);
     LOG_N(EMU,
           ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU Ending <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
 
@@ -1721,15 +1696,15 @@ sigh (void *arg) {
 void
 oai_shutdown (void) {
     static int done = 0;
-    int i;
-    char interfaceName[8];
 
     if (done)
         return;
 
     free (otg_pdcp_buffer);
+    otg_pdcp_buffer = 0;
 
 #ifdef SMBV
+    // Rohde&Schwarz SMBV100A vector signal generator
     if (config_smbv) {
         smbv_send_config (smbv_fname,smbv_ip);
     }
@@ -1764,7 +1739,7 @@ oai_shutdown (void) {
          #endif
          */
 
-        for (i = 0; i < 2; i++) {
+        for (int i = 0; i < 2; i++) {
             free (s_re[i]);
             free (s_im[i]);
             free (r_re[i]);
@@ -1774,6 +1749,10 @@ oai_shutdown (void) {
         free (s_im);
         free (r_re);
         free (r_im);
+        s_re = 0;
+        s_im = 0;
+        r_re = 0;
+        r_im = 0;
 
         lte_sync_time_free ();
     }
@@ -1782,9 +1761,11 @@ oai_shutdown (void) {
     if (oai_emulation.info.ocm_enabled == 1) {
         for (eNB_inst = 0; eNB_inst < NUMBER_OF_eNB_MAX; eNB_inst++) {
             free (enb_data[eNB_inst]);
+            enb_data[eNB_inst] = 0;
         }
         for (UE_inst = 0; UE_inst < NUMBER_OF_UE_MAX; UE_inst++) {
             free (ue_data[UE_inst]);
+            ue_data[UE_inst] = 0;
         }
     } //End of PHY abstraction changes
 
@@ -1799,8 +1780,10 @@ oai_shutdown (void) {
                     omv_end (pfd[1], omv_data);
 #endif
     if ((oai_emulation.info.ocm_enabled == 1) && (ethernet_flag == 0)
-                    && (ShaF != NULL))
+                    && (ShaF != NULL)) {
         destroyMat (ShaF, map1, map2);
+        ShaF = 0;
+    }
 
     if ((oai_emulation.info.opt_enabled == 1))
         terminate_opt ();
@@ -1808,16 +1791,18 @@ oai_shutdown (void) {
     if (oai_emulation.info.cli_enabled)
         cli_server_cleanup ();
 
-    for (i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++)
+    for (int i = 0; i < NUMBER_OF_eNB_MAX + NUMBER_OF_UE_MAX; i++)
         if (oai_emulation.info.oai_ifup[i] == 1) {
-            sprintf (interfaceName, "oai%d", i);
+            char interfaceName[8];
+            snprintf (interfaceName, sizeof(interfaceName), "oai%d", i);
             bringInterfaceUp (interfaceName, 0);
         }
 
     log_thread_finalize ();
     logClean ();
     vcd_signal_dumper_close ();
-    done = 1;
+
+    done = 1; // prevent next invokation of this function
 
     LOG_N(EMU,
           ">>>>>>>>>>>>>>>>>>>>>>>>>>> OAIEMU shutdown <<<<<<<<<<<<<<<<<<<<<<<<<<\n\n");
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 049d2de9a7..cf69389529 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -88,7 +88,6 @@ int           otg_times             = 0;
 int           if_times              = 0;
 int           for_times             = 0;
 
-static char  *conf_config_file_name = NULL;
 uint16_t           Nid_cell              = 0; //needed by init_lte_vars
 int           nb_antennas_rx        = 2; // //
 uint8_t            target_dl_mcs         = 16; // max mcs used by MAC scheduler
@@ -162,6 +161,7 @@ extern time_stats_t ul_chan_stats;
 void get_simulation_options(int argc, char *argv[]) {
   int                           option;
   const Enb_properties_array_t *enb_properties;
+  char  *conf_config_file_name = NULL;
 
   enum long_option_e {
     LONG_OPTION_START = 0x100, /* Start after regular single char options */
@@ -231,6 +231,7 @@ void get_simulation_options(int argc, char *argv[]) {
       switch (option) {
       case LONG_OPTION_ENB_CONF:
         if (optarg) {
+            free(conf_config_file_name); // prevent memory leak if option is used multiple times
             conf_config_file_name = strdup(optarg);
             printf("eNB configuration file is %s\n", conf_config_file_name);
         }
@@ -508,7 +509,10 @@ void get_simulation_options(int argc, char *argv[]) {
         break;
 
       case 'O':
-        conf_config_file_name = optarg;
+        if (optarg) {
+            free(conf_config_file_name); // prevent memory leak if option is used multiple times
+            conf_config_file_name = strdup(optarg);
+        }
         break;
 
       case 'o':
@@ -677,6 +681,9 @@ void get_simulation_options(int argc, char *argv[]) {
       oai_emulation.info.tdd_config_S[0] =         enb_properties->properties[0]->tdd_config_s[0];
       oai_emulation.info.extended_prefix_flag[0] = enb_properties->properties[0]->prefix_type[0];
     }
+
+    free(conf_config_file_name);
+    conf_config_file_name = 0;
 }
 
 void check_and_adjust_params(void) {
@@ -834,12 +841,12 @@ void init_openair1(void) {
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK;
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_RI_Index  = beta_RI;
           PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_CQI_Index = beta_CQI;
-          ((PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
+          PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_A = rho_B
 	
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = beta_ACK;
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_RI_Index  = beta_RI;
 	  PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = beta_CQI;
-	  ((PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms).pdsch_config_common).p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_a = rhob
+          PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_A = rho_B
 	}
       }
   }
diff --git a/targets/TEST/OAI/case01.py b/targets/TEST/OAI/case01.py
index fcc54e4d44..a45850b03a 100644
--- a/targets/TEST/OAI/case01.py
+++ b/targets/TEST/OAI/case01.py
@@ -48,6 +48,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send_recv('cd $OPENAIR_TARGETS;')   
  
     try:
+        log.start()
         test = '00'
         name = 'Check oai.svn.add'
         conf = 'svn st -q | grep makefile'
@@ -68,6 +69,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('mkdir ' + logdir + ';')
     
     try:
+        log.start()
         test = '01'
         name = 'Compile oai.rel8.make'
         conf = 'make'
@@ -84,8 +86,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
-        
+
     try:
+        log.start()
         test = '02'
         name = 'Compile oai.rel8.nas.make'
         conf = 'make nasmesh_fix; make NAS=1'
@@ -97,6 +100,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         trace = logdir + '/log_' + case + test + '_1.txt;'
         tee = ' 2>&1 | tee ' + trace
         oai.send_expect_false('make nasmesh_fix' + tee, makerr1,  60)
+        oai.send('cp $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko .')
         trace = logdir + '/log_' + case + test + '_2.txt;'
         tee = ' 2>&1 | tee ' + trace
         oai.send_expect_false('make NAS=1 JF=1 -j4' + tee, makerr1,  1500)
@@ -112,6 +116,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd RT/USER;')   
 
     try:
+        log.start()
         test = '03'
         name = 'Compile oai.rel8.rf.make' 
         conf = 'make RTAI=0 EXMIMO=1 Rel8=1'
@@ -131,6 +136,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd SIMULATION/LTE_PHY;')   
 
     try:
+        log.start()
         test = '04'
         name = 'Compile oai.rel8.phy.dlsim.make' 
         conf = 'make dlsim'
@@ -148,6 +154,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '05'
         name = 'Compile oai.rel8.phy.ulsim.make' 
         conf = 'make ulsim'
@@ -168,6 +175,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd SIMU/USER;')   
     
     try:
+        log.start()
         test = '06'
         name = 'Compile oai.rel8.itti.make' 
         conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
@@ -185,6 +193,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '07'
         name = 'Compile oai.rel10.make' 
         conf = 'make RLC_STOP_ON_LOST_PDU=1 Rel10=1'
@@ -204,6 +213,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '08'
         name = 'Compile oai.rel10.itti.make' 
         conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
@@ -219,7 +229,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         rv = 0
     else:
         log.ok(case, test, name, conf, '', logfile)
+
     try:
+        log.start()
         test = '13'
         name = 'Compile oai_nw_ether IP driver' 
         conf = 'make oai_nw_drv'
@@ -237,7 +249,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
         log.ok(case, test, name, conf, '', logfile)
+    
     try:
+        log.start()
         test = '14'
         name = 'Compile oai.rel8.itti.ral.make' 
         conf = 'make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1'
@@ -254,7 +268,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.fail(case, test, name, conf, e.value, diag, logfile,trace)
     else:
         log.ok(case, test, name, conf, '', logfile)
+
     try:
+        log.start()
         test = '15'
         name = 'Compile oai.rel10.itti.ral.make' 
         conf = 'make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
diff --git a/targets/TEST/OAI/case02.py b/targets/TEST/OAI/case02.py
index 274a23596a..b90209fbfb 100644
--- a/targets/TEST/OAI/case02.py
+++ b/targets/TEST/OAI/case02.py
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd SIMU/USER;')
     
     try:
+        log.start()
         test = '00'
         name = 'Run oai.rel8.sf'
         conf = '-a -A AWGN -n 100'
@@ -71,6 +72,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '01'
         name = 'Run oai.rel8.err'
         conf = '-a -A AWGN -n 100 -l7'
@@ -85,6 +87,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
         
     try:
+        log.start()
         test = '02'
         name = 'Run oai.rel8.abs.rrc'
         diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -100,6 +103,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
         
     try:
+        log.start()
         test = '03'
         name = 'Run oai.rel8.abs.ping'
         diag = 'Data-plane is not working normally, check the OAI protocol stack, OAI driver, and normal operation of the OS'
@@ -123,12 +127,13 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
 
                     oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' +  str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 20)
                 if user == 'root' :
-                    oai.send('pkill oaisim.rel8.nas.'+host)
-                    oai.send('pkill oaisim.rel8.nas.'+host)
+                    oai.send('pkill -f oaisim.rel8.nas.'+host)
+                    time.sleep(1)
+                    oai.send('pkill -f -KILL oaisim.rel8.nas.'+host)
                 else :
-                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
+                    oai.send('echo '+pw+ ' | sudo -S pkill -f oaisim.rel8.nas.'+host)
                     time.sleep(1)
-                    oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
+                    oai.send('echo '+pw+ ' | sudo -S pkill -f -KILL oaisim.rel8.nas.'+host)
         
         oai.rm_driver(oai,user,pw)
 
@@ -138,6 +143,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
         
     try:
+        log.start()
         test = '04'
         name = 'Run oai.rel8.phy.rrc'
         diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -153,6 +159,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '05'
         name = 'Run oai.rel8.phy.rrc.fdd'
         diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -168,6 +175,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '06'
         name = 'Run oai.rel8.itti.abs.rrc'
         diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.band7.generic.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -188,6 +196,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         
 
     try:
+        log.start()
         test='07'
         name = 'Run oai.rel8.abs.ocg.otg'
         diag = 'Check the scenario if the tests 0202 and 0203 are passed.'
diff --git a/targets/TEST/OAI/case03.py b/targets/TEST/OAI/case03.py
index 296bb488ca..0116f7c4c1 100644
--- a/targets/TEST/OAI/case03.py
+++ b/targets/TEST/OAI/case03.py
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd SIMU/USER;')
     
     try:
+        log.start()
         test = '00'
         name = 'Run oai.rel10.sf'
         conf = '-a -A AWGN -l7 -n 100'
@@ -71,6 +72,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '01'
         name = 'Run oai.rel10.err'
         conf = '-a -A AWGN -l7 -n 100'
@@ -85,6 +87,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
         
     try:
+        log.start()
         test = '02'
         name = 'Run oai.rel10.abs.rrc'
         diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -100,6 +103,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)    
 
     try:
+        log.start()
         test = '03'
         name = 'Run oai.rel10.phy.rrc'
         diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
@@ -115,6 +119,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)  
 
     try:
+        log.start()
         test = '04'
         name = 'Run oai.rel10.phy.rrc.fdd'
         diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
diff --git a/targets/TEST/OAI/case04.py b/targets/TEST/OAI/case04.py
index f1b26c0785..e271d2c6e7 100644
--- a/targets/TEST/OAI/case04.py
+++ b/targets/TEST/OAI/case04.py
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
     oai.send('cd SIMULATION/LTE_PHY;')   
     
     try:
+        log.start()
         test = '00'
         name = 'Perf oai.dlsim.sanity'
         conf = '-a -A AWGN -n 100'
@@ -71,6 +72,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
     
     try:
+        log.start()
         test = '01'
         name = 'Perf oai.dlsim.test1'
         diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
@@ -99,6 +101,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
 #        log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '06'
         name = 'Perf oai.dlsim.test6'
         diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
@@ -113,6 +116,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '06b'
         name = 'Perf oai.dlsim.test6b'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
@@ -127,6 +131,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '07'
         name = 'Perf oai.dlsim.test7'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
@@ -142,6 +147,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
 
 
     try:
+        log.start()
         test = '07b'
         name = 'Perf oai.dlsim.test7b'
         diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)'
@@ -156,6 +162,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '10'
         name = 'Perf oai.dlsim.test10'
         diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
@@ -170,6 +177,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '10b'
         name = 'Perf oai.dlsim.test10b'
         diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
@@ -184,6 +192,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '11'
         name = 'Perf oai.dlsim.test11'
         diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
diff --git a/targets/TEST/OAI/case05.py b/targets/TEST/OAI/case05.py
index 46f50bba87..2cb5715f08 100644
--- a/targets/TEST/OAI/case05.py
+++ b/targets/TEST/OAI/case05.py
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
     oai.send('cd SIMULATION/LTE_PHY;')   
     
     try:
+        log.start()
         test = '00'
         name = 'Perf oai.dlsim.sanity'
         conf = '-a -A AWGN -n 100'
@@ -71,6 +72,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
     
     try:
+        log.start()
         test = '01'
         name = 'Perf oai.ulsim.test1'
         diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
@@ -86,6 +88,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
         
     try:
+        log.start()
         test = '06'
         name = 'Perf oai.ulsim.test5'
         diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
@@ -101,6 +104,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '06'
         name = 'Perf oai.ulsim.test6'
         diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
@@ -116,6 +120,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '06b'
         name = 'Perf oai.ulsim.test6b'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
@@ -131,6 +136,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
   
     try:
+        log.start()
         test = '07'
         name = 'Perf oai.ulsim.test7'
         diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
@@ -146,6 +152,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '10'
         name = 'Perf oai.ulsim.test10'
         diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
@@ -161,6 +168,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '10b'
         name = 'Perf oai.ulsim.test10b'
         diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
@@ -176,6 +184,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '11'
         name = 'Perf oai.ulsim.test11'
         diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
diff --git a/targets/TEST/OAI/case11.py b/targets/TEST/OAI/case11.py
index 69319ff4af..18d619f896 100644
--- a/targets/TEST/OAI/case11.py
+++ b/targets/TEST/OAI/case11.py
@@ -50,6 +50,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
     oai.send('cd SIMULATION/LTE_PHY;')   
 
     try:
+        log.start()
         test = '01'
         name = 'Compile oai.rel8.phy.dlsim.make' 
         conf = 'make dlsim'  # PERFECT_CE=1 # for perfect channel estimation
@@ -68,6 +69,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
         log.ok(case, test, name, conf, '', logfile)
 
     try:
+        log.start()
         test = '02'
         name = 'Compile oai.rel8.phy.ulsim.make' 
         conf = 'make ulsim'
diff --git a/targets/TEST/OAI/case12.py b/targets/TEST/OAI/case12.py
index a4bb736c15..cc46dbc2a3 100644
--- a/targets/TEST/OAI/case12.py
+++ b/targets/TEST/OAI/case12.py
@@ -74,6 +74,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,cpu):
     oai.send('cd $OPENAIR1_DIR;')     
     oai.send('cd SIMULATION/LTE_PHY;')   
     try:
+        log.start()
         test = '200'
         name = 'Run oai.dlsim.sanity'
         conf = '-a -n 100'
@@ -94,6 +95,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,cpu):
         log.ok(case, test, name, conf, '', logfile)
     
     try:
+        log.start()
         test = 210
        
         name = 'Run oai.dlsim.perf.'+str(PERF)+'%'
diff --git a/targets/TEST/OAI/case13.py b/targets/TEST/OAI/case13.py
index a4ccf13d85..d178188ab9 100644
--- a/targets/TEST/OAI/case13.py
+++ b/targets/TEST/OAI/case13.py
@@ -73,6 +73,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug,cpu):
     oai.send('cd SIMULATION/LTE_PHY;')   
     
     try:
+        log.start()
         test = '300'
         name = 'Run oai.ulsim.sanity'
         conf = '-a -n 100'
@@ -93,6 +94,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug,cpu):
         log.ok(case, test, name, conf, '', logfile)
     
     try:
+        log.start()
         test = 310
         name = 'Run oai.ulsim.perf.'+str(PERF)+'%'
         diag = 'no diagnostic is available, check the log file'
diff --git a/targets/TEST/OAI/log.py b/targets/TEST/OAI/log.py
index ef56250637..0b4baff3e9 100644
--- a/targets/TEST/OAI/log.py
+++ b/targets/TEST/OAI/log.py
@@ -39,14 +39,24 @@ import re
 import time
 import datetime
 import array
+import xml.etree.ElementTree as ET
 
 
 debug = False
 docfile = ''
 start_time = time.time()
+testcase_starttime = start_time
 debug = 0
 stats = {'passed':0, 'failed':0, 'skipped':0, 'internal_errors':0, 'cmd':0}
 
+# xml result (jUnit like)
+xUnitTestsuites = ET.Element( 'testsuites' )
+xUnitTestsuite = ET.SubElement( xUnitTestsuites, 'testsuite' )
+xUnitTestsuite.set( 'name', 'OAI' )
+xUnitTestsuite.set( 'timestamp', datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%dT%H:%M:%S') )
+xUnitTestsuite.set( 'hostname', 'localhost' )
+#xUnitSystemOut = ET.SubElement( xUnitTestsuite, 'system-out' )
+
 class bcolors:
     header = '\033[95m'
     okblue = '\033[94m'
@@ -55,6 +65,10 @@ class bcolors:
     fail = '\033[91m'
     normal = '\033[0m'
     
+    def __init__(self):
+        if not sys.stdout.isatty():
+            self.disable()
+
     def disable(self):
         self.header = ''
         self.okblue = ''
@@ -78,6 +92,11 @@ def writefile(logfile, message):
 def sleep(seconds):
         time.sleep(seconds)
 
+def start():
+    """Start the timer for the following testcase."""
+    global testcase_starttime
+    testcase_starttime = time.time()
+
 def set_debug_level(level):
     debug = level
 
@@ -116,6 +135,14 @@ def statistics(logfile):
     writefile(logfile, 'Testing pass rate                    ' + repr((stats['passed'] * 100) / total_tests) + '%')
     writefile(logfile, '===============================================\n')
     
+    xUnitTestsuite.set( 'tests', repr(total_tests) )
+    xUnitTestsuite.set( 'failures', repr(stats['failed']) )
+    xUnitTestsuite.set( 'skipped', repr(stats['skipped']) )
+    xUnitTestsuite.set( 'errors', '0' )
+    time_delta = datetime.datetime.now() - datetime.datetime.fromtimestamp(start_time)
+    xUnitTestsuite.set( 'time', repr(time_delta.total_seconds()) )
+    writefile( logfile + '.xml', ET.tostring( xUnitTestsuites, encoding="utf-8", method="xml" ) )
+
 def log_record(level, message):
     ts = time.strftime('%d %b %Y %H:%M')
     message = ts + ' [' + level + '] ' + message
@@ -167,5 +194,13 @@ def report(case, test, name, conf, status, output, diag=None, desc=None):
     if desc:
         writefile(output, desc)
     #log_record('report', + case + test + ' documented')
-  
-    
+    e = ET.SubElement( xUnitTestsuite, 'testcase' )
+    e.set( 'name', case + '_' + test + '_' + name )
+    e.set( 'classname', 'shellscript' )
+    e.set( 'time', repr( time.time() - testcase_starttime ) )
+    if status == 'failed':
+        e = ET.SubElement( e, 'failure' )
+        e.set( 'message', 'failed' )
+        e.text = diag
+    if status == 'skipped':
+        e = ET.SubElement( e, 'skipped' )
diff --git a/targets/TEST/OAI/openair.py b/targets/TEST/OAI/openair.py
index 94d42611a4..78c319c981 100644
--- a/targets/TEST/OAI/openair.py
+++ b/targets/TEST/OAI/openair.py
@@ -132,8 +132,26 @@ class openair(core):
             except Exception, val:
                 time.sleep(5)
                 print "Error:", val
- 
+
+    def connect_localshell(self, prompt='$'):
+        self.prompt1 = prompt
+        self.prompt2 = prompt
+
+        while 1:
+            try:
+                # start a shell and use the current environment
+                self.oai = pexpect.spawn('bash --norc --noprofile')
                 
+                index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
+                if index == 0 :
+                    return 'Ok'
+                else :
+                    sys.exit(1)
+
+            except Exception, val:
+                time.sleep(5)
+                print "Error:", val
+
     def disconnect(self):
         print 'disconnecting the ssh connection to ' + self.address + '\n'
         self.oai.send('exit')
diff --git a/targets/TEST/OAI/test01.py b/targets/TEST/OAI/test01.py
index 0c77f57bbb..09418dd54f 100644
--- a/targets/TEST/OAI/test01.py
+++ b/targets/TEST/OAI/test01.py
@@ -57,6 +57,7 @@ debug = 0
 pw =''
 i = 0
 dlsim=0
+localshell=0
 
 for arg in sys.argv:
     if arg == '-d':
@@ -69,11 +70,14 @@ for arg in sys.argv:
         pw = sys.argv[i+1]
     elif arg == '-P' :
         dlsim = 1
+    elif arg == '-l' :
+        localshell = 1
     elif arg == '-h' :
         print "-d:  low debug level"
         print "-dd: high debug level"
         print "-p:  set the prompt"
         print "-w:  set the password for ssh to localhost"
+        print "-l:  use local shell instead of ssh connection"
         sys.exit()
     i= i + 1     
 
@@ -99,26 +103,29 @@ except KeyError:
 host = os.uname()[1]
 oai = openair('localdomain','localhost')
 #start_time = time.time()  # datetime.datetime.now()
-try: 
-    user = getpass.getuser()
-    print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
-    print '******* Connecting to the localhost to perform the test *******\n'
-   
-    if not pw :
-        print "username: " + user 
-        pw = getpass.getpass() 
-    else :
-        print "username: " + user 
-        #print "password: " + pw 
-
-       # issues in ubuntu 12.04
-    #  oai.connect(user,pw)
-    oai.connect2(user,pw) 
-    #oai.get_shell()
-except :
-    print 'Fail to connect to the local host'
-    sys.exit(1)
-
+user = getpass.getuser()
+if localshell == 0:
+    try: 
+        print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
+        print '******* Connecting to the localhost to perform the test *******\n'
+    
+        if not pw :
+            print "username: " + user 
+            pw = getpass.getpass() 
+        else :
+            print "username: " + user 
+            #print "password: " + pw 
+
+        # issues in ubuntu 12.04
+        #  oai.connect(user,pw)
+        oai.connect2(user,pw) 
+        #oai.get_shell()
+    except :
+        print 'Fail to connect to the local host'
+        sys.exit(1)
+else:
+    pw = ''
+    oai.connect_localshell()
 
 test = 'test01'
 ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
diff --git a/targets/TEST/OAI/test02.py b/targets/TEST/OAI/test02.py
index db4d48e456..037d48cf98 100644
--- a/targets/TEST/OAI/test02.py
+++ b/targets/TEST/OAI/test02.py
@@ -58,6 +58,7 @@ i = 0
 clean = 0 
 start_case  = 0
 cpu = -1 
+localshell=0
 
 for arg in sys.argv:
     if arg == '-d':
@@ -74,6 +75,8 @@ for arg in sys.argv:
         cpu = sys.argv[i+1]
     elif arg == '-s' :
         start_case = sys.argv[i+1]
+    elif arg == '-l' :
+        localshell = 1
     elif arg == '-h' :
         print "-d:  low debug level"
         print "-dd: high debug level"
@@ -81,6 +84,7 @@ for arg in sys.argv:
         print "-w:  set the password for ssh to localhost"
         print "-c: clean the log directory " 
         print "-t: set the cpu "
+        print "-l:  use local shell instead of ssh connection"
         sys.exit()
     i= i + 1     
 
@@ -106,28 +110,32 @@ host = os.uname()[1]
 # get the oai object
 oai = openair('localdomain','localhost')
 #start_time = time.time()  # datetime.datetime.now()
-try: 
-    user = getpass.getuser()
-    print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
-    if cpu > -1 :
-        print '******* Connecting to the localhost <'+host+'> to perform the test on CPU '+str(cpu)+' *******\n'
-    else :
-        print '******* Connecting to the localhost <'+host+'> to perform the test *******\n'
-   
-    if not pw :
-        print "username: " + user 
-        pw = getpass.getpass() 
-    else :
-        print "username: " + user 
-        #print "password: " + pw 
-    print "prompt:   " + prompt
+user = getpass.getuser()
+if localshell == 0:
+    try: 
+        print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
+        if cpu > -1 :
+            print '******* Connecting to the localhost <'+host+'> to perform the test on CPU '+str(cpu)+' *******\n'
+        else :
+            print '******* Connecting to the localhost <'+host+'> to perform the test *******\n'
     
-    oai.connect(user,pw,prompt)
-    #oai.get_shell()
-except :
-    print 'Fail to connect to the local host'
-    sys.exit(1)
-
+        if not pw :
+            print "username: " + user 
+            pw = getpass.getpass() 
+        else :
+            print "username: " + user 
+            #print "password: " + pw 
+        print "prompt:   " + prompt
+        
+        oai.connect(user,pw,prompt)
+        #oai.get_shell()
+    except :
+        print 'Fail to connect to the local host'
+        sys.exit(1)
+else:
+    pw = ''
+    print "prompt:   " + prompt
+    oai.connect_localshell(prompt)
 
 test = 'test02'
 ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
-- 
GitLab