From e4c44dd0a9c7b20a0c63e29e08fc0ff24d7be188 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Sun, 29 Apr 2018 11:08:32 -0700
Subject: [PATCH] checked compilation/execution of dlsim/ulsim. removal of most
 warnings.

---
 cmake_targets/CMakeLists.txt                  |  2 +-
 .../CODING/3gpplte_turbo_decoder_avx2_16bit.c |  1 +
 openair1/PHY/INIT/lte_init_ue.c               |  1 +
 openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c |  2 +-
 .../PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c   |  1 +
 .../lte_dl_bf_channel_estimation.c            |  3 +++
 .../lte_dl_channel_estimation.c               |  3 +++
 .../lte_dl_mbsfn_channel_estimation.c         |  2 ++
 openair1/PHY/LTE_TRANSPORT/pucch.c            |  1 +
 openair1/PHY/LTE_TRANSPORT/rar_tools.c        |  2 +-
 openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c  | 11 +++++++---
 openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c       |  1 +
 openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c     |  1 +
 openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c      |  3 ++-
 openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c       |  2 +-
 openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c      |  1 +
 openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c  |  1 +
 openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h  |  1 +
 openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c  |  2 +-
 .../PHY/LTE_UE_TRANSPORT/ulsch_modulation.c   |  3 ++-
 openair1/PHY/MODULATION/slot_fep.c            |  2 ++
 openair1/PHY/MODULATION/slot_fep_mbsfn.c      |  2 ++
 openair1/PHY/TOOLS/lte_phy_scope.c            |  1 +
 openair1/SCHED_UE/sched_UE.h                  |  5 +++--
 openair1/SIMULATION/LTE_PHY/dlsim.c           | 20 +++++++------------
 openair1/SIMULATION/LTE_PHY/ulsim.c           |  2 ++
 26 files changed, 51 insertions(+), 25 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index dbc129f3f75..53623c04e0c 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -2143,7 +2143,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr
     )
   target_link_libraries (${myExe}
 
-    -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
+    -Wl,--start-group SIMU UTIL SCHED_LIB SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY PHY_UE PHY_RU LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group
     pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl
     )
 endforeach(myExe)
diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
index 9c8e3eff3a7..a541c223934 100644
--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
@@ -42,6 +42,7 @@
 
 
 #ifndef TEST_DEBUG
+#include "PHY/impl_defs_top.h"
 #include "PHY/defs_common.h"
 #include "PHY/CODING/coding_defs.h"
 #include "PHY/CODING/lte_interleaver_inline.h"
diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c
index 11260274db9..46fce73314e 100644
--- a/openair1/PHY/INIT/lte_init_ue.c
+++ b/openair1/PHY/INIT/lte_init_ue.c
@@ -32,6 +32,7 @@
 #include <math.h>
 #include "PHY/LTE_TRANSPORT/transport_common_proto.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
index 3e1311734f1..8810752398f 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync.c
@@ -24,7 +24,7 @@
 #include "PHY/phy_extern_ue.h"
 
 #include "UTIL/LOG/vcd_signal_dumper.h"
-#include "lte_estimation.h"
+#include "openair2/LAYER2/MAC/mac_proto.h"
 
 #define DEBUG_PHY
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
index 327d07b7303..06ef4a5d1a1 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_ue.c
@@ -23,6 +23,7 @@
 #include "PHY/defs_UE.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
 #include "PHY/impl_defs_top.h"
+#include "openair2/LAYER2/MAC/mac_proto.h"
 
 #include "UTIL/LOG/vcd_signal_dumper.h"
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
index fe3084cdb2f..8d1fb20d6b7 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
@@ -21,6 +21,9 @@
 
 #include <string.h>
 #include "PHY/defs_UE.h"
