From 7292fb2505d257478e869f595427038d9cca7060 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Wed, 15 Jan 2020 12:56:52 +0100
Subject: [PATCH] NR-UE: fix temporarly the build. Quite dirty.

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 cmake_targets/CMakeLists.txt                  |  5 +-
 executables/nr-ue.c                           | 16 ++++++
 executables/nr-uesoftmodem.c                  | 10 ++++
 openair1/PHY/INIT/nr_init_ue.c                |  2 +
 openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h |  7 +++
 .../PHY/NR_UE_ESTIMATION/nr_ue_measurements.c | 10 ++--
 openair1/PHY/NR_UE_TRANSPORT/dci_nr.c         | 20 +++----
 .../nr_dlsch_llr_computation.c                | 44 ++++++++--------
 .../NR_UE_TRANSPORT/nr_transport_proto_ue.h   | 16 +++---
 openair1/PHY/phy_vars_nr_ue.h                 |  2 +
 openair1/SCHED_NR_UE/defs.h                   |  2 +-
 openair1/SCHED_NR_UE/phy_procedures_nr_ue.c   | 52 ++++++++++---------
 .../SCHED_NR_UE/pucch_power_control_ue_nr.c   |  3 +-
 openair1/SCHED_NR_UE/pucch_uci_ue_nr.c        | 11 ++--
 openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c  |  4 +-
 openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c       | 18 +++++++
 16 files changed, 147 insertions(+), 75 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index 6f9e9239390..2bff30d5e73 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -1722,6 +1722,7 @@ set(NR_L2_SRC_UE
   ${NR_UE_RRC_DIR}/L2_interface_ue.c
   ${NR_UE_RRC_DIR}/main_ue.c
   ${NR_UE_RRC_DIR}/rrc_UE.c
+  ${LTE_RLC_SRC}
   )
 
 set (MAC_SRC
@@ -2612,6 +2613,7 @@ add_executable(nr-uesoftmodem
   ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
   ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
   ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
+  ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
   ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
   ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
   ${OPENAIR_DIR}/common/utils/utils.c
@@ -2627,7 +2629,8 @@ target_link_libraries (nr-uesoftmodem
   -Wl,--start-group
   RRC_LIB NR_RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
   ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} 
-  PHY_COMMON PHY_NR_UE PHY_RU LFDS L2_UE NR_L2_UE MAC_NR_COMMON NFAPI_USER_LIB S1AP_LIB S1AP_ENB
+  PHY_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS L2_UE NR_L2_UE MAC_NR_COMMON S1AP_LIB S1AP_ENB
+  NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
   -Wl,--end-group z dl)
 
 target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES})
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 92bcc743bc9..e2ef2f69428 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -55,6 +55,9 @@
   extern char do_forms;
 #endif
 
+// Missing stuff?
+int next_ra_frame = 0;
+module_id_t next_Mod_id = 0;
 
 extern double cpuf;
 //static  nfapi_nr_config_request_t config_t;
@@ -845,3 +848,16 @@ void init_NR_UE(int nb_inst) {
   printf("UE threads created by %ld\n", gettid());
 }
 
+/* HACK: this function is needed to compile the UE
+ * fix it somehow
+ */
+int8_t find_dlsch(uint16_t rnti,
+                  PHY_VARS_eNB *eNB,
+                  find_type_t type)
+{
+  printf("you cannot read this\n");
+  abort();
+}
+
+void multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP) {}
+
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index d3e93000538..0887a2ef21d 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -111,6 +111,16 @@ static pthread_t forms_thread; //xforms
 #include "executables/softmodem-common.h"
 #include "executables/thread-common.h"
 
+// Raphael : missing
+pthread_cond_t nfapi_sync_cond;
+pthread_mutex_t nfapi_sync_mutex;
+int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
+uint16_t sf_ahead=6; //??? value ???
+pthread_cond_t sync_cond;
+pthread_mutex_t sync_mutex;
+int sync_var=-1; //!< protected by mutex \ref sync_mutex.
+int config_sync_var=-1;
+
 RAN_CONTEXT_t RC;
 volatile int             start_eNB = 0;
 volatile int             start_UE = 0;
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 0c7ce1cdd65..ca92c384a51 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -357,6 +357,7 @@ void phy_config_dedicated_scell_ue(uint8_t Mod_id,
 }
 #endif
 
+#if 0
 void phy_config_harq_ue(module_id_t Mod_id,
                         int CC_id,
                         uint8_t eNB_id,
@@ -368,6 +369,7 @@ void phy_config_harq_ue(module_id_t Mod_id,
     for (num_of_code_words=0; num_of_code_words<NR_MAX_NB_CODEWORDS; num_of_code_words++)
       phy_vars_ue->ulsch[num_of_threads][eNB_id][num_of_code_words]->Mlimit = max_harq_tx;
 }
+#endif
 
 extern uint16_t beta_cqi[16];
 
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
index 3e1a579e89d..ba328e39ec2 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h
@@ -90,4 +90,11 @@ void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
                         uint32_t rx_power_fil_dB,
                         uint8_t eNB_id);
 
