From 78a47159325187df73579317eff4f51702b871ac Mon Sep 17 00:00:00 2001
From: trilyrak <aikaterini.trilyraki@eurecom.fr>
Date: Wed, 17 Feb 2016 13:50:05 +0100
Subject: [PATCH] updated enb configuration params for rrh

---
 openair2/ENB_APP/enb_config.c | 80 ++++++++++++++++++++++++++++++-----
 1 file changed, 70 insertions(+), 10 deletions(-)

diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index b437c7e264..0f6e6b3706 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -177,7 +177,11 @@
 #define ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT               "local_port"
 #define ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT              "remote_port"
 #define ENB_CONFIG_STRING_RRH_GW_ACTIVE                   "active"
-#define ENB_CONFIG_STRING_RRH_GW_PREFERENCE               "preference"
+#define ENB_CONFIG_STRING_RRH_GW_TRANSPORT_PREFERENCE     "tr_preference"
+#define ENB_CONFIG_STRING_RRH_GW_RF_TARGET_PREFERENCE     "rf_preference"
+#define ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT               "iq_txshift"
+#define ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE        "tx_sample_advance"
+#define ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE    "tx_scheduling_advance"
 
 #define ENB_CONFIG_STRING_ASN1_VERBOSITY                   "Asn1_verbosity"
 #define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE              "none"
@@ -291,7 +295,23 @@ static void enb_config_display(void)
 	printf( "\tlocal port     :       \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].local_port);
 	printf( "\tremote address :       \t%s:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_address);
 	printf( "\tremote port    :       \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].remote_port);
-	printf( "\ttransport      :       \t%s Ethernet:\n\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : "UDP");
+	printf( "\ttx_scheduling_advance :\t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_scheduling_advance);
+	printf( "\ttx_sample_advance :    \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].tx_sample_advance);
+	printf( "\tiq_txshift :           \t%d:\n",enb_properties.properties[i]->rrh_gw_config[j].iq_txshift);
+	printf( "\ttransport  :           \t%s Ethernet:\n",(enb_properties.properties[i]->rrh_gw_config[j].raw == 1)? "RAW" : "UDP");
+	if (enb_properties.properties[i]->rrh_gw_config[j].exmimo == 1) {
+	  printf( "\tRF target  :           \tEXMIMO:\n\n");
+	} else if (enb_properties.properties[i]->rrh_gw_config[j].usrp_b200 == 1) {
+	  printf( "\tRF target  :           \tUSRP_B200:\n\n");
+	} else if (enb_properties.properties[i]->rrh_gw_config[j].usrp_x300 == 1) {
+	  printf( "\tRF target  :           \tUSRP_X300:\n\n");
+	} else if (enb_properties.properties[i]->rrh_gw_config[j].bladerf == 1) {
+	  printf( "\tRF target  :           \tBLADERF:\n\n");
+	} else if (enb_properties.properties[i]->rrh_gw_config[j].lmssdr == 1) {
+	  printf( "\tRF target  :           \tLMSSDR:\n\n");
+	} else {
+	  printf( "\tRF target  :           \tNONE:\n\n");
+	}
       }
     }
 
@@ -479,14 +499,14 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
   config_setting_t *setting_rrh_gw                = NULL;
   config_setting_t *setting_enb                   = NULL;
   config_setting_t *setting_otg                   = NULL;
-  config_setting_t *subsetting_otg                   = NULL;
+  config_setting_t *subsetting_otg                = NULL;
   int               num_enb_properties            = 0;
   int               enb_properties_index          = 0;
   int               num_enbs                      = 0;
   int               num_mme_address               = 0;
   int               num_rrh_gw                    = 0;
-  int               num_otg_elements              =0;
-  int               num_component_carriers        =0;
+  int               num_otg_elements              = 0;
+  int               num_component_carriers        = 0;
   int               i                             = 0;
   int               j                             = 0;
   int               parse_errors                  = 0;
@@ -588,6 +608,12 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
   char*             ipv6                          = NULL;
   char*             active                        = NULL;
   char*             preference                    = NULL;
+
+  char*             tr_preference                 = NULL;
+  char*             rf_preference                 = NULL;
+  libconfig_int     tx_scheduling_advance         = 0;
+  libconfig_int     tx_sample_advance             = 0;
+  libconfig_int     iq_txshift                    = 0;
   libconfig_int     local_port                    = 0;
   libconfig_int     remote_port                   = 0;
   const char*       active_enb[MAX_ENB];
@@ -2180,7 +2206,11 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
                    && config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_LOCAL_PORT, &local_port)
                    && config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_REMOTE_PORT, &remote_port)
                    && config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_ACTIVE, (const char **)&active)
-                   && config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_PREFERENCE, (const char **)&preference)
+		   && config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TRANSPORT_PREFERENCE, (const char **)&tr_preference)
+		   && config_setting_lookup_string(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_RF_TARGET_PREFERENCE, (const char **)&rf_preference)
+		   && config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_IQ_TXSHIFT, &iq_txshift) 
+		   && config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SAMPLE_ADVANCE, &tx_sample_advance)
+		   && config_setting_lookup_int(setting_rrh_gw, ENB_CONFIG_STRING_RRH_GW_TX_SCHEDULING_ADVANCE, &tx_scheduling_advance)
                  )
               ) {
               AssertError (0, parse_errors ++,
@@ -2194,21 +2224,43 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
 	    enb_properties.properties[enb_properties_index]->rrh_gw_if_name = strdup(if_name);
             enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_address  = strdup(ipv4);
             enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_address = strdup(ipv4_remote);
-	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port= local_port;
-	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port= remote_port;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].local_port = local_port;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].remote_port = remote_port;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].iq_txshift = iq_txshift;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_sample_advance = tx_sample_advance;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_scheduling_advance= tx_scheduling_advance;
 
             if (strcmp(active, "yes") == 0) {
               enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 1;
             } 
 
-            if (strcmp(preference, "udp") == 0) {
+            if (strcmp(tr_preference, "udp") == 0) {
               enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
-            } else if (strcmp(preference, "raw") == 0) {
+            } else if (strcmp(tr_preference, "raw") == 0) {
               enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
             } else {//if (strcmp(preference, "no") == 0) 
               enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 1;
               enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 1;
             }
+
+	    if (strcmp(rf_preference, "exmimo") == 0) {
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
+            } else if (strcmp(rf_preference, "usrp_b200") == 0) {
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
+	    } else if (strcmp(rf_preference, "usrp_x300") == 0) {
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
+            } else if (strcmp(rf_preference, "bladerf") == 0) {
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;
+	    } else if (strcmp(rf_preference, "bladerf") == 0) {
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;	      
+            } else {//if (strcmp(preference, "no") == 0) 
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 1;
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 1;
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 1;
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 1;    
+              enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 1;    
+
+            }
           }
 	  } else {
 	    enb_properties.properties[enb_properties_index]->nb_rrh_gw = 0;	    
@@ -2220,6 +2272,14 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP)
 	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].active = 0;	    
 	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].udp = 0;
 	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].raw = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_scheduling_advance = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].tx_sample_advance = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].iq_txshift = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].exmimo = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_b200 = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].usrp_x300 = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].bladerf = 0;
+	    enb_properties.properties[enb_properties_index]->rrh_gw_config[j].lmssdr = 0;
 	  }
 
           // SCTP SETTING
-- 
GitLab