+#include "lte_estimation.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
+
 #include "filt16_32.h"
 //#define DEBUG_BF_CH
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
index 15dbcd6ed7c..a72563f7e6d 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
@@ -24,6 +24,9 @@
 #include "filt96_32.h"
 #include "T.h"
 //#define DEBUG_CH
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
+#include "SCHED_UE/sched_UE.h"
 
 int lte_dl_channel_estimation(PHY_VARS_UE *ue,
                               uint8_t eNB_id,
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
index 585ed871fa3..c4fc80a8c11 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
@@ -21,6 +21,8 @@
 
 #include <string.h>
 #include "PHY/defs_UE.h"
+#include "lte_estimation.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 //#define DEBUG_CH
 int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *ue,
diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c
index c46aba4d81c..39703eebfd3 100644
--- a/openair1/PHY/LTE_TRANSPORT/pucch.c
+++ b/openair1/PHY/LTE_TRANSPORT/pucch.c
@@ -32,6 +32,7 @@
 #include "PHY/defs_eNB.h"
 #include "PHY/phy_extern.h" 
 #include "LAYER2/MAC/mac.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c
index f8bb01fd9bf..ab4656716bc 100644
--- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c
+++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c
@@ -34,7 +34,7 @@
 #include "SCHED/sched_eNB.h"
 #include "LAYER2/MAC/mac.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
-
+#include "PHY/LTE_TRANSPORT/transport_proto.h"
 #include "assertions.h"
 
 extern uint16_t RIV2nb_rb_LUT6[32];
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
index 277ca90a2ef..b1d5b9b70e3 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/initial_sync.c
@@ -33,12 +33,17 @@
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
 #include "SCHED_UE/sched_UE.h"
-#include "transport_ue.h"
-
+#include "transport_proto_ue.h"
+#include "PHY/MODULATION/modulation_UE.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
+#include "openair2/LAYER2/MAC/mac_proto.h"
 #include "common_lib.h"
+#include "PHY/INIT/phy_init.h"
+
 extern openair0_config_t openair0_cfg[];
 
-#define DEBUG_INITIAL_SYNCH
+//#define DEBUG_INITIAL_SYNCH
 
 int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
 {
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
index 5f2ad6cf796..a6acec9ca37 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
@@ -36,6 +36,7 @@
 #include "transport_ue.h"
 #include "PHY/phy_extern_ue.h"
 #include "PHY/sse_intrin.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 //#define DEBUG_PBCH 1
 //#define DEBUG_PBCH_ENCODING
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
index cd63f0483b1..82bb0a2659e 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
@@ -30,6 +30,7 @@
 * \warning
 */
 #include "PHY/defs_UE.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 //#define DEBUG_PCFICH
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c
index 22d10319603..669e0937c6c 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/phich_ue.c
@@ -34,7 +34,8 @@
 #include "PHY/phy_extern_ue.h"
 #include "SCHED_UE/sched_UE.h"
 #include "transport_ue.h"
-
+#include "transport_proto_ue.h"
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 #include "LAYER2/MAC/mac.h"
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
index 1efa09ff9d8..d944491b639 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
@@ -22,7 +22,7 @@
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
 #include "PHY/sse_intrin.h"
-#include "PHY/LTE_TRANSPORT/transport_common.h"
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 
 // Mask for identifying subframe for MBMS
 #define MBSFN_TDD_SF3 0x80// for TDD
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
index a762bb047b7..c3bbd0fb1ca 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
@@ -31,6 +31,7 @@
 */
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h" 
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 #include "UTIL/LOG/log.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
index 2bbbf95b760..03df4e7f690 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
@@ -34,6 +34,7 @@
 #include "SCHED_UE/sched_UE.h"
 #include "LAYER2/MAC/mac.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
+#include "transport_proto_ue.h"
 
 #include "assertions.h"
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
index 574905b5b06..e97353a9028 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h
@@ -36,6 +36,7 @@
 #include "../LTE_TRANSPORT/dci.h"
 #include "../LTE_TRANSPORT/mdci.h"
 #include "../LTE_TRANSPORT/uci_common.h"
+#include "../LTE_TRANSPORT/transport_common.h"
 #ifndef STANDALONE_COMPILE
 #include "UTIL/LISTS/list.h"
 #endif
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
index a9a6c006356..d913a6f7790 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
@@ -32,7 +32,7 @@
 
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
-
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/CODING/coding_defs.h"
 #include "PHY/CODING/coding_extern.h"
 #include "PHY/CODING/lte_interleaver_inline.h"
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
index adf89031dc3..92a8d16b44a 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
@@ -34,9 +34,10 @@
 #include "PHY/CODING/coding_defs.h"
 #include "PHY/CODING/coding_extern.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/LTE_TRANSPORT/transport_eNB.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
-
+#include "PHY/LTE_REFSIG/lte_refsig.h"
 
 
 //#define DEBUG_ULSCH_MODULATION
diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c
index a5fcaabf8fd..b01979431dc 100644
--- a/openair1/PHY/MODULATION/slot_fep.c
+++ b/openair1/PHY/MODULATION/slot_fep.c
@@ -21,6 +21,8 @@
 
 #include "PHY/defs_UE.h"
 #include "modulation_UE.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
+
 //#define DEBUG_FEP
 
 #define SOFFSET 0
diff --git a/openair1/PHY/MODULATION/slot_fep_mbsfn.c b/openair1/PHY/MODULATION/slot_fep_mbsfn.c
index 7a8fd3f03f1..272cbc5d60b 100644
--- a/openair1/PHY/MODULATION/slot_fep_mbsfn.c
+++ b/openair1/PHY/MODULATION/slot_fep_mbsfn.c
@@ -21,6 +21,8 @@
 
 #include "PHY/defs_UE.h"
 #include "modulation_UE.h"
+#include "PHY/LTE_ESTIMATION/lte_estimation.h"
+
 //#define DEBUG_FEP
 
 #define SOFFSET 0
diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c
index 34799bff7a4..9f2ec547449 100644
--- a/openair1/PHY/TOOLS/lte_phy_scope.c
+++ b/openair1/PHY/TOOLS/lte_phy_scope.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include "lte_phy_scope.h"
 #include "PHY/defs_common.h"
+#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 
 #define TPUT_WINDOW_LENGTH 100
 int otg_enabled;
diff --git a/openair1/SCHED_UE/sched_UE.h b/openair1/SCHED_UE/sched_UE.h
index 43d863b062f..244d6789d24 100644
--- a/openair1/SCHED_UE/sched_UE.h
+++ b/openair1/SCHED_UE/sched_UE.h
@@ -25,10 +25,11 @@
   \email knopp@eurecom.fr
 */
 
-#ifndef __openair_SCHED_ENB_H__
-#define __openair_SCHED_ENB_H__
+#ifndef __openair_SCHED_UE_H__
+#define __openair_SCHED_UE_H__
 
 #include "PHY/defs_UE.h"
+#include "../SCHED/sched_common.h"
 
 /*! \brief Scheduling for UE TX procedures in normal subframes.
   @param phy_vars_ue Pointer to UE variables on which to act
diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index 3780600a421..77b8c0e674d 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -64,6 +64,11 @@
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "SCHED/sched_eNB.h"
 #include "SCHED_UE/sched_UE.h"
+#include "common/config/config_load_configmodule.h"
+#include "PHY/INIT/phy_init.h"
+
+void feptx_ofdm(RU_t *ru);
+void feptx_prec(RU_t *ru);
 
 double cpuf;
 
@@ -547,7 +552,6 @@ int main(int argc, char **argv)
   DCI_ALLOC_t da;
   DCI_ALLOC_t *dci_alloc = &da;
 
-  unsigned int ret;
   unsigned int coded_bits_per_codeword=0,nsymb; //,tbs=0;
 
   unsigned int tx_lev=0,tx_lev_dB=0,trials;
@@ -570,16 +574,6 @@ int main(int argc, char **argv)
   unsigned char input_trch_file=0;
   FILE *input_fd=NULL;
   unsigned char input_file=0;
-  //  char input_val_str[50],input_val_str2[50];
-
-  char input_trch_val[16];
-
-  //  unsigned char pbch_pdu[6];
-
-
-
-
-  //  FILE *rx_frame_file;
 
   int n_frames;
   int n_ch_rlz = 1;
@@ -602,7 +596,7 @@ int main(int argc, char **argv)
   // void *data;
   // int ii;
   //  int bler;
-  double blerr[4],uncoded_ber=0; //,avg_ber;
+  double blerr[4];
   short *uncoded_ber_bit=NULL;
   uint8_t N_RB_DL=25,osf=1;
   frame_t frame_type = FDD;
@@ -1607,7 +1601,7 @@ int main(int argc, char **argv)
 	      // this is for user 0 only
 	      printf("nb_rb %d, rb_alloc %x, mcs %d\n",
 		     eNB->dlsch[0][0]->harq_processes[0]->nb_rb,
-		     eNB->dlsch[0][0]->harq_processes[0]->rb_alloc,
+		     eNB->dlsch[0][0]->harq_processes[0]->rb_alloc[0],
 		     eNB->dlsch[0][0]->harq_processes[0]->mcs);
 
 	      coded_bits_per_codeword = get_G(&eNB->frame_parms,
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 6590ea4dbc5..22cac371937 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -49,12 +49,14 @@
 
 #include "PHY/LTE_TRANSPORT/transport_proto.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
+#include "PHY/INIT/phy_init.h"
 
 #include "unitary_defs.h"
 
 #include "PHY/TOOLS/lte_phy_scope.h"
 #include "dummy_functions.c"
 
+#include "common/config/config_load_configmodule.h"
 double cpuf;
 
 
-- 
GitLab