+/*! \brief Function to return the path-loss based on the UE cell-specific reference signal strength and transmission power of eNB
+@param Mod_id Module ID for UE
+@param eNB_index Index of eNB on which to act
+@returns Path loss in dB
+ */
+int16_t nr_get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
+
 #endif
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
index 092fdfd1fc8..ac9713fec27 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
@@ -34,6 +34,7 @@
 //#define DEBUG_MEAS_UE
 //#define DEBUG_RANK_EST
 
+#if 0
 int16_t cond_num_threshold = 0;
 
 void print_shorts(char *s,short *x)
@@ -54,8 +55,9 @@ void print_ints(char *s,int *x)
         );
 
 }
+#endif
 
-int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
+int16_t nr_get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
 {
 
   PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
@@ -69,7 +71,7 @@ int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
     RSoffset = 3;
   */
 
- /* LOG_D(PHY,"get_PL : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n", 
+ /* LOG_D(PHY,"nr_get_PL : rsrp %f dBm/RE (%f), eNB power %d dBm/RE\n", 
         (1.0*dB_fixed_times10(ue->measurements.rsrp[eNB_index])-(10.0*ue->rx_total_gain_dB))/10.0,
         10*log10((double)ue->measurements.rsrp[eNB_index]),
         ue->frame_parms.pdsch_config_common.referenceSignalPower);*/
@@ -79,9 +81,9 @@ int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index)
                     //        dB_fixed_times10(RSoffset*12*ue_g[Mod_id][CC_id]->frame_parms.N_RB_DL) +
                     //(ue->frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
 }
-#if 0
 
 
+#if 0
 uint8_t get_n_adj_cells (module_id_t Mod_id,uint8_t CC_id)
 {
 
@@ -456,6 +458,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
 }
 #endif
 
