From f1e8bff3ecd167df9a079cbae90b2e9c0156cfc1 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 19 Oct 2017 17:00:30 +0200
Subject: [PATCH] remove gcc warnings

phy_init_lte_ue_signal was renamed init_lte_ue_signal in openair1/PHY/INIT/defs.h
maybe it's the opposite that should have been done?

Functions used in one file and defined in another may have been
declared in the wrong header file.
---
 openair1/PHY/INIT/defs.h                                 | 2 +-
 openair1/PHY/LTE_TRANSPORT/prach.c                       | 6 ++++--
 openair1/SCHED/phy_procedures_lte_eNb.c                  | 6 ------
 openair1/SCHED/ru_procedures.c                           | 4 +---
 openair2/ENB_APP/enb_app.c                               | 9 ---------
 openair2/ENB_APP/enb_config.h                            | 5 +++++
 openair2/LAYER2/MAC/config.c                             | 3 +--
 openair2/LAYER2/MAC/eNB_scheduler_primitives.c           | 2 +-
 openair2/LAYER2/MAC/eNB_scheduler_ulsch.c                | 6 ------
 openair2/LAYER2/MAC/proto.h                              | 6 +++++-
 openair2/LAYER2/MAC/ra_procedures.c                      | 1 +
 openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c                 | 1 +
 .../LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c     | 4 ++--
 openair2/RRC/LITE/proto.h                                | 8 ++++++++
 openair2/RRC/LITE/rrc_UE.c                               | 4 ++--
 openair2/UTIL/CLI/cli.c                                  | 2 +-
 openair2/UTIL/CLI/cli_cmd.c                              | 2 +-
 openair2/UTIL/OTG/otg_rx.c                               | 3 ++-
 openair3/GTPV1-U/gtpv1u_eNB_defs.h                       | 2 ++
 targets/RT/USER/lte-softmodem.h                          | 5 +++++
 targets/RT/USER/rt_wrapper.c                             | 2 ++
 21 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h
index 36d8aa00be4..4fd8e10527c 100644
--- a/openair1/PHY/INIT/defs.h
+++ b/openair1/PHY/INIT/defs.h
@@ -65,7 +65,7 @@ int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms);
 @returns -1 if any memory allocation failed
 @note The current implementation will never return -1, but segfault.
  */
