diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c
index e14f28f8297383bfd22573d2b75f47f3c3f88705..56c3c0951fd493758c171e81ac62920297af03f7 100644
--- a/common/config/config_userapi.c
+++ b/common/config/config_userapi.c
@@ -81,7 +81,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
   }
 
   if (*ptr == NULL) {
-    *ptr = malloc(length);
+    *ptr = malloc(length>40?length:40); // LTS: dummy fix, waiting Francois full fix in 4G branch
 
     if ( *ptr != NULL) {
       memset(*ptr,0,length);
diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c
index 6bad041641cf626440d049af9662104ee9f471b9..7f177b90cee51c7c516ebe436fac181ff02d210c 100644
--- a/common/utils/LOG/log.c
+++ b/common/utils/LOG/log.c
@@ -324,7 +324,9 @@ void  log_getconfig(log_t *g_log)
 
   config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
   config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
-  config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
+
+  if (config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX) > 0)
+    exit(1);
 
   /* set the debug mask according to the debug parameters values */
   for (int i=0; log_maskmap[i].name != NULL ; i++) {
diff --git a/common/utils/hashtable/hashtable.c b/common/utils/hashtable/hashtable.c
index 50c2ec83245bd5dc5d7ce69e89103c5c96c1f2a1..e9641f8e0c06141eeeacd8442dbc518897b2e141 100644
--- a/common/utils/hashtable/hashtable.c
+++ b/common/utils/hashtable/hashtable.c
@@ -162,34 +162,6 @@ hashtable_rc_t hashtable_is_key_exists (const hash_table_t *const hashtblP, cons
   return HASH_TABLE_KEY_NOT_EXISTS;
 }
 //-------------------------------------------------------------------------------------------------------------------------------
-hashtable_rc_t hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void functP(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP)
-//-------------------------------------------------------------------------------------------------------------------------------
-{
-  hash_node_t  *node         = NULL;
-  unsigned int  i            = 0;
-  unsigned int  num_elements = 0;
-
-  if (hashtblP == NULL) {
-    return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
-  }
-
-  while ((num_elements < hashtblP->num_elements) && (i < hashtblP->size)) {
-    if (hashtblP->nodes[i] != NULL) {
-      node=hashtblP->nodes[i];
-
-      while(node) {
-        num_elements += 1;
-        functP(node->key, node->data, parameterP);
-        node=node->next;
-      }
-    }
-
-    i += 1;
-  }
-
-  return HASH_TABLE_OK;
-}
-//-------------------------------------------------------------------------------------------------------------------------------
 hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP )
 //-------------------------------------------------------------------------------------------------------------------------------
 {
@@ -266,7 +238,6 @@ hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t k
   }
 
   hashtblP->nodes[hash]=node;
-  hashtblP->num_elements += 1;
   return HASH_TABLE_OK;
 }
 //-------------------------------------------------------------------------------------------------------------------------------
@@ -295,7 +266,6 @@ hashtable_rc_t hashtable_remove(hash_table_t *const hashtblP, const hash_key_t k
       }
 
       free(node);
-      hashtblP->num_elements -= 1;
       return HASH_TABLE_OK;
     }
 
@@ -335,47 +305,3 @@ hashtable_rc_t hashtable_get(const hash_table_t *const hashtblP, const hash_key_
   *dataP = NULL;
   return HASH_TABLE_KEY_NOT_EXISTS;
 }
-//-------------------------------------------------------------------------------------------------------------------------------
-/*
- * Resizing
- * The number of elements in a hash table is not always known when creating the table.
- * If the number of elements grows too large, it will seriously reduce the performance of most hash table operations.
- * If the number of elements are reduced, the hash table will waste memory. That is why we provide a function for resizing the table.
- * Resizing a hash table is not as easy as a realloc(). All hash values must be recalculated and each element must be inserted into its new position.
- * We create a temporary hash_table_t object (newtbl) to be used while building the new hashes.
- * This allows us to reuse hashtable_insert() and hashtable_remove(), when moving the elements to the new table.
- * After that, we can just free the old table and copy the elements from newtbl to hashtbl.
- */
-
-hashtable_rc_t hashtable_resize(hash_table_t *const hashtblP, const hash_size_t sizeP) {
-  hash_table_t       newtbl;
-  hash_size_t        n;
-  hash_node_t       *node,*next;
-
-  if (hashtblP == NULL) {
-    return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
-  }
-
-  newtbl.size     = sizeP;
-  newtbl.hashfunc = hashtblP->hashfunc;
-  newtbl.num_elements = 0;
-
-  if(!(newtbl.nodes=calloc(sizeP, sizeof(hash_node_t *)))) return -1;
-
-  for(n=0; n<hashtblP->size; ++n) {
-    for(node=hashtblP->nodes[n]; node; node=next) {
-      next = node->next;
-      hashtable_insert(&newtbl, node->key, node->data);
-      // Lionel GAUTHIER: BAD CODE TO BE REWRITTEN
-      hashtable_remove(hashtblP, node->key);
-    }
-  }
-
-  free(hashtblP->nodes);
-  hashtblP->size=newtbl.size;
-  hashtblP->nodes=newtbl.nodes;
-  return HASH_TABLE_OK;
-}
-
-
-
diff --git a/common/utils/hashtable/hashtable.h b/common/utils/hashtable/hashtable.h
index 3f770684fae9996f8973b4268f106a6526dafd0b..09f8623ce23af44ac608ed1f9e95102f2653e093 100644
--- a/common/utils/hashtable/hashtable.h
+++ b/common/utils/hashtable/hashtable.h
@@ -49,7 +49,6 @@ typedef struct hash_node_s {
 
 typedef struct hash_table_s {
   hash_size_t         size;
-  hash_size_t         num_elements;
   struct hash_node_s **nodes;
   hash_size_t       (*hashfunc)(const hash_key_t);
   void              (*freefunc)(void *);
@@ -60,12 +59,10 @@ void            hash_free_int_func(void *memoryP);
 hash_table_t   *hashtable_create (const hash_size_t   size, hash_size_t (*hashfunc)(const hash_key_t ), void (*freefunc)(void *));
 hashtable_rc_t  hashtable_destroy(hash_table_t **hashtbl);
 hashtable_rc_t  hashtable_is_key_exists (const hash_table_t *const hashtbl, const uint64_t key);
-hashtable_rc_t  hashtable_apply_funct_on_elements (hash_table_t *const hashtblP, void funct(hash_key_t keyP, void *dataP, void *parameterP), void *parameterP);
 hashtable_rc_t  hashtable_dump_content (const hash_table_t *const hashtblP, char *const buffer_pP, int *const remaining_bytes_in_buffer_pP );
 hashtable_rc_t  hashtable_insert (hash_table_t *const hashtbl, const hash_key_t key, void *data);
 hashtable_rc_t  hashtable_remove (hash_table_t *const hashtbl, const hash_key_t key);
 hashtable_rc_t  hashtable_get    (const hash_table_t *const hashtbl, const hash_key_t key, void **dataP);
-hashtable_rc_t  hashtable_resize (hash_table_t *const hashtbl, const hash_size_t size);
 
 
 
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index fcbd659bbea7832b5b8f75c5394058fb5530a5f3..24288d76d38fe476325e77a886ea0d9b8a261ff2 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -419,7 +419,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
 	  PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
                                    0x1234, proc->frame_rx,
                                    proc->nr_tti_rx, 0);
-	  //pdcp_run(&ctxt);
+	  pdcp_run(&ctxt);
           pdcp_fifo_flush_sdus(&ctxt);
   }
   }
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index d8a916d13fba1c7fd61d2dc36ba0acefe8679aae..7e2ffebb35bde1b4324174f2dcc64d3c547374cf 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -664,7 +664,7 @@ int main( int argc, char **argv ) {
   logInit();
   // get options and fill parameters from configuration file
   get_options (); //Command-line options, enb_properties
-  //get_common_options();
+  get_common_options();
 #if T_TRACER
   T_Config_Init();
 #endif
diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c
index 856621e673593702f4dc933fba5e22a8fc08d5f2..a5475a1555535a7291978f66c1411566a8cebb34 100644
--- a/openair1/PHY/INIT/nr_parms.c
+++ b/openair1/PHY/INIT/nr_parms.c
@@ -93,7 +93,7 @@ int nr_is_ssb_slot(nfapi_nr_config_request_t *cfg, int slot, int frame)
   p = cfg->sch_config.ssb_periodicity.value;
   n_hf = cfg->sch_config.half_frame_index.value;
 
-  // checking if the ssb is transmitted in given frame according to periodicity
+  // if SSB periodicity is 5ms, they are transmitted in both half frames
   if ( (p>10) && (frame%(p/10)) )  
     return 0;
   else {
@@ -101,15 +101,15 @@ int nr_is_ssb_slot(nfapi_nr_config_request_t *cfg, int slot, int frame)
     // if SSB periodicity is 5ms, they are transmitted in both half frames
     if ( p == 5) {
       if (slot<hf_slots) 
-        n_hf=0;
-      else
-        n_hf=1;
-    }
+      n_hf=0;
+    else
+      n_hf=1;
+  }
 
-    // to set a effective slot number between 0 to hf_slots-1 in the half frame where the SSB is supposed to be
+  // to set a effective slot number between 0 to 9 in the half frame where the SSB is supposed to be
     rel_slot = (n_hf)? (slot-hf_slots) : slot;
 
-    // there are two potential SSB per slot
+
     return ( ((ssb_map >> rel_slot*2) & 0x01) || ((ssb_map >> (1+rel_slot*2)) & 0x01) ); 
   }
 }
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
index 4942ffe2f467eb2d22079b012ff8f9cd504bf858..dc7489ea512c9d3b988dc707961032d9eda60314 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.h
@@ -79,4 +79,4 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB,
                          int slot_rx,
                          int UE_id,
                          uint8_t harq_pid);
-
+int16_t find_nr_ulsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
index 6e991faf37246a3a72bd4501fe5513b4086faf25..2faf5aab727299e29ae006b465a728adff9c7606 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
@@ -311,7 +311,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
 
   int16_t  z [68*384];
   int8_t   l [68*384];
-  uint8_t  kc;
+  uint8_t  kc=255;
   uint8_t  Ilbrm        = 0;
   uint32_t Tbslbrm     = 950984;
   double   Coderate    = 0.0;
@@ -568,6 +568,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
         pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
       }
 
+      AssertFatal(kc!=255,"");
       for (i=Kr_bytes,j=K_bytes_F-((2*p_decParams->Z)>>3); i < ((kc*p_decParams->Z)>>3); i++, j++) {
         pv[i]= _mm_loadu_si128((__m128i*)(&harq_process->d[r][8*j]));
       }
diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
index 00499f2ef353177c61f13774177ad03ca6f2f345..aaa304ec6373c1c194e41ddbc5a2fc735be928b4 100644
--- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
@@ -205,10 +205,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
   unsigned int pilot_cnt;
   int16_t ch[2],*pil,*rxF,*dl_ch,*fl,*fm,*fr;
   int ch_offset,symbol_offset;
-  int slot_pbch;
-  fapi_nr_pbch_config_t *pbch_config = &ue->nrUE_config.pbch_config;
+  //int slot_pbch;
+  //fapi_nr_pbch_config_t *pbch_config = &ue->nrUE_config.pbch_config;
   // initialized to 5ms in nr_init_ue for scenarios where UE is not configured (otherwise acquired by cell configuration from gNB or LTE)
-  uint8_t ssb_periodicity = 10;// ue->ssb_periodicity;
+  //uint8_t ssb_periodicity = 10;// ue->ssb_periodicity;
 
   //uint16_t Nid_cell = (eNB_offset == 0) ? ue->frame_parms.Nid_cell : ue->measurements.adj_cell_id[eNB_offset-1];
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index de88858c2da60ea4cf2365fe30d2651b5ddb2b63..a14137434c90c36f596d93bd019594724fd346a5 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -49,7 +49,16 @@
 
 //#define NR_LTE_PDCCH_DCI_SWITCH
 #define NR_PDCCH_DCI_RUN              // activates new nr functions
-//#define NR_PDCCH_DCI_DEBUG            // activates NR_PDCCH_DCI_DEBUG logs
+#define NR_PDCCH_DCI_DEBUG            // activates NR_PDCCH_DCI_DEBUG logs
+#ifdef NR_PDCCH_DCI_DEBUG
+#define LOG_DNL(a, ...) printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ )
+#define LOG_DD(a, ...) printf("\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ )
+#define LOG_DDD(a, ...) printf("\t\t<-NR_PDCCH_DCI_DEBUG (%s)-> " a, __func__, ##__VA_ARGS__ )
+#else
+#define LOG_DNL(a...)
+#define LOG_DD(a...)
+#define LOG_DDD(a...)
+#endif
 #define NR_NBR_CORESET_ACT_BWP 3      // The number of CoreSets per BWP is limited to 3 (including initial CORESET: ControlResourceId 0)
 #define NR_NBR_SEARCHSPACE_ACT_BWP 10 // The number of SearSpaces per BWP is limited to 10 (including initial SEARCHSPACE: SearchSpaceId 0)
 #define PDCCH_TEST_POLAR_TEMP_FIX
@@ -134,9 +143,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
 
       if (coreset_interleaved==0) f_bundle_j=bundle_j;
 
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_demapping_deinterleaving)-> [r=%d,c=%d] bundle_j(%d) interleaved at f_bundle_j(%d)\n",r,c,bundle_j,f_bundle_j);
-#endif
+      LOG_DNL("[r=%d,c=%d] bundle_j(%d) interleaved at f_bundle_j(%d)\n",r,c,bundle_j,f_bundle_j);
     }
 
     f_reg = (f_bundle_j*reg_bundle_size_L)+(reg%reg_bundle_size_L);
@@ -145,11 +152,9 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
 
     for (int i=0; i<9; i++) {
       z[index_z + i] = llr[index_llr + i];
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_demapping_deinterleaving)-> [reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
+      LOG_DDD("[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n",
              reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
              f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
-#endif
     }
 
     if ((reg%reg_bundle_size_L) == 0) r++;
@@ -167,13 +172,11 @@ int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp,
   pdcch_llrp = &pdcch_llr[2 * symbol * coreset_nbr_rb * 9];
 
   if (!pdcch_llrp) {
-    printf("pdcch_qpsk_llr: llr is null, symbol %d\n", symbol);
+    LOG_E(PHY,"pdcch_qpsk_llr: llr is null, symbol %d\n", symbol);
     return (-1);
   }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_llr)-> llr logs: pdcch qpsk llr for symbol %d (pos %d), llr offset %d\n",symbol,(symbol*frame_parms->N_RB_DL*12),pdcch_llrp-pdcch_llr);
-#endif
+  LOG_DDD("llr logs: pdcch qpsk llr for symbol %d (pos %d), llr offset %ld\n",symbol,(symbol*frame_parms->N_RB_DL*12),pdcch_llrp-pdcch_llr);
 
   //for (i = 0; i < (frame_parms->N_RB_DL * ((symbol == 0) ? 16 : 24)); i++) {
   for (i = 0; i < (coreset_nbr_rb * ((symbol == 0) ? 18 : 18)); i++) {
@@ -184,9 +187,7 @@ int32_t nr_pdcch_llr(NR_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp,
     else
       *pdcch_llrp = (*rxF);
 
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_llr)-> llr logs: rb=%d i=%d *rxF:%d => *pdcch_llrp:%d\n",i/18,i,*rxF,*pdcch_llrp);
-#endif
+    LOG_DDD("llr logs: rb=%d i=%d *rxF:%d => *pdcch_llrp:%d\n",i/18,i,*rxF,*pdcch_llrp);
     rxF++;
     pdcch_llrp++;
   }
@@ -207,7 +208,7 @@ int32_t pdcch_llr(NR_DL_FRAME_PARMS *frame_parms,
   pdcch_llr8 = &pdcch_llr[2*symbol*frame_parms->N_RB_DL*12];
 
   if (!pdcch_llr8) {
-    printf("pdcch_qpsk_llr: llr is null, symbol %d\n",symbol);
+    LOG_E(PHY,"pdcch_qpsk_llr: llr is null, symbol %d\n",symbol);
     return(-1);
   }
 
@@ -330,43 +331,33 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
   //uint8_t rb_count_bit;
   uint8_t i, j, aarx, bitcnt_coreset_freq_dom=0;
   int32_t *dl_ch0, *dl_ch0_ext, *rxF, *rxF_ext;
-#ifdef NR_PDCCH_DCI_DEBUG
-  int nushiftmod3 = frame_parms->nushift % 3;
-#endif
 
-#if defined(DEBUG_DCI_DECODING) || defined(NR_PDCCH_DCI_DEBUG)
-  uint8_t symbol_mod = (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol;
-#endif
   c_rb = n_BWP_start; // c_rb is the common resource block: RB within the BWP
 #ifdef DEBUG_DCI_DECODING
+  uint8_t symbol_mod = (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol;
   LOG_I(PHY, "extract_rbs_single: symbol_mod %d\n",symbol_mod);
 #endif
 
   for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
     if (high_speed_flag == 1) {
       dl_ch0 = &dl_ch_estimates[aarx][(symbol * (frame_parms->ofdm_symbol_size))];
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> dl_ch0 = &dl_ch_estimates[aarx = (%d)][ (symbol * (frame_parms->ofdm_symbol_size (%d))) = (%d)]\n",
+      LOG_DDD("dl_ch0 = &dl_ch_estimates[aarx = (%d)][ (symbol * (frame_parms->ofdm_symbol_size (%d))) = (%d)]\n",
              aarx,frame_parms->ofdm_symbol_size,(symbol * (frame_parms->ofdm_symbol_size)));
-#endif
     } else {
       dl_ch0 = &dl_ch_estimates[aarx][0];
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> dl_ch0 = &dl_ch_estimates[aarx = (%d)][0]\n",aarx);
-#endif
+      LOG_DDD("dl_ch0 = &dl_ch_estimates[aarx = (%d)][0]\n",aarx);
     }
 
     dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol * (coreset_nbr_rb * NBR_RE_PER_RB_WITH_DMRS)];
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> dl_ch0_ext = &dl_ch_estimates_ext[aarx = (%d)][symbol * (frame_parms->N_RB_DL * 9) = (%d)]\n",
+    LOG_DDD("dl_ch0_ext = &dl_ch_estimates_ext[aarx = (%d)][symbol * (frame_parms->N_RB_DL * 9) = (%d)]\n",
            aarx,symbol * (coreset_nbr_rb * NBR_RE_PER_RB_WITH_DMRS));
-#endif
     rxF_ext = &rxdataF_ext[aarx][symbol * (coreset_nbr_rb * NBR_RE_PER_RB_WITH_DMRS)];
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> rxF_ext = &rxdataF_ext[aarx = (%d)][symbol * (frame_parms->N_RB_DL * 9) = (%d)]\n",
+    LOG_DDD("rxF_ext = &rxdataF_ext[aarx = (%d)][symbol * (frame_parms->N_RB_DL * 9) = (%d)]\n",
            aarx,symbol * (coreset_nbr_rb * NBR_RE_PER_RB_WITH_DMRS));
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> (for symbol=%d, aarx=%d), symbol_mod=%d, nushiftmod3=%d \n",symbol,aarx,symbol_mod,nushiftmod3);
-#endif
+    LOG_DDD("(for symbol=%d, aarx=%d), symbol_mod=%d, nushiftmod3=%d \n",
+    symbol,aarx,
+    (symbol >= (7 - frame_parms->Ncp)) ? symbol - (7 - frame_parms->Ncp) : symbol,
+    frame_parms->nushift % 3);
     /*
      * The following for loop handles treatment of PDCCH contained in table rxdataF (in frequency domain)
      * In NR the PDCCH IQ symbols are contained within RBs in the CORESET defined by higher layers which is located within the BWP
@@ -384,9 +375,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
      * then the IQ symbol is going to be found at the position 0+c_rb-N_RB_DL/2 in rxdataF and
      * we have to point the pointer at (1+c_rb-N_RB_DL/2) in rxdataF
      */
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb);
-#endif
+    LOG_DDD("n_BWP_start=%d, coreset_nbr_rb=%d\n",n_BWP_start,coreset_nbr_rb);
 
     for (c_rb = n_BWP_start; c_rb < (n_BWP_start + coreset_nbr_rb + (BIT_TO_NBR_RB_CORESET_FREQ_DOMAIN * offset_discontiguous)); c_rb++) {
       //c_rb_tmp = 0;
@@ -399,40 +388,32 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
           //c_rb_tmp = c_rb_tmp + 6;
           c_rb = c_rb + BIT_TO_NBR_RB_CORESET_FREQ_DOMAIN;
           offset_discontiguous ++;
-#ifdef NR_PDCCH_DCI_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> we entered here as coreset_freq_dom=%lx (bit %d) is 0, coreset_freq_domain is discontiguous\n",coreset_freq_dom,
+          LOG_DDD("we entered here as coreset_freq_dom=%lx (bit %d) is 0, coreset_freq_domain is discontiguous\n",coreset_freq_dom,
                  (46 - bitcnt_coreset_freq_dom));
-#endif
         }
       }
 
       //c_rb = c_rb + c_rb_tmp;
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> c_rb=%d\n",c_rb);
-#endif
+      LOG_DDD("c_rb=%d\n",c_rb);
       rxF=NULL;
 
       // first we set initial conditions for pointer to rxdataF depending on the situation of the first RB within the CORESET (c_rb = n_BWP_start)
       if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
         //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): even case
         rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        LOG_DDD("in even case c_rb (%d) is lower than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
                c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
-#endif
       }
 
       if ((c_rb >= (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) == 0)) {
         // number of RBs is even  and c_rb is higher than half system bandwidth (we don't skip DC)
         // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF
         rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
                c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))));
-#endif
         //rxF = &rxdataF[aarx][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
         //#ifdef NR_PDCCH_DCI_DEBUG
-        //  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        //  LOG_DDD("in even case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
         //         c_rb,aarx,(1 + 12*(c_rb - (frame_parms->N_RB_DL>>1)) + (symbol * (frame_parms->ofdm_symbol_size))));
         //#endif
       }
