From bd7b0ead3acfd3fab26b2f3d35a29e8f7a0f2588 Mon Sep 17 00:00:00 2001
From: Florian Kaltenberger <florian.kaltenberger@eurecom.fr>
Date: Fri, 10 Apr 2015 13:30:16 +0000
Subject: [PATCH] merges from branch regarding openair1

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7119 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair1/Makefile                             |  2 +-
 openair1/PHY/CODING/TESTBENCH/Makefile        |  4 +--
 openair1/PHY/LTE_TRANSPORT/print_stats.c      |  9 ++---
 openair1/SCHED/phy_procedures_lte_eNb.c       |  2 +-
 openair1/SCHED/phy_procedures_lte_ue.c        | 35 +++++++++----------
 .../SIMULATION/ETH_TRANSPORT/netlink_init.c   | 10 ++++--
 openair1/SIMULATION/LTE_PHY/Makefile          |  4 +--
 openair1/SIMULATION/RF/Makefile               |  2 +-
 8 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/openair1/Makefile b/openair1/Makefile
index 521528d119b..04be9ff8b0e 100644
--- a/openair1/Makefile
+++ b/openair1/Makefile
@@ -3,7 +3,7 @@
 # these flags have to be explicitely exported so that the sub-make is aware of them
 
 
-include $(OPENAIR_HOME)/common/utils/Makefile.inc
+include $(OPENAIR_DIR)/common/utils/Makefile.inc
 ifndef OPENAIR_LTE
 export OPENAIR_LTE=1
 endif
diff --git a/openair1/PHY/CODING/TESTBENCH/Makefile b/openair1/PHY/CODING/TESTBENCH/Makefile
index 1cd9516d436..a8ddd1fcb55 100644
--- a/openair1/PHY/CODING/TESTBENCH/Makefile
+++ b/openair1/PHY/CODING/TESTBENCH/Makefile
@@ -1,6 +1,6 @@
-include $(OPENAIR_HOME)/common/utils/Makefile.inc
+include $(OPENAIR_DIR)/common/utils/Makefile.inc
 
-COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils
+COMMON_UTILS_DIR = $(OPENAIR_DIR)/common/utils
 TOP_DIR = $(OPENAIR1_DIR)
 OPENAIR1_TOP = $(OPENAIR1_DIR)
 OPENAIR2_TOP = $(OPENAIR2_DIR)
diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c
index bd9032e6b2e..3316b8aaa67 100644
--- a/openair1/PHY/LTE_TRANSPORT/print_stats.c
+++ b/openair1/PHY/LTE_TRANSPORT/print_stats.c
@@ -46,10 +46,11 @@
 
 #ifdef OPENAIR2
 #include "../openair2/LAYER2/MAC/proto.h"
+#include "../openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
 #endif
 
 extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
-#if defined(USRP) || defined(EXMIMO)
+#if defined(OAI_USRP) || defined(EXMIMO)
 #include "common_lib.h"
 extern openair0_config_t openair0_cfg[];
 #endif
@@ -86,7 +87,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
 #ifdef EXMIMO
     len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, openair0_cfg[0].rxg_mode[0],(int)openair0_cfg[0].rx_gain[0]);
 #endif
-#ifdef USRP
+#ifdef OAI_USRP
     len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
 #endif
 
@@ -451,7 +452,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
       }
 
 #ifdef OPENAIR2
-      RRC_status = mac_get_rrc_status(phy_vars_ue->Mod_id,0,0);
+      RRC_status = mac_UE_get_rrc_status(phy_vars_ue->Mod_id, 0);
       len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
 #endif
       len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f, RSRQ[0] %.2f\n",
@@ -661,7 +662,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length)
       UE_id_mac = find_UE_id(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti);
 
       if (UE_id_mac != -1) {
-        RRC_status = mac_get_rrc_status(phy_vars_eNB->Mod_id,1,UE_id_mac);
+        RRC_status = mac_eNB_get_rrc_status(phy_vars_eNB->Mod_id,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti);
         len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status);
       } else
         len += sprintf(&buffer[len],"[eNB PROC] UE_id_mac = -1\n");
diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c
index 1966a8c0c0b..d2433eb3a1a 100755
--- a/openair1/SCHED/phy_procedures_lte_eNb.c
+++ b/openair1/SCHED/phy_procedures_lte_eNb.c
@@ -2545,7 +2545,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
   phy_procedures_emos_eNB_TX(subframe, phy_vars_eNB);
 #endif
 
-#if !(defined(EXMIMO) || defined(USRP) || defined (CPRIGW))
+#if !(defined(EXMIMO) || defined(OAI_USRP) || defined (CPRIGW))
 
   if (abstraction_flag==0)
   {
diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c
index cf90f7ccb7c..c3500b01d58 100755
--- a/openair1/SCHED/phy_procedures_lte_ue.c
+++ b/openair1/SCHED/phy_procedures_lte_ue.c
@@ -122,7 +122,7 @@ extern int rx_sig_fifo;
 #endif
 
 
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
 extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
 #endif
 
@@ -619,7 +619,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
   uint8_t ack_status=0;
   int8_t Po_PUCCH;
   int32_t ulsch_start=0;
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
   int overflow=0;
   int k,l;
 #endif
@@ -934,7 +934,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
 
           LOG_D(PHY,"[UE  %d][PUSCH %d] Frame %d subframe %d, generating PUSCH, Po_PUSCH: %d dBm, amp %d\n",
                 Mod_id,harq_pid,frame_tx,subframe_tx,phy_vars_ue->tx_power_dBm,
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                 get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm)
 #else
                 AMP
@@ -942,7 +942,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                );
           start_meas(&phy_vars_ue->ulsch_modulation_stats);
           ulsch_modulation(phy_vars_ue->lte_ue_common_vars.txdataF,
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                            get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),
 #else
                            AMP,
