From 99c6c9227ea39a21f993e5a82fef90f3fc0ca018 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Fri, 12 Apr 2019 13:27:20 +0200
Subject: [PATCH] cleanup after merge with develop-nr

---
 .../nfapi/public_inc/nfapi_interface.h        |  2 +-
 openair1/PHY/CODING/TESTBENCH/ldpctest.c      |  8 +--
 openair1/PHY/CODING/coding_defs.h             |  2 -
 openair1/PHY/CODING/crc_byte.c                |  2 +-
 .../PHY/CODING/nrPolar_tools/nr_polar_defs.h  |  2 +
 .../CODING/nrPolar_tools/nr_polar_encoder.c   |  1 +
 openair1/PHY/LTE_TRANSPORT/dlsch_coding.c     |  2 +-
 openair1/SCHED_NR_UE/phy_procedures_nr_ue.c   | 39 ++++++-------
 .../SCHED_NR_UE/pucch_power_control_ue_nr.c   |  4 +-
 openair1/SCHED_NR_UE/pucch_uci_ue_nr.c        | 58 +++++++++++++++++--
 openair1/SIMULATION/NR_PHY/dlschsim.c         |  8 +--
 openair1/SIMULATION/NR_PHY/dlsim.c            | 35 +++++------
 openair2/GNB_APP/gnb_config.c                 |  2 +-
 openair2/LAYER2/NR_MAC_UE/mac.h               |  8 +--
 openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c  |  2 +-
 openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c    |  4 +-
 openair2/LAYER2/NR_MAC_gNB/mac_proto.h        | 22 -------
 openair2/RRC/NR/L2_nr_interface.c             |  1 +
 openair2/RRC/NR/rrc_gNB.c                     |  9 +--
 19 files changed, 115 insertions(+), 96 deletions(-)

diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
index fc3859be94b..51f66c30752 100644
--- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
+++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h
@@ -583,7 +583,7 @@ typedef struct {
 } nfapi_pnf_phy_rf_config_t;
 #define NFAPI_PNF_PHY_RF_TAG 0x1003
 
-// Generic structure for single tlv value.
+// Generic strucutre for single tlv value.
 typedef struct {
 	nfapi_tl_t tl;
 	uint16_t value;
diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
index d8ba9861752..6db9548dbea 100644
--- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c
+++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c
@@ -382,12 +382,12 @@ int test_ldpc(short No_iteration,
 
         //Uncoded BER
         if (channel_output_fixed[j][i]<0)
-        	channel_output_uncoded[j][i]=1;  //QPSK demod
-        else
-        	channel_output_uncoded[j][i]=0;
+            channel_output_uncoded[j][i]=1;  //QPSK demod
+	else
+            channel_output_uncoded[j][i]=0;
 
         if (channel_output_uncoded[j][i] != channel_input[j][i-2*Zc])
-        	*errors_bit_uncoded = (*errors_bit_uncoded) + 1;
+	  *errors_bit_uncoded = (*errors_bit_uncoded) + 1;
 
 	}
       } // End segments
diff --git a/openair1/PHY/CODING/coding_defs.h b/openair1/PHY/CODING/coding_defs.h
index 2277826a669..0c1dbfae359 100644
--- a/openair1/PHY/CODING/coding_defs.h
+++ b/openair1/PHY/CODING/coding_defs.h
@@ -30,8 +30,6 @@
 #include <stdint.h>
 #include <PHY/defs_common.h>
 
-typedef unsigned __int128 uint128_t;
-
 #define CRC24_A 0
 #define CRC24_B 1
 #define CRC16 2