-int phy_init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
+int init_lte_ue_signal(PHY_VARS_UE *phy_vars_ue,
 			   int          nb_connected_eNB,
 			   uint8_t         abstraction_flag);
 
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c
index 753ed86d0a8..2a50488ad3f 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach.c
@@ -1151,7 +1151,9 @@ void rx_prach0(PHY_VARS_eNB *eNB,
 #ifdef PRACH_DEBUG
   int en0=0;
 #endif
-  int en;
+
+  (void)frame; /* avoid gcc warnings */
+
   if (ru) { 
     fp    = &ru->frame_parms;
     nb_rx = ru->nb_rx;
@@ -1472,8 +1474,8 @@ void rx_prach0(PHY_VARS_eNB *eNB,
     return;
   } else if (eNB!=NULL) {
 
-    en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
 #ifdef PRACH_DEBUG
+    int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
     if ((en > 60)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
 #endif
 
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 9659aa9e610..5862f27b714 100644
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -555,7 +555,6 @@ void prach_procedures(PHY_VARS_eNB *eNB,
   uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
   uint16_t i;
   int frame,subframe;
-  LTE_eNB_PRACH *prach_vars=NULL;
 
 #ifdef Rel14
   if (br_flag==1) {
@@ -618,8 +617,6 @@ void prach_procedures(PHY_VARS_eNB *eNB,
 
 #ifdef Rel14
   if (br_flag==1) {
-
-    prach_vars = &eNB->prach_vars_br;
     int prach_mask;
       
     prach_mask = is_prach_subframe(&eNB->frame_parms,eNB->proc.frame_prach_br,eNB->proc.subframe_prach_br);
@@ -679,9 +676,6 @@ void prach_procedures(PHY_VARS_eNB *eNB,
 	    T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
 	      T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
 	    
-	    prach_vars = &eNB->prach_vars;
-	    
-	    
 	    pthread_mutex_lock(&eNB->UL_INFO_mutex);
 	    
 	    eNB->UL_INFO.rach_ind.number_of_preambles                 = 1;
diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c
index 7e0ca4e76a1..e5df2e0a6f1 100644
--- a/openair1/SCHED/ru_procedures.c
+++ b/openair1/SCHED/ru_procedures.c
@@ -69,11 +69,9 @@ void feptx0(RU_t *ru,int slot) {
   //int dummy_tx_b[7680*2] __attribute__((aligned(32)));
 
   unsigned int aa,slot_offset;
-  int i,j, tx_offset;
+  int i, tx_offset;
   int slot_sizeF = (fp->ofdm_symbol_size)*
                    ((fp->Ncp==1) ? 6 : 7);
-  int len,len2;
-  int16_t *txdata;
   int subframe = ru->proc.subframe_tx;
 
   slot_offset = subframe*fp->samples_per_tti + (slot*(fp->samples_per_tti>>1));
diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 0ca8616fd9a..b6321964749 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -211,19 +211,11 @@ static void configure_rrc(uint32_t enb_id)
 static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties)
 {
   uint32_t         enb_id;
-  uint32_t         mme_id;
   MessageDef      *msg_p;
   uint32_t         register_enb_pending = 0;
-  char            *str                  = NULL;
-  struct in_addr   addr;
-
-#   if defined(OAI_EMU)
-
-#   endif
 
   for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
 #   if defined(OAI_EMU)
-
     if (oai_emulation.info.cli_start_enb[enb_id] == 1)
 #   endif
     {
@@ -307,7 +299,6 @@ void *eNB_app_task(void *args_p)
   const char                      *msg_name        = NULL;
   instance_t                      instance;
   int                             result;
-  int                             j;
   /* for no gcc warnings */
   (void)instance;
 
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index b41545bcece..038cac25591 100644
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -46,6 +46,8 @@
 #else
 #include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h"
 #endif
+#include "intertask_interface_types.h"
+#include "RRC/LITE/defs.h"
 
 #define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\
             struct in_addr inp;\
@@ -100,5 +102,8 @@ extern void RCConfig(void);
 void                          enb_config_display(void);
 void                          ru_config_display(void);
 
+int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc);
+int RCconfig_S1(MessageDef *msg_p, uint32_t i);
+
 #endif /* ENB_CONFIG_H_ */
 /** @} */
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index d74955438f3..21d3a2fbb15 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -32,6 +32,7 @@
 
 #include "COMMON/platform_types.h"
 #include "COMMON/platform_constants.h"
+#include "SCHED/defs.h"
 #include "SystemInformationBlockType2.h"
 //#include "RadioResourceConfigCommonSIB.h"
 #include "RadioResourceConfigDedicated.h"
@@ -710,8 +711,6 @@ rrc_mac_config_req_ue(
 
   int i;
 
-  int UE_id = -1;
- 
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
 
   LOG_I(MAC,"[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",Mod_idP,eNB_index);
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
index b11634ef5da..5a9805654a3 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c
@@ -3605,9 +3605,9 @@ void SR_indication(module_id_t mod_idP, int cc_idP, frame_t frameP, sub_frame_t
     if (mac_eNB_get_rrc_status(mod_idP,UE_RNTI(mod_idP,UE_id)) < RRC_CONNECTED)
       LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d on CC_id %d\n",mod_idP,rntiP,frameP,subframeP, UE_id,cc_idP);
 
+#if 0
     UE_sched_ctrl *sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
 
-#if 0
     /* for the moment don't use ul_cqi from SR, value is too different from harq */
     sched_ctl->pucch1_snr[cc_idP]        = ul_cqi;
     sched_ctl->pucch1_cqi_update[cc_idP] = 1;
diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
index ee5ae3b5849..fee2002e4be 100644
--- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c
@@ -854,7 +854,6 @@ void schedule_ulsch_rnti(module_id_t   module_idP,
   UE_list_t         *UE_list=&eNB->UE_list;
   UE_TEMPLATE       *UE_template;
   UE_sched_ctrl     *UE_sched_ctrl;
-  int               tmode;
   int               sched_frame=frameP;
   int               rvidx_tab[4] = {0,2,3,1};
 
@@ -863,13 +862,8 @@ void schedule_ulsch_rnti(module_id_t   module_idP,
   nfapi_hi_dci0_request_body_t   *hi_dci0_req = &eNB->HI_DCI0_req[CC_id].hi_dci0_request_body;
   nfapi_hi_dci0_request_pdu_t    *hi_dci0_pdu;
 
-  nfapi_ul_config_request_pdu_t  *ul_config_pdu;
-
   nfapi_ul_config_request_body_t *ul_req_tmp       = &eNB->UL_req_tmp[CC_id][sched_subframeP].ul_config_request_body;
 
-  ul_config_pdu                                    = &ul_req_tmp->ul_config_pdu_list[0];
-
-
   LOG_D(MAC,"entering ulsch preprocesor\n");
   ulsch_scheduler_pre_processor(module_idP,
                                 frameP,
diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h
index 2bad81d52c4..a610c9b69f6 100644
--- a/openair2/LAYER2/MAC/proto.h
+++ b/openair2/LAYER2/MAC/proto.h
@@ -1058,7 +1058,11 @@ int narrowband_to_first_rb(COMMON_channels_t *cc, int nb_index);
 
 int l2_init_eNB(void);
 
-
+void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
+void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id);
+uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn);
+int32_t get_uldl_offset(int eutra_bandP);
+int l2_init_ue(int eMBMS_active, char *uecap_xer,uint8_t cba_group_active, uint8_t HO_active);
 
 #endif
 /** @}*/
diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c
index b63acf76f8a..f1f19a69319 100644
--- a/openair2/LAYER2/MAC/ra_procedures.c
+++ b/openair2/LAYER2/MAC/ra_procedures.c
@@ -35,6 +35,7 @@
 #include "proto.h"
 #include "UTIL/LOG/vcd_signal_dumper.h"
 #include "PHY_INTERFACE/extern.h"
+#include "SCHED/defs.h"
 #include "COMMON/mac_rrc_primitives.h"
 #include "RRC/LITE/extern.h"
 #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
index 046ba33e71d..de15e26b9c9 100644
--- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
+++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
@@ -89,6 +89,7 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
 
 #if defined(LINK_ENB_PDCP_TO_GTPV1U)
 #  include "gtpv1u_eNB_task.h"
+#  include "gtpv1u_eNB_defs.h"
 #endif
 
 /* Prevent de-queueing the same PDCP SDU from the queue twice
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 14ca1a62a98..f6d8e3f9f4f 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
@@ -79,9 +79,9 @@ void config_req_rlc_um (
 }
 //-----------------------------------------------------------------------------
 #if defined(Rel14)
-const uint32_t const t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
+const uint32_t t_Reordering_tab[32] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200,1600};
 #else
-const uint32_t const t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
+const uint32_t t_Reordering_tab[T_Reordering_spare1] = {0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,110,120,130,140,150,160,170,180,190,200};
 #endif
 
 void config_req_rlc_um_asn1 (
diff --git a/openair2/RRC/LITE/proto.h b/openair2/RRC/LITE/proto.h
index b0179bad8e6..41eb4a224f8 100644
--- a/openair2/RRC/LITE/proto.h
+++ b/openair2/RRC/LITE/proto.h
@@ -462,4 +462,12 @@ long binary_search_int(int elements[], long numElem, int value);
 long binary_search_float(float elements[], long numElem, float value);
 
 void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
+
+void openair_rrc_top_init_ue(
+                        int eMBMS_active,
+                        char* uecap_xer,
+                        uint8_t cba_group_active,
+                        uint8_t HO_active
+);
+
 /** @}*/
diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c
index 5cbc612b480..291539696d1 100644
--- a/openair2/RRC/LITE/rrc_UE.c
+++ b/openair2/RRC/LITE/rrc_UE.c
@@ -2604,7 +2604,7 @@ static const char* SIB2mac_ContentionResolutionTimer( long value )
 }
 static const char* SIB2modificationPeriodCoeff( long value )
 {
-  static char temp[4] = {0};
+  static char temp[32] = {0};
 
   if (value < 0 || value > 3)
     return "ERR";
@@ -2614,7 +2614,7 @@ static const char* SIB2modificationPeriodCoeff( long value )
 }
 static const char* SIB2defaultPagingCycle( long value )
 {
-  static char temp[6] = {0};
+  static char temp[32] = {0};
 
   if (value < 0 || value > 3)
     return "ERR";
diff --git a/openair2/UTIL/CLI/cli.c b/openair2/UTIL/CLI/cli.c
index bb193728c99..445b1f1c0a1 100644
--- a/openair2/UTIL/CLI/cli.c
+++ b/openair2/UTIL/CLI/cli.c
@@ -215,7 +215,7 @@ int cli_login(const char *username, int maxnodes, int maxcmds)
 
 char *cli_prompt(void)
 {
-  static char promptstr[200];
+  static char promptstr[256];
   promptstr[0]='\0';
   snprintf(promptstr, 200,"%s@%s",username, cli_cfg->prompt);
   return promptstr;
diff --git a/openair2/UTIL/CLI/cli_cmd.c b/openair2/UTIL/CLI/cli_cmd.c
index 366295bf1a0..d1e210e4389 100644
--- a/openair2/UTIL/CLI/cli_cmd.c
+++ b/openair2/UTIL/CLI/cli_cmd.c
@@ -103,7 +103,7 @@ int prompt (char *arg)
     return 0;
 
   if (!arg || !*arg) { // no arg is provided, run get func
-    snprintf(buffer,200,"%s\n", cli_cfg->prompt);
+    snprintf(buffer,256,"%s\n", cli_cfg->prompt);
     send(cli_cfg->cfd, buffer, strlen(buffer), 0);
     // send(cli_cfg->cfd, cli_cfg->prompt, strlen(cli_cfg->prompt), 0);
   } else {// set func
diff --git a/openair2/UTIL/OTG/otg_rx.c b/openair2/UTIL/OTG/otg_rx.c
index 824439e8737..a5b26594eba 100644
--- a/openair2/UTIL/OTG/otg_rx.c
+++ b/openair2/UTIL/OTG/otg_rx.c
@@ -48,10 +48,11 @@ extern unsigned char NB_UE_INST;
 
 //#include "LAYER2/MAC/extern.h"
 
+#undef MAX
 #define MAX(x,y) ((x)>(y)?(x):(y))
+#undef MIN
 #define MIN(x,y) ((x)<(y)?(x):(y))
 
-
 // Check if the packet is well received or not and extract data
 int otg_rx_pkt(const int dst_instanceP, const int ctime, const char * const buffer_tx, const unsigned int size)
 {
diff --git a/openair3/GTPV1-U/gtpv1u_eNB_defs.h b/openair3/GTPV1-U/gtpv1u_eNB_defs.h
index 91f045ace2e..24334d5864c 100644
--- a/openair3/GTPV1-U/gtpv1u_eNB_defs.h
+++ b/openair3/GTPV1-U/gtpv1u_eNB_defs.h
@@ -33,6 +33,8 @@
 #ifndef GTPV1U_ENB_DEFS_H_
 #define GTPV1U_ENB_DEFS_H_
 
+#include "NwGtpv1u.h"
+
 #define GTPV1U_UDP_PORT (2152)
 #define GTPV1U_BEARER_OFFSET 3
 
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 28003f75db4..0b6ce275ba8 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -259,4 +259,9 @@ extern void init_fep_thread(PHY_VARS_eNB *, pthread_attr_t *);
 extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *);
 extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *);
 
+PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
+                          uint8_t UE_id,
+                          uint8_t abstraction_flag);
+void init_eNB_afterRU(void);
+
 #endif
diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c
index e50b0ae34f4..5a03204f1d5 100644
--- a/targets/RT/USER/rt_wrapper.c
+++ b/targets/RT/USER/rt_wrapper.c
@@ -44,6 +44,8 @@
 #include <sys/sysinfo.h>
 #include "rt_wrapper.h"
 
+#include "openair1/PHY/defs.h"
+
 static int latency_target_fd = -1;
 static int32_t latency_target_value = 0;
 /* Latency trick - taken from cyclictest.c
-- 
GitLab