@@ -951,8 +951,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                            subframe_tx,
                            &phy_vars_ue->lte_frame_parms,
                            phy_vars_ue->ulsch_ue[eNB_id]);
-
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
 
           for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
             generate_drs_pusch(phy_vars_ue,eNB_id,get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm),subframe_tx,first_rb,nb_rb,aa);
@@ -1041,7 +1040,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                   frame_tx, subframe_tx,
                   phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
                   Po_PUCCH,
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                   get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm)
 #else
                   AMP
@@ -1054,7 +1053,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                   frame_tx, subframe_tx,
                   n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
                   Po_PUCCH,
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                   get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm)
 #else
                   AMP
@@ -1073,7 +1072,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                            0,  // n2_pucch
                            1,  // shortened format
                            pucch_ack_payload,
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                            get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm),
 #else
                            AMP,
@@ -1119,7 +1118,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                            0,  // n2_pucch
                            1,  // shortened format
                            pucch_ack_payload,  // this is ignored anyway, we just need a pointer
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                            get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm),
 #else
                            AMP,
@@ -1199,7 +1198,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
       if (abstraction_flag == 0) {
         nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
 
-#if defined(EXMIMO) || defined(USRP) //this is the EXPRESS MIMO case
+#if defined(EXMIMO) || defined(OAI_USRP) //this is the EXPRESS MIMO case
         ulsch_start = (phy_vars_ue->rx_offset+subframe_tx*frame_parms->samples_per_tti-
                        openair_daq_vars.timing_advance-
                        phy_vars_ue->timing_advance-
@@ -1223,7 +1222,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
           for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
             if (frame_parms->Ncp == 1)
               PHY_ofdm_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                            dummy_tx_buffer,
 #else
                            &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
@@ -1236,7 +1235,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
                            CYCLIC_PREFIX);
             else
               normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
                                 dummy_tx_buffer,
 #else
                                 &phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
@@ -1257,7 +1256,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
               }
             */
 #ifndef OFDMA_ULSCH
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
             apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,0);
             apply_7_5_kHz(phy_vars_ue,dummy_tx_buffer,1);
 #else
@@ -1272,7 +1271,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
             */
 #endif
 
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
             overflow = ulsch_start - 9*frame_parms->samples_per_tti;
 
             //if ((slot_tx==4) && (aa==0)) printf("ulsch_start %d, overflow %d\n",ulsch_start,overflow);
@@ -1358,7 +1357,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
 
             phy_vars_ue->tx_total_RE = 96;
 
-#if defined(EXMIMO) || defined(USRP)
+#if defined(EXMIMO) || defined(OAI_USRP)
             phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = get_tx_amp(phy_vars_ue->tx_power_dBm,phy_vars_ue->tx_power_max_dBm);
 #else
             phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp = AMP;
@@ -1560,7 +1559,7 @@ void lte_ue_measurement_procedures(uint16_t l, PHY_VARS_UE *phy_vars_ue,uint8_t
         gain_control_all(phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB_id],0);
 
 #else
-#ifndef USRP
+#ifndef OAI_USRP
     phy_adjust_gain (phy_vars_ue,0);
 #endif
 #endif
@@ -3622,7 +3621,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstr
 
   vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
 #if defined(EXMIMO)
-#ifndef USRP
+#ifndef OAI_USRP
   vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX, *((volatile unsigned int *) openair0_exmimo_pci[0].rxcnt_ptr[0]));
 #endif
 #endif
diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
index 95f82bba15a..bb1b9fcb07e 100644
--- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
+++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c
@@ -68,17 +68,21 @@ int netlink_init(void)
 
   if (nas_sock_fd == -1) {
     printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd,errno, strerror(errno));
-    //        exit(1);
+#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
+    exit(1);
+#endif
   }
 
   printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd);
 
-#if !defined(ENABLE_PDCP_NETLINK_FIFO)
+#if !defined(USE_PDCP_NETLINK_QUEUES)
   ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK);
 
   if (ret == -1) {
     printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
-    //      exit(1);
+#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
+    exit(1);
+#endif
   }
 
 #endif
diff --git a/openair1/SIMULATION/LTE_PHY/Makefile b/openair1/SIMULATION/LTE_PHY/Makefile
index ebed4a94efe..09b6cc66cda 100644
--- a/openair1/SIMULATION/LTE_PHY/Makefile
+++ b/openair1/SIMULATION/LTE_PHY/Makefile
@@ -1,6 +1,6 @@
-include $(OPENAIR_HOME)/common/utils/Makefile.inc
+include $(OPENAIR_DIR)/common/utils/Makefile.inc
 
-COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils
+COMMON_UTILS_DIR = $(OPENAIR_DIR)/common/utils
 TOP_DIR = $(OPENAIR1_DIR)
 OPENAIR1_TOP = $(OPENAIR1_DIR)
 OPENAIR2_TOP = $(OPENAIR2_DIR)
diff --git a/openair1/SIMULATION/RF/Makefile b/openair1/SIMULATION/RF/Makefile
index 052970d0d64..5b713b1d947 100644
--- a/openair1/SIMULATION/RF/Makefile
+++ b/openair1/SIMULATION/RF/Makefile
@@ -1,4 +1,4 @@
-include $(OPENAIR_HOME)/common/utils/Makefile.inc
+include $(OPENAIR_DIR)/common/utils/Makefile.inc
 OBJS = rf.o ../../PHY/TOOLS/file_output.o ../TOOLS/rangen_double.o
 CFLAGS += -DRF_MAIN -DUSER_MODE -DDEBUG_PHY 
 
-- 
GitLab