diff --git a/openair1/PHY/CODING/crc_byte.c b/openair1/PHY/CODING/crc_byte.c
index bf8d63fb398..5e0ebeb991f 100644
--- a/openair1/PHY/CODING/crc_byte.c
+++ b/openair1/PHY/CODING/crc_byte.c
@@ -259,7 +259,7 @@ unsigned int crcPayload(unsigned char * inptr, int bitlen, uint32_t* crc256Table
 int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type)
 {
   uint32_t crc=0,oldcrc=0;
-  uint8_t crc_len;
+  uint8_t crc_len,temp;
 
   switch (crc_type) {
   case CRC24_A:
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
index f6c66e89dc2..7b63e5757c9 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h
@@ -59,6 +59,8 @@ static const uint8_t nr_polar_subblock_interleaver_pattern[32] = {0,1,2,4,3,5,6,
 #define Nmax 1024
 #define nmax 10
 
+#define uint128_t __uint128_t
+
 typedef struct decoder_node_t_s {
   struct decoder_node_t_s *left;
   struct decoder_node_t_s *right;
diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 245094e2386..b504812d0b0 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -37,6 +37,7 @@
 
 #include "PHY/CODING/nrPolar_tools/nr_polar_defs.h"
 #include "assertions.h"
+#include <stdint.h>"
 
 //input  [a_31 a_30 ... a_0]
 //output [f_31 f_30 ... f_0] [f_63 f_62 ... f_32] ...
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
index 12870016fa1..a7e4b33c16a 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c
@@ -703,7 +703,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
 
 
 int dlsch_encoding(PHY_VARS_eNB *eNB,
-				   unsigned char *a,
+		unsigned char *a,
                    uint8_t num_pdcch_symbols,
                    LTE_eNB_DLSCH_t *dlsch,
                    int frame,
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index 2a12b331043..c83074d8a25 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -2814,8 +2814,8 @@ void nr_ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *
   //uint8_t pbch_phase;
   int ret = 0;
   uint16_t frame_tx;
-  //static uint8_t first_run = 1;
-  //uint8_t pbch_trials = 0;
+  static uint8_t first_run = 1;
+  uint8_t pbch_trials = 0;
 
   DevAssert(ue);
 
@@ -2908,10 +2908,9 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb
 
 #ifdef NR_PDCCH_SCHED
 
-int nr_ue_pdcch_procedures(uint8_t eNB_id,
-						   PHY_VARS_NR_UE *ue,
-						   UE_nr_rxtx_proc_t *proc)
+int nr_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc)
 {
+
   //  unsigned int dci_cnt=0, i;  //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
 #ifdef NR_PDCCH_SCHED_DEBUG
   printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_ue_pdcch_procedures() \n");
@@ -2959,10 +2958,10 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
   #endif
 
   // p in TS 38.212 Subclause 10.1, for each active BWP the UE can deal with 3 different CORESETs (including coresetId 0 for common search space)
-  //int nb_coreset_total = NR_NBR_CORESET_ACT_BWP;
+  int nb_coreset_total = NR_NBR_CORESET_ACT_BWP;
   unsigned int dci_cnt=0;
   // this table contains 56 (NBR_NR_DCI_FIELDS) elements for each dci field and format described in TS 38.212. Each element represents the size in bits for each dci field
-  //uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS] = {{0}};
+  uint8_t dci_fields_sizes[NBR_NR_DCI_FIELDS][NBR_NR_FORMATS] = {{0}};
   // this is the UL bandwidth part. FIXME! To be defined where this value comes from
   //  uint16_t n_RB_ULBWP = 106;
   // this is the DL bandwidth part. FIXME! To be defined where this value comes from
@@ -2989,7 +2988,7 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
      * To be implemented LATER !!!
      */
     //int _offset,_index,_M;
-    //int searchSpace_id                              = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceId;
+    int searchSpace_id                              = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceId;
 
 
     #ifdef NR_PDCCH_SCHED_DEBUG
@@ -3002,16 +3001,16 @@ int nr_ue_pdcch_procedures(uint8_t eNB_id,
       // the searchSpace indicates that we need to monitor PDCCH in current nr_tti_rx
       // get the parameters describing the current SEARCHSPACE
       // the CORESET id applicable to the current SearchSpace
-      //int searchSpace_coreset_id                      = pdcch_vars2->searchSpace[nb_searchspace_active].controlResourceSetId;
+      int searchSpace_coreset_id                      = pdcch_vars2->searchSpace[nb_searchspace_active].controlResourceSetId;
       // FIXME this variable is a bit string (14 bits) identifying every OFDM symbol in a slot.
       // at the moment we will not take into consideration this variable and we will consider that the OFDM symbol offset is always the first OFDM in a symbol
       uint16_t symbol_within_slot_mon                 = pdcch_vars2->searchSpace[nb_searchspace_active].monitoringSymbolWithinSlot;
       // get the remaining parameters describing the current SEARCHSPACE:     // FIXME! To be defined where we get this information from
-      //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L1         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel1;
-      //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L2         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel2;
-      //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L4         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel4;
-      //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L8         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel8;
-      //NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L16        = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel16;
+      NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L1         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel1;
+      NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L2         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel2;
+      NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L4         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel4;
+      NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L8         = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel8;
+      NR_UE_SEARCHSPACE_nbrCAND_t num_cand_L16        = pdcch_vars2->searchSpace[nb_searchspace_active].nrofCandidates_aggrlevel16;
                                                                                                   // FIXME! A table of five enum elements
       // searchSpaceType indicates whether this is a common search space or a UE-specific search space
       //int searchSpaceType                             = pdcch_vars2->searchSpace[nb_searchspace_active].searchSpaceType.type;
@@ -3781,7 +3780,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
   int frame_rx = proc->frame_rx;
   int nr_tti_rx = proc->nr_tti_rx;
   int ret=0, ret1=0;
-  //int CC_id = ue->CC_id;
+  int CC_id = ue->CC_id;
   NR_UE_PDSCH *pdsch_vars;
   uint8_t is_cw0_active = 0;
   uint8_t is_cw1_active = 0;
@@ -4318,11 +4317,11 @@ void *UE_thread_slot1_dl_processing(void *arg) {
 
 
 
-int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
-						   UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,
-						   uint8_t do_pdcch_flag,
-						   runmode_t mode)
-{
+int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t eNB_id,
+			   uint8_t do_pdcch_flag,runmode_t mode) {
+
+
+
   int l,l2;
   int pilot1;
 
diff --git a/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c b/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
index f0005f25b19..debb0d4ed5e 100644
--- a/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
+++ b/openair1/SCHED_NR_UE/pucch_power_control_ue_nr.c
@@ -34,8 +34,6 @@
 #include "SCHED_NR_UE/pucch_power_control_ue_nr.h"
 #include <openair1/PHY/LTE_ESTIMATION/lte_estimation.h>
 
-int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
-
 /**************** defines **************************************/
 
 /**************** variables **************************************/
@@ -149,7 +147,7 @@ int16_t get_pucch_tx_power_ue(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_pro
     }
   }
 
-  //int l = 0;
+  int l = 0;
   int k2;
 
   if (power_config->twoPUCCH_PC_AdjustmentStates > 1) {
diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
index 161ee0b57cd..ec5ed6d91d3 100644
--- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
+++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c
@@ -53,7 +53,57 @@
 int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe);
 uint8_t is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
 uint8_t is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
-
+/*
+void nr_generate_pucch0(int32_t **txdataF,
+                        NR_DL_FRAME_PARMS *frame_parms,
+                        PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                        int16_t amp,
+                        int nr_tti_tx,
+                        uint8_t mcs,
+                        uint8_t nrofSymbols,
+                        uint8_t startingSymbolIndex,
+                        uint16_t startingPRB);
+
+void nr_generate_pucch1(int32_t **txdataF,
+                        NR_DL_FRAME_PARMS *frame_parms,
+                        PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                        uint64_t payload,
+                        int16_t amp,
+                        int nr_tti_tx,
+                        uint8_t nrofSymbols,
+                        uint8_t startingSymbolIndex,
+                        uint16_t startingPRB,
+                        uint16_t startingPRB_intraSlotHopping,
+                        uint8_t timeDomainOCC,
+                        uint8_t nr_bit);
+
+void nr_generate_pucch2(int32_t **txdataF,
+                        NR_DL_FRAME_PARMS *frame_parms,
+                        PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                        uint64_t payload,
+                        int16_t amp,
+                        int nr_tti_tx,
+                        uint8_t nrofSymbols,
+                        uint8_t startingSymbolIndex,
+                        uint8_t nrofPRB,
+                        uint16_t startingPRB,
+                        uint8_t nr_bit);
+
+void nr_generate_pucch3_4(int32_t **txdataF,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         pucch_format_nr_t fmt,
+                         PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                         uint64_t payload,
+                         int16_t amp,
+                         int nr_tti_tx,
+                         uint8_t nrofSymbols,
+                         uint8_t startingSymbolIndex,
+                         uint8_t nrofPRB,
+                         uint16_t startingPRB,
+                         uint8_t nr_bit,
+                         uint8_t occ_length_format4,
+                         uint8_t occ_index_format4);
+*/
 /**************** variables **************************************/
 
 
@@ -508,8 +558,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
   switch(format) {
     case pucch_format0_nr:
     {
-      nr_generate_pucch0(ue,
-    		  	  	  	 ue->common_vars.txdataF,
+      nr_generate_pucch0(ue,ue->common_vars.txdataF,
                          &ue->frame_parms,
                          &ue->pucch_config_dedicated[gNB_id],
                          tx_amp,
@@ -523,8 +572,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
     }
     case pucch_format1_nr:
     {
-      nr_generate_pucch1(ue,
-    		             ue->common_vars.txdataF,
+      nr_generate_pucch1(ue,ue->common_vars.txdataF,
                          &ue->frame_parms,
                          &ue->pucch_config_dedicated[gNB_id],
                          pucch_payload,
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index fef06e5a505..2a95768a3e0 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -493,9 +493,9 @@ int main(int argc, char **argv) {
 	short *channel_output_fixed = malloc16(sizeof(short) * 16 * 68 * 384);
 	short *channel_output_uncoded = malloc16(sizeof(unsigned short) * 16 * 68 * 384);
 	double errors_bit_uncoded = 0;
-	//unsigned char *estimated_output = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
-	unsigned char *estimated_output_bit = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
-	unsigned char *test_input_bit = malloc16(sizeof(unsigned char) * 16 * 68 * 384);
+	unsigned char *estimated_output;
+	unsigned char *estimated_output_bit;
+	unsigned char *test_input_bit;
 	unsigned int errors_bit = 0;
 	test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
 	estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
@@ -514,7 +514,7 @@ int main(int argc, char **argv) {
 	for (i = 0; i < TBS / 8; i++)
 		test_input[i] = (unsigned char) rand();
 
-	//estimated_output = harq_process->b;
+	estimated_output = harq_process->b;
 
 #ifdef DEBUG_DLSCHSIM
 	for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%d \n",test_input[i]);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index acba9d0ef01..b95ea7502e6 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -42,12 +42,11 @@
 #include "PHY/MODULATION/modulation_UE.h"
 #include "PHY/INIT/phy_init.h"
 #include "PHY/NR_TRANSPORT/nr_transport.h"
-//#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
+#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
 
 #include "SCHED_NR/sched_nr.h"
 #include "SCHED_NR/fapi_nr_l1.h"
 #include "SCHED_NR_UE/fapi_nr_ue_l1.h"
-#include "SCHED_NR/fapi_nr_l1.h"
 
 #include "LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
 #include "LAYER2/NR_MAC_UE/mac_defs.h"
@@ -58,11 +57,6 @@
 #include "NR_PHY_INTERFACE/NR_IF_Module.h"
 #include "NR_UE_PHY_INTERFACE/NR_IF_Module.h"
 
-#include "LAYER2/NR_MAC_UE/mac_proto.h"
-//#include "LAYER2/NR_MAC_gNB/mac_proto.h"
-//#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
-#include "RRC/NR/MESSAGES/asn1_msg.h"
-
 
 PHY_VARS_gNB *gNB;
 PHY_VARS_NR_UE *UE;
@@ -126,40 +120,41 @@ int main(int argc, char **argv)
 {
 
   char c;
-  int i,aa;
+
+  int i,l,aa;
   double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
   uint8_t snr1set=0;
   int **txdata;
   double **s_re,**s_im,**r_re,**r_im;
-  //double iqim = 0.0;
-  //unsigned char pbch_pdu[6];
+  double iqim = 0.0;
+  unsigned char pbch_pdu[6];
   //  int sync_pos, sync_pos_slot;
   //  FILE *rx_frame_file;
   FILE *output_fd = NULL;
   uint8_t write_output_file=0;
   //int result;
-  //  int freq_offset, subframe_offset;
+  int freq_offset;
+  //  int subframe_offset;
   //  char fname[40], vname[40];
-  int trial,n_trials=1,n_errors=0;
-  //int n_errors2=0,n_alamouti=0;
+  int trial,n_trials=1,n_errors,n_errors2,n_alamouti;
   uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
   uint16_t Nid_cell=0;
   uint64_t SSB_positions=0x01;
 
   channel_desc_t *gNB2UE;
-  //uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
+  uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
   uint8_t extended_prefix_flag=0;
   int8_t interf1=-21,interf2=-21;
 
   FILE *input_fd=NULL,*pbch_file_fd=NULL;
-  //char input_val_str[50],input_val_str2[50];
+  char input_val_str[50],input_val_str2[50];
 
-  //uint8_t frame_mod4, num_pdcch_symbols = 0;
+  uint8_t frame_mod4,num_pdcch_symbols = 0;
 
   SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
 
-  //double pbch_sinr;
-  //int pbch_tx_ant;
+  double pbch_sinr;
+  int pbch_tx_ant;
   int N_RB_DL=273,mu=1;
 
   uint64_t ssb_pattern = 0x01;
@@ -681,8 +676,8 @@ int main(int argc, char **argv)
   for (SNR=snr0; SNR<snr1; SNR+=.2) {
 
     n_errors = 0;
-    //n_errors2 = 0;
-    //n_alamouti = 0;
+    n_errors2 = 0;
+    n_alamouti = 0;
 
     for (trial=0; trial<n_trials; trial++) {
 
diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c
index 6325428743e..99b62864833 100644
--- a/openair2/GNB_APP/gnb_config.c
+++ b/openair2/GNB_APP/gnb_config.c
@@ -628,7 +628,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
   paramdef_t GNBParams[]  = GNBPARAMS_DESC;
   paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0};
   ////////// Physical parameters
-  //checkedparam_t config_check_CCparams[] = NRCCPARAMS_CHECK;
+  checkedparam_t config_check_CCparams[] = NRCCPARAMS_CHECK;
   paramdef_t CCsParams[] = NRCCPARAMS_DESC;
   paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0};
   
diff --git a/openair2/LAYER2/NR_MAC_UE/mac.h b/openair2/LAYER2/NR_MAC_UE/mac.h
index e77a6450dad..fe8e91500a4 100644
--- a/openair2/LAYER2/NR_MAC_UE/mac.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac.h
@@ -82,10 +82,10 @@ typedef struct {
 #define DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH    0x34
 #define DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH    0x35
 #define DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL 0x36
-#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT   0x37
-#define DL_SCH_LCID_DUPLICATION_ACT                0x38
-#define DL_SCH_LCID_SCell_ACT_4_OCT                0x39
-#define DL_SCH_LCID_SCell_ACT_1_OCT                0x3A
+#define DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT   0X37 
+#define DL_SCH_LCID_DUPLICATION_ACT                0X38
+#define DL_SCH_LCID_SCell_ACT_4_OCT                0X39
+#define DL_SCH_LCID_SCell_ACT_1_OCT                0X3A
 #define DL_SCH_LCID_L_DRX                          0x3B
 #define DL_SCH_LCID_DRX                            0x3C
 #define DL_SCH_LCID_TA_COMMAND                     0x3D
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index bdb76a38f3c..c5a569b7814 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -69,7 +69,7 @@ int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index,
 
     NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
     fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request;
-    //fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
+    fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
     nr_phy_config_t *phy_config = &mac->phy_config;
 
     //ul_config->ul_config_list[ul_config->number_pdus].ulsch_config_pdu.rnti = rnti;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
index 4c7c491454d..def897433ea 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c
@@ -36,8 +36,6 @@
 #include "LAYER2/MAC/mac_extern.h"
 #include "LAYER2/MAC/mac_proto.h"
 #include "LAYER2/NR_MAC_gNB/mac_proto.h"
-#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h"
-#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "UTIL/OPT/opt.h"
@@ -337,7 +335,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
 
       rnti = UE_RNTI(module_idP, i);
       CC_id = UE_PCCID(module_idP, i);
-      //int spf = get_spf(cfg);
+      int spf = get_spf(cfg);
   
       if (((frameP&127) == 0) && (slotP == 0)) {
         LOG_I(MAC,
diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
index 9968c39df41..97a417fea1d 100644
--- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
+++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h
@@ -36,28 +36,6 @@
 
 void mac_top_init_gNB(void);
 
-uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint32_t bw);
-
-uint64_t from_nrarfcn(int nr_bandP, uint32_t dl_nrarfcn);
-
-void config_nr_mib(int Mod_idP,
-                int CC_idP,
-                int p_gNBP,
-                int subCarrierSpacingCommon,
-                uint32_t ssb_SubcarrierOffset,
-                int dmrs_TypeA_Position,
-                uint32_t pdcch_ConfigSIB1,
-                int cellBarred,
-                int intraFreqReselection
-                );
-
-void config_common(int Mod_idP,
-                   int CC_idP,
-                   int nr_bandP,
-                   uint64_t dl_CarrierFreqP,
-                   uint32_t dl_BandwidthP
-                  );
-
 int rrc_mac_config_req_gNB(module_id_t Mod_idP, 
                            int CC_id,
 						   int cellid,
diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c
index c8cdfd336fc..0dca3b80d2c 100644
--- a/openair2/RRC/NR/L2_nr_interface.c
+++ b/openair2/RRC/NR/L2_nr_interface.c
@@ -58,6 +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
+  int i;
   LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
 #endif
 
diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c
index af5ec8df823..801673b2ef2 100644
--- a/openair2/RRC/NR/rrc_gNB.c
+++ b/openair2/RRC/NR/rrc_gNB.c
@@ -144,15 +144,16 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
      rrc_gNB_ue_context_t   *const ue_context_pP
      ){
   
-  //uint8_t size, buffer[100];
-  //int     CC_id = ue_context_pP->ue_context.primaryCC_id;
-  //OCTET_STRING_t                                      *secondaryCellGroup;
+  uint8_t size;
+  uint8_t buffer[100];
+  int     CC_id = ue_context_pP->ue_context.primaryCC_id;
+  OCTET_STRING_t                                      *secondaryCellGroup;
   NR_CellGroupConfig_t                                *cellGroupconfig;
   struct NR_CellGroupConfig__rlc_BearerToAddModList   *rlc_BearerToAddModList;
   struct NR_MAC_CellGroupConfig                       *mac_CellGroupConfig;
   struct NR_PhysicalCellGroupConfig                   *physicalCellGroupConfig;
   struct NR_SpCellConfig                              *spCellConfig;
-  //struct NR_CellGroupConfig__sCellToAddModList        *sCellToAddModList;
+  struct NR_CellGroupConfig__sCellToAddModList        *sCellToAddModList;
 
   cellGroupconfig                           = CALLOC(1,sizeof(NR_CellGroupConfig_t));
   cellGroupconfig->rlc_BearerToAddModList   = CALLOC(1,sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList));
-- 
GitLab