@@ -440,30 +421,24 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
       if ((c_rb < (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
         //if RB to be treated is lower than middle system bandwidth then rxdataF pointed at (offset + c_br + symbol * ofdm_symbol_size): odd case
         rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        LOG_DDD("in odd case c_rb (%d) is lower or equal than half N_RB_DL -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
                c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
-#endif
       }
 
       if ((c_rb > (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) {
         // number of RBs is odd  and   c_rb is higher than half system bandwidth + 1
         // if these conditions are true the pointer has to be situated at the 1st part of the rxdataF just after the first IQ symbols of the RB containing DC
         rxF = &rxdataF[aarx][(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        LOG_DDD("in odd case c_rb (%d) is higher than half N_RB_DL (not DC) -> rxF = &rxdataF[aarx = (%d)][(12*(c_rb - frame_parms->N_RB_DL) - 5 + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
                c_rb,aarx,(12*(c_rb - (frame_parms->N_RB_DL>>1)) - 6 + (symbol * (frame_parms->ofdm_symbol_size))));
-#endif
       }
 
       if ((c_rb == (frame_parms->N_RB_DL >> 1)) && ((frame_parms->N_RB_DL & 1) != 0)) { // treatment of RB containing the DC
         // if odd number RBs in system bandwidth and first RB to be treated is higher than middle system bandwidth (around DC)
         // we have to treat the RB in two parts: first part from i=0 to 5, the data is at the end of rxdataF (pointing at the end of the table)
         rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size)))];
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
+        LOG_DDD("in odd case c_rb (%d) is half N_RB_DL + 1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))) = (%d)]\n",
                c_rb,aarx,(frame_parms->first_carrier_offset + 12 * c_rb + (symbol * (frame_parms->ofdm_symbol_size))));
-#endif
         /*if (symbol_mod > 300) { // this if is going to be removed as DM-RS signals are present in all symbols of PDCCH
           for (i = 0; i < 6; i++) {
         dl_ch0_ext[i] = dl_ch0[i];
@@ -471,7 +446,7 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
           }
           rxF = &rxdataF[aarx][(symbol * (frame_parms->ofdm_symbol_size))]; // we point at the 1st part of the rxdataF in symbol
           #ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n",
+        LOG_DDD("in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n",
         c_rb,aarx,(symbol * (frame_parms->ofdm_symbol_size)));
           #endif
           for (; i < 12; i++) {
@@ -497,10 +472,8 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
 
         // then we point at the begining of the symbol part of rxdataF do process second part of RB
         rxF = &rxdataF[aarx][((symbol * (frame_parms->ofdm_symbol_size)))]; // we point at the 1st part of the rxdataF in symbol
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n",
+        LOG_DDD("in odd case c_rb (%d) is half N_RB_DL +1 we treat DC case -> rxF = &rxdataF[aarx = (%d)][(symbol * (frame_parms->ofdm_symbol_size)) = (%d)]\n",
                c_rb,aarx,(symbol * (frame_parms->ofdm_symbol_size)));
-#endif
 
         for (; i < 12; i++) {
           if ((i != 9)) {
@@ -535,21 +508,17 @@ void nr_pdcch_extract_rbs_single(int32_t **rxdataF,
         for (i = 0; i < 12; i++) {
           if ((i != 1) && (i != 5) && (i != 9)) {
             rxF_ext[j] = rxF[i];
-#ifdef NR_PDCCH_DCI_DEBUG
-            printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n",
+            LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d)\n",
                    c_rb, i, j, *(short *) &rxF_ext[j],*(1 + (short *) &rxF_ext[j]), i,
                    *(short *) &rxF[i], *(1 + (short *) &rxF[i]));
-#endif
             dl_ch0_ext[j] = dl_ch0[i];
-            //printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> ch %d => dl_ch0(%d,%d)\n", i, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i]));
+            //LOG_DDD("ch %d => dl_ch0(%d,%d)\n", i, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i]));
             //printf("\t-> dl_ch0[%d] => dl_ch0_ext[%d](%d,%d)\n", i,j, *(short *) &dl_ch0[i], *(1 + (short*) &dl_ch0[i]));
             j++;
           } else {
-#ifdef NR_PDCCH_DCI_DEBUG
-            printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_extract_rbs_single)-> RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n",
+            LOG_DDD("RB[c_rb %d] \t RE[re %d] => rxF_ext[%d]=(%d,%d)\t rxF[%d]=(%d,%d) \t\t <==> DM-RS PDCCH, this is a pilot symbol\n",
                    c_rb, i, j, *(short *) &rxF_ext[j], *(1 + (short *) &rxF_ext[j]), i,
                    *(short *) &rxF[i], *(1 + (short *) &rxF[i]));
-#endif
           }
         }
 
@@ -658,15 +627,13 @@ void nr_pdcch_channel_compensation(int32_t **rxdataF_ext,
       //print_shorts("rx:",rxdataF128+2);
       //print_shorts("ch:",dl_ch128+2);
       //print_shorts("pack:",rxdataF_comp128+2);
-#ifdef NR_PDCCH_DCI_DEBUG
 
       for (int i=0; i<12 ; i++)
-        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_channel_compensation)-> rxdataF128[%d]=(%d,%d) X dlch[%d]=(%d,%d) rxdataF_comp128[%d]=(%d,%d)\n",
+        LOG_DDD("rxdataF128[%d]=(%d,%d) X dlch[%d]=(%d,%d) rxdataF_comp128[%d]=(%d,%d)\n",
                (rb*12)+i, ((short *)rxdataF128)[i<<1],((short *)rxdataF128)[1+(i<<1)],
                (rb*12)+i, ((short *)dl_ch128)[i<<1],((short *)dl_ch128)[1+(i<<1)],
                (rb*12)+i, ((short *)rxdataF_comp128)[i<<1],((short *)rxdataF_comp128)[1+(i<<1)]);
 
-#endif
       dl_ch128+=3;
       rxdataF128+=3;
       rxdataF_comp128+=3;
@@ -795,11 +762,9 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
     }
   }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> symbol_mon=(%d) and start_symbol=(%d)\n",symbol_mon,start_symbol);
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld) n_rb_offset=(%d) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) scrambling_ID=(%d) \n",
+  LOG_DD("symbol_mon=(%d) and start_symbol=(%d)\n",symbol_mon,start_symbol);
+  LOG_DD("coreset_freq_dom=(%ld) n_rb_offset=(%d) coreset_time_dur=(%d) n_shift=(%d) reg_bundle_size_L=(%d) coreset_interleaver_size_R=(%d) scrambling_ID=(%d) \n",
          coreset_freq_dom,n_rb_offset,coreset_time_dur,n_shift,reg_bundle_size_L,coreset_interleaver_size_R,pdcch_DMRS_scrambling_id);
-#endif
   //
   // according to 38.213 v15.1.0: a PDCCH monitoring pattern within a slot,
   // indicating first symbol(s) of the control resource set within a slot
@@ -815,9 +780,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
   // for (int j=0; j < coreset_nbr_act; j++) {
   // for each active CORESET (max number of active CORESETs in a BWP is 3),
   // we calculate the number of RB for each CORESET bitmap
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld)\n",coreset_freq_dom);
-#endif
+  LOG_DD("coreset_freq_dom=(%ld)\n",coreset_freq_dom);
   int i; //for each bit in the coreset_freq_dom bitmap
 
   for (i = 0; i < 45; i++) {
@@ -826,22 +789,18 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
   }
 
   coreset_nbr_rb = 6 * coreset_nbr_rb; // coreset_nbr_rb has to be multiplied by 6 to indicate the number of PRB or REG(=12 RE) within the CORESET
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_freq_dom=(%ld,%lx), coreset_nbr_rb=%d\n", coreset_freq_dom,coreset_freq_dom,coreset_nbr_rb);
-#endif
-#ifdef NR_PDCCH_DCI_DEBUG
-  uint8_t  coreset_nbr_reg = coreset_time_dur * coreset_nbr_rb;
-  uint32_t coreset_C = (uint32_t)(coreset_nbr_reg / (reg_bundle_size_L * coreset_interleaver_size_R));
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> coreset_nbr_rb=%d, coreset_nbr_reg=%d, coreset_C=(%d/(%d*%d))=%d\n",
-         coreset_nbr_rb, coreset_nbr_reg, coreset_nbr_reg, reg_bundle_size_L,coreset_interleaver_size_R, coreset_C);
-#endif
+  LOG_DD("coreset_freq_dom=(%ld,%lx), coreset_nbr_rb=%d\n", coreset_freq_dom,coreset_freq_dom,coreset_nbr_rb);
+  LOG_DD("coreset_nbr_rb=%d, coreset_nbr_reg=%d, coreset_C=(%d/(%d*%d))=%d\n",
+         coreset_nbr_rb, 
+	 coreset_time_dur * coreset_nbr_rb,
+	 coreset_time_dur * coreset_nbr_rb,
+	 reg_bundle_size_L,coreset_interleaver_size_R,
+	(uint32_t)((coreset_time_dur * coreset_nbr_rb) / (reg_bundle_size_L * coreset_interleaver_size_R)) );
 
   for (int s = start_symbol; s < (start_symbol + coreset_time_dur); s++) {
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we enter nr_pdcch_extract_rbs_single(is_secondary_ue=%d) to remove DM-RS PDCCH\n",
+    LOG_DD("we enter nr_pdcch_extract_rbs_single(is_secondary_ue=%d) to remove DM-RS PDCCH\n",
            is_secondary_ue);
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n");
-#endif
+    LOG_DD("in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n");
     nr_pdcch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[nr_tti_rx]].rxdataF,
                                 pdcch_vars[eNB_id]->dl_ch_estimates,
                                 pdcch_vars[eNB_id]->rxdataF_ext,
@@ -852,10 +811,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
                                 coreset_freq_dom,
                                 coreset_nbr_rb,
                                 n_rb_offset);
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> 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);
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> in pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n");
-#endif
+    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");
     // compute channel level based on ofdm symbol 0
     pdcch_channel_level(pdcch_vars[eNB_id]->dl_ch_estimates_ext,
                         frame_parms,
@@ -874,10 +831,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
     T(T_UE_PHY_PDCCH_ENERGY, T_INT(eNB_id), T_INT(0), T_INT(frame%1024), T_INT(nr_tti_rx),
       T_INT(avgP[0]), T_INT(avgP[1]), T_INT(avgP[2]), T_INT(avgP[3]));
 #endif
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we enter nr_pdcch_channel_compensation(log2_maxh=%d)\n",log2_maxh);
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> in nr_pdcch_channel_compensation(rxdataF_ext x dl_ch_estimates_ext -> rxdataF_comp)\n");
-#endif
+    LOG_DD("we enter nr_pdcch_channel_compensation(log2_maxh=%d)\n",log2_maxh);
+    LOG_DD("in nr_pdcch_channel_compensation(rxdataF_ext x dl_ch_estimates_ext -> rxdataF_comp)\n");
     // compute LLRs for ofdm symbol 0 only
     nr_pdcch_channel_compensation(pdcch_vars[eNB_id]->rxdataF_ext,
                                   pdcch_vars[eNB_id]->dl_ch_estimates_ext,
@@ -895,17 +850,13 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
 #endif
 
     if (frame_parms->nb_antennas_rx > 1) {
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we enter pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n",
+      LOG_DD("we enter pdcch_detection_mrc(frame_parms->nb_antennas_rx=%d)\n",
              frame_parms->nb_antennas_rx);
-#endif
       pdcch_detection_mrc(frame_parms, pdcch_vars[eNB_id]->rxdataF_comp,s);
     }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we enter nr_pdcch_llr(for symbol %d), pdcch_vars[eNB_id]->rxdataF_comp ---> pdcch_vars[eNB_id]->llr \n",s);
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> in nr_pdcch_llr(rxdataF_comp -> llr)\n");
-#endif
+    LOG_DD("we enter nr_pdcch_llr(for symbol %d), pdcch_vars[eNB_id]->rxdataF_comp ---> pdcch_vars[eNB_id]->llr \n",s);
+    LOG_DD("in nr_pdcch_llr(rxdataF_comp -> llr)\n");
     nr_pdcch_llr(frame_parms,
                  pdcch_vars[eNB_id]->rxdataF_comp,
                  pdcch_vars[eNB_id]->llr,
@@ -923,9 +874,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
 #endif
   }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we enter nr_pdcch_demapping_deinterleaving()\n");
-#endif
+  LOG_DD("we enter nr_pdcch_demapping_deinterleaving()\n");
   nr_pdcch_demapping_deinterleaving((uint32_t *) pdcch_vars[eNB_id]->llr,
                                     (uint32_t *) pdcch_vars[eNB_id]->e_rx,
                                     frame_parms,
@@ -942,12 +891,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
                         // get_nCCE(n_pdcch_symbols, frame_parms, mi) * 72,
                         pdcch_DMRS_scrambling_id,
                         do_common);
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> we end nr_pdcch_unscrambling()\n");
-#endif
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_rx_pdcch)-> Ending nr_rx_pdcch() function\n");
-#endif
+  LOG_DD("we end nr_pdcch_unscrambling()\n");
+  LOG_DD("Ending nr_rx_pdcch() function\n");
   return (0);
 }
 #endif
@@ -1006,22 +951,20 @@ void nr_pdcch_unscrambling(uint16_t crnti, NR_DL_FRAME_PARMS *frame_parms, uint8
   //uint32_t calc_x2=puissance_2_16%puissance_2_31;
   x2 = (((1<<16)*n_rnti)+n_id); //mod 2^31 is implicit //this is c_init in 38.211 v15.1.0 Section 7.3.2.3
   //  x2 = (nr_tti_rx << 9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
-#ifdef NR_PDCCH_DCI_DEBUG
-  //printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_unscrambling)->  (c_init=%d, n_id=%d, n_rnti=%d, length=%d)\n",x2,n_id,n_rnti,length);
-#endif
+  //LOG_DDD(" (c_init=%d, n_id=%d, n_rnti=%d, length=%d)\n",x2,n_id,n_rnti,length);
 
   for (i = 0; i < length; i++) {
     if ((i & 0x1f) == 0) {
       s = lte_gold_generic(&x1, &x2, reset);
-      //printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_unscrambling)-> lte_gold[%d]=%x\n",i,s);
+      //LOG_DDD("lte_gold[%d]=%x\n",i,s);
       reset = 0;
     }
 
     /*
     #ifdef NR_PDCCH_DCI_DEBUG
-    if (i%2 == 0) printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_unscrambling)->  unscrambling %d : scrambled_z=%d, => ",
+    if (i%2 == 0) LOG_DDD(" unscrambling %d : scrambled_z=%d, => ",
        i,*(char*) &z[(int)floor(i/2)]);
-    if (i%2 == 1) printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_unscrambling)->  unscrambling %d : scrambled_z=%d, => ",
+    if (i%2 == 1) LOG_DDD(" unscrambling %d : scrambled_z=%d, => ",
        i,*(1 + (char*) &z[(int)floor(i/2)]));
     #endif
     if (((s >> (i % 32)) & 1) == 1){
@@ -1035,16 +978,12 @@ void nr_pdcch_unscrambling(uint16_t crnti, NR_DL_FRAME_PARMS *frame_parms, uint8
     if (i%2 == 1) printf("unscrambled_z=%d\n",*(1 + (char*) &z[(int)floor(i/2)]));
     #endif
     */
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_pdcch_unscrambling)->  unscrambling %d : scrambled_z=%d, => ",
+    LOG_DDD(" unscrambling %d : scrambled_z=%d, => ",
            i,z[i]);
-#endif
 
     if (((s >> (i % 32)) & 1) == 1) z[i] = -z[i];
 
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("unscrambled_z=%d\n",z[i]);
-#endif
+    LOG_DDD("unscrambled_z=%d\n",z[i]);
   }
 }
 
@@ -1090,19 +1029,15 @@ void nr_dci_decoding_procedure0(int s,
   //Table 10.1-3: Maximum number of non-overlapped CCEs per slot and per serving cell as a function of the subcarrier spacing value 2^mu*15 KHz, mu {0,1,2,3}
   //uint8_t cce_max_slot_pdcch_Table10_1_3 [4] = {56,56,48,32};
   int coreset_nbr_cce_per_symbol=0;
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> format_found is %d \n", *format_found);
-#endif
+  LOG_DDD("format_found is %d \n", *format_found);
   //if (mode == NO_DCI) {
   //  #ifdef NR_PDCCH_DCI_DEBUG
-  //    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> skip DCI decoding: expect no DCIs at nr_tti_rx %d in current searchSpace\n", nr_tti_rx);
+  //    LOG_DDD("skip DCI decoding: expect no DCIs at nr_tti_rx %d in current searchSpace\n", nr_tti_rx);
   //  #endif
   //  return;
   //}
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> frequencyDomainResources=%lx, duration=%d\n",
+  LOG_DDD("frequencyDomainResources=%lx, duration=%d\n",
          pdcch_vars[eNB_id]->coreset[p].frequencyDomainResources, pdcch_vars[eNB_id]->coreset[p].duration);
-#endif
 
   // nCCE = get_nCCE(pdcch_vars[eNB_id]->num_pdcch_symbols, frame_parms, mi);
   for (int i = 0; i < 45; i++) {
@@ -1116,9 +1051,7 @@ void nr_dci_decoding_procedure0(int s,
   //   the number of symbols in the CORESET (pdcch_vars[eNB_id]->coreset[p].duration)
   //   multiplied by the number of bits set to '1' in the frequencyDomainResources bitmap
   //   (1 bit set to '1' corresponds to 6 RB and 1 CCE = 6 RB)
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> nCCE[%d]=%d\n",p,nCCE[p]);
-#endif
+  LOG_DDD("nCCE[%d]=%d\n",p,nCCE[p]);
 
   /*  if (nCCE > get_nCCE(3, frame_parms, 1)) {
   LOG_D(PHY,
@@ -1172,9 +1105,7 @@ void nr_dci_decoding_procedure0(int s,
       nb_candidates = pdcch_vars[eNB_id]->searchSpace[s].searchSpaceType.srs_nrofCandidates;
     } else {
       nb_candidates = (L2 == 4) ? 4 : ((L2 == 8)? 2 : 1); // according to Table 10.1-1 (38.213 section 10.1)
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> we are in common searchSpace and nb_candidates=%u for L2=%d\n", nb_candidates, L2);
-#endif
+      LOG_DDD("we are in common searchSpace and nb_candidates=%u for L2=%d\n", nb_candidates, L2);
     }
   } else {
     switch (L2) {
@@ -1211,9 +1142,7 @@ void nr_dci_decoding_procedure0(int s,
       Yk = (Yk * A[p%3]) % 65537;
   }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> L2(%d) | nCCE[%d](%d) | Yk(%u) | nb_candidates(%u)\n", L2, p, nCCE[p], Yk, nb_candidates);
-#endif
+  LOG_DDD("L2(%d) | nCCE[%d](%d) | Yk(%u) | nb_candidates(%u)\n", L2, p, nCCE[p], Yk, nb_candidates);
   /*  for (CCEind=0;
       CCEind<nCCE2;
       CCEind+=(1<<L)) {*/
@@ -1224,27 +1153,19 @@ void nr_dci_decoding_procedure0(int s,
 
   if (L==4) m_p_s_L_max=1; // Table 10.1-2 is not defined for L=4
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  if(0 <= L && L < 4) printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> m_max_slot_pdcch_Table10_1_2(%d)=%d\n",L,m_max_slot_pdcch_Table10_1_2[L]);
-#endif
+  if(0 <= L && L < 4) LOG_DDD("m_max_slot_pdcch_Table10_1_2(%d)=%d\n",L,m_max_slot_pdcch_Table10_1_2[L]);
 
   for (m = 0; m < nb_candidates; m++) {
     int n_ci = 0;
 
     if (nCCE[p] < L2) return;
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  int debug1 = nCCE[p] / L2;
-  int debug2 = L2*m_p_s_L_max;
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",debug1,p,nCCE[p],L2);
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",debug2,L2,m_p_s_L_max);
-#endif
+  LOG_DDD("debug1(%d)=nCCE[p]/L2 | nCCE[%d](%d) | L2(%d)\n",nCCE[p] / L2,p,nCCE[p],L2);
+  LOG_DDD("debug2(%d)=L2*m_p_s_L_max | L2(%d) | m_p_s_L_max(%d)\n",L2*m_p_s_L_max,L2,m_p_s_L_max);
   CCEind = (((Yk + (uint16_t)(floor((m*nCCE[p])/(L2*m_p_s_L_max))) + n_ci) % (uint16_t)(floor(nCCE[p] / L2))) * L2);
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEind(%d) = (((Yk(%u) + ((m(%u)*nCCE[p](%d))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n",
+  LOG_DDD("CCEind(%d) = (((Yk(%u) + ((m(%u)*nCCE[p](%d))/(L2(%d)*m_p_s_L_max(%d)))) %% (nCCE[p] / L2)) * L2)\n",
             CCEind,Yk,m,nCCE[p],L2,m_p_s_L_max);
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> n_candidate(m)=%u | CCEind=%d |",m,CCEind);
-#endif
+  LOG_DDD("n_candidate(m)=%u | CCEind=%d |",m,CCEind);
 
     if (CCEind < 32)
       CCEmap = CCEmap0;
@@ -1283,9 +1204,7 @@ void nr_dci_decoding_procedure0(int s,
 
     CCEmap_cand = (*CCEmap) & CCEmap_mask;
     // CCE is not allocated yet
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> CCEmap_cand=%u \n",CCEmap_cand);
-#endif
+    LOG_DDD("CCEmap_cand=%u \n",CCEmap_cand);
 
     if (CCEmap_cand == 0) {
 #ifdef DEBUG_DCI_DECODING
@@ -1298,15 +1217,11 @@ void nr_dci_decoding_procedure0(int s,
               pdcch_vars[eNB_id]->num_pdcch_symbols,m,L2,sizeof_bits,CCEind,nCCE,*CCEmap,CCEmap_mask,format_uss);
 
 #endif
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> ... we enter function dci_decoding(sizeof_bits=%d L=%d) -----\n",sizeof_bits,L);
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> ... we have to replace this part of the code by polar decoding\n");
-#endif
+      LOG_DDD("... we enter function dci_decoding(sizeof_bits=%d L=%d) -----\n",sizeof_bits,L);
+      LOG_DDD("... we have to replace this part of the code by polar decoding\n");
       //      for (int m=0; m < (nCCE[p]*6*9*2); m++)
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0: polar decoding)-> polar intput (with coreset_time_dur=%d, coreset_nbr_rb=%d, p=%d, CCEind=%d): \n",
+      LOG_DDD("(polar decoding)-> polar intput (with coreset_time_dur=%d, coreset_nbr_rb=%d, p=%d, CCEind=%d): \n",
              coreset_time_dur,coreset_nbr_rb,p,CCEind);
-#endif
       /*
       int reg_p=0,reg_e=0;
       for (int m=0; m < (L2*6); m++){
@@ -1331,7 +1246,7 @@ void nr_dci_decoding_procedure0(int s,
       //polar_hex[j] = (polar_hex[j]<<1) + ((polar_input[i]==-1)? 1:0);
       polar_hex[j] = polar_hex[j] + (((polar_input[i]==((-1)/sqrt(2)))?1:0)<<(i%32));
       }
-      for (j=0;j<27;j++) printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0: polar decoding input)-> polar_hex[%d]=%x\n",j,polar_hex[j]);
+      for (j=0;j<27;j++) LOG_DDD("polar_hex[%d]=%x\n",j,polar_hex[j]);
       #endif
       */
       uint64_t dci_estimation[2]= {0};
@@ -1342,17 +1257,13 @@ void nr_dci_decoding_procedure0(int s,
                                          currentPtrDCI);
       crc = decoderState;
       //crc = (crc16(&dci_decoded_output[current_thread_id][0], sizeof_bits) >> 16) ^ extract_crc(&dci_decoded_output[current_thread_id][0], sizeof_bits);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> ... we end function dci_decoding() with crc=%x\n",crc);
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> ... we have to replace this part of the code by polar decoding\n");
-#endif
+      LOG_DDD("... we end function dci_decoding() with crc=%x\n",crc);
+      LOG_DDD("... we have to replace this part of the code by polar decoding\n");
 #ifdef DEBUG_DCI_DECODING
-      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0: crc =>%d\n",crc);
+      LOG_DDD("(nr_dci_decoding_procedure0: crc =>%d\n",crc);
 #endif //uint16_t tc_rnti, uint16_t int_rnti, uint16_t sfi_rnti, uint16_t tpc_pusch_rnti, uint16_t tpc_pucch_rnti, uint16_t tpc_srs__rnti
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> format_found=%d\n",*format_found);
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> crc_scrambled=%d\n",*crc_scrambled);
-#endif
+      LOG_DDD("format_found=%d\n",*format_found);
+      LOG_DDD("crc_scrambled=%d\n",*crc_scrambled);
 
       if (crc == crc_scrambled_values[_C_RNTI_])  {
         *crc_scrambled =_c_rnti;
@@ -1420,10 +1331,8 @@ void nr_dci_decoding_procedure0(int s,
       }
 
 
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> format_found=%d\n",*format_found);
-      printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> crc_scrambled=%d\n",*crc_scrambled);
-#endif
+      LOG_DDD("format_found=%d\n",*format_found);
+      LOG_DDD("crc_scrambled=%d\n",*crc_scrambled);
 
       if (*format_found!=255) {
         dci_alloc[*dci_cnt].dci_length = sizeof_bits;
@@ -1432,31 +1341,29 @@ void nr_dci_decoding_procedure0(int s,
         dci_alloc[*dci_cnt].firstCCE = CCEind;
         memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_estimation,8);
 
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> rnti matches -> DCI FOUND !!! crc =>0x%x, sizeof_bits %d, sizeof_bytes %d \n",
+        LOG_DDD("rnti matches -> DCI FOUND !!! crc =>0x%x, sizeof_bits %d, sizeof_bytes %d \n",
                 dci_alloc[*dci_cnt].rnti, dci_alloc[*dci_cnt].dci_length, sizeof_bytes);
-        printf ("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> dci_cnt %d (format_css %d crc_scrambled %d) L %d, firstCCE %d pdu[0] 0x%lx pdu[1] 0x%lx \n",
+        LOG_DDD("dci_cnt %d (format_css %d crc_scrambled %d) L %d, firstCCE %d pdu[0] 0x%lx pdu[1] 0x%lx \n",
                 *dci_cnt, format_css,*crc_scrambled,dci_alloc[*dci_cnt].L, dci_alloc[*dci_cnt].firstCCE,dci_alloc[*dci_cnt].dci_pdu[0],dci_alloc[*dci_cnt].dci_pdu[1]);
-#endif
         if ((format_css == cformat0_0_and_1_0) || (format_uss == uformat0_0_and_1_0)) {
           if ((*crc_scrambled == _p_rnti) || (*crc_scrambled == _si_rnti) || (*crc_scrambled == _ra_rnti)) {
             dci_alloc[*dci_cnt].format = format1_0;
             *dci_cnt = *dci_cnt + 1;
             *format_found=_format_1_0_found;
-            //      printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> a format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
+            //      LOG_DDD("a format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
           } else {
             if ((dci_estimation[0]&1) == 0) {
               dci_alloc[*dci_cnt].format = format0_0;
               *dci_cnt = *dci_cnt + 1;
               *format_found=_format_0_0_found;
-              //        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> b format0_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
+              //        LOG_DDD("b format0_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
             }
 
             if ((dci_estimation[0]&1) == 1) {
               dci_alloc[*dci_cnt].format = format1_0;
               *dci_cnt = *dci_cnt + 1;
               *format_found=_format_1_0_found;
-              //        printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> c format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
+              //        LOG_DDD("c format1_0=%d and dci_cnt=%d\n",*format_found,*dci_cnt);
             }
           }
         }
@@ -1584,9 +1491,7 @@ void nr_dci_decoding_procedure0(int s,
     */
   } // candidate loop
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure0)-> end candidate loop\n");
-#endif
+  LOG_DDD("end candidate loop\n");
 }
 
 #endif
@@ -1628,7 +1533,7 @@ void nr_dci_decoding_procedure0(int s,
   unsigned int Yk,nb_candidates = 0,i,m;
   unsigned int CCEmap_cand;
   #ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (dci_decoding_procedure0)-> \n");
+  LOG_DDD("\n");
   #endif
   nCCE = get_nCCE(pdcch_vars[eNB_id]->num_pdcch_symbols,frame_parms,mi);
 
@@ -2053,9 +1958,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
                              uint16_t n_RB_DLBWP,
                              uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
                              uint8_t format) {
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size)-> crc_scrambled=%d, n_RB_ULBWP=%d, n_RB_DLBWP=%d\n",crc_scrambled,n_RB_ULBWP,n_RB_DLBWP);
-#endif
+  LOG_DDD("crc_scrambled=%d, n_RB_ULBWP=%d, n_RB_DLBWP=%d\n",crc_scrambled,n_RB_ULBWP,n_RB_DLBWP);
   /*
    * function nr_dci_format_size calculates and returns the size in bits of a determined format
    * it also returns an bi-dimensional array 'dci_fields_sizes' with x rows and y columns, where:
@@ -2524,7 +2427,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
 
   for (int i=0 ; i<NBR_NR_FORMATS ; i++) {
     //#ifdef NR_PDCCH_DCI_DEBUG
-    //  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size)-> i=%d, j=%d\n", i, j);
+    //  LOG_DDD("i=%d, j=%d\n", i, j);
     //#endif
     for (int j=0; j<NBR_NR_DCI_FIELDS; j++) {
       dci_size [i] = dci_size [i] + dci_field_size_table[j][i]; // dci_size[i] contains the size in bits of the dci pdu format i
@@ -2533,15 +2436,13 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
       //}
     }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) dci_size[%d]=%d for n_RB_ULBWP=%d\n",
+    LOG_DDD("(nr_dci_format_size) dci_size[%d]=%d for n_RB_ULBWP=%d\n",
            i,dci_size[i],n_RB_ULBWP);
-#endif
   }
 
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) dci_fields_sizes[][] = { \n");
+  LOG_DDD("(nr_dci_format_size) dci_fields_sizes[][] = { \n");
 
+#ifdef NR_PDCCH_DCI_DEBUG
   for (int j=0; j<NBR_NR_DCI_FIELDS; j++) {
     printf("\t\t");
 
@@ -2552,9 +2453,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
 
   printf(" }\n");
 #endif
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\n\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) dci_size[0_0]=%d, dci_size[0_1]=%d, dci_size[1_0]=%d, dci_size[1_1]=%d,\n",dci_size[0],dci_size[1],dci_size[2],dci_size[3]);
-#endif
+  LOG_DNL("(nr_dci_format_size) dci_size[0_0]=%d, dci_size[0_1]=%d, dci_size[1_0]=%d, dci_size[1_1]=%d,\n",dci_size[0],dci_size[1],dci_size[2],dci_size[3]);
 
   //UL/SUL indicator format0_0 (TS 38.212 subclause 7.3.1.1.1)
   // - 1 bit if the cell has two ULs and the number of bits for DCI format 1_0 before padding is larger than the number of bits for DCI format 0_0 before padding;
@@ -2574,9 +2473,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
     //if (format == format0_0) {
     dci_fields_sizes[PADDING_NR_DCI][0] = dci_size[2] - dci_size[0];
     dci_size[0] = dci_size[2];
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) new dci_size[format0_0]=%d\n",dci_size[0]);
-#endif
+    LOG_DDD("(nr_dci_format_size) new dci_size[format0_0]=%d\n",dci_size[0]);
     //}
   }
 
@@ -2588,9 +2485,7 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
     //if (format == format0_0) {
     dci_fields_sizes[FREQ_DOM_RESOURCE_ASSIGNMENT_UL][0] -= (dci_size[0] - dci_size[2]);
     dci_size[0] = dci_size[2];
-#ifdef NR_PDCCH_DCI_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) new dci_size[format0_0]=%d\n",dci_size[0]);
-#endif
+    LOG_DDD("(nr_dci_format_size) new dci_size[format0_0]=%d\n",dci_size[0]);
     //}
   }
 
@@ -2606,9 +2501,9 @@ uint16_t nr_dci_format_size (PHY_VARS_NR_UE *ue,
    *
    */
   //  }
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t\t<-NR_PDCCH_DCI_DEBUG (nr_dci_format_size) dci_fields_sizes[][] = { \n");
+  LOG_DDD("(nr_dci_format_size) dci_fields_sizes[][] = { \n");
 
+#ifdef NR_PDCCH_DCI_DEBUG
   for (int j=0; j<NBR_NR_DCI_FIELDS; j++) {
     printf("\t\t");
 
@@ -2640,10 +2535,8 @@ uint8_t nr_dci_decoding_procedure(int s,
                                   format_found_t *format_found,
                                   uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES]) {
   //                                  uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure) nr_tti_rx=%d n_RB_ULBWP=%d n_RB_DLBWP=%d format_found=%d\n",
+  LOG_DD("(nr_dci_decoding_procedure) nr_tti_rx=%d n_RB_ULBWP=%d n_RB_DLBWP=%d format_found=%d\n",
          nr_tti_rx,n_RB_ULBWP,n_RB_DLBWP,*format_found);
-#endif
   int do_common = (int)searchSpacetype;
   uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS];
   crc_scrambled_t crc_scrambled_ = *crc_scrambled;
@@ -2701,16 +2594,9 @@ uint8_t nr_dci_decoding_procedure(int s,
    * This can be implemented by setting variable 'mode = NO_DCI' when overlap occurs
    */
   //dci_detect_mode_t mode = 3; //dci_detect_mode_select(&ue->frame_parms, nr_tti_rx);
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> searSpaceType=%d\n",do_common);
-
-  if (do_common==0) {
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> css_dci_format=%d\n",css_dci_format);
-  } else {
-    printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> uss_dci_format=%d\n",uss_dci_format);
-  }
+  LOG_DD("searSpaceType=%d\n",do_common);
+  LOG_DD("%s_dci_format=%d\n",do_common?"uss":"css",css_dci_format);
 
-#endif
 
   // A set of PDCCH candidates for a UE to monitor is defined in terms of PDCCH search spaces
   if (do_common==0) { // COMMON SearchSpaceType assigned to current SearchSpace/CORESET
@@ -2739,18 +2625,14 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format0_0 and format1_0, first we calculate dci pdu size
       format_0_0_1_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,0);
       format_0_0_1_0_size_bytes = (format_0_0_1_0_size_bits%8 == 0) ? (uint8_t)floor(format_0_0_1_0_size_bits/8) : (uint8_t)(floor(format_0_0_1_0_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for common searchSpaces with format css_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
              css_dci_format,format_0_0_1_0_size_bits,format_0_0_1_0_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
         //for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
         // for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
                                    crc_scrambled_values, aggregationLevel,
@@ -2778,16 +2660,12 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format2_0, first we calculate dci pdu size
       format_2_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_sfi_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,4);
       format_2_0_size_bytes = (format_2_0_size_bits%8 == 0) ? (uint8_t)floor(format_2_0_size_bits/8) : (uint8_t)(floor(format_2_0_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_0_size_bits=%d, format2_0_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_0_size_bits=%d, format2_0_size_bytes=%d\n",
              css_dci_format,format_2_0_size_bits,format_2_0_size_bytes);
-#endif
 
       for (int aggregationLevelSFI = 0; aggregationLevelSFI<5 ; aggregationLevelSFI++) {
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevelSFI));
-#endif
         // for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
@@ -2812,16 +2690,12 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format2_1, first we calculate dci pdu size
       format_2_1_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_int_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,5);
       format_2_1_size_bytes = (format_2_1_size_bits%8 == 0) ? (uint8_t)floor(format_2_1_size_bits/8) : (uint8_t)(floor(format_2_1_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_1_size_bits=%d, format2_1_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_1_size_bits=%d, format2_1_size_bytes=%d\n",
              css_dci_format,format_2_1_size_bits,format_2_1_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         // for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
@@ -2846,16 +2720,12 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format2_2, first we calculate dci pdu size
       format_2_2_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_tpc_pucch_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,6);
       format_2_2_size_bytes = (format_2_2_size_bits%8 == 0) ? (uint8_t)floor(format_2_2_size_bits/8) : (uint8_t)(floor(format_2_2_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_2_size_bits=%d, format2_2_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_2_size_bits=%d, format2_2_size_bytes=%d\n",
              css_dci_format,format_2_2_size_bits,format_2_2_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         // for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
@@ -2880,16 +2750,12 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format2_1, first we calculate dci pdu size
       format_2_3_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_tpc_srs_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,7);
       format_2_3_size_bytes = (format_2_3_size_bits%8 == 0) ? (uint8_t)floor(format_2_3_size_bits/8) : (uint8_t)(floor(format_2_3_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_3_size_bits=%d, format2_3_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for common searchSpaces with format css_dci_format=%d, format2_3_size_bits=%d, format2_3_size_bytes=%d\n",
              css_dci_format,format_2_3_size_bits,format_2_3_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) {
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         // for aggregation level 'aggregationLevelSFI'. The number of candidates (nrofCandidates-SFI) will be calculated in function nr_dci_decoding_procedure0
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 1, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
@@ -2915,18 +2781,14 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format0_0 and format1_0, first we calculate dci pdu size
       format_0_0_1_0_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,0);
       format_0_0_1_0_size_bytes = (format_0_0_1_0_size_bits%8 == 0) ? (uint8_t)floor(format_0_0_1_0_size_bits/8) : (uint8_t)(floor(format_0_0_1_0_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_0_1_0_size_bits=%d, format_0_0_1_0_size_bytes=%d\n",
              css_dci_format,format_0_0_1_0_size_bits,format_0_0_1_0_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
         //for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
         // for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 0, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
                                    crc_scrambled_values, aggregationLevel,
@@ -2950,18 +2812,14 @@ uint8_t nr_dci_decoding_procedure(int s,
       // for format0_0 and format1_0, first we calculate dci pdu size
       format_0_1_1_1_size_bits = nr_dci_format_size(ue,eNB_id,nr_tti_rx,p,_c_rnti,n_RB_ULBWP,n_RB_DLBWP,dci_fields_sizes,1);
       format_0_1_1_1_size_bytes = (format_0_1_1_1_size_bits%8 == 0) ? (uint8_t)floor(format_0_1_1_1_size_bits/8) : (uint8_t)(floor(format_0_1_1_1_size_bits/8) + 1);
-#ifdef NR_PDCCH_DCI_DEBUG
-      printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_1_1_1_size_bits=%d, format_0_1_1_1_size_bytes=%d\n",
+      LOG_DD("calculating dci format size for UE-specific searchSpaces with format uss_dci_format=%d, format_0_1_1_1_size_bits=%d, format_0_1_1_1_size_bytes=%d\n",
              css_dci_format,format_0_1_1_1_size_bits,format_0_1_1_1_size_bytes);
-#endif
 
       for (int aggregationLevel = 0; aggregationLevel<5 ; aggregationLevel++) { // We fix aggregationLevel to 3 for testing=> nbr of CCE=8
         //for (int aggregationLevel = 2; aggregationLevel<5 ; aggregationLevel++) {
         // for aggregation level aggregationLevel. The number of candidates (for L2= 2^aggregationLevel) will be calculated in function nr_dci_decoding_procedure0
-#ifdef NR_PDCCH_DCI_DEBUG
-        printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
+        LOG_DD("common searchSpaces with format css_dci_format=%d and aggregation_level=%d\n",
                css_dci_format,(1<<aggregationLevel));
-#endif
         old_dci_cnt = dci_cnt;
         nr_dci_decoding_procedure0(s,p,coreset_time_dur,coreset_nbr_rb,pdcch_vars, 0, nr_tti_rx, dci_alloc, eNB_id, ue->current_thread_id[nr_tti_rx], frame_parms,
                                    crc_scrambled_values, aggregationLevel,
@@ -2984,12 +2842,8 @@ uint8_t nr_dci_decoding_procedure(int s,
 
   *crc_scrambled = crc_scrambled_;
   *format_found  = format_found_;
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> at the end crc_scrambled=%d and format_found=%d\n",*crc_scrambled,*format_found);
-#endif
-#ifdef NR_PDCCH_DCI_DEBUG
-  printf("\t<-NR_PDCCH_DCI_DEBUG (nr_dci_decoding_procedure)-> at the end dci_cnt=%d \n",dci_cnt);
-#endif
+  LOG_DD("at the end crc_scrambled=%d and format_found=%d\n",*crc_scrambled,*format_found);
+  LOG_DD("at the end dci_cnt=%d \n",dci_cnt);
   return(dci_cnt);
 }
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_tools_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_tools_nr.c
index 48125a01f83d2d7b9b6bea1c091dee17c6963b91..df79abefcdef6d2ce0decc771d8e77e216534581 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_tools_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_tools_nr.c
@@ -37,7 +37,7 @@
 //#include "PHY/extern.h"
 //#include "SCHED/defs.h"
 #ifdef DEBUG_DCI_TOOLS
-#include "PHY/vars.h"
+  #include "PHY/vars.h"
 #endif
 #include "assertions.h"
 
@@ -53,6 +53,12 @@
 //#define DEBUG_DCI
 #define NR_PDCCH_DCI_TOOLS
 //#define NR_PDCCH_DCI_TOOLS_DEBUG
+#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
+#define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a)
+#else 
+#define LOG_DCI_D(a...)
+#endif
+#define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
 
 typedef unsigned __int128 uint128_t;
 
@@ -66,18 +72,16 @@ int8_t *nr_delta_PUCCH_lut = nr_delta_PUSCH_acc;
 
 uint16_t nr_dci_field(uint64_t dci_pdu[2],
                       uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS],
-                      uint8_t dci_field)
-{
+                      uint8_t dci_field) {
   int dci_size=0;
 
-  for (int i=0;i<NBR_NR_DCI_FIELDS;i++) dci_size+=dci_fields_sizes[i];
+  for (int i=0; i<NBR_NR_DCI_FIELDS; i++) dci_size+=dci_fields_sizes[i];
 
   AssertFatal(dci_size<65,"DCI has %d > 64 bits, not supported for now\n",
-	      dci_size);
-
+              dci_size);
   uint16_t first_bit_position = dci_size;
-  
-  for (int i=0; i<=dci_field ; i++){
+
+  for (int i=0; i<=dci_field ; i++) {
     first_bit_position = first_bit_position - dci_fields_sizes[i];
   }
 
@@ -85,928 +89,832 @@ uint16_t nr_dci_field(uint64_t dci_pdu[2],
   uint16_t tmp2 = 0;
   for (int i=0; i<dci_fields_sizes[dci_field]; i++)
     tmp2 |= ((tmp1>>i)&1)<<(dci_fields_sizes[dci_field]-i-1);*/
-
   return ((uint16_t)(*dci_pdu>>first_bit_position)&((1<<dci_fields_sizes[dci_field])-1));
 }
 
 int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
-        uint8_t eNB_id,
-        lte_frame_type_t frame_type,
-        uint8_t dci_length,
-        uint16_t rnti,
-        uint64_t dci_pdu[2],
-        fapi_nr_dci_pdu_rel15_t *nr_pdci_info_extracted,
-        uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
-        NR_DCI_format_t dci_format,
-        uint8_t nr_tti_rx,
-        uint16_t n_RB_ULBWP,
-        uint16_t n_RB_DLBWP,
-        uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES])
-{
-
-/*
- * This function will extract the different elements of the dci pdu and interpret the values extracted to update correctly the parameters in:
- *                                                NR_DL_UE_HARQ_t *pdlsch0_harq,
- *                                                NR_UE_DLSCH_t *pdlsch0,
- *
- * We need to know the dci length and the dci_fields_sizes (array containing each field size in number of bits)
- * In order to get the value of a specific field we will proceed as follows (let's have a look to an example:
- * If the length of the pdu is 38 bits and the content of the dci_pdu is 0x3A8900789A (pdu is 11 1010 1000 1001 0000 0000 0111 1000 1001 1010)
- * If the dci_fields_sizes is {0 0 1 0 0 0 0 0 0 13 0 1 0 0 0 0 0 0 0 0 0 0 5 1 2 4 2 0 0 0 2 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...}
- * This means:
- *             number bits for carrier_ind field is 0
- *             number bits for sul_ind_0_1 field is 0
- *             number bits for identifier_dci_formats field is 0
- *             number bits for slot_format_ind field is 0
- *             number bits for pre_emption_ind field is 0
- *             ...
- *             number bits for freq_dom_resource_assignment_DL field is 13
- *             ...
- *             number bits for padding is 0
- * In order to extract the information of (e.g.) freq_dom_resource_assignment_DL field,
- * we will do a left-shift of 1 position (because previous to this field, and according to the dci_fields_sizes array, there is only one non-empty field of size 1 bit) -> (1 1010 1000 1001 0000 0000 0111 1000 1001 1010 0)
- * then we will do a right-shit of dci_length-13 positions -> (1 1010 1000 1001). And this is the content of the freq_dom_resource_assignment_DL field
- *
- *
- * At the moment we have implemented the following formats:
- *
- * Format 0_0, that contains the following fields according to Specification 38.212 V15.1.1 Section 7.3.1
- *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI
- *    0  IDENTIFIER_DCI_FORMATS:
- *    10 FREQ_DOM_RESOURCE_ASSIGNMENT_UL: PUSCH hopping with resource allocation type 1 not considered
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 6.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    17 FREQ_HOPPING_FLAG: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    25 NDI:
- *    26 RV:
- *    27 HARQ_PROCESS_NUMBER:
- *    32 TPC_PUSCH:
- *    49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
- *    50 SUL_IND_0_0:
- *
- * Format 0_1, that contains the following fields
- *  with CRC scrambled by C-RNTI or CS-RNTI or SP-CSI-RNTI or new-RNTI
- *    0  IDENTIFIER_DCI_FORMATS:
- *    1  CARRIER_IND
- *    2  SUL_IND_0_1
- *    7  BANDWIDTH_PART_IND
- *    10 FREQ_DOM_RESOURCE_ASSIGNMENT_UL: PUSCH hopping with resource allocation type 1 not considered
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 6.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    17 FREQ_HOPPING_FLAG: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    25 NDI:
- *    26 RV:
- *    27 HARQ_PROCESS_NUMBER:
- *    29 FIRST_DAI
- *    30 SECOND_DAI
- *    32 TPC_PUSCH:
- *    36 SRS_RESOURCE_IND:
- *    37 PRECOD_NBR_LAYERS:
- *    38 ANTENNA_PORTS:
- *    40 SRS_REQUEST:
- *    42 CSI_REQUEST:
- *    43 CBGTI
- *    45 PTRS_DMRS
- *    46 BETA_OFFSET_IND
- *    47 DMRS_SEQ_INI
- *    48 UL_SCH_IND
- *    49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
- *
- * Format 1_0, that contains the following fields
- *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
- *    0  IDENTIFIER_DCI_FORMATS:
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    25 NDI:
- *    26 RV:
- *    27 HARQ_PROCESS_NUMBER:
- *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
- *    33 TPC_PUCCH:
- *    34 PUCCH_RESOURCE_IND:
- *    35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND:
- *    55 RESERVED_NR_DCI
- *
- *    If the CRC of the DCI format 1_0 is scrambled by C-RNTI and the "Frequency domain resource assignment" field are of all ones,
- *    the DCI format 1_0 is for random access procedure initiated by a PDCCH order.
- *    This is not implemented, but the fields are already included: FIXME!!!
- *
- *  with CRC scrambled by P-RNTI
- *    8  SHORT_MESSAGE_IND
- *    9  SHORT_MESSAGES
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    31 TB_SCALING
- *    55 RESERVED_NR_DCI
- *
- *  with CRC scrambled by SI-RNTI
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    26 RV:
- *    55 RESERVED_NR_DCI
- *
- *  with CRC scrambled by RA-RNTI
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    31 TB_SCALING
- *    55 RESERVED_NR_DCI
- *
- *  with CRC scrambled by TC-RNTI
- *    0  IDENTIFIER_DCI_FORMATS:
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    24 MCS:
- *    25 NDI:
- *    26 RV:
- *    27 HARQ_PROCESS_NUMBER:
- *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
- *    33 TPC_PUCCH:
- *
- * Format 1_1, that contains the following fields
- *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
- *    0  IDENTIFIER_DCI_FORMATS:
- *    1  CARRIER_IND:
- *    7  BANDWIDTH_PART_IND:
- *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
- *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
- *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
- *    14 PRB_BUNDLING_SIZE_IND:
- *    15 RATE_MATCHING_IND:
- *    16 ZP_CSI_RS_TRIGGER:
- *    18 TB1_MCS:
- *    19 TB1_NDI:
- *    20 TB1_RV:
- *    21 TB2_MCS:
- *    22 TB2_NDI:
- *    23 TB2_RV:
- *    27 HARQ_PROCESS_NUMBER:
- *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
- *    33 TPC_PUCCH:
- *    34 PUCCH_RESOURCE_IND:
- *    35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND:
- *    38 ANTENNA_PORTS:
- *    39 TCI:
- *    40 SRS_REQUEST:
- *    43 CBGTI:
- *    44 CBGFI:
- *    47 DMRS_SEQ_INI:
- *
- * We have not implemented the following formats:
- *
- * Format 2_0
- * Used for notifying the slot format
- *
- * Format 2_1
- * Used for notifying the PRB(s) and OFDM symbol(s) where UE may assume no transmission is intended for the UE
- *
- * Format 2_2
- * This format supports power control commands for semi-persistent scheduling.
- * As we can already support power control commands dynamically with formats 0_0/0_1 (TPC PUSCH) and 1_0/1_1 (TPC PUCCH)
- * This format will be implemented in the future FIXME!!!
- *
- * Format 2_3
- * This format is used for power control of uplink sounding reference signals for devices which have not coupled SRS power control to the PUSCH power control
- * either because independent control is desirable or because the device is configured without PUCCH and PUSCH
- * This format will be implemented in the future FIXME!!!
- *
- */
+                        uint8_t eNB_id,
+                        lte_frame_type_t frame_type,
+                        uint8_t dci_length,
+                        uint16_t rnti,
+                        uint64_t dci_pdu[2],
+                        fapi_nr_dci_pdu_rel15_t *nr_pdci_info_extracted,
+                        uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
+                        NR_DCI_format_t dci_format,
+                        uint8_t nr_tti_rx,
+                        uint16_t n_RB_ULBWP,
+                        uint16_t n_RB_DLBWP,
+                        uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES]) {
+  /*
+   * This function will extract the different elements of the dci pdu and interpret the values extracted to update correctly the parameters in:
+   *                                                NR_DL_UE_HARQ_t *pdlsch0_harq,
+   *                                                NR_UE_DLSCH_t *pdlsch0,
+   *
+   * We need to know the dci length and the dci_fields_sizes (array containing each field size in number of bits)
+   * In order to get the value of a specific field we will proceed as follows (let's have a look to an example:
+   * If the length of the pdu is 38 bits and the content of the dci_pdu is 0x3A8900789A (pdu is 11 1010 1000 1001 0000 0000 0111 1000 1001 1010)
+   * If the dci_fields_sizes is {0 0 1 0 0 0 0 0 0 13 0 1 0 0 0 0 0 0 0 0 0 0 5 1 2 4 2 0 0 0 2 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...}
+   * This means:
+   *             number bits for carrier_ind field is 0
+   *             number bits for sul_ind_0_1 field is 0
+   *             number bits for identifier_dci_formats field is 0
+   *             number bits for slot_format_ind field is 0
+   *             number bits for pre_emption_ind field is 0
+   *             ...
+   *             number bits for freq_dom_resource_assignment_DL field is 13
+   *             ...
+   *             number bits for padding is 0
+   * In order to extract the information of (e.g.) freq_dom_resource_assignment_DL field,
+   * we will do a left-shift of 1 position (because previous to this field, and according to the dci_fields_sizes array, there is only one non-empty field of size 1 bit) -> (1 1010 1000 1001 0000 0000 0111 1000 1001 1010 0)
+   * then we will do a right-shit of dci_length-13 positions -> (1 1010 1000 1001). And this is the content of the freq_dom_resource_assignment_DL field
+   *
+   *
+   * At the moment we have implemented the following formats:
+   *
+   * Format 0_0, that contains the following fields according to Specification 38.212 V15.1.1 Section 7.3.1
+   *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI
+   *    0  IDENTIFIER_DCI_FORMATS:
+   *    10 FREQ_DOM_RESOURCE_ASSIGNMENT_UL: PUSCH hopping with resource allocation type 1 not considered
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 6.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    17 FREQ_HOPPING_FLAG: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    25 NDI:
+   *    26 RV:
+   *    27 HARQ_PROCESS_NUMBER:
+   *    32 TPC_PUSCH:
+   *    49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
+   *    50 SUL_IND_0_0:
+   *
+   * Format 0_1, that contains the following fields
+   *  with CRC scrambled by C-RNTI or CS-RNTI or SP-CSI-RNTI or new-RNTI
+   *    0  IDENTIFIER_DCI_FORMATS:
+   *    1  CARRIER_IND
+   *    2  SUL_IND_0_1
+   *    7  BANDWIDTH_PART_IND
+   *    10 FREQ_DOM_RESOURCE_ASSIGNMENT_UL: PUSCH hopping with resource allocation type 1 not considered
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 6.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    17 FREQ_HOPPING_FLAG: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    25 NDI:
+   *    26 RV:
+   *    27 HARQ_PROCESS_NUMBER:
+   *    29 FIRST_DAI
+   *    30 SECOND_DAI
+   *    32 TPC_PUSCH:
+   *    36 SRS_RESOURCE_IND:
+   *    37 PRECOD_NBR_LAYERS:
+   *    38 ANTENNA_PORTS:
+   *    40 SRS_REQUEST:
+   *    42 CSI_REQUEST:
+   *    43 CBGTI
+   *    45 PTRS_DMRS
+   *    46 BETA_OFFSET_IND
+   *    47 DMRS_SEQ_INI
+   *    48 UL_SCH_IND
+   *    49 PADDING_NR_DCI: (Note 2) If DCI format 0_0 is monitored in common search space
+   *
+   * Format 1_0, that contains the following fields
+   *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
+   *    0  IDENTIFIER_DCI_FORMATS:
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    25 NDI:
+   *    26 RV:
+   *    27 HARQ_PROCESS_NUMBER:
+   *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
+   *    33 TPC_PUCCH:
+   *    34 PUCCH_RESOURCE_IND:
+   *    35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND:
+   *    55 RESERVED_NR_DCI
+   *
+   *    If the CRC of the DCI format 1_0 is scrambled by C-RNTI and the "Frequency domain resource assignment" field are of all ones,
+   *    the DCI format 1_0 is for random access procedure initiated by a PDCCH order.
+   *    This is not implemented, but the fields are already included: FIXME!!!
+   *
+   *  with CRC scrambled by P-RNTI
+   *    8  SHORT_MESSAGE_IND
+   *    9  SHORT_MESSAGES
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    31 TB_SCALING
+   *    55 RESERVED_NR_DCI
+   *
+   *  with CRC scrambled by SI-RNTI
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    26 RV:
+   *    55 RESERVED_NR_DCI
+   *
+   *  with CRC scrambled by RA-RNTI
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    31 TB_SCALING
+   *    55 RESERVED_NR_DCI
+   *
+   *  with CRC scrambled by TC-RNTI
+   *    0  IDENTIFIER_DCI_FORMATS:
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    24 MCS:
+   *    25 NDI:
+   *    26 RV:
+   *    27 HARQ_PROCESS_NUMBER:
+   *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
+   *    33 TPC_PUCCH:
+   *
+   * Format 1_1, that contains the following fields
+   *  with CRC scrambled by C-RNTI or CS-RNTI or new-RNTI
+   *    0  IDENTIFIER_DCI_FORMATS:
+   *    1  CARRIER_IND:
+   *    7  BANDWIDTH_PART_IND:
+   *    11 FREQ_DOM_RESOURCE_ASSIGNMENT_DL:
+   *    12 TIME_DOM_RESOURCE_ASSIGNMENT: 0, 1, 2, 3, or 4 bits as defined in Subclause 5.1.2.1 of [6, TS 38.214]. The bitwidth for this field is determined as log2(I) bits,
+   *    13 VRB_TO_PRB_MAPPING: 0 bit if only resource allocation type 0
+   *    14 PRB_BUNDLING_SIZE_IND:
+   *    15 RATE_MATCHING_IND:
+   *    16 ZP_CSI_RS_TRIGGER:
+   *    18 TB1_MCS:
+   *    19 TB1_NDI:
+   *    20 TB1_RV:
+   *    21 TB2_MCS:
+   *    22 TB2_NDI:
+   *    23 TB2_RV:
+   *    27 HARQ_PROCESS_NUMBER:
+   *    28 DAI_: For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
+   *    33 TPC_PUCCH:
+   *    34 PUCCH_RESOURCE_IND:
+   *    35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND:
+   *    38 ANTENNA_PORTS:
+   *    39 TCI:
+   *    40 SRS_REQUEST:
+   *    43 CBGTI:
+   *    44 CBGFI:
+   *    47 DMRS_SEQ_INI:
+   *
+   * We have not implemented the following formats:
+   *
+   * Format 2_0
+   * Used for notifying the slot format
+   *
+   * Format 2_1
+   * Used for notifying the PRB(s) and OFDM symbol(s) where UE may assume no transmission is intended for the UE
+   *
+   * Format 2_2
+   * This format supports power control commands for semi-persistent scheduling.
+   * As we can already support power control commands dynamically with formats 0_0/0_1 (TPC PUSCH) and 1_0/1_1 (TPC PUCCH)
+   * This format will be implemented in the future FIXME!!!
+   *
+   * Format 2_3
+   * This format is used for power control of uplink sounding reference signals for devices which have not coupled SRS power control to the PUSCH power control
+   * either because independent control is desirable or because the device is configured without PUCCH and PUSCH
+   * This format will be implemented in the future FIXME!!!
+   *
+   */
   uint8_t dci_fields_sizes_format[NBR_NR_DCI_FIELDS] = {0};
-  for (int m=0; m<NBR_NR_DCI_FIELDS; m++) dci_fields_sizes_format[m]=dci_fields_sizes[m][dci_format];
 
+  for (int m=0; m<NBR_NR_DCI_FIELDS; m++) dci_fields_sizes_format[m]=dci_fields_sizes[m][dci_format];
 
-//  uint64_t pdu_bitmap = 0xFFFFFFFFFFFFFFFF;
-//  uint128_t pdu_bitmap = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
-//#define DCI_MAX_SIZE 128
-//  pdu_bitmap = (pdu_bitmap << (DCI_MAX_SIZE - dci_length)) >> (DCI_MAX_SIZE - dci_length); // this variable will help to remove the bits of other fields when left-switching
+  //  uint64_t pdu_bitmap = 0xFFFFFFFFFFFFFFFF;
+  //  uint128_t pdu_bitmap = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
+  //#define DCI_MAX_SIZE 128
+  //  pdu_bitmap = (pdu_bitmap << (DCI_MAX_SIZE - dci_length)) >> (DCI_MAX_SIZE - dci_length); // this variable will help to remove the bits of other fields when left-switching
   uint8_t dci_field=0;
-//  uint8_t sizes_count=0;
-//  uint8_t left_shift=0;
-  #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> Entering function nr_extract_dci_info() with dci_pdu=%lx %lx dci_length=%d\n",
+  //  uint8_t sizes_count=0;
+  //  uint8_t left_shift=0;
+  LOG_DCI_D("Entering function nr_extract_dci_info() with dci_pdu=%lx %lx dci_length=%d\n",
             dci_pdu[0],dci_pdu[1], dci_length);
-    printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> for format %d, dci_fields_sizes {",dci_format);
-    for (int i=0; i<NBR_NR_DCI_FIELDS; i++) printf("%d ",dci_fields_sizes[i][dci_format]);
-    printf("}\n");
-  #endif
+  LOG_DCI_D("for format %d, dci_fields_sizes {",dci_format);
+#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
+
+  for (int i=0; i<NBR_NR_DCI_FIELDS; i++) printf("%d ",dci_fields_sizes[i][dci_format]);
 
-//  uint8_t  prev_ndi = pdlsch0_harq->DCINdi;
+  printf("}\n");
+#endif
 
+  //  uint8_t  prev_ndi = pdlsch0_harq->DCINdi;
 
- /*
-  * Some dci fields need to be interpreted before the others.
-  */
+  /*
+   * Some dci fields need to be interpreted before the others.
+   */
   if (dci_fields_sizes[HARQ_PROCESS_NUMBER][dci_format] != 0) { // E.g: 27 HARQ_PROCESS_NUMBER (27 is the position in dci_fields_sizes array for field HARQ_PROCESS_NUMBER)
     //for (int i=0; i<=HARQ_PROCESS_NUMBER; i++) left_shift = left_shift + dci_fields_sizes[i][dci_format];
     nr_pdci_info_extracted->harq_process_number = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,HARQ_PROCESS_NUMBER);
     //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[HARQ_PROCESS_NUMBER][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[HARQ_PROCESS_NUMBER][dci_format]));
     //left_shift = 0;
-    #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-      printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->harq_process_number=%x\n",nr_pdci_info_extracted->harq_process_number);
-    #endif
+    LOG_DCI_D("nr_pdci_info_extracted->harq_process_number=%x\n",nr_pdci_info_extracted->harq_process_number);
   }
-/*
-  if ((dci_format == format1_0) || (dci_format == format1_1)) {
-    if (rnti==crc_scrambled_values[_SI_RNTI_]) {
-      ue->dlsch_SI[eNB_id]->active = 1;
-    } else if (rnti==crc_scrambled_values[_P_RNTI_]) {
-      ue->dlsch_p[eNB_id]->active  = 1;
-    } else if (rnti==crc_scrambled_values[_RA_RNTI_]) {
-      ue->dlsch_ra[eNB_id]->active = 1;
-    } else {
-      pdlsch0->active          = 1;
-    }
-    pdlsch0->rnti              = rnti;
-    pdlsch0_harq->codeword     = 0;
-    pdlsch0_harq->Nl           = 1;
-//  pdlsch0_harq->mimo_mode    = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI;
-    pdlsch0_harq->dl_power_off = 1; //no power offset
-
-    if ((rnti==crc_scrambled_values[_SI_RNTI_]) || (rnti==crc_scrambled_values[_P_RNTI_]) || (rnti==crc_scrambled_values[_RA_RNTI_])) {
-      pdlsch0_harq->round    = 0;
-      pdlsch0_harq->status   = ACTIVE;
-    } else {
+
+  /*
+    if ((dci_format == format1_0) || (dci_format == format1_1)) {
+      if (rnti==crc_scrambled_values[_SI_RNTI_]) {
+        ue->dlsch_SI[eNB_id]->active = 1;
+      } else if (rnti==crc_scrambled_values[_P_RNTI_]) {
+        ue->dlsch_p[eNB_id]->active  = 1;
+      } else if (rnti==crc_scrambled_values[_RA_RNTI_]) {
+        ue->dlsch_ra[eNB_id]->active = 1;
+      } else {
+        pdlsch0->active          = 1;
+      }
+      pdlsch0->rnti              = rnti;
+      pdlsch0_harq->codeword     = 0;
+      pdlsch0_harq->Nl           = 1;
+  //  pdlsch0_harq->mimo_mode    = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI;
+      pdlsch0_harq->dl_power_off = 1; //no power offset
+
+      if ((rnti==crc_scrambled_values[_SI_RNTI_]) || (rnti==crc_scrambled_values[_P_RNTI_]) || (rnti==crc_scrambled_values[_RA_RNTI_])) {
+        pdlsch0_harq->round    = 0;
+        pdlsch0_harq->status   = ACTIVE;
+      } else {
+      }
     }
-  }
-*/
+  */
   for (dci_field=0; dci_field<NBR_NR_DCI_FIELDS; dci_field++) {
     //left_shift = left_shift + dci_fields_sizes[dci_field][dci_format];
-    if (dci_fields_sizes[dci_field][dci_format] != 0){
+    if (dci_fields_sizes[dci_field][dci_format] != 0) {
       //sizes_count = dci_fields_sizes[dci_field][dci_format];
-      #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> dci_fields_sizes[%d][%d] = %d\n",dci_field,dci_format,dci_fields_sizes[dci_field][dci_format]);
-      #endif
-
-      switch (dci_field){
-      case IDENTIFIER_DCI_FORMATS: // 0  IDENTIFIER_DCI_FORMATS: (field defined for format0_0,format0_1,format1_0,format1_1,format2_0,format2_1,format2_2,format2_3)
-              // if format 0_0: The value of this bit field is always set to 0, indicating an UL DCI format (TS38.212 Section 7.3.1.1.1)
-              // if format 1_0: The value of this bit field is always set to 1, indicating a  DL DCI format (TS38.212 Section 7.3.1.2.1)
-        nr_pdci_info_extracted->identifier_dci_formats           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->identifier_dci_formats=%x\n",nr_pdci_info_extracted->identifier_dci_formats);
-        #endif
-        break;
+      LOG_DCI_D("dci_fields_sizes[%d][%d] = %d\n",dci_field,dci_format,dci_fields_sizes[dci_field][dci_format]);
+
+      switch (dci_field) {
+        case IDENTIFIER_DCI_FORMATS: // 0  IDENTIFIER_DCI_FORMATS: (field defined for format0_0,format0_1,format1_0,format1_1,format2_0,format2_1,format2_2,format2_3)
+          // if format 0_0: The value of this bit field is always set to 0, indicating an UL DCI format (TS38.212 Section 7.3.1.1.1)
+          // if format 1_0: The value of this bit field is always set to 1, indicating a  DL DCI format (TS38.212 Section 7.3.1.2.1)
+          nr_pdci_info_extracted->identifier_dci_formats           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->identifier_dci_formats=%x\n",nr_pdci_info_extracted->identifier_dci_formats);
+          break;
 
-      case CARRIER_IND: // 1  CARRIER_IND: (field defined for -,format0_1,-,format1_1,-,-,-,-)
-              // 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213]
-        nr_pdci_info_extracted->carrier_ind                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->carrier_ind=%x\n",nr_pdci_info_extracted->carrier_ind);
-#endif
-        break;
-      case SUL_IND_0_1: // 2  SUL_IND_0_1: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->sul_ind_0_1                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->sul_ind_0_1=%x\n",nr_pdci_info_extracted->sul_ind_0_1);
-        #endif
-        break;
+        case CARRIER_IND: // 1  CARRIER_IND: (field defined for -,format0_1,-,format1_1,-,-,-,-)
+          // 0 or 3 bits, as defined in Subclause x.x of [5, TS38.213]
+          nr_pdci_info_extracted->carrier_ind                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->carrier_ind=%x\n",nr_pdci_info_extracted->carrier_ind);
+          break;
 
-      case SLOT_FORMAT_IND: // 3  SLOT_FORMAT_IND: (field defined for -,-,-,-,format2_0,-,-,-)
-              // size of DCI format 2_0 is configurable by higher layers up to 128 bits, according to Subclause 11.1.1 of [5, TS 38.213]
-        nr_pdci_info_extracted->slot_format_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->slot_format_ind=%x\n",nr_pdci_info_extracted->slot_format_ind);
-        #endif
-        break;
-      case PRE_EMPTION_IND: // 4  PRE_EMPTION_IND: (field defined for -,-,-,-,-,format2_1,-,-)
-              // size of DCI format 2_1 is configurable by higher layers up to 126 bits, according to Subclause 11.2 of [5, TS 38.213]. Each pre-emption indication is 14 bits
-        nr_pdci_info_extracted->pre_emption_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->pre_emption_ind=%x\n",nr_pdci_info_extracted->pre_emption_ind);
-        #endif
-        break;
-      case BLOCK_NUMBER: // 5  BLOCK_NUMBER: (field defined for -,-,-,-,-,-,-,format2_3)
-              // starting position of a block is determined by the parameter startingBitOfFormat2_3
-        nr_pdci_info_extracted->block_number                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->block_number=%x\n",nr_pdci_info_extracted->block_number);
-        #endif
-        break;
-      case CLOSE_LOOP_IND: // 6  CLOSE_LOOP_IND: (field defined for -,-,-,-,-,-,format2_2,-)
-              // The parameter xxx provided by higher layers determines the index to the TPC command number for an UL of a cell. Each TPC command number is 2 bits
-        nr_pdci_info_extracted->close_loop_ind                   = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->close_loop_ind=%x\n",nr_pdci_info_extracted->close_loop_ind);
-        #endif
-        break;
-      case BANDWIDTH_PART_IND: // 7  BANDWIDTH_PART_IND: (field defined for -,format0_1,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->bandwidth_part_ind               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->bandwidth_part_ind=%x\n",nr_pdci_info_extracted->bandwidth_part_ind);
-        #endif
-        break;
+        case SUL_IND_0_1: // 2  SUL_IND_0_1: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->sul_ind_0_1                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->sul_ind_0_1=%x\n",nr_pdci_info_extracted->sul_ind_0_1);
+          break;
 
-      case SHORT_MESSAGE_IND: // 8  SHORT_MESSAGE_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->short_message_ind                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->short_message_ind=%x\n",nr_pdci_info_extracted->short_message_ind);
-        #endif
-        break;
+        case SLOT_FORMAT_IND: // 3  SLOT_FORMAT_IND: (field defined for -,-,-,-,format2_0,-,-,-)
+          // size of DCI format 2_0 is configurable by higher layers up to 128 bits, according to Subclause 11.1.1 of [5, TS 38.213]
+          nr_pdci_info_extracted->slot_format_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->slot_format_ind=%x\n",nr_pdci_info_extracted->slot_format_ind);
+          break;
 
-      case SHORT_MESSAGES: // 9  SHORT_MESSAGES: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->short_messages                   = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->short_messages=%x\n",nr_pdci_info_extracted->short_messages);
-        #endif
-        break;
+        case PRE_EMPTION_IND: // 4  PRE_EMPTION_IND: (field defined for -,-,-,-,-,format2_1,-,-)
+          // size of DCI format 2_1 is configurable by higher layers up to 126 bits, according to Subclause 11.2 of [5, TS 38.213]. Each pre-emption indication is 14 bits
+          nr_pdci_info_extracted->pre_emption_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->pre_emption_ind=%x\n",nr_pdci_info_extracted->pre_emption_ind);
+          break;
 
-      case FREQ_DOM_RESOURCE_ASSIGNMENT_UL: // 10  FREQ_DOM_RESOURCE_ASSIGNMENT_UL: (field defined for format0_0,format0_1,-,-,-,-,-,-)
-              // PUSCH hopping with resource allocation type 1 not considered
-              // According to 38.214 V15.1.0 Section 6.1.2.2 Two uplink resource allocation schemes, type 0 and type 1, are supported.
-              // The UE shall assume that when the scheduling PDCCH is received with DCI format 0_0, then uplink resource allocation type 1 is used.
-        nr_pdci_info_extracted->freq_dom_resource_assignment_UL  = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        /*if (dci_format == format0_1){ // uplink resource allocation type 0 or 1 can be used
-        }
-        if (dci_format == format0_0){ // only uplink resource allocation type 1
-              // At the moment we are supporting only format 1_0 (and not format 1_1), so we only support resource allocation type 1 (and not type 0).
-              // For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
-              // RIV = n_RB_ULBWP * (l_RB - 1) + start_RB                                  if (l_RB - 1) <= floor (n_RB_ULBWP/2)
-              // RIV = n_RB_ULBWP * (n_RB_ULBWP - l_RB + 1) + (n_RB_ULBWP - 1 - start_RB)  if (l_RB - 1)  > floor (n_RB_ULBWP/2)
-          // the following two expressions apply only if (l_RB - 1) <= floor (n_RB_ULBWP/2)
-          l_RB = floor(nr_pdci_info_extracted->freq_dom_resource_assignment_DL/n_RB_ULBWP) + 1;
-          start_RB = nr_pdci_info_extracted->freq_dom_resource_assignment_DL%n_RB_ULBWP;
-          // if (l_RB - 1)  > floor (n_RB_ULBWP/2) we need to recalculate them using the following lines
-          tmp_RIV = n_RB_ULBWP * (l_RB - 1) + start_RB;
-          if (tmp_RIV != nr_pdci_info_extracted->freq_dom_resource_assignment_DL) { // then (l_RB - 1)  > floor (n_RB_ULBWP/2) and we need to recalculate l_RB and start_RB
-            l_RB = n_RB_ULBWP - l_RB + 2;
-            start_RB = n_RB_ULBWP - start_RB - 1;
-          }
-          ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_rb = start_RB;
-          ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->nb_rb    = l_RB;
-        }*/
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->freq_dom_resource_assignment_UL=%x\n",nr_pdci_info_extracted->freq_dom_resource_assignment_UL);
-          //printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> l_RB=%d, start_RB=%d, n_RB_DLBWP=%d\n",l_RB,start_RB,n_RB_ULBWP);
-        #endif
-        break;
+        case BLOCK_NUMBER: // 5  BLOCK_NUMBER: (field defined for -,-,-,-,-,-,-,format2_3)
+          // starting position of a block is determined by the parameter startingBitOfFormat2_3
+          nr_pdci_info_extracted->block_number                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->block_number=%x\n",nr_pdci_info_extracted->block_number);
+          break;
 
-      case FREQ_DOM_RESOURCE_ASSIGNMENT_DL: // 11  FREQ_DOM_RESOURCE_ASSIGNMENT_DL: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-              // According to 38.214 V15.1.0 Section 5.1.2.2 Two downlink resource allocation schemes, type 0 and type 1, are supported.
-              // The UE shall assume that when the scheduling grant is received with DCI format 1_0, then downlink resource allocation type 1 is used.
-        nr_pdci_info_extracted->freq_dom_resource_assignment_DL  = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        /*if (dci_format == format1_1){ // uplink resource allocation type 0 or 1 can be used
-        }
-        if (dci_format == format1_0){ // only uplink resource allocation type 1
-              // At the moment we are supporting only format 0_0 (and not format 0_1), so we only support resource allocation type 1 (and not type 0).
-              // For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
-              // RIV = n_RB_DLBWP * (l_RB - 1) + start_RB                                  if (l_RB - 1) <= floor (n_RB_DLBWP/2)
-              // RIV = n_RB_DLBWP * (n_RB_DLBWP - l_RB + 1) + (n_RB_DLBWP - 1 - start_RB)  if (l_RB - 1)  > floor (n_RB_DLBWP/2)
-          // the following two expressions apply only if (l_RB - 1) <= floor (n_RB_DLBWP/2)
-          l_RB = floor(nr_pdci_info_extracted->freq_dom_resource_assignment_DL/n_RB_DLBWP) + 1;
-          start_RB = nr_pdci_info_extracted->freq_dom_resource_assignment_DL%n_RB_DLBWP;
-          // if (l_RB - 1)  > floor (n_RB_DLBWP/2) we need to recalculate them using the following lines
-          tmp_RIV = n_RB_DLBWP * (l_RB - 1) + start_RB;
-          if (tmp_RIV != nr_pdci_info_extracted->freq_dom_resource_assignment_DL) { // then (l_RB - 1)  > floor (n_RB_DLBWP/2) and we need to recalculate l_RB and start_RB
-            l_RB = n_RB_DLBWP - l_RB + 2;
-            start_RB = n_RB_DLBWP - start_RB - 1;
+        case CLOSE_LOOP_IND: // 6  CLOSE_LOOP_IND: (field defined for -,-,-,-,-,-,format2_2,-)
+          // The parameter xxx provided by higher layers determines the index to the TPC command number for an UL of a cell. Each TPC command number is 2 bits
+          nr_pdci_info_extracted->close_loop_ind                   = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->close_loop_ind=%x\n",nr_pdci_info_extracted->close_loop_ind);
+          break;
+
+        case BANDWIDTH_PART_IND: // 7  BANDWIDTH_PART_IND: (field defined for -,format0_1,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->bandwidth_part_ind               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->bandwidth_part_ind=%x\n",nr_pdci_info_extracted->bandwidth_part_ind);
+          break;
+
+        case SHORT_MESSAGE_IND: // 8  SHORT_MESSAGE_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->short_message_ind                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->short_message_ind=%x\n",nr_pdci_info_extracted->short_message_ind);
+          break;
+
+        case SHORT_MESSAGES: // 9  SHORT_MESSAGES: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->short_messages                   = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->short_messages=%x\n",nr_pdci_info_extracted->short_messages);
+          break;
+
+        case FREQ_DOM_RESOURCE_ASSIGNMENT_UL: // 10  FREQ_DOM_RESOURCE_ASSIGNMENT_UL: (field defined for format0_0,format0_1,-,-,-,-,-,-)
+          // PUSCH hopping with resource allocation type 1 not considered
+          // According to 38.214 V15.1.0 Section 6.1.2.2 Two uplink resource allocation schemes, type 0 and type 1, are supported.
+          // The UE shall assume that when the scheduling PDCCH is received with DCI format 0_0, then uplink resource allocation type 1 is used.
+          nr_pdci_info_extracted->freq_dom_resource_assignment_UL  = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          /*if (dci_format == format0_1){ // uplink resource allocation type 0 or 1 can be used
           }
-          pdlsch0_harq->nb_rb = l_RB;
-          pdlsch0->current_harq_pid = nr_pdci_info_extracted->harq_process_number;
-          pdlsch0->active           = 1;
-          pdlsch0->rnti             = rnti;
-        }*/
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->freq_dom_resource_assignment_DL=%x, RIV = %d\n",nr_pdci_info_extracted->freq_dom_resource_assignment_DL,nr_pdci_info_extracted->freq_dom_resource_assignment_DL);
-          //printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> l_RB=%d, start_RB=%d, n_RB_DLBWP=%d\n",l_RB,start_RB,n_RB_DLBWP);
-         /*
-          * According to TC 38.212 Subclause 7.3.1.2.1 (V15.2.0) (not implemented FIXME!!!)
-          * If the CRC of the DCI format 1_0 is scrambled by C-RNTI
-          * and the "Frequency domain resource assignment" field are of all ones,
-          * the DCI format 1_0 is for random access procedure initiated by a PDCCH order,
-          * with all remaining fields set as follows:
-          * - Random Access Preamble index (6 bits)
-          * - UL/SUL indicator (1 bit)
-          * - SS/PBCH index (6 bits)
-          * - PRACH Mask index (4 bits)
-          * - Reserved bits (10 bits)
-          *
-          */
-         /*
-         * The following commented code is used to verify that l_RB and start_RB are correctly calculated
-         *
-         *
-        printf("\ns_RB\t");
-        n_RB_DLBWP = 20;
-        for (int k = 0 ; k < n_RB_DLBWP; k++) printf("%d\t",k);
-        printf("\nl_RB");
-        for (int j = 1 ; j <= n_RB_DLBWP; j++){ // l_RB
-          printf("\n%d\t",j);
-          for (int i = 0 ; i < n_RB_DLBWP; i++) { // start_RB
-            if ((j-1) <= (floor(n_RB_DLBWP/2)) && ((j+i) <= n_RB_DLBWP)) {
-              tmp_RIV = n_RB_DLBWP * (j - 1) + i;
-              l_RB = floor(tmp_RIV/n_RB_DLBWP) + 1;
-              start_RB = tmp_RIV%n_RB_DLBWP;
-              printf("%d(%d,%d)  ",tmp_RIV,l_RB,start_RB);
-            }
-            if ((j-1) >  (floor(n_RB_DLBWP/2)) && ((j+i) <= n_RB_DLBWP)) {
-              tmp_RIV = n_RB_DLBWP * (n_RB_DLBWP - j + 1) + (n_RB_DLBWP - 1 - i);
-              //l_RB = floor(tmp_RIV/n_RB_DLBWP) + 1;
-              //start_RB = tmp_RIV%n_RB_DLBWP;
-              l_RB = n_RB_DLBWP - (floor(tmp_RIV/n_RB_DLBWP) + 1) + 2;
-              start_RB = n_RB_DLBWP - (tmp_RIV%n_RB_DLBWP) - 1;
-              printf("%d*(%d,%d)  ",tmp_RIV,l_RB,start_RB);
+          if (dci_format == format0_0){ // only uplink resource allocation type 1
+                // At the moment we are supporting only format 1_0 (and not format 1_1), so we only support resource allocation type 1 (and not type 0).
+                // For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
+                // RIV = n_RB_ULBWP * (l_RB - 1) + start_RB                                  if (l_RB - 1) <= floor (n_RB_ULBWP/2)
+                // RIV = n_RB_ULBWP * (n_RB_ULBWP - l_RB + 1) + (n_RB_ULBWP - 1 - start_RB)  if (l_RB - 1)  > floor (n_RB_ULBWP/2)
+            // the following two expressions apply only if (l_RB - 1) <= floor (n_RB_ULBWP/2)
+            l_RB = floor(nr_pdci_info_extracted->freq_dom_resource_assignment_DL/n_RB_ULBWP) + 1;
+            start_RB = nr_pdci_info_extracted->freq_dom_resource_assignment_DL%n_RB_ULBWP;
+            // if (l_RB - 1)  > floor (n_RB_ULBWP/2) we need to recalculate them using the following lines
+            tmp_RIV = n_RB_ULBWP * (l_RB - 1) + start_RB;
+            if (tmp_RIV != nr_pdci_info_extracted->freq_dom_resource_assignment_DL) { // then (l_RB - 1)  > floor (n_RB_ULBWP/2) and we need to recalculate l_RB and start_RB
+              l_RB = n_RB_ULBWP - l_RB + 2;
+              start_RB = n_RB_ULBWP - start_RB - 1;
             }
+            ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_rb = start_RB;
+            ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->nb_rb    = l_RB;
+          }*/
+          LOG_DCI_D("nr_pdci_info_extracted->freq_dom_resource_assignment_UL=%x\n",nr_pdci_info_extracted->freq_dom_resource_assignment_UL);
+          //LOG_DCI_D("l_RB=%d, start_RB=%d, n_RB_DLBWP=%d\n",l_RB,start_RB,n_RB_ULBWP);
+          break;
+
+        case FREQ_DOM_RESOURCE_ASSIGNMENT_DL: // 11  FREQ_DOM_RESOURCE_ASSIGNMENT_DL: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          // According to 38.214 V15.1.0 Section 5.1.2.2 Two downlink resource allocation schemes, type 0 and type 1, are supported.
+          // The UE shall assume that when the scheduling grant is received with DCI format 1_0, then downlink resource allocation type 1 is used.
+          nr_pdci_info_extracted->freq_dom_resource_assignment_DL  = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          /*if (dci_format == format1_1){ // uplink resource allocation type 0 or 1 can be used
           }
-        }*/
-        #endif
-        break;
+          if (dci_format == format1_0){ // only uplink resource allocation type 1
+                // At the moment we are supporting only format 0_0 (and not format 0_1), so we only support resource allocation type 1 (and not type 0).
+                // For resource allocation type 1, the resource allocation field consists of a resource indication value (RIV):
+                // RIV = n_RB_DLBWP * (l_RB - 1) + start_RB                                  if (l_RB - 1) <= floor (n_RB_DLBWP/2)
+                // RIV = n_RB_DLBWP * (n_RB_DLBWP - l_RB + 1) + (n_RB_DLBWP - 1 - start_RB)  if (l_RB - 1)  > floor (n_RB_DLBWP/2)
+            // the following two expressions apply only if (l_RB - 1) <= floor (n_RB_DLBWP/2)
+            l_RB = floor(nr_pdci_info_extracted->freq_dom_resource_assignment_DL/n_RB_DLBWP) + 1;
+            start_RB = nr_pdci_info_extracted->freq_dom_resource_assignment_DL%n_RB_DLBWP;
+            // if (l_RB - 1)  > floor (n_RB_DLBWP/2) we need to recalculate them using the following lines
+            tmp_RIV = n_RB_DLBWP * (l_RB - 1) + start_RB;
+            if (tmp_RIV != nr_pdci_info_extracted->freq_dom_resource_assignment_DL) { // then (l_RB - 1)  > floor (n_RB_DLBWP/2) and we need to recalculate l_RB and start_RB
+              l_RB = n_RB_DLBWP - l_RB + 2;
+              start_RB = n_RB_DLBWP - start_RB - 1;
+            }
+            pdlsch0_harq->nb_rb = l_RB;
+            pdlsch0->current_harq_pid = nr_pdci_info_extracted->harq_process_number;
+            pdlsch0->active           = 1;
+            pdlsch0->rnti             = rnti;
+          }*/
+          LOG_DCI_D("nr_pdci_info_extracted->freq_dom_resource_assignment_DL=%x, RIV = %d\n",nr_pdci_info_extracted->freq_dom_resource_assignment_DL,nr_pdci_info_extracted->freq_dom_resource_assignment_DL);
+          //LOG_DCI_D("l_RB=%d, start_RB=%d, n_RB_DLBWP=%d\n",l_RB,start_RB,n_RB_DLBWP);
+          /*
+           * According to TC 38.212 Subclause 7.3.1.2.1 (V15.2.0) (not implemented FIXME!!!)
+           * If the CRC of the DCI format 1_0 is scrambled by C-RNTI
+           * and the "Frequency domain resource assignment" field are of all ones,
+           * the DCI format 1_0 is for random access procedure initiated by a PDCCH order,
+           * with all remaining fields set as follows:
+           * - Random Access Preamble index (6 bits)
+           * - UL/SUL indicator (1 bit)
+           * - SS/PBCH index (6 bits)
+           * - PRACH Mask index (4 bits)
+           * - Reserved bits (10 bits)
+           *
+           */
+          /*
+          * The following commented code is used to verify that l_RB and start_RB are correctly calculated
+          *
+          *
+          printf("\ns_RB\t");
+          n_RB_DLBWP = 20;
+          for (int k = 0 ; k < n_RB_DLBWP; k++) printf("%d\t",k);
+          printf("\nl_RB");
+          for (int j = 1 ; j <= n_RB_DLBWP; j++){ // l_RB
+           printf("\n%d\t",j);
+           for (int i = 0 ; i < n_RB_DLBWP; i++) { // start_RB
+             if ((j-1) <= (floor(n_RB_DLBWP/2)) && ((j+i) <= n_RB_DLBWP)) {
+               tmp_RIV = n_RB_DLBWP * (j - 1) + i;
+               l_RB = floor(tmp_RIV/n_RB_DLBWP) + 1;
+               start_RB = tmp_RIV%n_RB_DLBWP;
+               printf("%d(%d,%d)  ",tmp_RIV,l_RB,start_RB);
+             }
+             if ((j-1) >  (floor(n_RB_DLBWP/2)) && ((j+i) <= n_RB_DLBWP)) {
+               tmp_RIV = n_RB_DLBWP * (n_RB_DLBWP - j + 1) + (n_RB_DLBWP - 1 - i);
+               //l_RB = floor(tmp_RIV/n_RB_DLBWP) + 1;
+               //start_RB = tmp_RIV%n_RB_DLBWP;
+               l_RB = n_RB_DLBWP - (floor(tmp_RIV/n_RB_DLBWP) + 1) + 2;
+               start_RB = n_RB_DLBWP - (tmp_RIV%n_RB_DLBWP) - 1;
+               printf("%d*(%d,%d)  ",tmp_RIV,l_RB,start_RB);
+             }
+           }
+          }*/
+          break;
 
-      case TIME_DOM_RESOURCE_ASSIGNMENT: // 12 TIME_DOM_RESOURCE_ASSIGNMENT: (field defined for format0_0,format0_1,format1_0,format1_1,-,-,-,-)
-               // 0, 1, 2, 3, or 4 bits as defined in:
-               //         Subclause 6.1.2.1 of [6, TS 38.214] for formats format0_0,format0_1
-               //         Subclause 5.1.2.1 of [6, TS 38.214] for formats format1_0,format1_1
-               // The bitwidth for this field is determined as log2(I) bits,
-               // where I the number of entries in the higher layer parameter pusch-AllocationList
-        nr_pdci_info_extracted->time_dom_resource_assignment     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        /*if (dci_format == format0_0 || dci_format == format0_1){ // Subclause 6.1.2.1 of [6, TS 38.214]
-          k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          sliv_S   = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          sliv_L   = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][2];
-          // k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          // sliv_S   = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          // sliv_L   = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+        case TIME_DOM_RESOURCE_ASSIGNMENT: // 12 TIME_DOM_RESOURCE_ASSIGNMENT: (field defined for format0_0,format0_1,format1_0,format1_1,-,-,-,-)
+          // 0, 1, 2, 3, or 4 bits as defined in:
+          //         Subclause 6.1.2.1 of [6, TS 38.214] for formats format0_0,format0_1
+          //         Subclause 5.1.2.1 of [6, TS 38.214] for formats format1_0,format1_1
+          // The bitwidth for this field is determined as log2(I) bits,
+          // where I the number of entries in the higher layer parameter pusch-AllocationList
+          nr_pdci_info_extracted->time_dom_resource_assignment     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          /*if (dci_format == format0_0 || dci_format == format0_1){ // Subclause 6.1.2.1 of [6, TS 38.214]
+            k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            sliv_S   = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            sliv_L   = table_6_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+            // k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            // sliv_S   = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            // sliv_L   = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
 
-        }
-        if (dci_format == format1_0 || dci_format == format1_1){ // Subclause 5.1.2.1 of [6, TS 38.214]
-          // the Time domain resource assignment field of the DCI provides a row index of a higher layer configured table pdsch-symbolAllocation
-          // FIXME! To clarify which parameters to update after reception of row index
-          k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          sliv_S   = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          sliv_L   = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][2];
-          // k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          // sliv_S   = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          // sliv_L   = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
-          // k_offset = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          // sliv_S   = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          // sliv_L   = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][2];
-          // k_offset = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][0];
-          // sliv_S   = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][1];
-          // sliv_L   = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][2];
-        }*/
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->time_dom_resource_assignment=%x\n",nr_pdci_info_extracted->time_dom_resource_assignment);
-        #endif
-        break;
+          }
+          if (dci_format == format1_0 || dci_format == format1_1){ // Subclause 5.1.2.1 of [6, TS 38.214]
+            // the Time domain resource assignment field of the DCI provides a row index of a higher layer configured table pdsch-symbolAllocation
+            // FIXME! To clarify which parameters to update after reception of row index
+            k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            sliv_S   = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            sliv_L   = table_5_1_2_1_1_2_time_dom_res_alloc_A[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+            // k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            // sliv_S   = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            // sliv_L   = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+            // k_offset = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            // sliv_S   = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            // sliv_L   = table_5_1_2_1_1_4_time_dom_res_alloc_B[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+            // k_offset = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][0];
+            // sliv_S   = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][1];
+            // sliv_L   = table_5_1_2_1_1_5_time_dom_res_alloc_C[nr_pdci_info_extracted->time_dom_resource_assignment][2];
+          }*/
+          LOG_DCI_D("nr_pdci_info_extracted->time_dom_resource_assignment=%x\n",nr_pdci_info_extracted->time_dom_resource_assignment);
+          break;
 
-      case VRB_TO_PRB_MAPPING: // 13 VRB_TO_PRB_MAPPING: (field defined for -,format0_1,format1_0,format1_1,-,-,-,-)
-      //0 bit if resource allocation type 0
-      //1 bit if resource allocation type 1
-                             //Table 7.3.1.1.2-33: VRB-to-PRB mapping
-                            // 0  Non-interleaved
-                            // 1  Interleaved
-        nr_pdci_info_extracted->vrb_to_prb_mapping               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (nr_pdci_info_extracted->vrb_to_prb_mapping == 0) { // Non-interleaved
-        //} else { // Interleaved
-                 // format 0_1 defined in TS 38.211 Section 6.3.1.7
-                 // formats 1_0 and 1_1 not defined yet
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->vrb_to_prb_mapping=%x\n",nr_pdci_info_extracted->vrb_to_prb_mapping);
-        #endif
-        break;
+        case VRB_TO_PRB_MAPPING: // 13 VRB_TO_PRB_MAPPING: (field defined for -,format0_1,format1_0,format1_1,-,-,-,-)
+          //0 bit if resource allocation type 0
+          //1 bit if resource allocation type 1
+          //Table 7.3.1.1.2-33: VRB-to-PRB mapping
+          // 0  Non-interleaved
+          // 1  Interleaved
+          nr_pdci_info_extracted->vrb_to_prb_mapping               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (nr_pdci_info_extracted->vrb_to_prb_mapping == 0) { // Non-interleaved
+          //} else { // Interleaved
+          // format 0_1 defined in TS 38.211 Section 6.3.1.7
+          // formats 1_0 and 1_1 not defined yet
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->vrb_to_prb_mapping=%x\n",nr_pdci_info_extracted->vrb_to_prb_mapping);
+          break;
 
-      case PRB_BUNDLING_SIZE_IND: // 14 PRB_BUNDLING_SIZE_IND: (field defined for -,-,-,format1_1,-,-,-,-)
-               // 0 bit if the higher layer parameter PRB_bundling is not configured or is set to 'static', or 1 bit if the higher layer parameter PRB_bundling is set to 'dynamic' according to Subclause 5.1.2.3 of [6, TS 38.214]
-        nr_pdci_info_extracted->prb_bundling_size_ind            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->prb_bundling_size_ind=%x\n",nr_pdci_info_extracted->prb_bundling_size_ind);
-        #endif
-        break;
-      case RATE_MATCHING_IND: // 15 RATE_MATCHING_IND: (field defined for -,-,-,format1_1,-,-,-,-)
-               // 0, 1, or 2 bits according to higher layer parameter rate-match-PDSCH-resource-set
-        nr_pdci_info_extracted->rate_matching_ind                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->rate_matching_ind=%x\n",nr_pdci_info_extracted->rate_matching_ind);
-        #endif
-        break;
-      case ZP_CSI_RS_TRIGGER: // 16 ZP_CSI_RS_TRIGGER: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->zp_csi_rs_trigger                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->zp_csi_rs_trigger=%x\n",nr_pdci_info_extracted->zp_csi_rs_trigger);
-        #endif
-        break;
+        case PRB_BUNDLING_SIZE_IND: // 14 PRB_BUNDLING_SIZE_IND: (field defined for -,-,-,format1_1,-,-,-,-)
+          // 0 bit if the higher layer parameter PRB_bundling is not configured or is set to 'static', or 1 bit if the higher layer parameter PRB_bundling is set to 'dynamic' according to Subclause 5.1.2.3 of [6, TS 38.214]
+          nr_pdci_info_extracted->prb_bundling_size_ind            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->prb_bundling_size_ind=%x\n",nr_pdci_info_extracted->prb_bundling_size_ind);
+          break;
 
-      case FREQ_HOPPING_FLAG: // 17 FREQ_HOPPING_FLAG: (field defined for format0_0,format0_1,-,-,-,-,-,-)
-               // 0 bit if only resource allocation type 0
-               // 1 bit otherwise, only applicable to resource allocation type 1, as defined in Subclause 6.3 of [6, TS 38.214]
-        nr_pdci_info_extracted->freq_hopping_flag                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (nr_pdci_info_extracted->freq_hopping_flag != 0) { // PUSCH frequency hopping is performed     (only resource allocation type 1)
+        case RATE_MATCHING_IND: // 15 RATE_MATCHING_IND: (field defined for -,-,-,format1_1,-,-,-,-)
+          // 0, 1, or 2 bits according to higher layer parameter rate-match-PDSCH-resource-set
+          nr_pdci_info_extracted->rate_matching_ind                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->rate_matching_ind=%x\n",nr_pdci_info_extracted->rate_matching_ind);
+          break;
 
-        //} else {                                              // PUSCH frequency hopping is not performed (only resource allocation type 1)
+        case ZP_CSI_RS_TRIGGER: // 16 ZP_CSI_RS_TRIGGER: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->zp_csi_rs_trigger                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->zp_csi_rs_trigger=%x\n",nr_pdci_info_extracted->zp_csi_rs_trigger);
+          break;
+
+        case FREQ_HOPPING_FLAG: // 17 FREQ_HOPPING_FLAG: (field defined for format0_0,format0_1,-,-,-,-,-,-)
+          // 0 bit if only resource allocation type 0
+          // 1 bit otherwise, only applicable to resource allocation type 1, as defined in Subclause 6.3 of [6, TS 38.214]
+          nr_pdci_info_extracted->freq_hopping_flag                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (nr_pdci_info_extracted->freq_hopping_flag != 0) { // PUSCH frequency hopping is performed     (only resource allocation type 1)
+          //} else {                                              // PUSCH frequency hopping is not performed (only resource allocation type 1)
           // At the moment PUSCH hopping is not implemented. We are considering that the bit is present and the value is '0'
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->freq_hopping_flag=%x\n",nr_pdci_info_extracted->freq_hopping_flag);
-        #endif
-        break;
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->freq_hopping_flag=%x\n",nr_pdci_info_extracted->freq_hopping_flag);
+          break;
 
-      case TB1_MCS: // 18 TB1_MCS: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb1_mcs                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (nr_pdci_info_extracted->mcs < 29) pdlsch0_harq->mcs  = nr_pdci_info_extracted->tb1_mcs;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb1_mcs=%x\n",nr_pdci_info_extracted->tb1_mcs);
-        #endif
-        break;
-      case TB1_NDI: // 19 TB1_NDI: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb1_ndi                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0_harq->DCINdi = nr_pdci_info_extracted->tb1_ndi;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb1_ndi=%x\n",nr_pdci_info_extracted->tb1_ndi);
-        #endif
-        break;
-      case TB1_RV: // 20 TB1_RV: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb1_rv                           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0_harq->rvidx  = nr_pdci_info_extracted->tb1_rv;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb1_rv=%x\n",nr_pdci_info_extracted->tb1_rv);
-        #endif
-        break;
-      case TB2_MCS: // 21 TB2_MCS: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb2_mcs                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (nr_pdci_info_extracted->mcs < 29) pdlsch0_harq->mcs  = nr_pdci_info_extracted->tb2_mcs;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb2_mcs=%x\n",nr_pdci_info_extracted->tb2_mcs);
-        #endif
-        break;
-      case TB2_NDI: // 22 TB2_NDI: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb2_ndi                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0_harq->DCINdi = nr_pdci_info_extracted->tb2_ndi;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb2_ndi=%x\n",nr_pdci_info_extracted->tb2_ndi);
-        #endif
-        break;
-      case TB2_RV: // 23 TB2_RV: (field defined for -,-,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->tb2_rv                           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0_harq->rvidx  = nr_pdci_info_extracted->tb2_rv;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb2_rv=%x\n",nr_pdci_info_extracted->tb2_rv);
-        #endif
-        break;
+        case TB1_MCS: // 18 TB1_MCS: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb1_mcs                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (nr_pdci_info_extracted->mcs < 29) pdlsch0_harq->mcs  = nr_pdci_info_extracted->tb1_mcs;
+          LOG_DCI_D("nr_pdci_info_extracted->tb1_mcs=%x\n",nr_pdci_info_extracted->tb1_mcs);
+          break;
 
-      case MCS: // 24 MCS: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
-        nr_pdci_info_extracted->mcs                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (nr_pdci_info_extracted->mcs < 29) {
-        //  if (dci_format == format0_0 || dci_format == format0_1)
-        //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->mcs = nr_pdci_info_extracted->mcs;
-        //  else
-        //    pdlsch0_harq->mcs = nr_pdci_info_extracted->mcs;
-        //} else {
-        //  return(0);
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->mcs=%x\n",nr_pdci_info_extracted->mcs);
-        #endif
-        break;
+        case TB1_NDI: // 19 TB1_NDI: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb1_ndi                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0_harq->DCINdi = nr_pdci_info_extracted->tb1_ndi;
+          LOG_DCI_D("nr_pdci_info_extracted->tb1_ndi=%x\n",nr_pdci_info_extracted->tb1_ndi);
+          break;
 
-      case NDI: // 25 NDI: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
-        nr_pdci_info_extracted->ndi                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (dci_format == format0_0 || dci_format == format0_1) {
-        //  ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi = nr_pdci_info_extracted->ndi;
-        //  if (ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_tx==1) {
-        //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_tx=0;
-        //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi= nr_pdci_info_extracted->ndi;
-        //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->round = 0;
-        //  } else {
-        //    if (ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi != nr_pdci_info_extracted->ndi) { // new SDU opportunity
-        //      ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi= nr_pdci_info_extracted->ndi;
-        //     ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->round = 0;
-        //    }
-        //  }
-        //} else {
-        //  if (rnti == crc_scrambled_values[_TC_RNTI_]) { //fix for standalone Contention Resolution Id
-        //    pdlsch0_harq->DCINdi = (uint8_t)-1;
-        //  } else {
-        //    if ((prev_ndi != nr_pdci_info_extracted->ndi) || (pdlsch0_harq->first_tx==1)) {
-        //      pdlsch0_harq->round    = 0;
-        //      pdlsch0_harq->first_tx = 0;
-        //      pdlsch0_harq->status   = ACTIVE;
-        //    }
-        //    pdlsch0_harq->DCINdi = nr_pdci_info_extracted->ndi;
-        //  }
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->ndi=%x\n",nr_pdci_info_extracted->ndi);
-        #endif
-        break;
+        case TB1_RV: // 20 TB1_RV: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb1_rv                           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0_harq->rvidx  = nr_pdci_info_extracted->tb1_rv;
+          LOG_DCI_D("nr_pdci_info_extracted->tb1_rv=%x\n",nr_pdci_info_extracted->tb1_rv);
+          break;
 
-      case RV: // 26 RV: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
-        nr_pdci_info_extracted->rv                               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //if (dci_format == format0_0 || dci_format == format0_1)
-        //  ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->rvidx = nr_pdci_info_extracted->rv;
-        //else
-        //  pdlsch0_harq->rvidx = nr_pdci_info_extracted->rv;
-        //if ((prev_ndi == nr_pdci_info_extracted->ndi) && (pdlsch0_harq->rvidx != 0)) { // NDI has not been toggled but rv was increased by eNB: retransmission
-        //  if (pdlsch0_harq->status == SCH_IDLE) {
-                        // packet was actually decoded in previous transmission (ACK was missed by eNB)
-                        // however, the round is not a good check as it might have been decoded in a retransmission prior to this one.
-                        // skip pdsch decoding and report ack
-            
-        //    pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.ack = 1;
-        //    pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.send_harq_status;
-#if 0            
-        //    pdlsch0->active       = 0;
-        //    pdlsch0->harq_ack[nr_tti_rx].ack = 1;
-        //    pdlsch0->harq_ack[nr_tti_rx].harq_id = nr_pdci_info_extracted->harq_process_number;
-        //    pdlsch0->harq_ack[nr_tti_rx].send_harq_status = 1;
-#endif            
-         // } else { // normal retransmission, nothing special to do
-         // }
-        //} else {
-        //  pdlsch0_harq->status   = ACTIVE;
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-         printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->rv=%x\n",nr_pdci_info_extracted->rv);
-        #endif
-        break;
+        case TB2_MCS: // 21 TB2_MCS: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb2_mcs                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (nr_pdci_info_extracted->mcs < 29) pdlsch0_harq->mcs  = nr_pdci_info_extracted->tb2_mcs;
+          LOG_DCI_D("nr_pdci_info_extracted->tb2_mcs=%x\n",nr_pdci_info_extracted->tb2_mcs);
+          break;
 
-      case HARQ_PROCESS_NUMBER: // 27 HARQ_PROCESS_NUMBER: (field defined for format0_0,format0_1,format1_0,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->harq_process_number              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0->current_harq_pid = nr_pdci_info_extracted->harq_process_number;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->harq_process_number=%x\n",nr_pdci_info_extracted->harq_process_number);
-        #endif
-        break;
+        case TB2_NDI: // 22 TB2_NDI: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb2_ndi                          = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0_harq->DCINdi = nr_pdci_info_extracted->tb2_ndi;
+          LOG_DCI_D("nr_pdci_info_extracted->tb2_ndi=%x\n",nr_pdci_info_extracted->tb2_ndi);
+          break;
 
-      case DAI_: // 28 DAI_: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-               // For format1_0: 2 bits as defined in Subclause 9.1.3 at TS 38.213
-               // For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
-               // 2 if one serving cell is configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 bits are the counter DAI
-               // 0 otherwise
-        nr_pdci_info_extracted->dai                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.vDAI_DL = nr_pdci_info_extracted->dai+1;
-        //pdlsch0->harq_ack[nr_tti_rx].vDAI_DL = nr_pdci_info_extracted->dai+1;
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->dai=%x\n",nr_pdci_info_extracted->dai);
-        #endif
-        break;
+        case TB2_RV: // 23 TB2_RV: (field defined for -,-,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->tb2_rv                           = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0_harq->rvidx  = nr_pdci_info_extracted->tb2_rv;
+          LOG_DCI_D("nr_pdci_info_extracted->tb2_rv=%x\n",nr_pdci_info_extracted->tb2_rv);
+          break;
 
-      case FIRST_DAI: // 29 FIRST_DAI: (field defined for -,format0_1,-,-,-,-,-,-)
-               // (1 or 2 bits) 1 bit for semi-static HARQ-ACK
-        nr_pdci_info_extracted->first_dai                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-         printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->first_dai=%x\n",nr_pdci_info_extracted->first_dai);
-        #endif
-        break;
-      case SECOND_DAI: // 30 SECOND_DAI: (field defined for -,format0_1,-,-,-,-,-,-)
-               // (0 or 2 bits) 2 bits for dynamic HARQ-ACK codebook with two HARQ-ACK sub-codebooks
-        nr_pdci_info_extracted->second_dai                       = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->second_dai=%x\n",nr_pdci_info_extracted->second_dai);
-        #endif
-        break;
+        case MCS: // 24 MCS: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
+          nr_pdci_info_extracted->mcs                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (nr_pdci_info_extracted->mcs < 29) {
+          //  if (dci_format == format0_0 || dci_format == format0_1)
+          //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->mcs = nr_pdci_info_extracted->mcs;
+          //  else
+          //    pdlsch0_harq->mcs = nr_pdci_info_extracted->mcs;
+          //} else {
+          //  return(0);
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->mcs=%x\n",nr_pdci_info_extracted->mcs);
+          break;
 
-      case TB_SCALING: // 31 TB_SCALING: (field defined for -,format0_1,-,-,-,-,-,-)
-               // (0 or 2 bits) 2 bits for dynamic HARQ-ACK codebook with two HARQ-ACK sub-codebooks
-        nr_pdci_info_extracted->tb_scaling                       = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tb_scaling=%x\n",nr_pdci_info_extracted->tb_scaling);
-        #endif
-        break;
+        case NDI: // 25 NDI: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
+          nr_pdci_info_extracted->ndi                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (dci_format == format0_0 || dci_format == format0_1) {
+          //  ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi = nr_pdci_info_extracted->ndi;
+          //  if (ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_tx==1) {
+          //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->first_tx=0;
+          //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi= nr_pdci_info_extracted->ndi;
+          //    ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->round = 0;
+          //  } else {
+          //    if (ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi != nr_pdci_info_extracted->ndi) { // new SDU opportunity
+          //      ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->DCINdi= nr_pdci_info_extracted->ndi;
+          //     ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->round = 0;
+          //    }
+          //  }
+          //} else {
+          //  if (rnti == crc_scrambled_values[_TC_RNTI_]) { //fix for standalone Contention Resolution Id
+          //    pdlsch0_harq->DCINdi = (uint8_t)-1;
+          //  } else {
+          //    if ((prev_ndi != nr_pdci_info_extracted->ndi) || (pdlsch0_harq->first_tx==1)) {
+          //      pdlsch0_harq->round    = 0;
+          //      pdlsch0_harq->first_tx = 0;
+          //      pdlsch0_harq->status   = ACTIVE;
+          //    }
+          //    pdlsch0_harq->DCINdi = nr_pdci_info_extracted->ndi;
+          //  }
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->ndi=%x\n",nr_pdci_info_extracted->ndi);
+          break;
 
-      case TPC_PUSCH: // 32 TPC_PUSCH: (field defined for format0_0,format0_1,-,-,-,-,-,-)
-               // defined in Subclause 7.1.1 TS 38.213
-        nr_pdci_info_extracted->tpc_pusch                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC = nr_pdci_info_extracted->tpc_pusch;
-        //if (ue->ul_power_control_dedicated[eNB_id].accumulationEnabled == 1) {
-        //  ulsch0->f_pusch += nr_delta_PUSCH_acc[ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC];
-        //} else {
-        //  ulsch0->f_pusch  = nr_delta_PUSCH_abs[ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC];
-        //}
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tpc_pusch=%x\n",nr_pdci_info_extracted->tpc_pusch);
-        #endif
-        break;
+        case RV: // 26 RV: (field defined for format0_0,format0_1,format1_0,-,-,-,-,-)
+          nr_pdci_info_extracted->rv                               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //if (dci_format == format0_0 || dci_format == format0_1)
+          //  ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->rvidx = nr_pdci_info_extracted->rv;
+          //else
+          //  pdlsch0_harq->rvidx = nr_pdci_info_extracted->rv;
+          //if ((prev_ndi == nr_pdci_info_extracted->ndi) && (pdlsch0_harq->rvidx != 0)) { // NDI has not been toggled but rv was increased by eNB: retransmission
+          //  if (pdlsch0_harq->status == SCH_IDLE) {
+          // packet was actually decoded in previous transmission (ACK was missed by eNB)
+          // however, the round is not a good check as it might have been decoded in a retransmission prior to this one.
+          // skip pdsch decoding and report ack
+          //    pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.ack = 1;
+          //    pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.send_harq_status;
+#if 0
+          //    pdlsch0->active       = 0;
+          //    pdlsch0->harq_ack[nr_tti_rx].ack = 1;
+          //    pdlsch0->harq_ack[nr_tti_rx].harq_id = nr_pdci_info_extracted->harq_process_number;
+          //    pdlsch0->harq_ack[nr_tti_rx].send_harq_status = 1;
+#endif
+          // } else { // normal retransmission, nothing special to do
+          // }
+          //} else {
+          //  pdlsch0_harq->status   = ACTIVE;
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->rv=%x\n",nr_pdci_info_extracted->rv);
+          break;
 
-      case TPC_PUCCH: // 33 TPC_PUCCH: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-               // defined in Subclause 7.2.1 TS 38.213
-        nr_pdci_info_extracted->tpc_pucch                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        //pdlsch0_harq->delta_PUCCH  = nr_delta_PUCCH_lut[nr_pdci_info_extracted->tpc_pucch &3];
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tpc_pucch=%x\n",nr_pdci_info_extracted->tpc_pucch);
-        #endif
-        break;
+        case HARQ_PROCESS_NUMBER: // 27 HARQ_PROCESS_NUMBER: (field defined for format0_0,format0_1,format1_0,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->harq_process_number              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0->current_harq_pid = nr_pdci_info_extracted->harq_process_number;
+          LOG_DCI_D("nr_pdci_info_extracted->harq_process_number=%x\n",nr_pdci_info_extracted->harq_process_number);
+          break;
 
-      case PUCCH_RESOURCE_IND: // 34 PUCCH_RESOURCE_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-               // defined in Subclause 9.2.3 TS 38.213
-               // PUCCH_RESOURCE_IND points to PUCCH-ResourceId, but PUCCH-ResourceId is not defined yet
-        nr_pdci_info_extracted->pucch_resource_ind               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->pucch_resource_ind=%x\n",nr_pdci_info_extracted->pucch_resource_ind);
-        #endif
-        break;
+        case DAI_: // 28 DAI_: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          // For format1_0: 2 bits as defined in Subclause 9.1.3 at TS 38.213
+          // For format1_1: 4 if more than one serving cell are configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 MSB bits are the counter DAI and the 2 LSB bits are the total DAI
+          // 2 if one serving cell is configured in the DL and the higher layer parameter HARQ-ACK-codebook=dynamic, where the 2 bits are the counter DAI
+          // 0 otherwise
+          nr_pdci_info_extracted->dai                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0->harq_processes[pdlsch0->current_harq_pid]->harq_ack.vDAI_DL = nr_pdci_info_extracted->dai+1;
+          //pdlsch0->harq_ack[nr_tti_rx].vDAI_DL = nr_pdci_info_extracted->dai+1;
+          LOG_DCI_D("nr_pdci_info_extracted->dai=%x\n",nr_pdci_info_extracted->dai);
+          break;
 
-      case PDSCH_TO_HARQ_FEEDBACK_TIME_IND: // 35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
-               // defined in Subclause 9.2.3 TS 38.213
-               // PDSCH_TO_HARQ_FEEDBACK_TIME_IND points to DL-data-DL-acknowledgement, but DL-data-DL-acknowledgement is not defined yet
-        nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-          printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind=%x\n",nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind);
-        #endif
-        break;
+        case FIRST_DAI: // 29 FIRST_DAI: (field defined for -,format0_1,-,-,-,-,-,-)
+          // (1 or 2 bits) 1 bit for semi-static HARQ-ACK
+          nr_pdci_info_extracted->first_dai                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->first_dai=%x\n",nr_pdci_info_extracted->first_dai);
+          break;
 
-      case SRS_RESOURCE_IND: // 36 SRS_RESOURCE_IND: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->srs_resource_ind                 = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->srs_resource_ind=%x\n",nr_pdci_info_extracted->srs_resource_ind);
-        #endif
-        break;
-      case PRECOD_NBR_LAYERS: // 37 PRECOD_NBR_LAYERS: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->precod_nbr_layers                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->precod_nbr_layers=%x\n",nr_pdci_info_extracted->precod_nbr_layers);
-        #endif
-        break;
-      case ANTENNA_PORTS: // 38 ANTENNA_PORTS: (field defined for -,format0_1,-,format1_1,-,-,-,-)
-        nr_pdci_info_extracted->antenna_ports                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->antenna_ports=%x\n",nr_pdci_info_extracted->antenna_ports);
-        #endif
-        break;
-      case TCI: // 39 TCI: (field defined for -,-,-,format1_1,-,-,-,-)
-               // 0 bit if higher layer parameter tci-PresentInDCI is not enabled; otherwise 3 bits
-        nr_pdci_info_extracted->tci                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tci=%x\n",nr_pdci_info_extracted->tci);
-        #endif
-        break;
-      case SRS_REQUEST: // 40 SRS_REQUEST: (field defined for -,format0_1,-,format1_1,-,-,-,format2_3)
-        nr_pdci_info_extracted->srs_request                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->srs_request=%x\n",nr_pdci_info_extracted->srs_request);
-        #endif
-        break;
-      case TPC_CMD: // 41 TPC_CMD: (field defined for -,-,-,-,-,-,-,format2_3)
-        nr_pdci_info_extracted->tpc_cmd         = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->tpc_cmd=%x\n",nr_pdci_info_extracted->tpc_cmd);
-        #endif
-        break;
-      case CSI_REQUEST: // 42 CSI_REQUEST: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->csi_request                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->csi_request=%x\n",nr_pdci_info_extracted->csi_request);
-        #endif
-        break;
-      case CBGTI: // 43 CBGTI: (field defined for -,format0_1,-,format1_1,-,-,-,-)
-               // 0, 2, 4, 6, or 8 bits determined by higher layer parameter maxCodeBlockGroupsPerTransportBlock for the PDSCH
-        nr_pdci_info_extracted->cbgti                            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->cbgti=%x\n",nr_pdci_info_extracted->cbgti);
-        #endif
-        break;
-      case CBGFI: // 44 CBGFI: (field defined for -,-,-,format1_1,-,-,-,-)
-                  // 0 or 1 bit determined by higher layer parameter codeBlockGroupFlushIndicator
-        nr_pdci_info_extracted->cbgfi                            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->cbgfi=%x\n",nr_pdci_info_extracted->cbgfi);
-        #endif
-        break;
-      case PTRS_DMRS: // 45 PTRS_DMRS: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->ptrs_dmrs                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->ptrs_dmrs=%x\n",nr_pdci_info_extracted->ptrs_dmrs);
-        #endif
-        break;
-      case BETA_OFFSET_IND: // 46 BETA_OFFSET_IND: (field defined for -,format0_1,-,-,-,-,-,-)
-        nr_pdci_info_extracted->beta_offset_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->beta_offset_ind=%x\n",nr_pdci_info_extracted->beta_offset_ind);
-        #endif
-        break;
-      case DMRS_SEQ_INI: // 47 DMRS_SEQ_INI: (field defined for -,format0_1,-,format1_1,-,-,-,-)
-               // 1 bit if the cell has two ULs and the number of bits for DCI format 1_0 before padding is larger than the number of bits for DCI format 0_0 before padding; 0 bit otherwise
-        nr_pdci_info_extracted->dmrs_seq_ini                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->dmrs_seq_ini=%x\n",nr_pdci_info_extracted->dmrs_seq_ini);
-        #endif
-        break;
-      case UL_SCH_IND: // 48 UL_SCH_IND: (field defined for -,format0_1,-,-,-,-,-,-)
-               // value of "1" indicates UL-SCH shall be transmitted on the PUSCH and a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH
-        nr_pdci_info_extracted->ul_sch_ind                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->dmrs_seq_ini=%x\n",nr_pdci_info_extracted->ul_sch_ind);
-        #endif
-        break;
+        case SECOND_DAI: // 30 SECOND_DAI: (field defined for -,format0_1,-,-,-,-,-,-)
+          // (0 or 2 bits) 2 bits for dynamic HARQ-ACK codebook with two HARQ-ACK sub-codebooks
+          nr_pdci_info_extracted->second_dai                       = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->second_dai=%x\n",nr_pdci_info_extracted->second_dai);
+          break;
 
-      case PADDING_NR_DCI: // 49 PADDING_NR_DCI: (field defined for format0_0,-,format1_0,-,-,-,-,-)
-               // (Note 2) If DCI format 0_0 is monitored in common search space
-        nr_pdci_info_extracted->padding_nr_dci                 = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->padding=%x\n",nr_pdci_info_extracted->padding_nr_dci);
-        #endif
-        break;
+        case TB_SCALING: // 31 TB_SCALING: (field defined for -,format0_1,-,-,-,-,-,-)
+          // (0 or 2 bits) 2 bits for dynamic HARQ-ACK codebook with two HARQ-ACK sub-codebooks
+          nr_pdci_info_extracted->tb_scaling                       = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->tb_scaling=%x\n",nr_pdci_info_extracted->tb_scaling);
+          break;
 
-      case SUL_IND_0_0: // 50 SUL_IND_0_0: (field defined for format0_0,-,-,-,-,-,-,-)
-        nr_pdci_info_extracted->sul_ind_0_0                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->sul_ind_0_0=%x\n",nr_pdci_info_extracted->sul_ind_0_0);
-        #endif
-        break;
+        case TPC_PUSCH: // 32 TPC_PUSCH: (field defined for format0_0,format0_1,-,-,-,-,-,-)
+          // defined in Subclause 7.1.1 TS 38.213
+          nr_pdci_info_extracted->tpc_pusch                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC = nr_pdci_info_extracted->tpc_pusch;
+          //if (ue->ul_power_control_dedicated[eNB_id].accumulationEnabled == 1) {
+          //  ulsch0->f_pusch += nr_delta_PUSCH_acc[ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC];
+          //} else {
+          //  ulsch0->f_pusch  = nr_delta_PUSCH_abs[ulsch0->harq_processes[nr_pdci_info_extracted->harq_process_number]->TPC];
+          //}
+          LOG_DCI_D("nr_pdci_info_extracted->tpc_pusch=%x\n",nr_pdci_info_extracted->tpc_pusch);
+          break;
 
-      case RA_PREAMBLE_INDEX: // 51 RA_PREAMBLE_INDEX: (field defined for format0_0,-,-,-,-,-,-,-)
-        nr_pdci_info_extracted->ra_preamble_index              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->ra_preamble_index=%x\n",nr_pdci_info_extracted->ra_preamble_index);
-        #endif
-        break;
+        case TPC_PUCCH: // 33 TPC_PUCCH: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          // defined in Subclause 7.2.1 TS 38.213
+          nr_pdci_info_extracted->tpc_pucch                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          //pdlsch0_harq->delta_PUCCH  = nr_delta_PUCCH_lut[nr_pdci_info_extracted->tpc_pucch &3];
+          LOG_DCI_D("nr_pdci_info_extracted->tpc_pucch=%x\n",nr_pdci_info_extracted->tpc_pucch);
+          break;
 
-      case SUL_IND_1_0: // 52 SUL_IND_1_0: (field defined for -,-,format1_0,-,-,-,-,-)
-        nr_pdci_info_extracted->sul_ind_1_0                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->sul_ind_1_0=%x\n",nr_pdci_info_extracted->sul_ind_1_0);
-        #endif
-        break;
+        case PUCCH_RESOURCE_IND: // 34 PUCCH_RESOURCE_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          // defined in Subclause 9.2.3 TS 38.213
+          // PUCCH_RESOURCE_IND points to PUCCH-ResourceId, but PUCCH-ResourceId is not defined yet
+          nr_pdci_info_extracted->pucch_resource_ind               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->pucch_resource_ind=%x\n",nr_pdci_info_extracted->pucch_resource_ind);
+          break;
 
-      case SS_PBCH_INDEX: // 53 SS_PBCH_INDEX: (field defined for -,-,format1_0,-,-,-,-,-)
-        nr_pdci_info_extracted->ss_pbch_index                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->ss_pbch_index=%x\n",nr_pdci_info_extracted->ss_pbch_index);
-        #endif
-        break;
+        case PDSCH_TO_HARQ_FEEDBACK_TIME_IND: // 35 PDSCH_TO_HARQ_FEEDBACK_TIME_IND: (field defined for -,-,format1_0,format1_1,-,-,-,-)
+          // defined in Subclause 9.2.3 TS 38.213
+          // PDSCH_TO_HARQ_FEEDBACK_TIME_IND points to DL-data-DL-acknowledgement, but DL-data-DL-acknowledgement is not defined yet
+          nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind=%x\n",nr_pdci_info_extracted->pdsch_to_harq_feedback_time_ind);
+          break;
 
-      case PRACH_MASK_INDEX: // 54 PRACH_MASK_INDEX: (field defined for -,-,-,format1_0,-,-,-,-)
-        nr_pdci_info_extracted->prach_mask_index               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->prach_mask_index=%x\n",nr_pdci_info_extracted->prach_mask_index);
-        #endif
-        break;
+        case SRS_RESOURCE_IND: // 36 SRS_RESOURCE_IND: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->srs_resource_ind                 = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->srs_resource_ind=%x\n",nr_pdci_info_extracted->srs_resource_ind);
+          break;
 
-      case RESERVED_NR_DCI: // 55 RESERVED_NR_DCI: (field defined for -,-,-,format1_0,-,-,-,-)
-        nr_pdci_info_extracted->reserved_nr_dci                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
-        //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
-        #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-        printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> nr_pdci_info_extracted->reserved_nr_dci=%x\n",nr_pdci_info_extracted->reserved_nr_dci);
-        #endif
-        break;
+        case PRECOD_NBR_LAYERS: // 37 PRECOD_NBR_LAYERS: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->precod_nbr_layers                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->precod_nbr_layers=%x\n",nr_pdci_info_extracted->precod_nbr_layers);
+          break;
+
+        case ANTENNA_PORTS: // 38 ANTENNA_PORTS: (field defined for -,format0_1,-,format1_1,-,-,-,-)
+          nr_pdci_info_extracted->antenna_ports                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->antenna_ports=%x\n",nr_pdci_info_extracted->antenna_ports);
+          break;
+
+        case TCI: // 39 TCI: (field defined for -,-,-,format1_1,-,-,-,-)
+          // 0 bit if higher layer parameter tci-PresentInDCI is not enabled; otherwise 3 bits
+          nr_pdci_info_extracted->tci                              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->tci=%x\n",nr_pdci_info_extracted->tci);
+          break;
+
+        case SRS_REQUEST: // 40 SRS_REQUEST: (field defined for -,format0_1,-,format1_1,-,-,-,format2_3)
+          nr_pdci_info_extracted->srs_request                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->srs_request=%x\n",nr_pdci_info_extracted->srs_request);
+          break;
+
+        case TPC_CMD: // 41 TPC_CMD: (field defined for -,-,-,-,-,-,-,format2_3)
+          nr_pdci_info_extracted->tpc_cmd         = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->tpc_cmd=%x\n",nr_pdci_info_extracted->tpc_cmd);
+          break;
+
+        case CSI_REQUEST: // 42 CSI_REQUEST: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->csi_request                      = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->csi_request=%x\n",nr_pdci_info_extracted->csi_request);
+          break;
+
+        case CBGTI: // 43 CBGTI: (field defined for -,format0_1,-,format1_1,-,-,-,-)
+          // 0, 2, 4, 6, or 8 bits determined by higher layer parameter maxCodeBlockGroupsPerTransportBlock for the PDSCH
+          nr_pdci_info_extracted->cbgti                            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->cbgti=%x\n",nr_pdci_info_extracted->cbgti);
+          break;
+
+        case CBGFI: // 44 CBGFI: (field defined for -,-,-,format1_1,-,-,-,-)
+          // 0 or 1 bit determined by higher layer parameter codeBlockGroupFlushIndicator
+          nr_pdci_info_extracted->cbgfi                            = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->cbgfi=%x\n",nr_pdci_info_extracted->cbgfi);
+          break;
+
+        case PTRS_DMRS: // 45 PTRS_DMRS: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->ptrs_dmrs                        = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->ptrs_dmrs=%x\n",nr_pdci_info_extracted->ptrs_dmrs);
+          break;
+
+        case BETA_OFFSET_IND: // 46 BETA_OFFSET_IND: (field defined for -,format0_1,-,-,-,-,-,-)
+          nr_pdci_info_extracted->beta_offset_ind                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->beta_offset_ind=%x\n",nr_pdci_info_extracted->beta_offset_ind);
+          break;
+
+        case DMRS_SEQ_INI: // 47 DMRS_SEQ_INI: (field defined for -,format0_1,-,format1_1,-,-,-,-)
+          // 1 bit if the cell has two ULs and the number of bits for DCI format 1_0 before padding is larger than the number of bits for DCI format 0_0 before padding; 0 bit otherwise
+          nr_pdci_info_extracted->dmrs_seq_ini                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->dmrs_seq_ini=%x\n",nr_pdci_info_extracted->dmrs_seq_ini);
+          break;
+
+        case UL_SCH_IND: // 48 UL_SCH_IND: (field defined for -,format0_1,-,-,-,-,-,-)
+          // value of "1" indicates UL-SCH shall be transmitted on the PUSCH and a value of "0" indicates UL-SCH shall not be transmitted on the PUSCH
+          nr_pdci_info_extracted->ul_sch_ind                     = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->dmrs_seq_ini=%x\n",nr_pdci_info_extracted->ul_sch_ind);
+          break;
+
+        case PADDING_NR_DCI: // 49 PADDING_NR_DCI: (field defined for format0_0,-,format1_0,-,-,-,-,-)
+          // (Note 2) If DCI format 0_0 is monitored in common search space
+          nr_pdci_info_extracted->padding_nr_dci                 = (uint16_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->padding=%x\n",nr_pdci_info_extracted->padding_nr_dci);
+          break;
+
+        case SUL_IND_0_0: // 50 SUL_IND_0_0: (field defined for format0_0,-,-,-,-,-,-,-)
+          nr_pdci_info_extracted->sul_ind_0_0                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->sul_ind_0_0=%x\n",nr_pdci_info_extracted->sul_ind_0_0);
+          break;
+
+        case RA_PREAMBLE_INDEX: // 51 RA_PREAMBLE_INDEX: (field defined for format0_0,-,-,-,-,-,-,-)
+          nr_pdci_info_extracted->ra_preamble_index              = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->ra_preamble_index=%x\n",nr_pdci_info_extracted->ra_preamble_index);
+          break;
+
+        case SUL_IND_1_0: // 52 SUL_IND_1_0: (field defined for -,-,format1_0,-,-,-,-,-)
+          nr_pdci_info_extracted->sul_ind_1_0                    = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->sul_ind_1_0=%x\n",nr_pdci_info_extracted->sul_ind_1_0);
+          break;
+
+        case SS_PBCH_INDEX: // 53 SS_PBCH_INDEX: (field defined for -,-,format1_0,-,-,-,-,-)
+          nr_pdci_info_extracted->ss_pbch_index                  = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->ss_pbch_index=%x\n",nr_pdci_info_extracted->ss_pbch_index);
+          break;
 
+        case PRACH_MASK_INDEX: // 54 PRACH_MASK_INDEX: (field defined for -,-,-,format1_0,-,-,-,-)
+          nr_pdci_info_extracted->prach_mask_index               = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->prach_mask_index=%x\n",nr_pdci_info_extracted->prach_mask_index);
+          break;
+
+        case RESERVED_NR_DCI: // 55 RESERVED_NR_DCI: (field defined for -,-,-,format1_0,-,-,-,-)
+          nr_pdci_info_extracted->reserved_nr_dci                = (uint8_t)nr_dci_field(dci_pdu,dci_fields_sizes_format,dci_field);
+          //(((((*(uint128_t *)dci_pdu)  << (left_shift - dci_fields_sizes[dci_field][dci_format]))) & pdu_bitmap) >> (dci_length - dci_fields_sizes[dci_field][dci_format]));
+          LOG_DCI_D("nr_pdci_info_extracted->reserved_nr_dci=%x\n",nr_pdci_info_extracted->reserved_nr_dci);
+          break;
       }
     }
   }
-  #ifdef NR_PDCCH_DCI_TOOLS_DEBUG
-    printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) -> Ending function nr_extract_dci_info()\n");
-  #endif
+
+  LOG_DCI_D("Ending function nr_extract_dci_info()\n");
   return(1);
 }
 
@@ -1015,34 +923,29 @@ int nr_extract_dci_info(PHY_VARS_NR_UE *ue,
 #ifdef NR_PDCCH_DCI_TOOLS
 
 int nr_generate_ue_ul_dlsch_params_from_dci(PHY_VARS_NR_UE *ue,
-        uint8_t eNB_id,
-        int frame,
-        uint8_t nr_tti_rx,
-        uint64_t dci_pdu[2],
-        uint16_t rnti,
-        uint8_t dci_length,
-        NR_DCI_format_t dci_format,
-        NR_DL_FRAME_PARMS *frame_parms,
-        PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
-        uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
-        uint16_t n_RB_ULBWP,
-        uint16_t n_RB_DLBWP,
-        uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES],
-        fapi_nr_dci_pdu_rel15_t *nr_dci_info_extracted)
-{
+    uint8_t eNB_id,
+    int frame,
+    uint8_t nr_tti_rx,
+    uint64_t dci_pdu[2],
+    uint16_t rnti,
+    uint8_t dci_length,
+    NR_DCI_format_t dci_format,
+    NR_DL_FRAME_PARMS *frame_parms,
+    PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
+    uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS],
+    uint16_t n_RB_ULBWP,
+    uint16_t n_RB_DLBWP,
+    uint16_t crc_scrambled_values[TOTAL_NBR_SCRAMBLED_VALUES],
+    fapi_nr_dci_pdu_rel15_t *nr_dci_info_extracted) {
   /*
    * Note only format0_0 and format1_0 are implemented
    */
-
   uint8_t frame_type=frame_parms->frame_type;
   uint8_t status=0;
-
-  LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci) -> dci_format=%d, rnti=%d, dci_length=%d, dci_pdu[0]=0x%lx, dci_pdu[1]=0x%lx\n",dci_format,rnti,dci_length,dci_pdu[0],dci_pdu[1]);
-
+  LOG_DCI_PARM("dci_format=%d, rnti=%d, dci_length=%d, dci_pdu[0]=0x%lx, dci_pdu[1]=0x%lx\n",dci_format,rnti,dci_length,dci_pdu[0],
+        dci_pdu[1]);
   memset(nr_dci_info_extracted,0,sizeof(*nr_dci_info_extracted));
-
-  LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci) -> Entering function nr_extract_dci_info(dci_format=%d) \n",dci_format);
-
+  LOG_DCI_PARM("Entering function nr_extract_dci_info(dci_format=%d) \n",dci_format);
   status = nr_extract_dci_info(ue,
                                eNB_id,
                                frame_type,
@@ -1058,21 +961,18 @@ int nr_generate_ue_ul_dlsch_params_from_dci(PHY_VARS_NR_UE *ue,
                                crc_scrambled_values);
 
   if(status == 0) {
-    LOG_W(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci) -> bad DCI %d !!! \n",dci_format);
+    LOG_DCI_PARM("bad DCI %d !!! \n",dci_format);
     return(-1);
   }
 
-  LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci) -> Ending function nr_extract_dci_info()\n");
-
-  //fill 
-  
+  LOG_DCI_PARM("Ending function nr_extract_dci_info()\n");
+  //fill
   return(0);
 }
 
 #endif
 
-uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t nr_tti_rx)
-{
+uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t nr_tti_rx) {
   /*
     #ifdef DEBUG_DCI
     if (frame_parms->frame_type == TDD)
@@ -1081,81 +981,77 @@ uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8
     printf("dci_tools.c: subframe2_harq_pid, subframe %d for FDD \n",subframe);
     #endif
   */
-
   uint8_t ret = 255;
   uint8_t subframe = nr_tti_rx>>((int)(log2 (frame_parms->ttis_per_subframe)));
 
   if (frame_parms->frame_type == FDD) {
     ret = (((frame<<1)+nr_tti_rx)&7);
   } else {
-
     switch (frame_parms->tdd_config) {
+      case 1:
+        if ((subframe==2) ||
+            (subframe==3) ||
+            (subframe==7) ||
+            (subframe==8))
+          switch (subframe) {
+            case 2:
+            case 3:
+              ret = (subframe-2);
+              break;
+
+            case 7:
+            case 8:
+              ret = (subframe-5);
+              break;
+
+            default:
+              LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+              ret = (255);
+              break;
+          }
 
-    case 1:
-      if ((subframe==2) ||
-          (subframe==3) ||
-          (subframe==7) ||
-          (subframe==8))
-        switch (subframe) {
-        case 2:
-        case 3:
-          ret = (subframe-2);
-          break;
-
-        case 7:
-        case 8:
-          ret = (subframe-5);
-          break;
+        break;
 
-        default:
+      case 2:
+        if ((subframe!=2) && (subframe!=7)) {
           LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+          //mac_xface->macphy_exit("subframe2_harq_pid, Illegal subframe");
           ret = (255);
-          break;
         }
 
-      break;
+        ret = (subframe/7);
+        break;
 
-    case 2:
-      if ((subframe!=2) && (subframe!=7)) {
-        LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
-        //mac_xface->macphy_exit("subframe2_harq_pid, Illegal subframe");
-        ret = (255);
-      }
+      case 3:
+        if ((subframe<2) || (subframe>4)) {
+          LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+          ret = (255);
+        }
 
-      ret = (subframe/7);
-      break;
+        ret = (subframe-2);
+        break;
 
-    case 3:
-      if ((subframe<2) || (subframe>4)) {
-        LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
-        ret = (255);
-      }
+      case 4:
+        if ((subframe<2) || (subframe>3)) {
+          LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+          ret = (255);
+        }
 
-      ret = (subframe-2);
-      break;
+        ret = (subframe-2);
+        break;
 
-    case 4:
-      if ((subframe<2) || (subframe>3)) {
-        LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
-        ret = (255);
-      }
+      case 5:
+        if (subframe!=2) {
+          LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+          ret = (255);
+        }
 
-      ret = (subframe-2);
-      break;
+        ret = (subframe-2);
+        break;
 
-    case 5:
-      if (subframe!=2) {
-        LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
+      default:
+        LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config);
         ret = (255);
-      }
-
-      ret = (subframe-2);
-      break;
-
-    default:
-      LOG_E(PHY,"subframe2_harq_pid, Unsupported TDD mode %d\n",frame_parms->tdd_config);
-      ret = (255);
-
     }
   }
 
@@ -1163,12 +1059,12 @@ uint8_t nr_subframe2harq_pid(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8
     LOG_E(PHY, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", ret, frame, subframe);
     //mac_xface->macphy_exit("invalid harq_pid");
   }
+
   return ret;
 }
 
 
-uint8_t nr_pdcch_alloc2ul_subframe(NR_DL_FRAME_PARMS *frame_parms,uint8_t n)
-{
+uint8_t nr_pdcch_alloc2ul_subframe(NR_DL_FRAME_PARMS *frame_parms,uint8_t n) {
   uint8_t ul_subframe = 255;
 
   if ((frame_parms->frame_type == TDD) &&
@@ -1190,8 +1086,7 @@ uint8_t nr_pdcch_alloc2ul_subframe(NR_DL_FRAME_PARMS *frame_parms,uint8_t n)
   return ul_subframe;
 }
 
-uint32_t nr_pdcch_alloc2ul_frame(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n)
-{
+uint32_t nr_pdcch_alloc2ul_frame(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t n) {
   uint32_t ul_frame = 255;
 
   if ((frame_parms->frame_type == TDD) &&
@@ -1211,6 +1106,5 @@ uint32_t nr_pdcch_alloc2ul_frame(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame,
 
   LOG_D(PHY, "frame %d subframe %d: PUSCH frame = %d\n", frame, n, ul_frame);
   return ul_frame;
-
 }
 
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
index 12aaebc91755ca214322d4e30f6b1dffa2e8c402..d2dbd6fef2869a3d4ff290767b7f95c6b942b72c 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
@@ -124,7 +124,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
     ulsch_ue->length_dmrs = length_dmrs;
     ulsch_ue->rnti        = n_rnti;
     ulsch_ue->Nid_cell    = Nid_cell;
-    ulsch_ue->nb_re_dmrs  = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4;
+    ulsch_ue->nb_re_dmrs  = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1?6:4);
 
     N_RE_prime = NR_NB_SC_PER_RB*harq_process_ul_ue->number_of_symbols - ulsch_ue->nb_re_dmrs - N_PRB_oh;
 
diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c
index 793e26232f5c705c126a898da77d7242cc48a369..270ab5772cc3c0e0780ca726a34a16f4654463e4 100644
--- a/openair1/SCHED_NR/fapi_nr_l1.c
+++ b/openair1/SCHED_NR/fapi_nr_l1.c
@@ -139,7 +139,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
   gNB         = RC.gNB[Mod_id][CC_id];
 
   uint8_t number_dl_pdu             = DL_req->dl_config_request_body.number_pdu;
-  uint8_t number_ul_pdu             = UL_tti_req->n_pdus;
+  //uint8_t number_ul_pdu             = UL_tti_req->n_pdus;
 
   nfapi_nr_dl_config_request_pdu_t *dl_config_pdu;
  
diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c
index c37db11188aedb8e38c78709e93525ea1219c673..0ce3172bfd8ce4813159a09e89a03f868d738458 100644
--- a/openair1/SCHED_NR/nr_ru_procedures.c
+++ b/openair1/SCHED_NR/nr_ru_procedures.c
@@ -300,18 +300,15 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
   int slot = tti_tx;
   int *txdata = &ru->common.txdata[aa][slot*fp->samples_per_slot];
 
+  if (nr_slot_select(cfg,slot, frame_tx) == SF_UL) return;
+
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
   start_meas(&ru->ofdm_mod_stats);
 
-  if ((nr_slot_select(cfg,slot,frame_tx)==SF_DL)||
-      ((nr_slot_select(cfg,slot,frame_tx)==SF_S))) {
-
     //    LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot);
 
     nr_feptx0(ru,slot,0,fp->symbols_per_slot,aa);
 
-  }
-
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
   stop_meas(&ru->ofdm_mod_stats);
 
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index a9cafd4c48df91c8e25a8cccd025d2696400ec19..8d8140e19254131f98a15ed72ac1554e0e437b61 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -86,7 +86,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t       module_idP,
 					  const tb_size_t         tb_sizeP,
 					  const uint32_t sourceL2Id,
 					  const uint32_t destinationL2Id)
-{mac_rlc_status_resp_t  mac_rlc_status_resp; return mac_rlc_status_resp;}
+{mac_rlc_status_resp_t  mac_rlc_status_resp={0}; return mac_rlc_status_resp;}
 tbs_size_t mac_rlc_data_req(  const module_id_t       module_idP,
 			      const rnti_t            rntiP,
 			      const eNB_index_t       eNB_index,
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 3e8a4ac423f11f9816d8ef88bf872dc742bf7778..724faf1d7f86806a34524944420c34595347f3c6 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
   uint16_t N_RB_DL = 106, N_RB_UL = 106, mu = 1;
   //unsigned char frame_type = 0;
   int number_of_frames = 1;
-  int frame_length_complex_samples, frame_length_complex_samples_no_prefix ;
+  int frame_length_complex_samples;
   NR_DL_FRAME_PARMS *frame_parms;
   int loglvl = OAILOG_WARNING;
   uint64_t SSB_positions=0x01;
@@ -409,7 +409,7 @@ int main(int argc, char **argv)
   //init_eNB_afterRU();
 
   frame_length_complex_samples = frame_parms->samples_per_subframe;
-  frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
+  //frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP;
 
   //configure UE
   UE = malloc(sizeof(PHY_VARS_NR_UE));
@@ -443,7 +443,7 @@ int main(int argc, char **argv)
   unsigned char harq_pid = 0;
   unsigned int TBS;
   unsigned int available_bits;
-  uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1)?6:4;
+  uint8_t nb_re_dmrs = UE->dmrs_UplinkConfig.pusch_maxLength*(UE->dmrs_UplinkConfig.pusch_dmrs_type == pusch_dmrs_type1?6:4);
   uint8_t length_dmrs = 1;
   unsigned char mod_order;
   uint16_t code_rate;
diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h
index 4f81c22fb0bee322e307222890e6ff51c456ddb8..054f3f37341477ed5b033531cad4869cf7f1cddd 100644
--- a/openair2/COMMON/gtpv1_u_messages_types.h
+++ b/openair2/COMMON/gtpv1_u_messages_types.h
@@ -133,7 +133,7 @@ typedef struct gtpv1u_enb_data_forwarding_req_s {
 typedef struct gtpv1u_enb_data_forwarding_ind_s {
   uint32_t 				 frame;
   uint8_t 				 enb_flag;
-  uint32_t 				 rb_id;
+  rb_id_t 				 rb_id;
   uint32_t 				 muip;
   uint32_t 				 confirmp;
   uint32_t 				 sdu_size;
@@ -155,7 +155,7 @@ typedef struct gtpv1u_enb_end_marker_req_s {
 typedef struct gtpv1u_enb_end_marker_ind_s {
   uint32_t 			 frame;
   uint8_t 			 enb_flag;
-  uint32_t 			 rb_id;
+  rb_id_t 			 rb_id;
   uint32_t 			 muip;
   uint32_t 			 confirmp;
   uint32_t 			 sdu_size;
diff --git a/openair2/COMMON/pdcp_messages_types.h b/openair2/COMMON/pdcp_messages_types.h
index c90490b0fd36077c99f1c023ec33655244b01ca0..1551e4283f38327be795b84d86d419ef9e0e8f6b 100644
--- a/openair2/COMMON/pdcp_messages_types.h
+++ b/openair2/COMMON/pdcp_messages_types.h
@@ -40,7 +40,7 @@
 typedef struct RrcDcchDataReq_s {
   uint32_t frame;
   uint8_t enb_flag;
-  uint32_t rb_id;
+  rb_id_t rb_id;
   uint32_t muip;
   uint32_t confirmp;
   uint32_t sdu_size;
diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h
index 977f44a31050f387d778dd1b9728d83e1e6bf7bf..49c1b340a6994a70c22176c46c1ddcb52aa49833 100644
--- a/openair2/COMMON/platform_types.h
+++ b/openair2/COMMON/platform_types.h
@@ -71,8 +71,8 @@ typedef uint8_t               slice_id_t;
 typedef uint8_t               eNB_index_t;
 typedef uint16_t              ue_id_t;
 typedef int16_t               smodule_id_t;
-typedef uint16_t              rb_id_t;
-typedef uint16_t              srb_id_t;
+typedef long              rb_id_t;
+typedef long              srb_id_t;
 
 typedef boolean_t             MBMS_flag_t;
 #define  MBMS_FLAG_NO         FALSE
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
index b1e1fb5d73022fa83a545b933fce51885379971c..04757dab16275b09c7e8c6448ec6f06977a1eee0 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
@@ -171,7 +171,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
   frame_t         frameP,
   sub_frame_t     subframeP,
   int            *mbsfn_flag,
-  uint16_t        nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+  uint16_t        nb_rbs_required[MAX_NUM_CCs][MAX_MOBILES_PER_ENB],
   DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]) {
   eNB_MAC_INST                   *eNB      = RC.mac[module_idP];
   COMMON_channels_t              *cc       = eNB->common_channels;
@@ -573,8 +573,8 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
   uint8_t slice_allocation[MAX_NUM_CCs][N_RBG_MAX];
   int                     UE_id, i;
   uint16_t                j,c;
-  uint16_t                nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
-  uint16_t                nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
+  uint16_t                nb_rbs_required[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
+  uint16_t                nb_rbs_required_remaining[MAX_NUM_CCs][MAX_MOBILES_PER_ENB];
   //  uint16_t                nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
   uint16_t                average_rbs_per_user[MAX_NUM_CCs] = {0};
   rnti_t             rnti;
@@ -617,7 +617,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
                                           frameP,
                                           subframeP,
                                           min_rb_unit,
-                                          (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required,
+                                          (uint16_t (*)[MAX_MOBILES_PER_ENB])nb_rbs_required,
                                           rballoc_sub,
                                           MIMO_mode_indicator,
                                           mbsfn_flag);
@@ -631,7 +631,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
   assign_rbs_required(Mod_id, 0, frameP, subframeP, nb_rbs_required,
                       min_rb_unit);
 #else
-  memcpy(nb_rbs_required, pre_nb_rbs_required[dlsch_ue_select_tbl_in_use], sizeof(uint16_t)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
+  memcpy(nb_rbs_required, pre_nb_rbs_required[dlsch_ue_select_tbl_in_use], sizeof(uint16_t)*MAX_NUM_CCs*MAX_MOBILES_PER_ENB);
 #endif
   dlsch_scheduler_pre_ue_select_fairRR(Mod_id,frameP,subframeP, mbsfn_flag,nb_rbs_required,dlsch_ue_select);
 
@@ -701,8 +701,8 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
                                               CC_id,
                                               N_RBG[CC_id],
                                               min_rb_unit[CC_id],
-                                              (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required,
-                                              (uint16_t (*)[NUMBER_OF_UE_MAX])nb_rbs_required_remaining,
+                                              (uint16_t (*)[MAX_MOBILES_PER_ENB])nb_rbs_required,
+                                              (uint16_t (*)[MAX_MOBILES_PER_ENB])nb_rbs_required_remaining,
                                               rballoc_sub,
                                               slice_allocation,
                                               MIMO_mode_indicator);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h
index 8c901186098c24b1a861dd208c97f8212c638ef0..5355a614a6c8c14b8dc7e2e3a1cd95ff270957c3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h
+++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h
@@ -82,7 +82,7 @@ void dlsch_scheduler_pre_ue_select_fairRR(
     frame_t         frameP,
     sub_frame_t     subframeP,
     int*            mbsfn_flag,
-    uint16_t        nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX],
+    uint16_t        nb_rbs_required[MAX_NUM_CCs][MAX_MOBILES_PER_ENB],
     DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]);
 
 void dlsch_scheduler_pre_processor_fairRR (module_id_t   Mod_id,
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
index f196293ea0890a44070c7c989b072cd4bb4ab984..a74615c3d3309236c193fa4dd7ec1e30b49205f1 100755
--- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
@@ -63,7 +63,8 @@
 
 typedef enum {
     SFN_C_MOD_2_EQ_0, 
-    SFN_C_MOD_2_EQ_1
+    SFN_C_MOD_2_EQ_1,
+    SFN_C_IMPOSSIBLE
 } SFN_C_TYPE;
 
 
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index 6b9e79d51025cb9c41e88c899cf9b2aac9a5ee48..ef94d5db7e10f3c176f69dd5414833c0b996b886 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -441,10 +441,10 @@ int8_t nr_ue_decode_mib(
         float big_o;
         float big_m;
         uint32_t temp;
-        SFN_C_TYPE sfn_c;   //  only valid for mux=1
-        uint32_t n_c;
-        uint32_t number_of_search_space_per_slot;
-        uint32_t first_symbol_index;
+        SFN_C_TYPE sfn_c=SFN_C_IMPOSSIBLE;   //  only valid for mux=1
+        uint32_t n_c=UINT_MAX;
+        uint32_t number_of_search_space_per_slot=UINT_MAX;
+        uint32_t first_symbol_index=UINT_MAX;
         uint32_t search_space_duration;  //  element of search space
         uint32_t coreset_duration;  //  element of coreset
         
@@ -582,6 +582,7 @@ int8_t nr_ue_decode_mib(
             search_space_duration = 1;
         }
 
+	AssertFatal(number_of_search_space_per_slot!=UINT_MAX,"");
         coreset_duration = num_symbols * number_of_search_space_per_slot;
 
         mac->type0_pdcch_dci_config.number_of_candidates[0] = table_38213_10_1_1_c2[0];
@@ -591,8 +592,11 @@ int8_t nr_ue_decode_mib(
         mac->type0_pdcch_dci_config.number_of_candidates[4] = table_38213_10_1_1_c2[4];   //  CCE aggregation level = 16
         mac->type0_pdcch_dci_config.duration = search_space_duration;
         mac->type0_pdcch_dci_config.coreset.duration = coreset_duration;   //  coreset
+	AssertFatal(first_symbol_index!=UINT_MAX,"");
         mac->type0_pdcch_dci_config.monitoring_symbols_within_slot = (0x3fff << first_symbol_index) & (0x3fff >> (14-coreset_duration-first_symbol_index)) & 0x3fff;
 
+	AssertFatal(sfn_c!=SFN_C_IMPOSSIBLE,"");
+	AssertFatal(n_c!=UINT_MAX,"");
         mac->type0_pdcch_ss_sfn_c = sfn_c;
         mac->type0_pdcch_ss_n_c = n_c;
         
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
index d7cbb33c9eea307b1c181fb02e7c02e8a7a412f5..f234e02c04b7086ca6e81c9552bbd00aeb47410d 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c
@@ -146,12 +146,12 @@ boolean_t pdcp_data_req(
               sdu_buffer_sizeP, MAX_IP_PACKET_SIZE);
 
   if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
-    AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rnti);
+    AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ctxt_pP->module_id, ctxt_pP->rnti);
   } else {
     if (srb_flagP) {
-      AssertError (rb_idP < 3, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rnti);
+      AssertError (rb_idP < 3, return FALSE, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, 3, ctxt_pP->module_id, ctxt_pP->rnti);
     } else {
-      AssertError (rb_idP < LTE_maxDRB, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti);
+      AssertError (rb_idP < LTE_maxDRB, return FALSE, "RB id is too high (%ld/%d) %u %u!\n", rb_idP, LTE_maxDRB, ctxt_pP->module_id, ctxt_pP->rnti);
     }
   }
 
@@ -160,7 +160,7 @@ boolean_t pdcp_data_req(
 
   if (h_rc != HASH_TABLE_OK) {
     if (modeP != PDCP_TRANSMISSION_MODE_TRANSPARENT) {
-      LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %d Ignoring SDU...\n",
+      LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %ld Ignoring SDU...\n",
             PROTOCOL_CTXT_ARGS(ctxt_pP),
             rb_idP);
       ctxt_pP->configured=FALSE;
@@ -190,7 +190,7 @@ boolean_t pdcp_data_req(
         rlc_util_print_hex_octets(PDCP,
                                   (unsigned char *)&pdcp_pdu_p->data[0],
                                   sdu_buffer_sizeP);
-        LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %d \n", srb_flagP, rb_idP);
+        LOG_UI(PDCP, "Before rlc_data_req 1, srb_flagP: %d, rb_idP: %ld \n", srb_flagP, rb_idP);
       }
 
       rlc_status = pdcp_params.send_rlc_data_req_func(ctxt_pP, srb_flagP, NODE_IS_CU(RC.rrc[ctxt_pP->module_id]->node_type)?MBMS_FLAG_NO:MBMS_FLAG_YES, rb_idP, muiP,
@@ -338,7 +338,7 @@ boolean_t pdcp_data_req(
         stop_meas(&UE_pdcp_stats[ctxt_pP->module_id].data_req);
       }
 
-      LOG_E(PDCP,  "[FRAME %5u][%s][PDCP][MOD %u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n",
+      LOG_E(PDCP,  "[FRAME %5u][%s][PDCP][MOD %u][RB %ld] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n",
             ctxt_pP->frame,
             (ctxt_pP->enb_flag) ? "eNB" : "UE",
             ctxt_pP->module_id,
@@ -352,11 +352,11 @@ boolean_t pdcp_data_req(
      * to see if RLC succeeded
      */
     LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)pdcp_pdu_p->data,pdcp_pdu_size,
-                "[MSG] PDCP DL %s PDU on rb_id %d\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP);
+                "[MSG] PDCP DL %s PDU on rb_id %ld\n",(srb_flagP)? "CONTROL" : "DATA", rb_idP);
 
     if ((pdcp_pdu_p!=NULL) && (srb_flagP == 0) && (ctxt_pP->enb_flag == 1)) {
-      LOG_D(PDCP, "pdcp data req on drb %d, size %d, rnti %x, node_type %d \n",
-            rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc[ctxt_pP->module_id]->node_type);
+      LOG_D(PDCP, "pdcp data req on drb %ld, size %d, rnti %x, node_type %d \n",
+            rb_idP, pdcp_pdu_size, ctxt_pP->rnti, RC.rrc ? RC.rrc[ctxt_pP->module_id]->node_type: -1);
 
       // The check on nos1 is done only for the use case of LTE stack running over 5g-nr PHY. This should be changed
       // before future merge of develop with develop-nr and instead of a check of IS_SOFTMODEM_NOS1, we should use a check
@@ -374,7 +374,7 @@ boolean_t pdcp_data_req(
         rlc_status = pdcp_params.send_rlc_data_req_func(ctxt_pP, srb_flagP, MBMS_FLAG_NO, rb_idP, muiP,
                      confirmP, pdcp_pdu_size, pdcp_pdu_p,sourceL2Id,
                      destinationL2Id);
-
+	ret=FALSE;
         switch (rlc_status) {
           case RLC_OP_STATUS_OK:
             LOG_D(PDCP, "Data sending request over RLC succeeded!\n");
@@ -383,22 +383,18 @@ boolean_t pdcp_data_req(
 
           case RLC_OP_STATUS_BAD_PARAMETER:
             LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
-            ret= FALSE;
             break;
 
           case RLC_OP_STATUS_INTERNAL_ERROR:
             LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
-            ret= FALSE;
             break;
 
           case RLC_OP_STATUS_OUT_OF_RESSOURCES:
             LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
-            ret= FALSE;
             break;
 
           default:
             LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
-            ret= FALSE;
             break;
         } // switch case
       } /* end if node_type is not DU */
@@ -527,19 +523,11 @@ pdcp_data_ind(
   int         security_ok;
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_IN);
   LOG_DUMPMSG(PDCP,DEBUG_PDCP,(char *)sdu_buffer_pP->data,sdu_buffer_sizeP,
-              "[MSG] PDCP UL %s PDU on rb_id %d\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
-
-
-#if T_TRACER
-
-  if (ctxt_pP->enb_flag != ENB_FLAG_NO)
-    T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rnti), T_INT(rb_idP), T_INT(sdu_buffer_sizeP));
-
-#endif
+              "[MSG] PDCP UL %s PDU on rb_id %ld\n", (srb_flagP)? "CONTROL" : "DATA", rb_idP);
 
   if (MBMS_flagP) {
     AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE,
-                 "RB id is too high (%u/%d) %u rnti %x!\n",
+                 "RB id is too high (%ld/%d) %u rnti %x!\n",
                  rb_idP,
                  NB_RB_MBMS_MAX,
                  ctxt_pP->module_id,
@@ -547,7 +535,7 @@ pdcp_data_ind(
 
     if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
       LOG_D(PDCP, "e-MBMS Data indication notification for PDCP entity from eNB %u to UE %x "
-            "and radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d\n",
+            "and radio bearer ID %ld rlc sdu size %d ctxt_pP->enb_flag %d\n",
             ctxt_pP->module_id,
             ctxt_pP->rnti,
             rb_idP,
@@ -555,7 +543,7 @@ pdcp_data_ind(
             ctxt_pP->enb_flag);
     } else {
       LOG_D(PDCP, "Data indication notification for PDCP entity from UE %x to eNB %u "
-            "and radio bearer ID %d rlc sdu size %d ctxt_pP->enb_flag %d\n",
+            "and radio bearer ID %ld rlc sdu size %d ctxt_pP->enb_flag %d\n",
             ctxt_pP->rnti,
             ctxt_pP->module_id,
             rb_idP,
@@ -564,12 +552,12 @@ pdcp_data_ind(
     }
   } else {
     rb_id = rb_idP % LTE_maxDRB;
-    AssertError (rb_id < LTE_maxDRB, return FALSE, "RB id is too high (%u/%d) %u UE %x!\n",
+    AssertError (rb_id < LTE_maxDRB, return FALSE, "RB id is too high (%ld/%d) %u UE %x!\n",
                  rb_id,
                  LTE_maxDRB,
                  ctxt_pP->module_id,
                  ctxt_pP->rnti);
-    AssertError (rb_id > 0, return FALSE, "RB id is too low (%u/%d) %u UE %x!\n",
+    AssertError (rb_id > 0, return FALSE, "RB id is too low (%ld/%d) %u UE %x!\n",
                  rb_id,
                  LTE_maxDRB,
                  ctxt_pP->module_id,
@@ -735,14 +723,6 @@ pdcp_data_ind(
         pdcp_p->rx_hfn++;
       }
 
-      //rrc_lite_data_ind(module_id, //Modified MW - L2 Interface
-      MSC_LOG_TX_MESSAGE(
-        (ctxt_pP->enb_flag == ENB_FLAG_NO)? MSC_PDCP_UE:MSC_PDCP_ENB,
-        (ctxt_pP->enb_flag == ENB_FLAG_NO)? MSC_RRC_UE:MSC_RRC_ENB,
-        NULL,0,
-        PROTOCOL_PDCP_CTXT_FMT" DATA-IND len %u",
-        PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
-        sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len);
       rrc_data_ind(ctxt_pP,
                    rb_id,
                    sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
@@ -945,7 +925,7 @@ pdcp_data_ind(
 
   if (LINK_ENB_PDCP_TO_GTPV1U) {
     if ((TRUE == ctxt_pP->enb_flag) && (FALSE == srb_flagP)) {
-      LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ  ue %x rab %u len %u\n",
+      LOG_D(PDCP, "Sending packet to GTP, Calling GTPV1U_ENB_TUNNEL_DATA_REQ  ue %x rab %ld len %u\n",
             ctxt_pP->rnti,
             rb_id + 4,
             sdu_buffer_sizeP - payload_offset );
@@ -1186,7 +1166,7 @@ pdcp_run (
             RRC_DCCH_DATA_REQ (msg_p).frame,
             0,
             RRC_DCCH_DATA_REQ (msg_p).eNB_index);
-          LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
+          LOG_D(PDCP, PROTOCOL_CTXT_FMT"Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n",
                 PROTOCOL_CTXT_ARGS(&ctxt),
                 ITTI_MSG_NAME (msg_p),
                 ITTI_MSG_ORIGIN_NAME(msg_p),
@@ -1195,7 +1175,7 @@ pdcp_run (
                 RRC_DCCH_DATA_REQ (msg_p).muip,
                 RRC_DCCH_DATA_REQ (msg_p).confirmp,
                 RRC_DCCH_DATA_REQ (msg_p).mode);
-          LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %d \n", RRC_DCCH_DATA_REQ (msg_p).rb_id);
+          LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %ld \n", RRC_DCCH_DATA_REQ (msg_p).rb_id);
           result = pdcp_data_req (&ctxt,
                                   SRB_FLAG_YES,
                                   RRC_DCCH_DATA_REQ (msg_p).rb_id,
@@ -1846,7 +1826,7 @@ pdcp_config_req_asn1 (
       pdcp_pP->rx_hfn                           = 0;
       pdcp_pP->last_submitted_pdcp_rx_sn        = 4095;
       pdcp_pP->first_missing_pdu                = -1;
-      LOG_I(PDCP, PROTOCOL_PDCP_CTXT_FMT" Action ADD  LCID %d (%s id %d) "
+      LOG_I(PDCP, PROTOCOL_PDCP_CTXT_FMT" Action ADD  LCID %d (%s id %ld) "
             "configured with SN size %d bits and RLC %s\n",
             PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
             lc_idP,
@@ -1898,7 +1878,7 @@ pdcp_config_req_asn1 (
       }
 
       LOG_I(PDCP,PROTOCOL_PDCP_CTXT_FMT" Action MODIFY LCID %d "
-            "RB id %d reconfigured with SN size %d and RLC %s \n",
+            "RB id %ld reconfigured with SN size %d and RLC %s \n",
             PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
             lc_idP,
             rb_idP,
@@ -1910,7 +1890,7 @@ pdcp_config_req_asn1 (
       DevAssert(pdcp_pP != NULL);
       //#warning "TODO pdcp_module_id_to_rnti"
       //pdcp_module_id_to_rnti[ctxt_pP.module_id ][dst_id] = NOT_A_RNTI;
-      LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_REMOVE LCID %d RBID %d configured\n",
+      LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_REMOVE LCID %d RBID %ld configured\n",
             PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
             lc_idP,
             rb_idP);
@@ -1937,7 +1917,7 @@ pdcp_config_req_asn1 (
 
     case CONFIG_ACTION_MBMS_ADD:
     case CONFIG_ACTION_MBMS_MODIFY:
-      LOG_D(PDCP," %s service_id/mch index %d, session_id/lcid %d, rbid %d configured\n",
+      LOG_D(PDCP," %s service_id/mch index %d, session_id/lcid %d, rbid %ld configured\n",
             //PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_pP),
             actionP == CONFIG_ACTION_MBMS_ADD ? "CONFIG_ACTION_MBMS_ADD" : "CONFIG_ACTION_MBMS_MODIFY",
             mch_idP,
@@ -2063,7 +2043,7 @@ rrc_pdcp_config_req (
         }
 
         pdcp_p->first_missing_pdu = -1;
-        LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Config request : Action ADD:  radio bearer id %d (already added) configured\n",
+        LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Config request : Action ADD:  radio bearer id %ld (already added) configured\n",
               PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p),
               rb_idP);
         break;
@@ -2072,7 +2052,7 @@ rrc_pdcp_config_req (
         break;
 
       case CONFIG_ACTION_REMOVE:
-        LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_REMOVE: radio bearer id %d configured\n",
+        LOG_D(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_REMOVE: radio bearer id %ld configured\n",
               PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p),
               rb_idP);
         pdcp_p->next_pdcp_tx_sn = 0;
@@ -2141,7 +2121,7 @@ rrc_pdcp_config_req (
           pdcp_p->first_missing_pdu = -1;
           LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Inserting PDCP instance in collection key 0x%"PRIx64"\n",
                 PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), key);
-          LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Config request : Action ADD:  radio bearer id %d configured\n",
+          LOG_D(PDCP,PROTOCOL_PDCP_CTXT_FMT" Config request : Action ADD:  radio bearer id %ld configured\n",
                 PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p),
                 rb_idP);
         }
@@ -2323,10 +2303,8 @@ void nr_ip_over_LTE_DRB_preconfiguration(void){
 	               DRB_configList,
 	               (LTE_DRB_ToReleaseList_t *) NULL,
 	               0xff, NULL, NULL, NULL
-	//#if (RRC_VERSION >= MAKE_VERSION(10, 0, 0))
-	               , (LTE_PMCH_InfoList_r9_t *) NULL
-	//#endif
-	               ,NULL);
+	               , (LTE_PMCH_InfoList_r9_t *) NULL,
+	               &DRB_config->drb_Identity);
 
 	rrc_rlc_config_asn1_req(&ctxt,
 	               (LTE_SRB_ToAddModList_t*)NULL,
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
index 14507f25894b08af00350400db24b955f423bf10..1d4c6127434e6b57d67601ab07edc321a02efa03 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h
@@ -87,7 +87,7 @@ extern pthread_mutex_t pdcp_mutex;
 extern pthread_cond_t  pdcp_cond;
 extern int             pdcp_instance_cnt;
 
-#define PROTOCOL_PDCP_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] "
+#define PROTOCOL_PDCP_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld] "
 
 #define PROTOCOL_PDCP_CTXT_ARGS(CTXT_Pp, pDCP_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
   (pDCP_Pp->is_srb) ? "SRB" : "DRB",\
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index bc3474a369e59690cf8943cc29912724cfd7bc53..9e873379b135d598ddd027dbfd4b3fe7be3c9e5c 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -98,7 +98,7 @@ extern int gtpv1u_new_data_req( uint8_t  enb_module_idP, rnti_t   ue_rntiP, uint
 
 void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) {
   LOG_I(PDCP,"%s: \nPC5S message, header traffic_type: %d)\n", title, sl_pc5s_msg->pc5s_header.traffic_type);
-  LOG_I(PDCP,"PC5S message, header rb_id: %d)\n", sl_pc5s_msg->pc5s_header.rb_id);
+  LOG_I(PDCP,"PC5S message, header rb_id: %ld)\n", sl_pc5s_msg->pc5s_header.rb_id);
   LOG_I(PDCP,"PC5S message, header data_size: %d)\n", sl_pc5s_msg->pc5s_header.data_size);
   LOG_I(PDCP,"PC5S message, header inst: %d)\n", sl_pc5s_msg->pc5s_header.inst);
   LOG_I(PDCP,"PC5-S message, sourceL2Id: 0x%08x\n)\n", sl_pc5s_msg->pc5s_header.sourceL2Id);
@@ -181,33 +181,19 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const  ctxt_pP) {
           ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
 
     if (h_rc == HASH_TABLE_OK) {
-      LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %d \n",
+      LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d on Rab %ld \n",
             ctxt.frame, ctxt.instance, len, rab_id);
-      LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %u]\n",
+      LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n",
             ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
             ctxt.rnti, rab_id);
-      MSC_LOG_RX_MESSAGE((ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-                         (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
-                         NULL, 0,
-                         MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
-                         MSC_AS_TIME_ARGS(ctxt_pP),
-                         ctxt.instance, rab_id, rab_id, len);
       pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
                     RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
                     PDCP_TRANSMISSION_MODE_DATA
                     , NULL, NULL
                    );
     } else {
-      MSC_LOG_RX_DISCARDED_MESSAGE(
-        (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-        (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
-        NULL,
-        0,
-        MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
-        MSC_AS_TIME_ARGS(ctxt_pP),
-        ctxt.instance, rab_id, rab_id, len);
       LOG_D(PDCP,
-            "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
+            "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %04x][RB %ld] TUN NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
             ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
             ctxt.rnti, rab_id, key);
     }
@@ -253,7 +239,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
           if (nas_nlh_rx->nlmsg_len == sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)) {
             pdcp_read_state_g = 1;  //get
             memcpy((void *)&pdcp_read_header_g, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
-            LOG_D(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %u data_size %d, source L2Id 0x%08x, destination L2Id 0x%08x\n",
+            LOG_D(PDCP, "[PDCP][NETLINK] RX pdcp_data_req_header_t inst %u, rb_id %ld data_size %d, source L2Id 0x%08x, destination L2Id 0x%08x\n",
                   pdcp_read_header_g.inst, pdcp_read_header_g.rb_id, pdcp_read_header_g.data_size,pdcp_read_header_g.sourceL2Id, pdcp_read_header_g.destinationL2Id );
           } else {
             LOG_E(PDCP, "[PDCP][NETLINK] WRONG size %d should be sizeof (pdcp_data_req_header_t) + sizeof(struct nlmsghdr)\n",
@@ -269,7 +255,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
           //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
           ctxt.frame         = ctxt_cpy.frame;
           ctxt.enb_flag      = ctxt_cpy.enb_flag;
-          LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d, source L2Id = 0x%08x, destination L2Id = 0x%08x \n", pdcp_read_header_g.rb_id, pdcp_read_header_g.sourceL2Id,
+          LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %ld, source L2Id = 0x%08x, destination L2Id = 0x%08x \n", pdcp_read_header_g.rb_id, pdcp_read_header_g.sourceL2Id,
                 pdcp_read_header_g.destinationL2Id);
 
           if (ctxt.enb_flag) {
@@ -283,25 +269,14 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
               h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
 
               if (h_rc == HASH_TABLE_OK) {
-                LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d for rnti: %d \n",
+                LOG_D(PDCP, "[FRAME %5u][eNB][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %ld for rnti: %d \n",
                       ctxt.frame,
                       pdcp_read_header_g.inst,
                       len,
                       nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
                       pdcp_read_header_g.rb_id,
                       ctxt.rnti);
-                MSC_LOG_RX_MESSAGE(
-                  (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-                  (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
-                  NULL,
-                  0,
-                  MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
-                  MSC_AS_TIME_ARGS(ctxt_pP),
-                  pdcp_read_header_g.inst,
-                  pdcp_read_header_g.rb_id,
-                  rab_id,
-                  pdcp_read_header_g.data_size);
-                LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %u][RB %u]\n",
+                LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u]UE %u][RB %ld]\n",
                       ctxt_cpy.frame,
                       pdcp_read_header_g.inst,
                       pdcp_read_header_g.rb_id,
@@ -320,7 +295,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
                               ,NULL, NULL
                              );
               } else {
-                LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE, DROPPED\n",
+                LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE, DROPPED\n",
                       ctxt.frame,
                       pdcp_read_header_g.inst,
                       pdcp_read_header_g.rb_id,
@@ -335,7 +310,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
               for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) {
                 if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) {
                   ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id];
-                  LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+                  LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
                         ctxt.frame,
                         pdcp_read_header_g.inst,
                         pdcp_read_header_g.rb_id,
@@ -377,27 +352,27 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
                       ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                 key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
                 h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
-                LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+                LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n",
                       (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
               } else {
                 rab_id = rab_id % LTE_maxDRB;
-                LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
+                LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n",
                       ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
                 key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
                 h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
-                LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+                LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n",
                       (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
               }
 
               if (h_rc == HASH_TABLE_OK) {
                 rab_id = pdcp_p->rb_id;
-                LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %d \n",
+                LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %zu) on Rab %ld \n",
                       ctxt.frame,
                       pdcp_read_header_g.inst,
                       len,
                       nas_nlh_rx->nlmsg_len-sizeof(struct nlmsghdr),
                       pdcp_read_header_g.rb_id);
-                LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
+                LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %ld]\n",
                       ctxt.frame,
                       pdcp_read_header_g.inst,
                       pdcp_read_header_g.rb_id,
@@ -405,17 +380,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
                       ctxt.module_id,
                       ctxt.rnti,
                       rab_id);
-                MSC_LOG_RX_MESSAGE(
-                  (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-                  (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
-                  NULL,
-                  0,
-                  MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u rab %u size %u",
-                  MSC_AS_TIME_ARGS(ctxt_pP),
-                  pdcp_read_header_g.inst,
-                  pdcp_read_header_g.rb_id,
-                  rab_id,
-                  pdcp_read_header_g.data_size);
                 pdcp_data_req(
                   &ctxt,
                   SRB_FLAG_NO,
@@ -441,7 +405,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
                   rab_id,
                   pdcp_read_header_g.data_size);
                 LOG_D(PDCP,
-                      "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
+                      "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
                       ctxt.frame,
                       pdcp_read_header_g.inst,
                       pdcp_read_header_g.rb_id,
@@ -453,7 +417,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
               } /* h_rc != HASH_TABLE_OK */
             }  else {/* else of rab_id != 0 */
               LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
-              LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+              LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
                     ctxt.frame,
                     pdcp_read_header_g.inst,
                     pdcp_read_header_g.rb_id,
@@ -461,16 +425,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const  ctx
                     ctxt.module_id,
                     ctxt.rnti,
                     DEFAULT_RAB_ID);
-              MSC_LOG_RX_MESSAGE(
-                (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
-                (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE,
-                NULL,0,
-                MSC_AS_TIME_FMT" DATA-REQ inst %u rb %u default rab %u size %u",
-                MSC_AS_TIME_ARGS(ctxt_pP),
-                pdcp_read_header_g.inst,
-                pdcp_read_header_g.rb_id,
-                DEFAULT_RAB_ID,
-                pdcp_read_header_g.data_size);
               pdcp_data_req (
                 &ctxt,
                 SRB_FLAG_NO,
@@ -555,7 +509,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const  ctxt_pP)
         //#warning "TO DO CORRCT VALUES FOR ue mod id, enb mod id"
         ctxt.frame         = ctxt_cpy.frame;
         ctxt.enb_flag      = ctxt_cpy.enb_flag;
-        LOG_I(PDCP, "[PDCP] pc5s_header->rb_id = %d\n", pc5s_header->rb_id);
+        LOG_I(PDCP, "[PDCP] pc5s_header->rb_id = %ld\n", pc5s_header->rb_id);
 
         if (ctxt_cpy.enb_flag) {
           ctxt.module_id = 0;
@@ -575,26 +529,26 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const  ctxt_pP)
                     ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
               key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
               h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
-              LOG_D(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+              LOG_D(PDCP,"request key %x : (%d,%x,%d,%ld)\n",
                     (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
             } else {
               rab_id = rab_id % LTE_maxDRB;
-              LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n",
+              LOG_I(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%ld, SRB_FLAG=%d)\n",
                     ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
               key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
               h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
-              LOG_I(PDCP,"request key %x : (%d,%x,%d,%d)\n",
+              LOG_I(PDCP,"request key %x : (%d,%x,%d,%ld)\n",
                     (uint8_t)key,ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id);
             }
 
             if (h_rc == HASH_TABLE_OK) {
               rab_id = pdcp_p->rb_id;
-              LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d  on Rab %d \n",
+              LOG_I(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d  on Rab %ld \n",
                     ctxt.frame,
                     pc5s_header->inst,
                     bytes_received,
                     pc5s_header->rb_id);
-              LOG_I(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %u]\n",
+              LOG_I(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB %ld]\n",
                     ctxt.frame,
                     pc5s_header->inst,
                     pc5s_header->rb_id,
@@ -638,7 +592,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const  ctxt_pP)
                 rab_id,
                 pc5s_header->data_size);
               LOG_D(PDCP,
-                    "[FRAME %5u][UE][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %u] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
+                    "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes ---X][PDCP][MOD %u][UE %u][RB %ld] NON INSTANCIATED INSTANCE key 0x%"PRIx64", DROPPED\n",
                     ctxt.frame,
                     pc5s_header->inst,
                     pc5s_header->rb_id,
@@ -650,7 +604,7 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const  ctxt_pP)
             }
           }  else { /* else of if (rab_id == 0) */
             LOG_D(PDCP, "Forcing send on DEFAULT_RAB_ID\n");
-            LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %u][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
+            LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n",
                   ctxt.frame,
                   pc5s_header->inst,
                   pc5s_header->rb_id,
@@ -706,28 +660,6 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t *const  ctxt_pP) {
   return 0;
 }
 
-
-void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const  ctxt_pP) {
-  module_id_t          dst_id; // dst for otg
-  protocol_ctxt_t      ctxt;
-
-  // we need to add conditions to avoid transmitting data when the UE is not RRC connected.
-  if ((otg_enabled==1) && (ctxt_pP->enb_flag == ENB_FLAG_YES)) { // generate DL traffic
-    PROTOCOL_CTXT_SET_BY_MODULE_ID(
-      &ctxt,
-      ctxt_pP->module_id,
-      ctxt_pP->enb_flag,
-      NOT_A_RNTI,
-      ctxt_pP->frame,
-      ctxt_pP->subframe,
-      ctxt_pP->module_id);
-
-    for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) {
-      ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id];
-    }
-  }
-}
-
 //TTN for D2D (PC5S)
 
 void
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
index 0bf3d86bae4f0db6549207de73e9c65a812e0e34..891c38209b5eda9637cc17fabb7c81c186d24eb0 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c
@@ -221,7 +221,7 @@ void *pdcp_netlink_thread_fct(void *arg)
             pdcp_thread_read_state = 1;
             memcpy((void *)&new_data_p->pdcp_read_header, (void *)NLMSG_DATA(nas_nlh_rx), sizeof(pdcp_data_req_header_t));
             LOG_I(PDCP, "[NETLINK_THREAD] RX pdcp_data_req_header_t inst %u, "
-                  "rb_id %u data_size %d\n",
+                  "rb_id %ld data_size %d\n",
                   new_data_p->pdcp_read_header.inst,
                   new_data_p->pdcp_read_header.rb_id,
                   new_data_p->pdcp_read_header.data_size);
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
index a18713fbb67a32c94a91a922e47f7e7f67657310..8f9ee0af188e93a7fdb9a15c21d0c3b0551ccf99 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_security.c
@@ -128,7 +128,7 @@ pdcp_apply_security(
     /* SRBs */
     uint8_t *mac_i;
 
-    LOG_D(PDCP, "[OSA][RB %d] %s Applying control-plane security %d \n",
+    LOG_D(PDCP, "[OSA][RB %ld] %s Applying control-plane security %d \n",
           rb_id, (pdcp_pP->is_ue != 0) ? "UE -> eNB" : "eNB -> UE", pdcp_pP->integrityProtAlgorithm);
 
     encrypt_params.message    = pdcp_pdu_buffer;
@@ -145,7 +145,7 @@ pdcp_apply_security(
 
     encrypt_params.key = pdcp_pP->kRRCenc;  // + 128  // bit key
   } else {
-    LOG_D(PDCP, "[OSA][RB %d] %s Applying user-plane security\n",
+    LOG_D(PDCP, "[OSA][RB %ld] %s Applying user-plane security\n",
           rb_id, (pdcp_pP->is_ue != 0) ? "UE -> eNB" : "eNB -> UE");
 
     encrypt_params.key = pdcp_pP->kUPenc;//  + 128;
@@ -200,11 +200,11 @@ pdcp_validate_security(
   decrypt_params.key_length = 16;
 
   if (srb_flagP) {
-    LOG_D(PDCP, "[OSA][RB %d] %s Validating control-plane security\n",
+    LOG_D(PDCP, "[OSA][RB %ld] %s Validating control-plane security\n",
           rb_id, (pdcp_pP->is_ue != 0) ? "eNB -> UE" : "UE -> eNB");
     decrypt_params.key = pdcp_pP->kRRCenc;// + 128;
   } else {
-    LOG_D(PDCP, "[OSA][RB %d] %s Validating user-plane security\n",
+    LOG_D(PDCP, "[OSA][RB %ld] %s Validating user-plane security\n",
           rb_id, (pdcp_pP->is_ue != 0) ? "eNB -> UE" : "UE -> eNB");
     decrypt_params.key = pdcp_pP->kUPenc;// + 128;
   }
@@ -228,7 +228,7 @@ pdcp_validate_security(
     	  " Security: failed MAC-I Algo %X UE %"PRIx16" ",
     	  pdcp_pP->integrityProtAlgorithm,
     	  ctxt_pP->rnti);
-      LOG_E(PDCP, "[OSA][RB %d] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
+      LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
             rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
       VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
       return -1;
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
index 02e1b63129668e97eb6dae7a98ee0990be15f499..a11c029bd3637e022a8699562f65f3863f56b5b3 100644
--- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c
@@ -543,7 +543,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto
   //   if (xid == 1)
   //     pdcp_data_ind_wifi((const protocol_ctxt_t*) ctxt_pP, (const srb_flag_t) srb_flagP, (const MBMS_flag_t) flag_MBMS, (const rb_id_t) rb_idP, pdcp_pdu_size, pdcp_pdu_p);
   //   else if (xid == 0)   // FIXME: USE a preprocessed definition
-  LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %d, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP);
+  LOG_D(PROTO_AGENT, "[inst %d] Received PDCP PDU with size %d for UE RNTI %x RB %ld, Calling pdcp_data_ind\n", ctxt_pP.instance, pdcp_pdu_size,ctxt_pP.rnti,rb_idP);
   result = pdcp_data_ind(&ctxt_pP,
                          srb_flagP,
                          flag_MBMS,
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
index ef40b186e001e01a3472ea00fb8ec63ff282b8df..865a81535946cd927d847a5e17d5c5c643982313 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c
@@ -672,7 +672,7 @@ rlc_am_mac_data_request (
 
           if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
             message_string_size = 0;
-            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", l_rlc_p->rb_id);
+            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", l_rlc_p->rb_id);
             message_string_size += sprintf(&message_string[message_string_size], "PDU size    : %u\n", tb_size_in_bytes);
             message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
             message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
@@ -771,7 +771,7 @@ rlc_am_mac_data_request (
 
           if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
             message_string_size = 0;
-            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", l_rlc_p->rb_id);
+            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", l_rlc_p->rb_id);
             message_string_size += sprintf(&message_string[message_string_size], "PDU size    : %u\n", tb_size_in_bytes);
             message_string_size += sprintf(&message_string[message_string_size], "PDU type    : RLC AM DATA REQ: STATUS PDU\n\n");
             message_string_size += sprintf(&message_string[message_string_size], "Header      :\n");
@@ -874,7 +874,7 @@ rlc_am_mac_data_indication (
             }
 
             if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
-              message_string_size += sprintf(&message_string[message_string_size], "Bearer	: %u\n", l_rlc_p->rb_id);
+              message_string_size += sprintf(&message_string[message_string_size], "Bearer	: %ld\n", l_rlc_p->rb_id);
               message_string_size += sprintf(&message_string[message_string_size], "PDU size	: %u\n", tb_size_in_bytes);
               message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
               message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
@@ -971,7 +971,7 @@ rlc_am_mac_data_indication (
 
             if ( LOG_DEBUGFLAG(DEBUG_RLC)) {
               message_string_size = 0;
-              message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", l_rlc_p->rb_id);
+              message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", l_rlc_p->rb_id);
               message_string_size += sprintf(&message_string[message_string_size], "PDU size    : %u\n", ((struct mac_tb_ind *) (tb_p->data))->size);
               message_string_size += sprintf(&message_string[message_string_size], "PDU type    : RLC AM DATA IND: STATUS PDU\n\n");
               message_string_size += sprintf(&message_string[message_string_size], "Header      :\n");
@@ -1039,7 +1039,7 @@ rlc_am_data_req (
       mui);
 
     if (LOG_DEBUGFLAG(DEBUG_RLC)) {
-      message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", l_rlc_p->rb_id);
+      message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", l_rlc_p->rb_id);
       message_string_size += sprintf(&message_string[message_string_size], "SDU size    : %u\n", data_size);
       message_string_size += sprintf(&message_string[message_string_size], "MUI         : %u\n", mui);
       message_string_size += sprintf(&message_string[message_string_size], "CONF        : %u\n", ((struct rlc_am_data_req *) (sdu_pP->data))->conf);
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
index c6a5ca721320915ccda6dbd98c5dbfca4e65a742..f2cb456e8cfb94816d46d77cecbb4e260cec5990 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h
@@ -60,12 +60,12 @@
 //#        include "rlc_am_test.h"
 
 
-#define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u]"
+#define PROTOCOL_RLC_AM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld]"
 #define PROTOCOL_RLC_AM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
           (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
           rLC_Pp->rb_id
 
-#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]"
+#define PROTOCOL_RLC_AM_MSC_FMT "[RNTI %" PRIx16 " %s %02ld]"
 #define PROTOCOL_RLC_AM_MSC_ARGS(CTXT_Pp, rLC_Pp) \
         CTXT_Pp->rnti,\
           (rLC_Pp->is_data_plane) ? "DRB AM" : "SRB AM",\
diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
index 369c7fd0da56576168243e6c8de429a2f557e773..793d0057ac99a149fb27c1011c23aa27e24f62f5 100644
--- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
+++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_reassembly.c
@@ -111,7 +111,7 @@ rlc_am_send_sdu (
         char                 message_string[7000];
         size_t               message_string_size = 0;
         int                  octet_index, index;
-        message_string_size += sprintf(&message_string[message_string_size], "Bearer	  : %u\n", rlc_pP->rb_id);
+        message_string_size += sprintf(&message_string[message_string_size], "Bearer	  : %ld\n", rlc_pP->rb_id);
         message_string_size += sprintf(&message_string[message_string_size], "SDU size    : %u\n", rlc_pP->output_sdu_size_to_write);
         message_string_size += sprintf(&message_string[message_string_size], "\nPayload  : \n");
         message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
index a5bd0b9ef59d4d077791498f75204750410e345c..1ea99887071397ebccb8c2b9f9c7d5ceaf92ff3d 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm.h
@@ -42,7 +42,7 @@
 #        include "mem_block.h"
 #        include "rlc_tm_init.h"
 
-#define PROTOCOL_RLC_TM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u]"
+#define PROTOCOL_RLC_TM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld]"
 #define PROTOCOL_RLC_TM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
           (rLC_Pp->is_data_plane) ? "DRB TM" : "SRB TM",\
           rLC_Pp->rb_id
diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
index 78d7cc515f4ae713991cd7ec51c964242a232c10..22e6f4d78d1a4d1b8d0dc4c855216bda7068caed 100644
--- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
+++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c
@@ -42,7 +42,7 @@ void config_req_rlc_tm (
 
   if (h_rc == HASH_TABLE_OK) {
     rlc_p = &rlc_union_p->rlc.tm;
-    LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ (is_uplink_downlink=%d) RB %u\n",
+    LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ (is_uplink_downlink=%d) RB %ld\n",
           PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
           config_tmP->is_uplink_downlink,
           rb_idP);
@@ -52,7 +52,7 @@ void config_req_rlc_tm (
     rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP);
     rlc_tm_configure(ctxt_pP, rlc_p, config_tmP->is_uplink_downlink);
   } else {
-    LOG_E(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ RB %u RLC NOT FOUND\n",
+    LOG_E(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ RB %ld RLC NOT FOUND\n",
           PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_p),
           rb_idP);
   }
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
index 66a544f96287c20a875d69277780e7cb1d4f2940..c7dc11f51dc62dfe4d615d427b5d45ce2d3edbd5 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c
@@ -279,7 +279,7 @@ rlc_um_rx (const protocol_ctxt_t *const ctxt_pP, void *argP, struct mac_data_ind
 
           if (LOG_DEBUGFLAG(DEBUG_RLC)) {
             message_string_size = 0;
-            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", l_rlc_p->rb_id);
+            message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", l_rlc_p->rb_id);
             message_string_size += sprintf(&message_string[message_string_size], "PDU size    : %u\n", tb_size_in_bytes);
             message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
             message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
@@ -525,7 +525,7 @@ rlc_um_mac_data_request (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP,cons
 
         if(LOG_DEBUGFLAG(DEBUG_RLC)) {
           message_string_size = 0;
-          message_string_size += sprintf(&message_string[message_string_size], "Bearer	  : %u\n", l_rlc_p->rb_id);
+          message_string_size += sprintf(&message_string[message_string_size], "Bearer	  : %ld\n", l_rlc_p->rb_id);
           message_string_size += sprintf(&message_string[message_string_size], "PDU size    : %u\n", tb_size_in_bytes);
           message_string_size += sprintf(&message_string[message_string_size], "Header size : %u\n", pdu_info.header_size);
           message_string_size += sprintf(&message_string[message_string_size], "Payload size: %u\n", pdu_info.payload_size);
@@ -631,7 +631,7 @@ rlc_um_data_req (const protocol_ctxt_t *const ctxt_pP, void *rlc_pP, mem_block_t
   if (LOG_DEBUGFLAG(DEBUG_RLC) ) {
     data_offset = sizeof (struct rlc_um_data_req_alloc);
     data_size = ((struct rlc_um_tx_sdu_management *)(sdu_pP->data))->sdu_size;
-    message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %u\n", rlc_p->rb_id);
+    message_string_size += sprintf(&message_string[message_string_size], "Bearer      : %ld\n", rlc_p->rb_id);
     message_string_size += sprintf(&message_string[message_string_size], "SDU size    : %u\n", data_size);
     message_string_size += sprintf(&message_string[message_string_size], "\nPayload  : \n");
     message_string_size += sprintf(&message_string[message_string_size], "------+-------------------------------------------------|\n");
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
index fc6e449acf7b7e38dfd1d8dd229c24af58181e90..8000196b32d7ec033d0a9af9099320e8d9db2b79 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h
@@ -50,13 +50,13 @@
 #        include "rlc_um_segment.h"
 #        include "rlc_um_test.h"
 
-#define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02u] %s()"
+#define PROTOCOL_RLC_UM_CTXT_FMT PROTOCOL_CTXT_FMT"[%s %02ld] %s()"
 #define PROTOCOL_RLC_UM_CTXT_ARGS(CTXT_Pp, rLC_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp),\
           (rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\
           rLC_Pp->rb_id,\
           __FUNCTION__
 
-#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %" PRIx16 " %s %02u]"
+#define PROTOCOL_RLC_UM_MSC_FMT "[RNTI %" PRIx16 " %s %02ld]"
 #define PROTOCOL_RLC_UM_MSC_ARGS(CTXT_Pp, rLC_Pp) \
         CTXT_Pp->rnti,\
           (rLC_Pp->is_data_plane) ? "DRB UM" : "SRB UM",\
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
index 77194f3a9e219712ae274c98e6d35383ff60f747..940740943e06b4da2125a9f88cd257f3e523ebf3 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c
@@ -50,7 +50,7 @@ void config_req_rlc_um (
 
   if (h_rc == HASH_TABLE_OK) {
     rlc_p = &rlc_union_p->rlc.um;
-    LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d RB %u\n",
+    LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" CONFIG_REQ timer_reordering=%d sn_field_length=%d is_mXch=%d RB %ld\n",
           PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
           config_um_pP->timer_reordering,
           config_um_pP->sn_field_length,
@@ -69,7 +69,7 @@ void config_req_rlc_um (
         config_um_pP->is_mXch);
     }
   } else {
-    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"  CONFIG_REQ RB %u  RLC UM NOT FOUND\n",
+    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT"  CONFIG_REQ RB %ld  RLC UM NOT FOUND\n",
           PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
           rb_idP);
   }
@@ -143,14 +143,14 @@ void config_req_rlc_um_asn1 (
   //             rb_idP,
   //             srb_flagP);
   if(h_rc != HASH_TABLE_OK) {
-    LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %u, srb flag %u\n",
+    LOG_E(RLC, "RLC NOT FOUND enb id %u ue id %i enb flag %u rb id %ld, srb flag %u\n",
           ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
     return;
   }
 
   rlc_p = &rlc_union_p->rlc.um;
   //-----------------------------------------------------------------------------
-  LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"  CONFIG_REQ timer_reordering=%dms sn_field_length=   RB %u \n",
+  LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT"  CONFIG_REQ timer_reordering=%dms sn_field_length=   RB %ld \n",
         PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
         (dl_rlc_pP && dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1,
         rb_idP);
@@ -170,7 +170,7 @@ void config_req_rlc_um_asn1 (
           break;
 
         default:
-          LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID UL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
+          LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID UL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
                 PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
                 rlc_p->rb_id,
                 ul_rlc_pP->sn_FieldLength);
@@ -198,7 +198,7 @@ void config_req_rlc_um_asn1 (
           break;
 
         default:
-          LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID DL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
+          LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID DL sn_FieldLength %ld, RLC NOT CONFIGURED\n",
                 PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
                 rlc_p->rb_id,
                 dl_rlc_pP->sn_FieldLength);
@@ -217,7 +217,7 @@ void config_req_rlc_um_asn1 (
       if (dl_rlc_pP->t_Reordering<32) {
         t_Reordering = t_Reordering_tab[dl_rlc_pP->t_Reordering];
       } else {
-        LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID T_Reordering %ld, RLC NOT CONFIGURED\n",
+        LOG_E(RLC,PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID T_Reordering %ld, RLC NOT CONFIGURED\n",
               PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_p),
               rlc_p->rb_id,
               dl_rlc_pP->t_Reordering);
@@ -382,7 +382,7 @@ void rlc_um_configure(
     rlc_pP->rx_um_window_size             = RLC_UM_WINDOW_SIZE_SN_5_BITS;
     rlc_pP->rx_header_min_length_in_bytes = 1;
   } else if (rx_sn_field_lengthP != 0) {
-    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
+    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
           PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
           rlc_pP->rb_id,
           rx_sn_field_lengthP);
@@ -400,7 +400,7 @@ void rlc_um_configure(
     rlc_pP->tx_um_window_size             = RLC_UM_WINDOW_SIZE_SN_5_BITS;
     rlc_pP->tx_header_min_length_in_bytes = 1;
   } else if (tx_sn_field_lengthP != 0) {
-    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %u INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
+    LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [CONFIGURE] RB %ld INVALID RX SN LENGTH %d BITS NOT IMPLEMENTED YET, RLC NOT CONFIGURED\n",
           PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
           rlc_pP->rb_id,
           tx_sn_field_lengthP);
@@ -428,7 +428,7 @@ void rlc_um_set_debug_infos(
   const srb_flag_t        srb_flagP,
   const rb_id_t           rb_idP,
   const logical_chan_id_t chan_idP) {
-  LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [SET DEBUG INFOS] rb_id %d srb_flag %d\n",
+  LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [SET DEBUG INFOS] rb_id %ld srb_flag %d\n",
         PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP),
         rb_idP,
         srb_flagP);
diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
index b6ab367bc1a112318c0c68073bf1a6a47b4586b2..90e006cd1782bdacc9b78d8213fbf1fa16ea78dd 100644
--- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
+++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_receiver.c
@@ -50,7 +50,7 @@ rlc_um_display_rx_window(
   LOG_T(RLC, "\n");
   sprintf(time_out_str, "%010d", rlc_pP->t_reordering.ms_duration);
   time_out_str[10] = 0;
-  LOG_T(RLC, "| RLC UM RB %02d    VR(UR)=%03d    VR(UX)=%03d    VR(UH)=%03d    t-Reordering: %s %s %s             |",
+  LOG_T(RLC, "| RLC UM RB %02ld    VR(UR)=%03d    VR(UX)=%03d    VR(UH)=%03d    t-Reordering: %s %s %s             |",
         rlc_pP->rb_id, rlc_pP->vr_ur, rlc_pP->vr_ux, rlc_pP->vr_uh,
         (rlc_pP->t_reordering.running)?" ON":"OFF",
         (rlc_pP->t_reordering.running)?"Time-out frameP:":"               ",
diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c
index bf51faef750645d332b3a97b12a3bcc84435abb1..2fb844f05a8b5d567cc559896e19a71643a1fe56 100644
--- a/openair2/LAYER2/RLC/rlc.c
+++ b/openair2/LAYER2/RLC/rlc.c
@@ -137,7 +137,7 @@ rlc_op_status_t rlc_stat_req     (
 
   //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
   if(rb_idP >= NB_RB_MAX) {
-    LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+    LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
     return RLC_OP_STATUS_BAD_PARAMETER;
   }
 
@@ -332,7 +332,7 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
   rlc_mbms_id_t         *mbms_id_p  = NULL;
   logical_chan_id_t      log_ch_id  = 0;
 #ifdef DEBUG_RLC_DATA_REQ
-  LOG_D(RLC,PROTOCOL_CTXT_FMT"rlc_data_req:  rb_id %u (MAX %d), muip %d, confirmP %d, sdu_sizeP %d, sdu_pP %p\n",
+  LOG_D(RLC,PROTOCOL_CTXT_FMT"rlc_data_req:  rb_id %ld (MAX %d), muip %d, confirmP %d, sdu_sizeP %d, sdu_pP %p\n",
         PROTOCOL_CTXT_ARGS(ctxt_pP),
         rb_idP,
         NB_RAB_MAX,
@@ -351,13 +351,13 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
   if (MBMS_flagP) {
     //AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
     if(rb_idP >= NB_RB_MBMS_MAX) {
-      LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
+      LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MBMS_MAX);
       return RLC_OP_STATUS_BAD_PARAMETER;
     }
   } else {
     //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
     if(rb_idP >= NB_RB_MAX) {
-      LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+      LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
       return RLC_OP_STATUS_BAD_PARAMETER;
     }
   }
@@ -387,14 +387,14 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
 
     key = RLC_COLL_KEY_MBMS_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, mbms_id_p->service_id, mbms_id_p->session_id);
   } else if (sourceL2Id && destinationL2Id) {
-    LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
+    LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%ld, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
            srb_flagP);
     key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
     //Thinh's line originally uncommented
     //key = RLC_COLL_KEY_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
     //key_lcid = RLC_COLL_KEY_LCID_SOURCE_DEST_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, *sourceL2Id, *destinationL2Id, srb_flagP);
   } else {
-    LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%d, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
+    LOG_D (RLC, "RLC_COLL_KEY_VALUE: ctxt_pP->module_id: %d, ctxt_pP->rnti: %d, ctxt_pP->enb_flag: %d, rb_idP:%ld, srb_flagP: %d \n \n", ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP,
            srb_flagP);
     key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP);
   }
@@ -411,7 +411,7 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
   }
 
   if (MBMS_flagP == 0) {
-    LOG_D(RLC, PROTOCOL_CTXT_FMT"[RB %u] Display of rlc_data_req:\n",
+    LOG_D(RLC, PROTOCOL_CTXT_FMT"[RB %ld] Display of rlc_data_req:\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           rb_idP);
 #if defined(TRACE_RLC_PAYLOAD)
@@ -424,7 +424,7 @@ rlc_op_status_t rlc_data_req     (const protocol_ctxt_t *const ctxt_pP,
     switch (rlc_mode) {
       case RLC_MODE_NONE:
         free_mem_block(sdu_pP, __func__);
-        LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %u\n",
+        LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %ld\n",
               PROTOCOL_CTXT_ARGS(ctxt_pP),
               rb_idP);
         VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
@@ -558,7 +558,7 @@ void rlc_data_ind     (
   const sdu_size_t  sdu_sizeP,
   mem_block_t      *sdu_pP) {
   //-----------------------------------------------------------------------------
-  LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] Display of rlc_data_ind: size %u\n",
+  LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld] Display of rlc_data_ind: size %u\n",
         PROTOCOL_CTXT_ARGS(ctxt_pP),
         (srb_flagP) ? "SRB" : "DRB",
         rb_idP,
diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h
index ca3aaf1d9054a6f92cd4621f0dbf0962d6f09fdc..dfdf527123536d125e2c64420ab796f0e78a6cf7 100644
--- a/openair2/LAYER2/RLC/rlc.h
+++ b/openair2/LAYER2/RLC/rlc.h
@@ -197,7 +197,7 @@ rlc_mbms_id_t        rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_
 #define rlc_mbms_ue_get_lcid_by_rb_id(uE_mOD,rB_iD) rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD]
 
 #define rlc_mbms_ue_set_lcid_by_rb_id(uE_mOD,rB_iD,lOG_cH_iD) do { \
-    AssertFatal(rB_iD<NB_RB_MBMS_MAX, "INVALID RB ID %u", rB_iD); \
+    AssertFatal(rB_iD<NB_RB_MBMS_MAX, "INVALID RB ID %ld", rB_iD); \
     rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \
   } while (0);
 
diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c
index 4c04b9f66208ef5ca353c03ed2ce3a2f2ff84308..49f7420216c1dde675249d62118d80e78c4532ac 100644
--- a/openair2/LAYER2/RLC/rlc_rrc.c
+++ b/openair2/LAYER2/RLC/rlc_rrc.c
@@ -81,7 +81,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
     for (cnt=0; cnt<srb2add_listP->list.count; cnt++) {
       rb_id = srb2add_listP->list.array[cnt]->srb_Identity;
       lc_id = rb_id;
-      LOG_D(RLC, "Adding SRB %ld, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id);
+      LOG_D(RLC, "Adding SRB %ld, rb_id %ld\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id);
       srb_toaddmod_p = srb2add_listP->list.array[cnt];
 
       if (srb_toaddmod_p->rlc_Config) {
@@ -102,7 +102,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                     &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
                     rb_id, lc_id);
                 } else {
-                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                         PROTOCOL_CTXT_ARGS(ctxt_pP),
                         rb_id);
                 }
@@ -122,7 +122,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                     rb_id, lc_id,0, 0
                   );
                 } else {
-                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                         PROTOCOL_CTXT_ARGS(ctxt_pP),
                         rb_id);
                 }
@@ -142,7 +142,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                     rb_id, lc_id,0, 0
                   );
                 } else {
-                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                         PROTOCOL_CTXT_ARGS(ctxt_pP),
                         rb_id);
                 }
@@ -162,7 +162,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                     rb_id, lc_id,0, 0
                   );
                 } else {
-                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+                  LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                         PROTOCOL_CTXT_ARGS(ctxt_pP),
                         rb_id);
                 }
@@ -196,7 +196,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                 &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am,
                 rb_id,lc_id);
             } else {
-              LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+              LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                     PROTOCOL_CTXT_ARGS(ctxt_pP),
                     rb_id);
             }
@@ -213,7 +213,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
                           NULL, // TO DO DEFAULT CONFIG
                           rb_id, lc_id);
                       } else {
-                        LOG_D(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n",
+                        LOG_D(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %ld \n",
                               PROTOCOL_CTXT_ARGS(ctxt_pP),
                               rb_id);
                       }
@@ -379,7 +379,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t    *const ctxt_pP
           }
         }
 
-        LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n",
+        LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG REQ MBMS ASN1 LC ID %u RB ID %ld SESSION ID %u SERVICE ID %u\n",
               PROTOCOL_CTXT_ARGS(ctxt_pP),
               lc_id,
               rb_id,
@@ -502,7 +502,7 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
 
   //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
   if(rb_idP >= NB_RB_MAX) {
-    LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+    LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
     return RLC_OP_STATUS_BAD_PARAMETER;
   }
 
@@ -524,7 +524,7 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
         break;
 
       default:
-        LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] RLC mode is unknown!\n",
+        LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] RLC mode is unknown!\n",
               PROTOCOL_CTXT_ARGS(ctxt_pP),
               (srb_flagP) ? "SRB" : "DRB",
               rb_idP);
@@ -539,20 +539,20 @@ rlc_op_status_t rrc_rlc_remove_rlc   (
   if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) {
     h_lcid_rc = hashtable_remove(rlc_coll_p, key_lcid);
     h_rc = hashtable_remove(rlc_coll_p, key);
-    LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASED %s\n",
+    LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASED %s\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           (srb_flagP) ? "SRB" : "DRB",
           rb_idP, lcid,
           (srb_flagP) ? "SRB" : "DRB");
   } else if ((h_rc == HASH_TABLE_KEY_NOT_EXISTS) || (h_lcid_rc == HASH_TABLE_KEY_NOT_EXISTS)) {
-    LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASE : RLC NOT FOUND %s, by RB-ID=%d, by LC-ID=%d\n",
+    LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASE : RLC NOT FOUND %s, by RB-ID=%d, by LC-ID=%d\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           (srb_flagP) ? "SRB" : "DRB",
           rb_idP, lcid,
           (srb_flagP) ? "SRB" : "DRB",
           h_rc, h_lcid_rc);
   } else {
-    LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASE : INTERNAL ERROR %s\n",
+    LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld LCID %d] RELEASE : INTERNAL ERROR %s\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           (srb_flagP) ? "SRB" : "DRB",
           rb_idP, lcid,
@@ -585,7 +585,7 @@ rlc_union_t *rrc_rlc_add_rlc   (
     //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
     //AssertFatal (chan_idP < RLC_MAX_LC, "LC id is too high (%u/%d)!\n", chan_idP, RLC_MAX_LC);
     if(rb_idP >= NB_RB_MAX) {
-      LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+      LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
       return NULL;
     }
 
@@ -624,7 +624,7 @@ rlc_union_t *rrc_rlc_add_rlc   (
   h_rc = hashtable_get(rlc_coll_p, key, (void **)&rlc_union_p);
 
   if (h_rc == HASH_TABLE_OK) {
-    LOG_W(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc , already exist %s\n",
+    LOG_W(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc , already exist %s\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           (srb_flagP) ? "SRB" : "DRB",
           rb_idP,
@@ -649,7 +649,7 @@ rlc_union_t *rrc_rlc_add_rlc   (
               mbms_id_p->service_id,
               mbms_id_p->session_id);
       } else {
-        LOG_I(RLC, PROTOCOL_CTXT_FMT" [%s %u] rrc_rlc_add_rlc  %s\n",
+        LOG_I(RLC, PROTOCOL_CTXT_FMT" [%s %ld] rrc_rlc_add_rlc  %s\n",
               PROTOCOL_CTXT_ARGS(ctxt_pP),
               (srb_flagP) ? "SRB" : "DRB",
               rb_idP,
@@ -659,7 +659,7 @@ rlc_union_t *rrc_rlc_add_rlc   (
       rlc_union_p->mode = rlc_modeP;
       return rlc_union_p;
     } else {
-      LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc FAILED %s (add by RB_id=%d; add by LC_id=%d)\n",
+      LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc FAILED %s (add by RB_id=%d; add by LC_id=%d)\n",
             PROTOCOL_CTXT_ARGS(ctxt_pP),
             (srb_flagP) ? "SRB" : "DRB",
             rb_idP,
@@ -670,7 +670,7 @@ rlc_union_t *rrc_rlc_add_rlc   (
       return NULL;
     }
   } else {
-    LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc , INTERNAL ERROR %s\n",
+    LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %ld] rrc_rlc_add_rlc , INTERNAL ERROR %s\n",
           PROTOCOL_CTXT_ARGS(ctxt_pP),
           (srb_flagP) ? "SRB" : "DRB",
           rb_idP,
@@ -689,13 +689,13 @@ rlc_op_status_t rrc_rlc_config_req   (
   const rlc_info_t      rlc_infoP) {
   //-----------------------------------------------------------------------------
   //rlc_op_status_t status;
-  LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG_REQ for RAB %u\n",
+  LOG_D(RLC, PROTOCOL_CTXT_FMT" CONFIG_REQ for RAB %ld\n",
         PROTOCOL_CTXT_ARGS(ctxt_pP),
         rb_idP);
 
   //AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
   if(rb_idP >= NB_RB_MAX) {
-    LOG_E(RLC, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX);
+    LOG_E(RLC, "RB id is too high (%ld/%d)!\n", rb_idP, NB_RB_MAX);
     return RLC_OP_STATUS_BAD_PARAMETER;
   }
 
@@ -709,7 +709,7 @@ rlc_op_status_t rrc_rlc_config_req   (
     case CONFIG_ACTION_MODIFY:
       switch (rlc_infoP.rlc_mode) {
         case RLC_MODE_AM:
-          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %u] MODIFY RB AM\n",
+          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB AM\n",
                 PROTOCOL_CTXT_ARGS(ctxt_pP),
                 rb_idP);
           config_req_rlc_am(
@@ -720,7 +720,7 @@ rlc_op_status_t rrc_rlc_config_req   (
           break;
 
         case RLC_MODE_UM:
-          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %u] MODIFY RB UM\n",
+          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB UM\n",
                 PROTOCOL_CTXT_ARGS(ctxt_pP),
                 rb_idP);
           config_req_rlc_um(
@@ -731,7 +731,7 @@ rlc_op_status_t rrc_rlc_config_req   (
           break;
 
         case RLC_MODE_TM:
-          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %u] MODIFY RB TM\n",
+          LOG_I(RLC, PROTOCOL_CTXT_FMT"[RB %ld] MODIFY RB TM\n",
                 PROTOCOL_CTXT_ARGS(ctxt_pP),
                 rb_idP);
           config_req_rlc_tm(
diff --git a/openair2/NETWORK_DRIVER/MESH/common.c b/openair2/NETWORK_DRIVER/MESH/common.c
index 493236cb30ab790de117d89519633ce052abaa4d..c5b46440dcf2f24e442a45ef4c4cd767db98d6db 100644
--- a/openair2/NETWORK_DRIVER/MESH/common.c
+++ b/openair2/NETWORK_DRIVER/MESH/common.c
@@ -407,7 +407,7 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
 
   if (bytes_wrote != NAS_PDCPH_SIZE) {
     printk("NAS_COMMON_QOS_SEND: problem while writing PDCP's header (bytes wrote = %d )\n",bytes_wrote);
-    printk("rb_id %d, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
+    printk("rb_id %ld, Wrote %d, Header Size %lu\n", pdcph.rb_id , bytes_wrote, NAS_PDCPH_SIZE);
 #ifndef PDCP_USE_NETLINK
     rtf_reset(NAS2PDCP_FIFO);
 #endif //PDCP_USE_NETLINK
@@ -421,7 +421,7 @@ void nas_COMMON_QOS_send(struct sk_buff *skb, struct cx_entity *cx, struct class
 #endif //PDCP_USE_NETLINK
 
   if (bytes_wrote != skb->len+NAS_PDCPH_SIZE) {
-    printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %d: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
+    printk("NAS_COMMON_QOS_SEND: Inst %d, RB_ID %ld: problem while writing PDCP's data, bytes_wrote = %d, Data_len %d, PDCPH_SIZE %lu\n",
            inst,
            pdcph.rb_id,
            bytes_wrote,
diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c
index ac855a46e643ae49df4ed9842eb698882f0f5f9e..54dba6862883011e13e702d380e56bc01c202477 100644
--- a/openair2/RRC/LTE/L2_interface.c
+++ b/openair2/RRC/LTE/L2_interface.c
@@ -68,7 +68,7 @@ mac_rrc_data_req(
   uint8_t sfn                     = (uint8_t)((frameP>>2)&0xff);
 
   if (LOG_DEBUGFLAG(DEBUG_RRC)) {
-    LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
+    LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
   }
 
   eNB_RRC_INST *rrc;
@@ -167,7 +167,7 @@ mac_rrc_data_req(
     if (ue_context_p == NULL) return(0);
 
     eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
-    LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti);
+    LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %ld, rnti %x)\n",Mod_idP,frameP, Srb_id,rnti);
     Srb_info=&ue_p->Srb0;
 
     // check if data is there for MAC
@@ -182,7 +182,7 @@ mac_rrc_data_req(
   }
 
   if( (Srb_id & RAB_OFFSET ) == PCCH) {
-    LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
+    LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %ld)\n",Mod_idP,frameP, Srb_id);
 
     // check if data is there for MAC
     if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
@@ -254,7 +254,7 @@ mac_rrc_data_ind(
 //--------------------------------------------------------------------------
 {
   if (NODE_IS_DU(RC.rrc[module_idP]->node_type)) {
-    LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %d length %d for UE id %d RNTI %x \n",
+    LOG_W(RRC,"[DU %d][RAPROC] Received SDU for CCCH on SRB %ld length %d for UE id %d RNTI %x \n",
           module_idP, srb_idP, sdu_lenP, UE_id, rntiP);
     /* do ITTI message */
     DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(
@@ -279,7 +279,7 @@ mac_rrc_data_ind(
   PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
 
   if((srb_idP & RAB_OFFSET) == CCCH) {
-    LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %d\n", module_idP, srb_idP);
+    LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
     ctxt.brOption = brOption;
 
     /*Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
diff --git a/openair2/RRC/LTE/L2_interface_common.c b/openair2/RRC/LTE/L2_interface_common.c
index b5cc99bc3a78fa1fba0dfbb1d40ab9d15545f66c..20df462938f960f3f436d28c51bd97c8708c9e45 100644
--- a/openair2/RRC/LTE/L2_interface_common.c
+++ b/openair2/RRC/LTE/L2_interface_common.c
@@ -123,10 +123,10 @@ rrc_data_ind(
   rb_id_t    DCCH_index = Srb_id;
 
   if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
-    LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
+    LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
           ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP,  ctxt_pP->eNB_index);
   } else {
-    LOG_D(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %x\n",
+    LOG_D(RRC, "[eNB %d] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from UE %x\n",
           ctxt_pP->module_id,
           ctxt_pP->frame,
           DCCH_index,
diff --git a/openair2/RRC/LTE/L2_interface_ue.c b/openair2/RRC/LTE/L2_interface_ue.c
index a8a0086a4d832b795f9a5e3c2ddf9f19ea9d28d3..c9d4e61d0ae7a19ff251dd8903c67cf3fb1d9e69 100644
--- a/openair2/RRC/LTE/L2_interface_ue.c
+++ b/openair2/RRC/LTE/L2_interface_ue.c
@@ -59,8 +59,8 @@ mac_rrc_data_req_ue(
 )
 //--------------------------------------------------------------------------
 {
-  LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
-  LOG_D(RRC,"[UE %d] Frame %d Filling SL DISCOVERY SRB_ID %d\n",Mod_idP,frameP,Srb_id);
+  LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
+  LOG_D(RRC,"[UE %d] Frame %d Filling SL DISCOVERY SRB_ID %ld\n",Mod_idP,frameP,Srb_id);
   LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].SL_Discovery[eNB_index].Tx_buffer.payload_size);
 
   //TTN (for D2D)
@@ -72,7 +72,7 @@ mac_rrc_data_req_ue(
     return(Ret_size);
   }
 
-  LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
+  LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %ld\n",Mod_idP,frameP,Srb_id);
   LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
 
   if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
@@ -137,7 +137,7 @@ mac_rrc_data_ind_ue(
   PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, 0, rntiP, frameP, sub_frameP,eNB_indexP);
 
   if(srb_idP == BCCH_SI_MBMS) {
-    LOG_D(RRC,"[UE %d] Received SDU for BCCH on MBMS SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
+    LOG_D(RRC,"[UE %d] Received SDU for BCCH on MBMS SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
 #if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
@@ -167,7 +167,7 @@ mac_rrc_data_ind_ue(
   }
 
   if(srb_idP == BCCH) {
-    LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
+    LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
 #if defined(ENABLE_ITTI)
     {
       MessageDef *message_p;
@@ -197,13 +197,13 @@ mac_rrc_data_ind_ue(
   }
 
   if(srb_idP == PCCH) {
-    LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
+    LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
     decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP);
   }
 
   if((srb_idP & RAB_OFFSET) == CCCH) {
     if (sdu_lenP>0) {
-      LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
+      LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %ld from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
 #if defined(ENABLE_ITTI)
       {
         MessageDef *message_p;
@@ -237,7 +237,7 @@ mac_rrc_data_ind_ue(
   }
 
   if ((srb_idP & RAB_OFFSET) == MCCH) {
-    LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
+    LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %ld from eNB %d\n",
           module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
 #if defined(ENABLE_ITTI)
     {
@@ -266,7 +266,7 @@ mac_rrc_data_ind_ue(
 
   //TTN (for D2D)
   if(srb_idP == SL_DISCOVERY) {
-    LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
+    LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %ld from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
     decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP);
   }
 
@@ -350,7 +350,7 @@ rrc_data_ind_ue(
 //------------------------------------------------------------------------------
 {
   rb_id_t    DCCH_index = Srb_id;
-  LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
+  LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
         ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP,  ctxt_pP->eNB_index);
 #if defined(ENABLE_ITTI)
   {
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index 17cef8112e79b34605954c5c80d4fd3cb9b074d8..66c4401e57c66238b25bd2214f4c2899312c9e4f 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -1307,7 +1307,7 @@ rrc_ue_process_radioResourceConfigDedicated(
       // configure the first DRB ID as the default DRB ID
       UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t));
       *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity;
-      LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
+      LOG_I(RRC,"[UE %d] default DRB = %ld\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB);
     }
 
     uint8_t *kUPenc = NULL;
@@ -1889,7 +1889,7 @@ rrc_ue_decode_dcch(
   MessageDef *msg_p;
 
   if (Srb_id != 1) {
-    LOG_E(RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%d), should not have ...\n",
+    LOG_E(RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB%ld), should not have ...\n",
           ctxt_pP->module_id, ctxt_pP->frame, Srb_id);
     return;
   }
diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c
index 3751f2ddfb3a3d0ec3fd4c866c010d454e50f162..dbeaa9f6a548c2d329e5fbd4a9ece1c9f90c61c8 100644
--- a/openair2/RRC/LTE/rrc_eNB.c
+++ b/openair2/RRC/LTE/rrc_eNB.c
@@ -4774,7 +4774,7 @@ check_handovers(
                 GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).frame,
                 0,
                 GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).eNB_index);
-              LOG_D(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
+              LOG_D(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n",
                     PROTOCOL_CTXT_ARGS(&ctxt),
                     ITTI_MSG_NAME (msg_p),
                     ITTI_MSG_ORIGIN_NAME(msg_p),
@@ -4783,7 +4783,7 @@ check_handovers(
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip,
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp,
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).mode);
-              LOG_I(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %d \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
+              LOG_I(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %ld \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
               result = pdcp_data_req (&ctxt,
                                       SRB_FLAG_NO,
                                       GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id,
@@ -4842,7 +4842,7 @@ check_handovers(
                 GTPV1U_ENB_END_MARKER_IND (msg_p).frame,
                 0,
                 GTPV1U_ENB_END_MARKER_IND (msg_p).eNB_index);
-              LOG_I(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %d, muiP %d, confirmP %d, mode %d\n",
+              LOG_I(RRC, PROTOCOL_CTXT_FMT"[check_handovers]Received %s from %s: instance %d, rb_id %ld, muiP %d, confirmP %d, mode %d\n",
                     PROTOCOL_CTXT_ARGS(&ctxt),
                     ITTI_MSG_NAME (msg_p),
                     ITTI_MSG_ORIGIN_NAME(msg_p),
@@ -4851,7 +4851,7 @@ check_handovers(
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).muip,
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).confirmp,
                     GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).mode);
-              LOG_D(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %d \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
+              LOG_D(RRC, "Before calling pdcp_data_req from check_handovers! GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id: %ld \n", GTPV1U_ENB_DATA_FORWARDING_IND (msg_p).rb_id);
               result = pdcp_data_req (&ctxt,
                                       SRB_FLAG_NO,
                                       GTPV1U_ENB_END_MARKER_IND (msg_p).rb_id,
@@ -7144,11 +7144,11 @@ rrc_eNB_decode_dcch(
     T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
 
   if ((Srb_id != 1) && (Srb_id != 2)) {
-    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n",
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%ld, should not have ...\n",
           PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
           Srb_id);
   } else {
-    LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d\n",
+    LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%ld\n",
           PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
           Srb_id);
   }
diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
index d873a825ba9ee2661c5c88ec4dab6c876a4955cf..749dff3acedf0832f1a737e5382ad66dcdba601a 100644
--- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
+++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c
@@ -112,7 +112,7 @@ gtpv_data_req(
     LOG_I(GTPU,"gtpv_data_req sdu_sizeP == 0");
     return FALSE;
   }
-  LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %d", ctxt_pP->rnti, sdu_sizeP, rb_idP);
+  LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP);
 #if defined(ENABLE_ITTI)
   {
     MessageDef *message_p;
diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c
index 00282c5dfa8f58531597a3c060448eba8a26398c..86cff69517f31df92d4fd9c65496cdf30c27f5f9 100644
--- a/openair2/RRC/NR/L2_nr_interface.c
+++ b/openair2/RRC/NR/L2_nr_interface.c
@@ -58,7 +58,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP,
   uint8_t sfn_msb                     = (uint8_t)((frameP>>4)&0x3f);
   
 #ifdef DEBUG_RRC
-  LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
+  LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id);
 #endif
 
   gNB_RRC_INST *rrc;
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c
index 78f0529512f0c2f59bc87b8fc1d5c114ede3a073..d9829a46dc48d03cf184c856004dfa85c95316f8 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.c
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c
@@ -519,8 +519,6 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
     bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf                            = MALLOC(2);
     bwp_dl_searchspace->nrofCandidates                                              = CALLOC(1,sizeof(struct NR_SearchSpace__nrofCandidates));
     bwp_dl_searchspace->searchSpaceType                                             = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType));
-    bwp_dl_searchspace->searchSpaceType->choice.common                              = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__common));
-    bwp_dl_searchspace->searchSpaceType->choice.ue_Specific                         = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__ue_Specific));
     bwp_dl_timedomainresourceallocation->k0 = CALLOC(1,sizeof(long));
     pusch_configcommontimedomainresourceallocation      = CALLOC(1,sizeof(NR_PUSCH_TimeDomainResourceAllocation_t));
     pusch_configcommontimedomainresourceallocation->k2  = CALLOC(1,sizeof(long));
@@ -647,6 +645,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
   bwp_dl_searchspace->searchSpaceType->present = configuration->SearchSpace_searchSpaceType[CC_id];
 
   if(bwp_dl_searchspace->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common) {
+    bwp_dl_searchspace->searchSpaceType->choice.common                              = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__common));
     bwp_dl_searchspace->searchSpaceType->choice.common->dci_Format2_0                                           = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__common__dci_Format2_0));
     bwp_dl_searchspace->searchSpaceType->choice.common->dci_Format2_0->nrofCandidates_SFI.aggregationLevel1     = CALLOC(1,sizeof(long));
     bwp_dl_searchspace->searchSpaceType->choice.common->dci_Format2_0->nrofCandidates_SFI.aggregationLevel2     = CALLOC(1,sizeof(long));
@@ -663,6 +662,7 @@ void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
     *(bwp_dl_searchspace->searchSpaceType->choice.common->dci_Format2_3->dummy1)                                = configuration->Common_dci_Format2_3_monitoringPeriodicity[CC_id];
     bwp_dl_searchspace->searchSpaceType->choice.common->dci_Format2_3->dummy2                                   = configuration->Common_dci_Format2_3_nrofPDCCH_Candidates[CC_id];
   } else if (bwp_dl_searchspace->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
+    bwp_dl_searchspace->searchSpaceType->choice.ue_Specific                         = CALLOC(1,sizeof(struct NR_SearchSpace__searchSpaceType__ue_Specific));
     bwp_dl_searchspace->searchSpaceType->choice.ue_Specific->dci_Formats = configuration->ue_Specific__dci_Formats[CC_id];
   }
 
diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h
index 10935ddf89f200ce6c7cec42e333f4bb1baac12d..c3154b708eda2581fff0093af7f7c13a70a52e7a 100644
--- a/openair2/RRC/NR/MESSAGES/asn1_msg.h
+++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h
@@ -74,7 +74,7 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
 /**
 \brief Generate configuration for SIB1 (gNB).
 @param carrier pointer to Carrier information
-@param configuration Pointer Configuration Request structure
+@param configuration Pointer Configuration Request structure  
 @return size of encoded bit stream in bytes*/
 uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
 #if defined(ENABLE_ITTI)
diff --git a/openair2/UTIL/FIFO/pad_list.c b/openair2/UTIL/FIFO/pad_list.c
index e15041118d0f182492d34f596c829c988c0dd371..124893a756c5c9533378f34af8e56a64235209d4 100644
--- a/openair2/UTIL/FIFO/pad_list.c
+++ b/openair2/UTIL/FIFO/pad_list.c
@@ -591,7 +591,7 @@ void pkt_list_display (Packet_OTG_List_t *listP) {
 
     if (cursor) {
       while (cursor != NULL) {
-        printf ("Pkt (DST %d, RB %d)\n", (cursor->otg_pkt).dst_id, (cursor->otg_pkt).rb_id);
+        printf ("Pkt (DST %d, RB %ld)\n", (cursor->otg_pkt).dst_id, (cursor->otg_pkt).rb_id);
         //msg ("From (%d,%d) To (%d,%d)\n", (cursor->job).node1, (cursor->job).master1, (cursor->job).node2, (cursor->job).master2);
         cursor = cursor->next;
         nb_elements++;
diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h
index 4d8ed4e89bc9e881ca0a6a346a3f2d97f36e0b61..f40566f6ed2d8051e5cfb8bae9220f1f531e2bec 100644
--- a/openair2/UTIL/MEM/mem_block.h
+++ b/openair2/UTIL/MEM/mem_block.h
@@ -180,8 +180,6 @@ typedef struct {
 
 } mem_pool;
 
-mem_pool  *memBlockVar;
-#define mem_block_var (*memBlockVar)
 
 #ifdef __cplusplus
 }
diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c
index 54c4153e46d753e1d1c27c95f7faa5dd5752e38a..f15f295548e9e4a474479f12501df1a99ad3ef75 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB.c
+++ b/openair3/GTPV1-U/gtpv1u_eNB.c
@@ -831,7 +831,7 @@ int gtpv1u_delete_x2u_tunnel(
       if (hash_rc == HASH_TABLE_OK) {
         for (erab_index = 0; erab_index < ue_context_p->ue_context.nb_x2u_e_rabs; erab_index++) {
           eps_bearer_id = ue_context_p->ue_context.enb_gtp_x2u_ebi[erab_index];
-          LOG_I(GTPU, "gtpv1u_delete_x2u_tunnel user rnti %x teNB X2U teid %u eps bearer id %u\n",
+          LOG_I(GTPU, "gtpv1u_delete_x2u_tunnel user rnti %x teNB X2U teid %u eps bearer id %ld\n",
                 req_pP->rnti,
                 gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_teNB,
                 ue_context_p->ue_context.enb_gtp_x2u_ebi[erab_index]);
diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c
index 76d0ad667478d89899063a7f9676156d9af7981d..cfaa7b8f5353f0adad589e875e3b44fced9c9d5b 100644
--- a/targets/ARCH/rfsimulator/simulator.c
+++ b/targets/ARCH/rfsimulator/simulator.c
@@ -276,7 +276,7 @@ sin_addr:
   };
   bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr));
   AssertFatal(listen(t->listen_sock, 5) == 0, "");
-  struct epoll_event ev;
+  struct epoll_event ev={0};
   ev.events = EPOLLIN;
   ev.data.fd = t->listen_sock;
   AssertFatal(epoll_ctl(t->epollfd, EPOLL_CTL_ADD,  t->listen_sock, &ev) != -1, "");
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
index 044c044fd68d41c7e8f2fac60b1fb194d8f7e187..b98adf5a95eebd1b02476d7bebac3f977c7991e0 100644
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf
@@ -285,9 +285,9 @@ NETWORK_CONTROLLER :
        global_log_verbosity                  ="medium";
        hw_log_level                          ="info";
        hw_log_verbosity                      ="medium";
-       phy_log_level                         ="debug";
+       phy_log_level                         ="info";
        phy_log_verbosity                     ="medium";
-       mac_log_level                         ="debug";
+       mac_log_level                         ="info";
        mac_log_verbosity                     ="high";
        rlc_log_level                         ="info";
        rlc_log_verbosity                     ="medium";