From 5ef2af1cce6bd45b734f551ef25a6f15eb11933c Mon Sep 17 00:00:00 2001
From: Francesco Mani <francesco.mani@eurecom.fr>
Date: Tue, 17 Mar 2020 16:27:08 +0100
Subject: [PATCH] minor changes

---
 openair1/PHY/MODULATION/modulation_UE.h           |  6 ++++++
 openair1/PHY/MODULATION/slot_fep_nr.c             |  8 ++++----
 openair1/PHY/NR_TRANSPORT/nr_ulsch.c              |  9 ++++-----
 openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c | 11 +++--------
 openair1/PHY/NR_UE_TRANSPORT/dci_nr.c             |  2 +-
 openair1/SCHED_NR/phy_procedures_nr_gNB.c         |  3 +--
 openair1/SIMULATION/NR_PHY/nr_unitary_defs.h      |  2 +-
 openair1/SIMULATION/NR_PHY/ulsim.c                |  2 ++
 8 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/openair1/PHY/MODULATION/modulation_UE.h b/openair1/PHY/MODULATION/modulation_UE.h
index 1199a91baa..228299095f 100644
--- a/openair1/PHY/MODULATION/modulation_UE.h
+++ b/openair1/PHY/MODULATION/modulation_UE.h
@@ -54,6 +54,12 @@ int nr_slot_fep(PHY_VARS_NR_UE *phy_vars_ue,
              int sample_offset,
              int no_prefix);
 
+int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
+                          unsigned char symbol,
+                          unsigned char Ns,
+                          int sample_offset,
+                          int no_prefix);
+
 int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
                    unsigned char l,
                    int subframe,
diff --git a/openair1/PHY/MODULATION/slot_fep_nr.c b/openair1/PHY/MODULATION/slot_fep_nr.c
index a15b12ed4e..01ea82d92a 100644
--- a/openair1/PHY/MODULATION/slot_fep_nr.c
+++ b/openair1/PHY/MODULATION/slot_fep_nr.c
@@ -211,10 +211,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
 }
 
 int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
-                unsigned char symbol,
-                unsigned char Ns,
-                int sample_offset,
-                int no_prefix)
+                          unsigned char symbol,
+                          unsigned char Ns,
+                          int sample_offset,
+                          int no_prefix)
 {
   NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
   NR_UE_COMMON *common_vars   = &ue->common_vars;
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
index 6764e6e125..8b35ca2e0f 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch.c
@@ -83,11 +83,10 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB,
 }
 
 void nr_ulsch_unscrambling(int16_t* llr,
-                         uint32_t size,
-                         uint8_t q,
-                         uint32_t Nid,
-                         uint32_t n_RNTI) 
-{
+                           uint32_t size,
+                           uint8_t q,
+                           uint32_t Nid,
+                           uint32_t n_RNTI) {
   uint8_t reset;
   uint32_t x1, x2, s=0;
 
diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
index 0478d892d5..add5587ea4 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
@@ -329,7 +329,6 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext,
           nb_rb = (2*nb_rb)/3;
       }
 
-
       for (rb=0;rb<nb_rb;rb++) {
 
         ul_ch128[0] = _mm_mulhi_epi16(ul_ch128[0], ch_amp128);
@@ -403,7 +402,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
 
   symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
 
-  for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++)
+  for (aatx=0; aatx<frame_parms->nb_antenna_ports_gNB; aatx++) {
     for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
       //clear average level
       avg128U = vdupq_n_s32(0);
@@ -446,8 +445,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext,
                              ((int32_t*)&avg128U)[2] +
                              ((int32_t*)&avg128U)[3]   ) / (nb_rb*nre);
     }
-
-
+  }
 #endif
 }
 
@@ -666,7 +664,6 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
 
   if (rho) {
 
-
     for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
       rho128        = (__m128i *)&rho[aarx][symbol*frame_parms->N_RB_UL*12];
       ul_ch128      = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_UL*12];
@@ -748,7 +745,6 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext,
 
 #elif defined(__arm__)
 
-
   unsigned short rb;
   unsigned char aatx,aarx,symbol_mod,is_dmrs_symbol=0;
 
@@ -1017,7 +1013,6 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
     nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB;
   }
 
-
   //----------------------------------------------------------
   //--------------------- Channel estimation ---------------------
   //----------------------------------------------------------
@@ -1071,7 +1066,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
 
       gNB->pusch_vars[UE_id]->log2_maxh = (log2_approx(avgs)/2)+1;
       gNB->pusch_vars[UE_id]->cl_done = 1;
-  }
+    }
 
     nr_ulsch_channel_compensation(gNB->pusch_vars[UE_id]->rxdataF_ext,
                                   gNB->pusch_vars[UE_id]->ul_ch_estimates_ext,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index 3a594031bd..6d98031843 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -702,7 +702,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
       for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++)
         avgs = cmax(avgs, avgP[aarx]);
 
-        log2_maxh = (log2_approx(avgs) / 2) + 5;  //+frame_parms->nb_antennas_rx;
+      log2_maxh = (log2_approx(avgs) / 2) + 5;  //+frame_parms->nb_antennas_rx;
 #ifdef UE_DEBUG_TRACE
       LOG_D(PHY,"slot %d: pdcch log2_maxh = %d (%d,%d)\n",slot,log2_maxh,avgP[0],avgs);
 #endif
diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
index 0a8a34e0da..14b7d2ebae 100644
--- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c
+++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c
@@ -224,7 +224,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
   number_symbols = pusch_pdu->nr_of_symbols;
 
   for (l = start_symbol; l < start_symbol + number_symbols; l++)
-      number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;;
+    number_dmrs_symbols += ((pusch_pdu->ul_dmrs_symb_pos)>>l)&0x01;
 
   if (nodata_dmrs)
     nb_re_dmrs = 12*number_dmrs_symbols;
@@ -238,7 +238,6 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
                pusch_pdu->qam_mod_order,
                pusch_pdu->nrOfLayers);
 
-
   //----------------------------------------------------------
   //------------------- ULSCH unscrambling -------------------
   //----------------------------------------------------------
diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h
index 6d07576d85..7a465e0ea3 100644
--- a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h
+++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h
@@ -161,7 +161,7 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL
   *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rsrp_ThresholdSSB=19;
   scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present=NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139;
   scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139=0;
-  scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet,TYPE_INT64;
+  scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet;
   *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=2;
   scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
   scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=55;
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 1c0ce8acf3..b3a7164378 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -46,12 +46,14 @@
 #include "PHY/NR_TRANSPORT/nr_ulsch.h"
 #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
 #include "PHY/TOOLS/tools_defs.h"
+#include "SCHED_NR/fapi_nr_l1.h"
 #include "SCHED_NR/sched_nr.h"
 #include "SCHED_NR_UE/defs.h"
 #include "SCHED_NR_UE/fapi_nr_ue_l1.h"
 #include "openair1/SIMULATION/TOOLS/sim.h"
 #include "openair1/SIMULATION/RF/rf.h"
 #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
+#include "openair2/RRC/NR/MESSAGES/asn1_msg.h"
 //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
 #include "LAYER2/NR_MAC_UE/mac_proto.h"
 #include "LAYER2/NR_MAC_gNB/mac_proto.h"
-- 
2.26.2