+#if 0
 void conjch0_mult_ch1(int *ch0,
                       int *ch1,
                       int32_t *ch0conj_ch1,
@@ -696,6 +699,7 @@ void numer(int32_t *Hh_h_00_sq,
   _m_empty();
 }
 
+#endif
 
 void nr_ue_measurements(PHY_VARS_NR_UE *ue,
                          unsigned int subframe_offset,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index ea90111bcc3..69077f02768 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -197,7 +197,7 @@ int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp,
 #endif
 
 
-
+#if 0
 int32_t pdcch_llr(NR_DL_FRAME_PARMS *frame_parms,
                   int32_t **rxdataF_comp,
                   char *pdcch_llr,
@@ -229,11 +229,12 @@ int32_t pdcch_llr(NR_DL_FRAME_PARMS *frame_parms,
 
   return(0);
 }
+#endif
 
 //__m128i avg128P;
 
 //compute average channel_level on each (TX,RX) antenna pair
-void pdcch_channel_level(int32_t **dl_ch_estimates_ext,
+void nr_pdcch_channel_level(int32_t **dl_ch_estimates_ext,
                          NR_DL_FRAME_PARMS *frame_parms,
                          int32_t *avg,
                          uint8_t nb_rb) {
@@ -651,7 +652,7 @@ void nr_pdcch_channel_compensation(int32_t **rxdataF_ext,
 }
 
 
-void pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
+void nr_pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
                          int32_t **rxdataF_comp,
                          uint8_t symbol) {
 #if defined(__x86_64__) || defined(__i386__)
@@ -686,6 +687,7 @@ void pdcch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
 #endif
 }
 
+#if 0
 void pdcch_siso(NR_DL_FRAME_PARMS *frame_parms,
                 int32_t **rxdataF_comp,
                 uint8_t l) {
@@ -700,7 +702,7 @@ void pdcch_siso(NR_DL_FRAME_PARMS *frame_parms,
     }
   }
 }
-
+#endif
 
 
 
@@ -812,10 +814,10 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
                                 coreset_freq_dom,
                                 coreset_nbr_rb,
                                 n_rb_offset);
-    LOG_DD("we enter pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP);
-    LOG_DD("in pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n");
+    LOG_DD("we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP);
+    LOG_DD("in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n");
     // compute channel level based on ofdm symbol 0
-    pdcch_channel_level(pdcch_vars[eNB_id]->dl_ch_estimates_ext,
+    nr_pdcch_channel_level(pdcch_vars[eNB_id]->dl_ch_estimates_ext,
                         frame_parms,
                         avgP,
                         coreset_nbr_rb);
@@ -851,9 +853,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
 #endif
 
     if (frame_parms->nb_antennas_rx > 1) {
-      LOG_DD("we enter pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n",
+      LOG_DD("we enter nr_pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n",
              frame_parms->nb_antennas_rx);
-      pdcch_detection_mrc(frame_parms, pdcch_vars[eNB_id]->rxdataF_comp,s);
+      nr_pdcch_detection_mrc(frame_parms, pdcch_vars[eNB_id]->rxdataF_comp,s);
     }
 
     LOG_DD("we enter nr_pdcch_llr(for symbol %d), pdcch_vars[eNB_id]->rxdataF_comp ---> pdcch_vars[eNB_id]->llr \n",s);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c
index 036316dbaa7..35458f330f4 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_llr_computation.c
@@ -39,8 +39,8 @@
 //#define DEBUG_LLR_SIC
 
 
-int16_t zeros[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
-int16_t ones[8] __attribute__ ((aligned(16))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
+int16_t nr_zeros[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0};
+int16_t nr_ones[8] __attribute__ ((aligned(16))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff};
 #if defined(__x86_64__) || defined(__i386__)
 __m128i rho_rpi __attribute__ ((aligned(16)));
 __m128i rho_rmi __attribute__ ((aligned(16)));
@@ -604,11 +604,11 @@ __m128i tmp_result4 __attribute__ ((aligned(16)));
 #define prodsum_psi_a_epi16(psi_r,a_r,psi_i,a_i,psi_a) tmp_result = _mm_mulhi_epi16(psi_r,a_r); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result2 = _mm_mulhi_epi16(psi_i,a_i); tmp_result2 = _mm_slli_epi16(tmp_result2,1); psi_a = _mm_adds_epi16(tmp_result,tmp_result2);
 
 // calculate interference magnitude
-#define interference_abs_epi16(psi,int_ch_mag,int_mag,c1,c2) tmp_result = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result2 = _mm_xor_si128(tmp_result,(*(__m128i*)&ones[0])); tmp_result = _mm_and_si128(tmp_result,c1); tmp_result2 = _mm_and_si128(tmp_result2,c2); int_mag = _mm_or_si128(tmp_result,tmp_result2);
+#define interference_abs_epi16(psi,int_ch_mag,int_mag,c1,c2) tmp_result = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result2 = _mm_xor_si128(tmp_result,(*(__m128i*)&nr_ones[0])); tmp_result = _mm_and_si128(tmp_result,c1); tmp_result2 = _mm_and_si128(tmp_result2,c2); int_mag = _mm_or_si128(tmp_result,tmp_result2);
 
 // calculate interference magnitude
-// tmp_result = ones in shorts corr. to interval 2<=x<=4, tmp_result2 interval < 2, tmp_result3 interval 4<x<6 and tmp_result4 interval x>6
-#define interference_abs_64qam_epi16(psi,int_ch_mag,int_two_ch_mag,int_three_ch_mag,a,c1,c3,c5,c7) tmp_result = _mm_cmplt_epi16(psi,int_two_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result,(*(__m128i*)&ones[0])); tmp_result2 = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result = _mm_xor_si128(tmp_result,tmp_result2); tmp_result4 = _mm_cmpgt_epi16(psi,int_three_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result3,tmp_result4); tmp_result = _mm_and_si128(tmp_result,c3); tmp_result2 = _mm_and_si128(tmp_result2,c1); tmp_result3 = _mm_and_si128(tmp_result3,c5); tmp_result4 = _mm_and_si128(tmp_result4,c7); tmp_result = _mm_or_si128(tmp_result,tmp_result2); tmp_result3 = _mm_or_si128(tmp_result3,tmp_result4); a = _mm_or_si128(tmp_result,tmp_result3);
+// tmp_result = nr_ones in shorts corr. to interval 2<=x<=4, tmp_result2 interval < 2, tmp_result3 interval 4<x<6 and tmp_result4 interval x>6
+#define interference_abs_64qam_epi16(psi,int_ch_mag,int_two_ch_mag,int_three_ch_mag,a,c1,c3,c5,c7) tmp_result = _mm_cmplt_epi16(psi,int_two_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result,(*(__m128i*)&nr_ones[0])); tmp_result2 = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result = _mm_xor_si128(tmp_result,tmp_result2); tmp_result4 = _mm_cmpgt_epi16(psi,int_three_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result3,tmp_result4); tmp_result = _mm_and_si128(tmp_result,c3); tmp_result2 = _mm_and_si128(tmp_result2,c1); tmp_result3 = _mm_and_si128(tmp_result3,c5); tmp_result4 = _mm_and_si128(tmp_result4,c7); tmp_result = _mm_or_si128(tmp_result,tmp_result2); tmp_result3 = _mm_or_si128(tmp_result3,tmp_result4); a = _mm_or_si128(tmp_result,tmp_result3);
 
 // calculates a_sq = int_ch_mag*(a_r^2 + a_i^2)*scale_factor
 #define square_a_epi16(a_r,a_i,int_ch_mag,scale_factor,a_sq) tmp_result = _mm_mulhi_epi16(a_r,a_r); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result = _mm_mulhi_epi16(tmp_result,scale_factor); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result = _mm_mulhi_epi16(tmp_result,int_ch_mag); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result2 = _mm_mulhi_epi16(a_i,a_i); tmp_result2 = _mm_slli_epi16(tmp_result2,1); tmp_result2 = _mm_mulhi_epi16(tmp_result2,scale_factor); tmp_result2 = _mm_slli_epi16(tmp_result2,1); tmp_result2 = _mm_mulhi_epi16(tmp_result2,int_ch_mag); tmp_result2 = _mm_slli_epi16(tmp_result2,1); a_sq = _mm_adds_epi16(tmp_result,tmp_result2);
@@ -1142,7 +1142,7 @@ int nr_dlsch_qpsk_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
 
   // printf("nr_dlsch_qpsk_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
   //    printf("qpsk_qpsk: len %d, llr16 %p\n",len,llr16);
-  qpsk_qpsk((short *)rxF,
+  nr_qpsk_qpsk((short *)rxF,
             (short *)rxF_i,
             (short *)llr16,
             (short *)rho,
@@ -1156,7 +1156,7 @@ int nr_dlsch_qpsk_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
 
 //__m128i ONE_OVER_SQRT_8 __attribute__((aligned(16)));
 
-void qpsk_qpsk(short *stream0_in,
+void nr_qpsk_qpsk(short *stream0_in,
                short *stream1_in,
                short *stream0_out,
                short *rho01,
@@ -1390,7 +1390,7 @@ int nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     len = (nb_rb*12) - pbch_pss_sss_adjust;
   }
 
-  qpsk_qam16((short *)rxF,
+  nr_qpsk_qam16((short *)rxF,
              (short *)rxF_i,
              (short *)ch_mag_i,
              (short *)llr16,
@@ -1413,7 +1413,7 @@ __m128i SQRT_10_OVER_FOUR __attribute__((aligned(16)));
 __m128i ch_mag_int;
 #endif
 */
-void qpsk_qam16(int16_t *stream0_in,
+void nr_qpsk_qam16(int16_t *stream0_in,
                 int16_t *stream1_in,
                 int16_t *ch_mag_i,
                 int16_t *stream0_out,
@@ -1672,7 +1672,7 @@ int nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     len = (nb_rb*12) - pbch_pss_sss_adjust;
   }
 
-  qpsk_qam64((short *)rxF,
+  nr_qpsk_qam64((short *)rxF,
              (short *)rxF_i,
              (short *)ch_mag_i,
              (short *)llr16,
@@ -1695,7 +1695,7 @@ __m128i two_ch_mag_int_with_sigma2 __attribute__((aligned(16)));
 __m128i three_ch_mag_int_with_sigma2 __attribute__((aligned(16)));
 __m128i SQRT_42_OVER_FOUR __attribute__((aligned(16)));
 */
-void qpsk_qam64(short *stream0_in,
+void nr_qpsk_qam64(short *stream0_in,
                 short *stream1_in,
                 short *ch_mag_i,
                 short *stream0_out,
@@ -1947,7 +1947,7 @@ __m128i ch_mag_over_2 __attribute__ ((aligned(16)));
 __m128i ch_mag_9_over_10 __attribute__ ((aligned(16)));
 */
 
-void qam16_qpsk(short *stream0_in,
+void nr_qam16_qpsk(short *stream0_in,
                 short *stream1_in,
                 short *ch_mag,
                 short *stream0_out,
@@ -2440,7 +2440,7 @@ int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
 
   // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16);
 
-  qam16_qpsk((short *)rxF,
+  nr_qam16_qpsk((short *)rxF,
              (short *)rxF_i,
              (short *)ch_mag,
              (short *)llr16,
@@ -2453,7 +2453,7 @@ int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
   return(0);
 }
 
-void qam16_qam16(short *stream0_in,
+void nr_qam16_qam16(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
                  short *ch_mag_i,
@@ -2981,7 +2981,7 @@ int nr_dlsch_16qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
 
   // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16);
 
-  qam16_qam16((short *)rxF,
+  nr_qam16_qam16((short *)rxF,
               (short *)rxF_i,
               (short *)ch_mag,
               (short *)ch_mag_i,
@@ -2995,7 +2995,7 @@ int nr_dlsch_16qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
   return(0);
 }
 
-void qam16_qam64(int16_t *stream0_in,
+void nr_qam16_qam64(int16_t *stream0_in,
                  int16_t *stream1_in,
                  int16_t *ch_mag,
                  int16_t *ch_mag_i,
@@ -3615,7 +3615,7 @@ int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
 
   // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16);
 
-  qam16_qam64((short *)rxF,
+  nr_qam16_qam64((short *)rxF,
               (short *)rxF_i,
               (short *)ch_mag,
               (short *)ch_mag_i,
@@ -3670,7 +3670,7 @@ __m128i ch_mag_2_over_42_with_sigma2 __attribute__((aligned(16)));
 
 */
 
-void qam64_qpsk(int16_t *stream0_in,
+void nr_qam64_qpsk(int16_t *stream0_in,
                 int16_t *stream1_in,
                 int16_t *ch_mag,
                 int16_t *stream0_out,
@@ -5175,7 +5175,7 @@ int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
     len = (nb_rb*12) - pbch_pss_sss_adjust;
   }
 
-  qam64_qpsk((short *)rxF,
+  nr_qam64_qpsk((short *)rxF,
              (short *)rxF_i,
              (short *)ch_mag,
              (short *)llr16,
@@ -5189,7 +5189,7 @@ int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
 
 
 
-void qam64_qam16(short *stream0_in,
+void nr_qam64_qam16(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
                  short *ch_mag_i,
@@ -6718,7 +6718,7 @@ int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     len = (nb_rb*12) - pbch_pss_sss_adjust;
   }
 
-  qam64_qam16((short *)rxF,
+  nr_qam64_qam16((short *)rxF,
               (short *)rxF_i,
               (short *)ch_mag,
               (short *)ch_mag_i,
@@ -6731,6 +6731,7 @@ int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
   return(0);
 }
 
+#if 0
 void qam64_qam64(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
@@ -8481,6 +8482,7 @@ void qam64_qam64(short *stream0_in,
   _m_empty();
 #endif
 }
+#endif
 
 
 int nr_dlsch_64qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index d5b993e3913..ba4459a8833 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -90,7 +90,7 @@ void dump_mch(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qpsk_qpsk(int16_t *stream0_in,
+void nr_qpsk_qpsk(int16_t *stream0_in,
                int16_t *stream1_in,
                int16_t *stream0_out,
                int16_t *rho01,
@@ -126,7 +126,7 @@ int32_t nr_dlsch_qpsk_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qpsk_qam16(int16_t *stream0_in,
+void nr_qpsk_qam16(int16_t *stream0_in,
                 int16_t *stream1_in,
                 short *ch_mag_i,
                 int16_t *stream0_out,
@@ -164,7 +164,7 @@ int32_t nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qpsk_qam64(int16_t *stream0_in,
+void nr_qpsk_qam64(int16_t *stream0_in,
                 int16_t *stream1_in,
                 short *ch_mag_i,
                 int16_t *stream0_out,
@@ -202,7 +202,7 @@ int32_t nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qam16_qpsk(short *stream0_in,
+void nr_qam16_qpsk(short *stream0_in,
                 short *stream1_in,
                 short *ch_mag,
                 short *stream0_out,
@@ -240,7 +240,7 @@ int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qam16_qam16(short *stream0_in,
+void nr_qam16_qam16(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
                  short *ch_mag_i,
@@ -283,7 +283,7 @@ int nr_dlsch_16qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qam16_qam64(short *stream0_in,
+void nr_qam16_qam64(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
                  short *ch_mag_i,
@@ -324,7 +324,7 @@ int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qam64_qpsk(short *stream0_in,
+void nr_qam64_qpsk(short *stream0_in,
                 short *stream1_in,
                 short *ch_mag,
                 short *stream0_out,
@@ -363,7 +363,7 @@ int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
     @param stream0_out Output from LLR unit for stream0
     @param rho01 Cross-correlation between channels (MR combined)
     @param length in complex channel outputs*/
-void qam64_qam16(short *stream0_in,
+void nr_qam64_qam16(short *stream0_in,
                  short *stream1_in,
                  short *ch_mag,
                  short *ch_mag_i,
diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h
index c3eecb90083..7f9d20e624e 100644
--- a/openair1/PHY/phy_vars_nr_ue.h
+++ b/openair1/PHY/phy_vars_nr_ue.h
@@ -141,4 +141,6 @@ int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
 uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
 
 uint8_t max_ldpc_iterations=4;
+uint8_t max_turbo_iterations=4;
+
 #endif /*__PHY_VARS_H__ */
diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h
index 8e42149addc..d38f9623001 100644
--- a/openair1/SCHED_NR_UE/defs.h
+++ b/openair1/SCHED_NR_UE/defs.h
@@ -292,7 +292,7 @@ int8_t nr_find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
 void nr_process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
 void nr_process_timing_advance_rar(PHY_VARS_NR_UE *phy_vars_ue,UE_nr_rxtx_proc_t *proc,uint16_t timing_advance);
 
-unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
+unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
 
 void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
 
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 5b4675fe390..f1184989913 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -89,7 +89,7 @@ fifo_dump_emos_UE emos_dump_UE;
 
 #define NS_PER_SLOT 500000
 
-char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
+char nr_mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
 
 extern double cpuf;
 
@@ -565,8 +565,8 @@ void ue_compute_srs_occasion(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t
 	//    Simultaneous-AN-and-SRS is FALSE
 
 	// check PUCCH format 2/2a/2b transmissions
-	is_pucch2_subframe = is_cqi_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0);
-	is_pucch2_subframe = (is_ri_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0)) || is_pucch2_subframe;
+	is_pucch2_subframe = nr_is_cqi_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0);
+	is_pucch2_subframe = (nr_is_ri_TXOp(ue,proc,eNB_id) && (ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0)) || is_pucch2_subframe;
 
 	// check ACK/SR transmission
 	if(frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission == FALSE)
@@ -1474,7 +1474,7 @@ if (ue->prach_resources[eNB_id]!=NULL) {
     LOG_I(PHY,"mode %d\n",mode);
 
     if ((ue->mac_enabled==1) && (mode != calib_prach_tx)) {
-      ue->tx_power_dBm[nr_tti_tx] = ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id);
+      ue->tx_power_dBm[nr_tti_tx] = ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id);
     }
     else {
       ue->tx_power_dBm[nr_tti_tx] = ue->tx_power_max_dBm;
@@ -1486,7 +1486,7 @@ if (ue->prach_resources[eNB_id]!=NULL) {
 	  frame_tx,
 	  nr_tti_tx,
 	  ue->prach_resources[eNB_id]->ra_PreambleIndex,
-	  get_PL(ue->Mod_id,ue->CC_id,eNB_id),
+	  nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id),
 	  ue->tx_power_dBm[nr_tti_tx],
 	  ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER,
 	  ue->prach_resources[eNB_id]->ra_TDD_map_index,
@@ -1495,7 +1495,7 @@ if (ue->prach_resources[eNB_id]!=NULL) {
     ue->tx_total_RE[nr_tti_tx] = 96;
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
-    ue->prach_vars[eNB_id]->amp = get_tx_amp(ue->tx_power_dBm[nr_tti_tx],
+    ue->prach_vars[eNB_id]->amp = nr_get_tx_amp(ue->tx_power_dBm[nr_tti_tx],
 					     ue->tx_power_max_dBm,
 					     ue->frame_parms.N_RB_UL,
 					     6);
@@ -1518,7 +1518,7 @@ if (ue->prach_resources[eNB_id]!=NULL) {
     //      stop_meas(&ue->tx_prach);
     LOG_D(PHY,"[UE  %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n",
 	  ue->Mod_id,
-	  get_PL(ue->Mod_id,ue->CC_id,eNB_id),
+	  nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id),
 	  ue->tx_power_dBm[nr_tti_tx],
 	  dB_fixed(prach_power),
 	  ue->prach_vars[eNB_id]->amp);
@@ -1537,8 +1537,8 @@ if (ue->prach_resources[eNB_id]!=NULL) {
 LOG_I(PHY,"[UE  %d][RAPROC] Frame %d, nr_tti_rx %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
       ue->Mod_id,frame_tx,nr_tti_tx,eNB_id,
       ue->prach_resources[eNB_id]->ra_PreambleIndex,
-      ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(ue->Mod_id,ue->CC_id,eNB_id),
-      get_PL(ue->Mod_id,ue->CC_id,eNB_id));
+      ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id),
+      nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id));
 
 }
 
@@ -1560,6 +1560,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDUR
 
 #endif
 
+#if 0
 void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,
 								UE_nr_rxtx_proc_t *proc,
 								uint8_t eNB_id,
@@ -1715,10 +1716,10 @@ void ue_ulsch_uespec_procedures(PHY_VARS_NR_UE *ue,
 
     // check Periodic CQI/RI reporting
     cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
-		  (is_cqi_TXOp(ue,proc,eNB_id)==1));
+		  (nr_is_cqi_TXOp(ue,proc,eNB_id)==1));
 
     ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
-		 (is_ri_TXOp(ue,proc,eNB_id)==1));
+		 (nr_is_ri_TXOp(ue,proc,eNB_id)==1));
 
     // compute CQI/RI resources
     compute_cqi_ri_resources(ue, ue->ulsch[eNB_id], eNB_id, ue->ulsch[eNB_id]->rnti, P_RNTI, CBA_RNTI, cqi_status, ri_status);
@@ -1923,7 +1924,7 @@ if (abstraction_flag == 0) {
   ue->tx_total_RE[nr_tti_tx] = nb_rb*12;
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
-  tx_amp = get_tx_amp(ue->tx_power_dBm[nr_tti_tx],
+  tx_amp = nr_get_tx_amp(ue->tx_power_dBm[nr_tti_tx],
 		      ue->tx_power_max_dBm,
 		      ue->frame_parms.N_RB_UL,
 		      nb_rb);
@@ -1932,7 +1933,7 @@ if (abstraction_flag == 0) {
 #endif
 #if T_TRACER
   T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(nr_tti_tx),T_INT(ue->tx_power_dBm[nr_tti_tx]),
-    T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
+    T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(nr_get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
 #endif
 
 #ifdef UE_DEBUG_TRACE
@@ -1982,6 +1983,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDUR
 #endif
 
 }
+#endif
 
 #if 0
 
@@ -2014,7 +2016,7 @@ void ue_srs_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
       if (ue->mac_enabled==1)
 	{
-	  tx_amp = get_tx_amp(Po_SRS,
+	  tx_amp = nr_get_tx_amp(Po_SRS,
 			      ue->tx_power_max_dBm,
 			      ue->frame_parms.N_RB_UL,
 			      nb_rb_srs);
@@ -2239,10 +2241,10 @@ void ue_pucch_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_
   nb_cw = ( (ack_status_cw0 != 0) ? 1:0) + ( (ack_status_cw1 != 0) ? 1:0);
 
   cqi_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&&
-		(is_cqi_TXOp(ue,proc,eNB_id)==1));
+		(nr_is_cqi_TXOp(ue,proc,eNB_id)==1));
 
   ri_status = ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
-	       (is_ri_TXOp(ue,proc,eNB_id)==1));
+	       (nr_is_ri_TXOp(ue,proc,eNB_id)==1));
 
   // Part - II
   // if nothing to report ==> exit function
@@ -2297,7 +2299,7 @@ void ue_pucch_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_
       ue->tx_total_RE[nr_tti_tx] = 12;
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
-      tx_amp = get_tx_amp(Po_PUCCH,
+      tx_amp = nr_get_tx_amp(Po_PUCCH,
 			  ue->tx_power_max_dBm,
 			  ue->frame_parms.N_RB_UL,
 			  1);
@@ -2306,7 +2308,7 @@ void ue_pucch_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_
 #endif
 #if T_TRACER
       T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(nr_tti_tx),T_INT(ue->tx_power_dBm[nr_tti_tx]),
-	T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
+	T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][eNB_id][0]->g_pucch),T_INT(nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
 #endif
 
 #ifdef UE_DEBUG_TRACE
@@ -2405,7 +2407,7 @@ void ue_pucch_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_
       ue->tx_total_RE[nr_tti_tx] = 12;
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
-      tx_amp =  get_tx_amp(Po_PUCCH,
+      tx_amp =  nr_get_tx_amp(Po_PUCCH,
 			   ue->tx_power_max_dBm,
 			   ue->frame_parms.N_RB_UL,
 			   1);
@@ -2414,7 +2416,7 @@ void ue_pucch_procedures(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_
 #endif
 #if T_TRACER
       T(T_UE_PHY_PUCCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(nr_tti_tx),T_INT(ue->tx_power_dBm[nr_tti_tx]),
-	T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][eNB_id][0]->g_pucch),T_INT(get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
+	T_INT(tx_amp),T_INT(ue->dlsch[ue->current_thread_id[proc->nr_tti_rx]][eNB_id][0]->g_pucch),T_INT(nr_get_PL(ue->Mod_id,ue->CC_id,eNB_id)));
 #endif
 #ifdef UE_DEBUG_TRACE
       LOG_I(PHY,"[UE  %d][RNTI %x] AbsSubFrame %d.%d Generating PUCCH 2 (RI or CQI), Po_PUCCH %d, isShortenPucch %d, amp %d\n",
@@ -2785,7 +2787,7 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,
 
 
 
-unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb)
+unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb)
 {
 
   int gain_dB = power_dBm - power_max_dBm;
@@ -3039,7 +3041,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
     */
 
     LOG_D(PHY,"[UE  %d] AbsSubFrame %d.%d, Mode %s: DCI found %i --> rnti %x / crnti %x : format %d\n",
-	  ue->Mod_id,frame_rx%1024,nr_tti_rx,mode_string[ue->UE_mode[eNB_id]],
+	  ue->Mod_id,frame_rx%1024,nr_tti_rx,nr_mode_string[ue->UE_mode[eNB_id]],
 	  dci_cnt,
 	  dci_alloc_rx[0].rnti,
 	  ue->pdcch_vars[ue->current_thread_id[nr_tti_rx]][eNB_id]->crnti,
@@ -3302,6 +3304,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
 #endif
 
 
+#if 0
 void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t *current_harq_processes)
 {
 
@@ -3338,6 +3341,7 @@ void copy_harq_proc_struct(NR_DL_UE_HARQ_t *harq_processes_dest, NR_DL_UE_HARQ_t
   harq_processes_dest->vrb_type       = current_harq_processes->vrb_type       ;
 
 }
+#endif
 
 /*void copy_ack_struct(nr_harq_status_t *harq_ack_dest, nr_harq_status_t *current_harq_ack)
   {
@@ -4535,7 +4539,7 @@ return (0);
 }
 
 
-uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,
+uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,
 		            UE_nr_rxtx_proc_t *proc,
 					uint8_t gNB_id)
 {
@@ -4557,7 +4561,7 @@ uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,
 }
 
 
-uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,
+uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,
 		           UE_nr_rxtx_proc_t *proc,
 				   uint8_t gNB_id)
 {
diff --git a/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c b/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
index 296d92969cf..d388d6877be 100644
--- a/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
+++ b/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
@@ -33,6 +33,7 @@
 #include "SCHED_NR_UE/pucch_uci_ue_nr.h"
 #include "SCHED_NR_UE/pucch_power_control_ue_nr.h"
 #include <openair1/PHY/LTE_ESTIMATION/lte_estimation.h>
+#include <openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h>
 
 /**************** defines **************************************/
 
@@ -103,7 +104,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue,
 
   int P_O_PUCCH = P_O_NOMINAL_PUCCH + P_O_UE_PUCCH;
 
-  int16_t PL = get_PL(ue->Mod_id, ue->CC_id, gNB_id); /* LTE function because NR path loss not yet implemented FFS TODO NR */
+  int16_t PL = nr_get_PL(ue->Mod_id, ue->CC_id, gNB_id); /* LTE function because NR path loss not yet implemented FFS TODO NR */
 
   int16_t delta_F_PUCCH =  power_config->deltaF_PUCCH_f[pucch_format];
 
diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
index 21886418b06..512db60510d 100644
--- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
+++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
@@ -42,6 +42,7 @@
 
 #ifndef NO_RAT_NR
 
+#include "SCHED_NR_UE/defs.h"
 #include "SCHED_NR_UE/harq_nr.h"
 #include "SCHED_NR_UE/pucch_power_control_ue_nr.h"
 
@@ -53,8 +54,8 @@
 
 
 
-uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
-uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
+uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
+uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
 /*
 void nr_generate_pucch0(int32_t **txdataF,
                         NR_DL_FRAME_PARMS *frame_parms,
@@ -227,10 +228,10 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
                             &n_HARQ_ACK, reset_harq); // 1 to reset ACK/NACK status : 0 otherwise
 
   cqi_status = ((ue->cqi_report_config[gNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0) &&
-                                                         (is_cqi_TXOp(ue,proc,gNB_id) == 1));
+                                                         (nr_is_cqi_TXOp(ue,proc,gNB_id) == 1));
 
   ri_status = ((ue->cqi_report_config[gNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
-                                                         (is_ri_TXOp(ue,proc,gNB_id) == 1));
+                                                         (nr_is_ri_TXOp(ue,proc,gNB_id) == 1));
 
   csi_status = get_csi_nr(ue, gNB_id, &csi_payload);
 
@@ -548,7 +549,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
 
 #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706)
 
-  tx_amp = get_tx_amp(pucch_tx_power,
+  tx_amp = nr_get_tx_amp(pucch_tx_power,
                       ue->tx_power_max_dBm,
                       ue->frame_parms.N_RB_UL,
                       nb_of_prbs);
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 34a59e70008..1af9a630c6c 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -2208,7 +2208,7 @@ void nr_ue_process_mac_pdu(
 //---------------------------------------------------------------------------------
 
 
-unsigned char *parse_header(unsigned char *mac_header,
+unsigned char *nr_parse_header(unsigned char *mac_header,
 			    unsigned char *num_ce,
 			    unsigned char *num_sdu,
 			    unsigned char *rx_ces,
@@ -2336,7 +2336,7 @@ nr_ue_send_sdu(module_id_t module_idP,
 
 
     payload_ptr =
-	parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
+	nr_parse_header(sdu, &num_ce, &num_sdu, rx_ces, rx_lcids, rx_lengths,
 		     sdu_len);
 
 #ifdef DEBUG_HEADER_PARSING
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
index c3d872d493c..9c5c17e2235 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c
@@ -33,10 +33,13 @@
 static nr_rlc_ue_manager_t *nr_rlc_ue_manager;
 
 /* TODO: handle time a bit more properly */
+#if 0
 static uint64_t nr_rlc_current_time;
 static int      nr_rlc_current_time_last_frame;
 static int      nr_rlc_current_time_last_subframe;
+#endif
 
+#if 0
 void mac_rlc_data_ind     (
   const module_id_t         module_idP,
   const rnti_t              rntiP,
@@ -196,9 +199,11 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
   ret.head_sdu_is_segmented = 0;
   return ret;
 }
+#endif
 
 int oai_emulation;
 
+#if 0
 rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
                                   const srb_flag_t   srb_flagP,
                                   const MBMS_flag_t  MBMS_flagP,
@@ -250,7 +255,9 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
 
   return RLC_OP_STATUS_OK;
 }
+#endif
 
+#if 0
 int rlc_module_init(int enb_flag)
 {
   static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
@@ -271,10 +278,13 @@ int rlc_module_init(int enb_flag)
 
   return 0;
 }
+#endif
 
+#if 0
 void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP)
 {
 }
+#endif
 
 static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
 {
@@ -745,6 +755,7 @@ static void add_drb(int rnti, struct LTE_DRB_ToAddMod *s)
   }
 }
 
+#if 0
 rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t   * const ctxt_pP,
     const LTE_SRB_ToAddModList_t   * const srb2add_listP,
     const LTE_DRB_ToAddModList_t   * const drb2add_listP,
@@ -789,7 +800,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t   * const ctxt_pP
 
   return RLC_OP_STATUS_OK;
 }
+#endif
 
+#if 0
 rlc_op_status_t rrc_rlc_config_req   (
   const protocol_ctxt_t* const ctxt_pP,
   const srb_flag_t      srb_flagP,
@@ -848,12 +861,16 @@ rlc_op_status_t rrc_rlc_config_req   (
   nr_rlc_manager_unlock(nr_rlc_ue_manager);
   return RLC_OP_STATUS_OK;
 }
+#endif
 
+#if 0
 void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP)
 {
   /* nothing to do */
 }
+#endif
 
+#if 0
 rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
 {
   LOG_D(RLC, "%s:%d:%s: remove UE %d\n", __FILE__, __LINE__, __FUNCTION__, x->rnti);
@@ -863,3 +880,4 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
 
   return RLC_OP_STATUS_OK;
 }
+#endif
-- 
GitLab