From 6b6154102f92f2a0290cbaa70bc88e4a5cf46f0f Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Tue, 12 Aug 2014 12:17:17 +0000
Subject: [PATCH] add configuration for component carriers

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5707 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair1/PHY/defs.h                           |   4 +-
 openair2/ENB_APP/enb_config.c                 | 259 ++++++++++++++++--
 openair2/ENB_APP/enb_config.h                 |  23 +-
 .../CONF/enb.centos.memphis.conf              |  39 ++-
 .../GENERIC-LTE-EPC/CONF/enb.centos.nord.conf |  31 ++-
 targets/RT/USER/Makefile                      |   2 +
 targets/RT/USER/lte-softmodem.c               |  87 ++++--
 targets/RT/USER/sched_dlsch.c                 |   1 +
 8 files changed, 396 insertions(+), 50 deletions(-)

diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h
index c8743b5578..b8898ee100 100755
--- a/openair1/PHY/defs.h
+++ b/openair1/PHY/defs.h
@@ -140,8 +140,8 @@ enum transmission_access_mode{
 
 /// Context data structure for eNB subframe processing
 typedef struct {
-  /// Component Carrier index
-  int CC_id;
+ /// Component Carrier index
+  uint8_t              CC_id;
   /// subframe index
   int subframe;
   /// subframe to act upon for transmission 
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 3463afa746..b095b13944 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -15,8 +15,8 @@
 
     You should have received a copy of the GNU General Public License
     along with OpenAirInterface.The full GNU General Public License is
-   included in this distribution in the file called "COPYING". If not,
-   see <http://www.gnu.org/licenses/>.
+    included in this distribution in the file called "COPYING". If not,
+    see <http://www.gnu.org/licenses/>.
 
   Contact Information
   OpenAirInterface Admin: openair_admin@eurecom.fr
@@ -30,9 +30,9 @@
 /*
                                 enb_config.c
                              -------------------
-  AUTHOR  : Lionel GAUTHIER, Laurent Winckel
+  AUTHOR  : Lionel GAUTHIER, navid nikaein, Laurent Winckel
   COMPANY : EURECOM
-  EMAIL   : Lionel.Gauthier@eurecom.fr
+  EMAIL   : Lionel.Gauthier@eurecom.fr, navid.nikaein@eurecom.fr
 */
 
 #include <string.h>
@@ -40,6 +40,7 @@
 #include <inttypes.h>
 
 #include "log.h"
+#include "log_extern.h"
 #include "assertions.h"
 #include "enb_config.h"
 #if defined(OAI_EMU)
@@ -77,6 +78,10 @@
 #define ENB_CONFIG_STRING_DOWNLINK_FREQUENCY            "downlink_frequency"
 #define ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET       "uplink_frequency_offset"
 
+#define ENB_CONFIG_STRING_COMPONENT_CARRIERS            "component_carriers"
+#define ENB_CONFIG_STRING_CELL_ID                       "cell_id"
+#define ENB_CONFIG_STRING_N_RB_DL                       "N_RB_DL"
+
 #define ENB_CONFIG_STRING_MME_IP_ADDRESS                "mme_ip_address"
 #define ENB_CONFIG_STRING_MME_IPV4_ADDRESS              "ipv4"
 #define ENB_CONFIG_STRING_MME_IPV6_ADDRESS              "ipv6"
@@ -96,6 +101,26 @@
 #define ENB_CONFIG_STRING_ASN1_VERBOSITY_INFO                 "info"
 
 
+// per eNB configuration 
+#define ENB_CONFIG_STRING_LOG_CONFIG                       "log_config"
+#define ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL                 "global_log_level"
+#define ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY              "global_log_verbosity"
+#define ENB_CONFIG_STRING_HW_LOG_LEVEL                    "hw_log_level"
+#define ENB_CONFIG_STRING_HW_LOG_VERBOSITY                "hw_log_verbosity"
+#define ENB_CONFIG_STRING_PHY_LOG_LEVEL                    "phy_log_level"
+#define ENB_CONFIG_STRING_PHY_LOG_VERBOSITY                "phy_log_verbosity"
+#define ENB_CONFIG_STRING_MAC_LOG_LEVEL                    "mac_log_level"
+#define ENB_CONFIG_STRING_MAC_LOG_VERBOSITY                "mac_log_verbosity"
+#define ENB_CONFIG_STRING_RLC_LOG_LEVEL                    "rlc_log_level"
+#define ENB_CONFIG_STRING_RLC_LOG_VERBOSITY                "rlc_log_verbosity"
+#define ENB_CONFIG_STRING_PDCP_LOG_LEVEL                   "pdcp_log_level"
+#define ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY               "pdcp_log_verbosity"
+#define ENB_CONFIG_STRING_RRC_LOG_LEVEL                    "rrc_log_level"
+#define ENB_CONFIG_STRING_RRC_LOG_VERBOSITY                "rrc_log_verbosity"
+
+
+
+
 #define KHz (1000UL)
 #define MHz (1000 * KHz)
 
@@ -141,24 +166,37 @@ static const eutra_band_t eutra_bands[] =
 static Enb_properties_array_t enb_properties;
 
 static void enb_config_display(void) {
-    int i;
+  int i,j;
 
     printf( "\n----------------------------------------------------------------------\n");
     printf( " ENB CONFIG FILE CONTENT LOADED (TBC):\n");
     printf( "----------------------------------------------------------------------\n");
     for (i = 0; i < enb_properties.number; i++) {
-        printf( "ENB CONFIG no %u:\n\n", i);
-        printf( "\teNB name:     \t%s:\n",enb_properties.properties[i]->eNB_name);
-        printf( "\teNB ID:       \t%u:\n",enb_properties.properties[i]->eNB_id);
-        printf( "\tCell type:    \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
-        printf( "\tTAC:          \t%u:\n",enb_properties.properties[i]->tac);
-        printf( "\tMCC:          \t%u:\n",enb_properties.properties[i]->mcc);
-        printf( "\tMNC:          \t%u:\n",enb_properties.properties[i]->mnc);
-	printf( "\teutra band:   \t%d:\n",enb_properties.properties[i]->eutra_band);
-        printf( "\tdownlink freq:\t%u:\n",enb_properties.properties[i]->downlink_frequency);
-        printf( "\tuplink freq:  \t%d:\n",enb_properties.properties[i]->uplink_frequency_offset);
-
-        printf( "\n--------------------------------------------------------\n");
+        printf( "ENB CONFIG for instance %u:\n\n", i);
+        printf( "\teNB name:           \t%s:\n",enb_properties.properties[i]->eNB_name);
+        printf( "\teNB ID:             \t%u:\n",enb_properties.properties[i]->eNB_id);
+        printf( "\tCell type:          \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
+        printf( "\tTAC:                \t%u:\n",enb_properties.properties[i]->tac);
+        printf( "\tMCC:                \t%u:\n",enb_properties.properties[i]->mcc);
+        printf( "\tMNC:                \t%u:\n",enb_properties.properties[i]->mnc);
+	printf( "\teutra band:         \t%d:\n",enb_properties.properties[i]->eutra_band);
+        printf( "\tdownlink freq:      \t%u:\n",enb_properties.properties[i]->downlink_frequency);
+        printf( "\tuplink freq:        \t%d:\n",enb_properties.properties[i]->uplink_frequency_offset);
+
+	for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
+	  printf( "\n\tCell ID for CC %d:\t%d:\n",j,enb_properties.properties[i]->cell_id[j]);
+	  printf( "\tN_RB_DL for CC %d:\t%d:\n",j,enb_properties.properties[i]->N_RB_DL[j]);
+	}
+	
+      	printf( "\n\tGlobal log level:  \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->glog_level));
+	printf( "\tHW log level:      \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->hw_log_level));
+	printf( "\tPHY log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->phy_log_level));
+	printf( "\tMAC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->mac_log_level));
+	printf( "\tRLC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->rlc_log_level));
+	printf( "\tPDCP log level:    \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->pdcp_log_level));
+	printf( "\tRRC log level:     \t%s\n", map_int_to_str(log_level_names,enb_properties.properties[i]->rrc_log_level));
+	 
+	printf( "\n--------------------------------------------------------\n");
     }
 }
 
@@ -214,6 +252,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
   config_t          cfg;
   config_setting_t *setting                       = NULL;
   config_setting_t *subsetting                    = NULL;
+  config_setting_t *setting_component_carriers    = NULL;
+  config_setting_t *component_carrier             = NULL;
   config_setting_t *setting_mme_addresses         = NULL;
   config_setting_t *setting_mme_address           = NULL;
   config_setting_t *setting_enb                   = NULL;
@@ -221,6 +261,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
   int               enb_properties_index          = 0;
   int               num_enbs;
   int               num_mme_address;
+  int               num_component_carriers        =0;
   int               i;
   int               j;
   int               parse_errors                  = 0;
@@ -238,6 +279,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
   long int          eutra_band;
   long long int     downlink_frequency;
   long int          uplink_frequency_offset;
+  long int          cell_id[MAX_NUM_CCs];
+  long int          N_RB_DL[MAX_NUM_CCs];
   char*             ipv4                          = NULL;
   char*             ipv6                          = NULL;
   char*             active                        = NULL;
@@ -250,6 +293,20 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
   char             *address                       = NULL;
   char             *cidr                          = NULL;
   char             *astring                       = NULL;
+  char*          glog_level                   = NULL;
+  char*          glog_verbosity               = NULL;
+  char*          hw_log_level                = NULL;
+  char*          hw_log_verbosity            = NULL;
+  char*          phy_log_level                = NULL;
+  char*          phy_log_verbosity            = NULL;
+  char*          mac_log_level                = NULL;
+  char*          mac_log_verbosity            = NULL;
+  char*          rlc_log_level                = NULL;
+  char*          rlc_log_verbosity            = NULL;
+  char*          pdcp_log_level               = NULL;
+  char*          pdcp_log_verbosity           = NULL;
+  char*          rrc_log_level                = NULL;
+  char*          rrc_log_verbosity            = NULL;
 
   memset((char*) (enb_properties.properties), 0 , MAX_ENB * sizeof(Enb_properties_t *));
   memset((char*)active_enb,     0 , MAX_ENB * sizeof(char*));
@@ -423,22 +480,22 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
 
                   if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_EUTRA_BAND, &eutra_band)) {
                       enb_properties.properties[enb_properties_index]->eutra_band = eutra_band;
-                      printf( "\teutra band:\t%d\n",enb_properties.properties[enb_properties_index]->eutra_band);
+		      // printf( "\teutra band:\t%d\n",enb_properties.properties[enb_properties_index]->eutra_band);
                   } else {
                       enb_properties.properties[enb_properties_index]->eutra_band = 7; // Default band
-                      printf( "\teutra band:\t%d (default)\n",enb_properties.properties[enb_properties_index]->eutra_band);
+                      //printf( "\teutra band:\t%d (default)\n",enb_properties.properties[enb_properties_index]->eutra_band);
                   }
 
                   if(config_setting_lookup_int64(setting_enb, ENB_CONFIG_STRING_DOWNLINK_FREQUENCY, &downlink_frequency)) {
                       enb_properties.properties[enb_properties_index]->downlink_frequency = (uint32_t) downlink_frequency;
-                      printf( "\tdownlink freq:\t%u\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
+                      //printf( "\tdownlink freq:\t%u\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
                   } else {
                       enb_properties.properties[enb_properties_index]->downlink_frequency = 2680000000UL; // Default downlink frequency
-                      printf( "\tdownlink freq:\t%u (default)\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
+		      // printf( "\tdownlink freq:\t%u (default)\n",enb_properties.properties[enb_properties_index]->downlink_frequency);
                   }
                   if(config_setting_lookup_int(setting_enb, ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET, &uplink_frequency_offset)) {
                       enb_properties.properties[enb_properties_index]->uplink_frequency_offset = (unsigned int) uplink_frequency_offset;
-                      printf( "\tuplink freq offset:\t%ld\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
+                      //printf( "\tuplink freq offset:\t%ld\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
                   } else {
                       // Default uplink frequency offset
                       if (enb_properties.properties[enb_properties_index]->frame_type == FDD) {
@@ -446,7 +503,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
                       } else {
                           enb_properties.properties[enb_properties_index]->uplink_frequency_offset = 0;
                       }
-                      printf( "\tuplink freq offset:\t%ld (default)\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
+                      //printf( "\tuplink freq offset:\t%ld (default)\n",enb_properties.properties[enb_properties_index]->uplink_frequency_offset);
                   }
 
                   parse_errors += enb_check_band_frequencies(lib_config_file_name_pP,
@@ -456,6 +513,36 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
                                              enb_properties.properties[enb_properties_index]->uplink_frequency_offset,
                                              enb_properties.properties[enb_properties_index]->frame_type);
 
+		  setting_component_carriers = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_COMPONENT_CARRIERS);
+		  enb_properties.properties[enb_properties_index]->nb_cc = 0;
+		  if(setting_component_carriers != NULL) { 
+
+		    num_component_carriers     = config_setting_length(setting_component_carriers);  
+		    //printf("num component carrier %d \n", num_component_carriers);
+		    //enb_properties.properties[enb_properties_index]->nb_cc = num_component_carriers; 
+		    for (j = 0; j < num_component_carriers /*&& j < MAX_NUM_CCs*/; j++) {
+		      component_carrier = config_setting_get_elem(setting_component_carriers, j);
+		      if(!(config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CELL_ID, &cell_id[j]) && 
+			   config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_N_RB_DL, &N_RB_DL[j])   )
+			 ){
+			AssertError (0, parse_errors ++,
+				     "Failed to parse eNB configuration file %s, Component Carrier!\n",
+				     lib_config_file_name_pP);
+		      }
+		      enb_properties.properties[enb_properties_index]->nb_cc++;
+		      enb_properties.properties[enb_properties_index]->cell_id[j]= cell_id[j];
+		      enb_properties.properties[enb_properties_index]->N_RB_DL[j]= N_RB_DL[j];
+		      //printf("adding component carrier %d\n", j);
+		    }
+		    
+		  } else {
+		    for (j=0; j< MAX_NUM_CCs; j++) {
+		      enb_properties.properties[enb_properties_index]->nb_cc +=1;
+		      enb_properties.properties[enb_properties_index]->cell_id[j]=j;
+		      enb_properties.properties[enb_properties_index]->N_RB_DL[j]=25;
+		    }
+		  }
+		  
                   setting_mme_addresses = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_MME_IP_ADDRESS);
                   num_mme_address     = config_setting_length(setting_mme_addresses);
                   enb_properties.properties[enb_properties_index]->nb_mme = 0;
@@ -492,6 +579,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
                           enb_properties.properties[enb_properties_index]->mme_ip_address[j].ipv6 = 1;
                       }
                   }
+		  // NETWORK_INTERFACES
                   subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
                   if(subsetting != NULL) {
                       if(  (
@@ -520,6 +608,131 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
                           }
                       }
                   }
+		  // log_config 
+		  subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_LOG_CONFIG);
+                  if(subsetting != NULL) {
+		    // global 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_LEVEL, (const char **)  &glog_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->glog_level = map_str_to_int(log_level_names, glog_level)) == -1)
+			enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
+		      //printf( "\tGlobal log level :\t%s->%d\n",glog_level, enb_properties.properties[enb_properties_index]->glog_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,(const char **)  &glog_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->glog_verbosity = map_str_to_int(log_verbosity_names, glog_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED;
+		      //printf( "\tGlobal log verbosity:\t%s->%d\n",glog_verbosity, enb_properties.properties[enb_properties_index]->glog_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED; 
+		    } 
+		    // HW
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_LEVEL, (const char **) &hw_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->hw_log_level = map_str_to_int(log_level_names,hw_log_level)) == -1)
+			enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
+                      //printf( "\tHW log level :\t%s->%d\n",hw_log_level,enb_properties.properties[enb_properties_index]->hw_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_HW_LOG_VERBOSITY, (const char **) &hw_log_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->hw_log_verbosity = map_str_to_int(log_verbosity_names,hw_log_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED;
+                      //printf( "\tHW log verbosity:\t%s->%d\n",hw_log_verbosity, enb_properties.properties[enb_properties_index]->hw_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED; 
+		    } 
+		    // phy 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_LEVEL,(const char **) &phy_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->phy_log_level = map_str_to_int(log_level_names,phy_log_level)) == -1)
+			enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
+                      //printf( "\tPHY log level :\t%s->%d\n",phy_log_level,enb_properties.properties[enb_properties_index]->phy_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PHY_LOG_VERBOSITY, (const char **)&phy_log_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->phy_log_verbosity = map_str_to_int(log_verbosity_names,phy_log_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
+                      //printf( "\tPHY log verbosity:\t%s->%d\n",phy_log_level,enb_properties.properties[enb_properties_index]->phy_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
+		    } 
+		    //mac 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_LEVEL, (const char **)&mac_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->mac_log_level = map_str_to_int(log_level_names,mac_log_level)) == -1 )
+			enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
+                      //printf( "\tMAC log level :\t%s->%d\n",mac_log_level,enb_properties.properties[enb_properties_index]->mac_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_MAC_LOG_VERBOSITY, (const char **)&mac_log_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->mac_log_verbosity = map_str_to_int(log_verbosity_names,mac_log_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED; 
+                      //printf( "\tMAC log verbosity:\t%s->%d\n",mac_log_verbosity,enb_properties.properties[enb_properties_index]->mac_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED; 
+		    } 
+		    //rlc
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_LEVEL, (const char **)&rlc_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->rlc_log_level = map_str_to_int(log_level_names,rlc_log_level)) == -1)
+			enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
+                      //printf( "\tRLC log level :\t%s->%d\n",rlc_log_level, enb_properties.properties[enb_properties_index]->rlc_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RLC_LOG_VERBOSITY, (const char **)&rlc_log_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->rlc_log_verbosity = map_str_to_int(log_verbosity_names,rlc_log_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED; 
+                      //printf( "\tRLC log verbosity:\t%s->%d\n",rlc_log_verbosity, enb_properties.properties[enb_properties_index]->rlc_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED; 
+		    } 
+		    //pdcp 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_LEVEL, (const char **)&pdcp_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->pdcp_log_level = map_str_to_int(log_level_names,pdcp_log_level)) == -1)
+			enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
+                      //printf( "\tPDCP log level :\t%s->%d\n",pdcp_log_level, enb_properties.properties[enb_properties_index]->pdcp_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_PDCP_LOG_VERBOSITY, (const char **)&pdcp_log_verbosity)) {
+                      enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = map_str_to_int(log_verbosity_names,pdcp_log_verbosity);
+                      //printf( "\tPDCP log verbosity:\t%s->%d\n",pdcp_log_verbosity, enb_properties.properties[enb_properties_index]->pdcp_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = LOG_MED; 
+		    } 
+		    //rrc
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_LEVEL, (const char **)&rrc_log_level)) {
+                      if ((enb_properties.properties[enb_properties_index]->rrc_log_level = map_str_to_int(log_level_names,rrc_log_level)) == -1 )
+			enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
+                      //printf( "\tRRC log level :\t%s->%d\n",rrc_log_level,enb_properties.properties[enb_properties_index]->rrc_log_level);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
+		    } 
+		    if(config_setting_lookup_string(subsetting, ENB_CONFIG_STRING_RRC_LOG_VERBOSITY, (const char **)&rrc_log_verbosity)) {
+                      if ((enb_properties.properties[enb_properties_index]->rrc_log_verbosity = map_str_to_int(log_verbosity_names,rrc_log_verbosity)) == -1)
+			enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
+                      //printf( "\tRRC log verbosity:\t%s->%d\n",rrc_log_verbosity,enb_properties.properties[enb_properties_index]->rrc_log_verbosity);
+		    } else {
+                      enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
+		    } 
+		    
+                  } else { // not configuration is given 
+		    enb_properties.properties[enb_properties_index]->glog_level = LOG_INFO; 
+		    enb_properties.properties[enb_properties_index]->glog_verbosity = LOG_MED; 
+		    enb_properties.properties[enb_properties_index]->hw_log_level = LOG_INFO;
+		    enb_properties.properties[enb_properties_index]->hw_log_verbosity = LOG_MED; 
+		    enb_properties.properties[enb_properties_index]->phy_log_level = LOG_INFO;
+		    enb_properties.properties[enb_properties_index]->phy_log_verbosity = LOG_MED; 
+		    enb_properties.properties[enb_properties_index]->mac_log_level = LOG_INFO; 
+		    enb_properties.properties[enb_properties_index]->mac_log_verbosity = LOG_MED;
+		    enb_properties.properties[enb_properties_index]->rlc_log_level = LOG_INFO; 
+		    enb_properties.properties[enb_properties_index]->rlc_log_verbosity = LOG_MED;
+		    enb_properties.properties[enb_properties_index]->pdcp_log_level = LOG_INFO; 
+		    enb_properties.properties[enb_properties_index]->pdcp_log_verbosity = LOG_MED; 
+		    enb_properties.properties[enb_properties_index]->rrc_log_level = LOG_INFO; 
+		    enb_properties.properties[enb_properties_index]->rrc_log_verbosity = LOG_MED; 
+		  }
+
                   enb_properties_index += 1;
                   break;
               }
diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h
index 3e5569b813..8e0d0bbc50 100755
--- a/openair2/ENB_APP/enb_config.h
+++ b/openair2/ENB_APP/enb_config.h
@@ -100,7 +100,12 @@ typedef struct Enb_properties_s {
     int16_t             eutra_band;
     uint32_t            downlink_frequency;
     int32_t             uplink_frequency_offset;
-
+  
+  /* Nb of component carrier for a given enb */
+  int16_t                 nb_cc;
+  int16_t                 cell_id[2];//cell_id[MAX_NUM_CCs];// for testing, change later
+  int16_t                 N_RB_DL[2];//N_RB_DL[MAX_NUM_CCs];// for testing, change later
+  
     /* Nb of MME to connect to */
     uint8_t             nb_mme;
     /* List of MME to connect to */
@@ -112,6 +117,22 @@ typedef struct Enb_properties_s {
     char               *enb_interface_name_for_S1_MME;
     in_addr_t           enb_ipv4_address_for_S1_MME;
 
+  // log config
+  int16_t           glog_level;
+  int16_t           glog_verbosity;
+  int16_t           hw_log_level;
+  int16_t           hw_log_verbosity;
+  int16_t           phy_log_level;
+  int16_t           phy_log_verbosity;
+  int16_t           mac_log_level;
+  int16_t           mac_log_verbosity;
+  int16_t           rlc_log_level;
+  int16_t           rlc_log_verbosity;
+  int16_t           pdcp_log_level;
+  int16_t           pdcp_log_verbosity;
+  int16_t           rrc_log_level;
+  int16_t           rrc_log_verbosity;
+
 } Enb_properties_t;
 
 typedef struct Enb_properties_array_s {
diff --git a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf
index 20b613fb7b..d8fa9fbe6a 100755
--- a/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf
+++ b/targets/PROJECTS/CENTOS-LTE-EPC-INTEGRATION/CONF/enb.centos.memphis.conf
@@ -30,22 +30,53 @@ eNBs =
     downlink_frequency      = 2680000000L;
     uplink_frequency_offset = -120000000;
     
+    component_carriers = (
+    		       	 {
+			 cell_id                 = 0;
+                         N_RB_DL                 = 25;
+			 },
+			 {
+			 cell_id		 = 1; 
+			 N_RB_DL                 = 50;
+			 }  
+			 );
+    
+
     ////////// MME parameters:
-    mme_ip_address      = ( { ipv4       = "192.168.14.11";
+    mme_ip_address      = ( { ipv4       = "192.168.13.11";
                               ipv6       = "192:168:30::17";
                               active     = "yes";
                               preference = "ipv4";
                             }
-                          );
+			    );
 
     NETWORK_INTERFACES : 
     {
         ENB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.14.10/24";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.13.10/24";
 
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
-        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.14.10/24";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.13.10/24";
     };
+# available options for level:   error, warn, notice, info, debug, trace
+# available options for verbosity: none, low, medium, high, full
+    log_config : 
+    {
+	global_log_level                      ="debug"; 
+    	global_log_verbosity                  ="medium";
+	hw_log_level                          ="debug"; 
+    	hw_log_verbosity                      ="medium";
+	phy_log_level                         ="info"; 
+    	phy_log_verbosity                     ="medium";
+	mac_log_level                         ="debug"; 
+    	mac_log_verbosity                     ="high";
+	rlc_log_level                         ="info"; 
+    	rlc_log_verbosity                     ="medium";
+	pdcp_log_level                        ="info"; 
+    	pdcp_log_verbosity                    ="medium";
+	rrc_log_level                         ="info"; 
+    	rrc_log_verbosity                     ="medium";
+   };	
 
   }
 );
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf
index 5be5f7ad40..2cccde680c 100755
--- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.centos.nord.conf
@@ -32,6 +32,17 @@ eNBs =
     downlink_frequency      = 2680000000;
     uplink_frequency_offset = -120000000;
     
+    component_carriers = (
+    		       	 {
+			 cell_id                 = 0;
+                         N_RB_DL                 = 25;
+			 },
+			 {
+			 cell_id		 = 1; 
+			 N_RB_DL                 = 50;
+			 }  
+			 );
+    
     ////////// MME parameters:
     mme_ip_address      = ( { ipv4       = "192.168.13.11";
                               ipv6       = "192:168:30::17";
@@ -48,6 +59,24 @@ eNBs =
         ENB_INTERFACE_NAME_FOR_S1U               = "eth0";
         ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.13.10/24";
     };
-
+    
+    log_config : 
+    {
+	global_log_level                      ="debug"; 
+    	global_log_verbosity                  ="medium";
+	hw_log_level                          ="debug"; 
+    	hw_log_verbosity                      ="medium";
+	phy_log_level                         ="info"; 
+    	phy_log_verbosity                     ="medium";
+	mac_log_level                         ="debug"; 
+    	mac_log_verbosity                     ="high";
+	rlc_log_level                         ="info"; 
+    	rlc_log_verbosity                     ="medium";
+	pdcp_log_level                        ="info"; 
+    	pdcp_log_verbosity                    ="medium";
+	rrc_log_level                         ="info"; 
+    	rrc_log_verbosity                     ="medium";
+   };	
+   
   }
 );
diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile
index 0d5fd6184f..586123b716 100644
--- a/targets/RT/USER/Makefile
+++ b/targets/RT/USER/Makefile
@@ -24,6 +24,8 @@ endif
 CFLAGS += -O2 
 CFLAGS += -DDRIVER2013 -I$(OPENAIR_TARGETS)/ARCH/COMMON 
 
+CFLAGS += -DMAX_NUM_CCs=1
+
 ifeq ($(USRP),0)
   CFLAGS += -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/LIB/ -I$(OPENAIR_TARGETS)/ARCH/EXMIMO/DEFS -DENABLE_VCD_FIFO
 endif
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index f1fc55ef49..6db6d32abf 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -29,11 +29,11 @@
 
 /*! \file lte-softmodem.c
  * \brief main program to control HW and scheduling
- * \author R. Knopp, F. Kaltenberger
+ * \author R. Knopp, F. Kaltenberger, Navid Nikaein
  * \date 2012
  * \version 0.1
  * \company Eurecom
- * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr
+ * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
  * \note
  * \warning
  */
@@ -306,6 +306,21 @@ static LTE_DL_FRAME_PARMS      *frame_parms;
 int multi_thread=1;
 int N_RB_DL=25;
 
+int16_t           glog_level=LOG_DEBUG;
+int16_t           glog_verbosity=LOG_MED;
+int16_t           hw_log_level=LOG_DEBUG;
+int16_t           hw_log_verbosity=LOG_MED;
+int16_t           phy_log_level=LOG_DEBUG;
+int16_t           phy_log_verbosity=LOG_MED;
+int16_t           mac_log_level=LOG_DEBUG;
+int16_t           mac_log_verbosity=LOG_MED;
+int16_t           rlc_log_level=LOG_DEBUG;
+int16_t           rlc_log_verbosity=LOG_MED;
+int16_t           pdcp_log_level=LOG_DEBUG;
+int16_t           pdcp_log_verbosity=LOG_MED;
+int16_t           rrc_log_level=LOG_DEBUG;
+int16_t           rrc_log_verbosity=LOG_MED;
+
 unsigned int build_rflocal(int txi, int txq, int rxi, int rxq)
 {
   return (txi + (txq<<6) + (rxi<<12) + (rxq<<18));
@@ -1695,6 +1710,7 @@ static void get_options (int argc, char **argv) {
   int                           c;
   //  char                          line[1000];
   //  int                           l;
+  int i,j,k;
 #ifdef USRP
   int clock_src;
 #endif
@@ -1722,7 +1738,7 @@ static void get_options (int argc, char **argv) {
     {"no-L2-connect",   no_argument,        NULL, LONG_OPTION_NO_L2_CONNECT},
     {NULL, 0, NULL, 0}};
   
-  while ((c = getopt_long (argc, argv, "C:dK:qO:SUVRMr:s:",long_options,NULL)) != -1) {
+  while ((c = getopt_long (argc, argv, "C:dK:g:G:qO:SUVRMr:s:",long_options,NULL)) != -1) {
     switch (c) {
     case LONG_OPTION_ULSCH_MAX_CONSECUTIVE_ERRORS:
       ULSCH_max_consecutive_errors = atoi(optarg);
@@ -1834,6 +1850,12 @@ static void get_options (int argc, char **argv) {
       printf("Note: -s not defined for ExpressMIMO2\n");
 #endif
       break;
+    case 'g':
+      glog_level=atoi(optarg); // value between 1 - 9 
+      break;
+    case 'G':
+      glog_verbosity=atoi(optarg);// value from 0, 0x5, 0x15, 0x35, 0x75
+      break;
     default:
       break;
     }
@@ -1852,14 +1874,41 @@ static void get_options (int argc, char **argv) {
 		 conf_config_file_name, NB_eNB_INST, enb_properties->number);
     
     /* Update some simulation parameters */
-    frame_parms->frame_type =       enb_properties->properties[0]->frame_type;
-    frame_parms->tdd_config =       enb_properties->properties[0]->tdd_config;
-    frame_parms->tdd_config_S =     enb_properties->properties[0]->tdd_config_s;
-    for (i = 0 ; i < (sizeof(downlink_frequency) / sizeof (downlink_frequency[0])); i++) {
-      downlink_frequency[i] =       enb_properties->properties[0]->downlink_frequency;
-      printf("Downlink frequency set to %u\n", downlink_frequency[i]);
-      uplink_frequency_offset[i] =  enb_properties->properties[0]->uplink_frequency_offset;
-    }
+    for (i=0; i < enb_properties->number; i++) {
+      
+      frame_parms->frame_type =       enb_properties->properties[i]->frame_type;
+      frame_parms->tdd_config =       enb_properties->properties[i]->tdd_config;
+      frame_parms->tdd_config_S =     enb_properties->properties[i]->tdd_config_s;
+
+      for (j=0; j < enb_properties->properties[i]->nb_cc; j++ ){ 
+	frame_parms->Nid_cell          =  enb_properties->properties[i]->cell_id;
+	frame_parms->N_RB_DL          =  enb_properties->properties[i]->N_RB_DL;
+      } // j
+    
+      glog_level                     = enb_properties->properties[i]->glog_level;
+      glog_verbosity                 = enb_properties->properties[i]->glog_verbosity;
+      hw_log_level                   = enb_properties->properties[i]->hw_log_level;
+      hw_log_verbosity               = enb_properties->properties[i]->hw_log_verbosity ;
+      phy_log_level                  = enb_properties->properties[i]->phy_log_level;
+      phy_log_verbosity              = enb_properties->properties[i]->phy_log_verbosity;
+      mac_log_level                  = enb_properties->properties[i]->mac_log_level;
+      mac_log_verbosity              = enb_properties->properties[i]->mac_log_verbosity;
+      rlc_log_level                  = enb_properties->properties[i]->rlc_log_level;
+      rlc_log_verbosity              = enb_properties->properties[i]->rlc_log_verbosity;
+      pdcp_log_level                 = enb_properties->properties[i]->pdcp_log_level;
+      pdcp_log_verbosity             = enb_properties->properties[i]->pdcp_log_verbosity;
+      rrc_log_level                  = enb_properties->properties[i]->rrc_log_level;
+      rrc_log_verbosity              = enb_properties->properties[i]->rrc_log_verbosity;
+    
+    
+    // adjust the log 
+
+      for (k = 0 ; k < (sizeof(downlink_frequency) / sizeof (downlink_frequency[0])); k++) {
+	downlink_frequency[k] =       enb_properties->properties[i]->downlink_frequency;
+	printf("Downlink frequency set to %u\n", downlink_frequency[k]);
+	uplink_frequency_offset[k] =  enb_properties->properties[i]->uplink_frequency_offset;
+      } // k 
+    }// i
   }
 }
 
@@ -1916,7 +1965,7 @@ int main(int argc, char **argv) {
   // initialize the log (see log.h for details)
   logInit();
 
-  set_glog(LOG_DEBUG, LOG_MED);
+  set_glog(glog_level, glog_verbosity);
   if (UE_flag==1)
     {
       printf("configuring for UE\n");
@@ -1943,17 +1992,16 @@ int main(int argc, char **argv) {
     {
       printf("configuring for eNB\n");
 
-      set_comp_log(HW,      LOG_DEBUG,  LOG_HIGH, 1);
+      set_comp_log(HW,      hw_log_level, hw_log_verbosity, 1);
 #ifdef OPENAIR2
-      set_comp_log(PHY,     LOG_DEBUG,   LOG_HIGH, 1);
+      set_comp_log(PHY,     phy_log_level,   phy_log_verbosity, 1);
 #else
       set_comp_log(PHY,     LOG_INFO,   LOG_HIGH, 1);
 #endif
-      set_comp_log(MAC,     LOG_INFO,   LOG_HIGH, 1);
-      set_comp_log(RLC,     LOG_TRACE,   LOG_HIGH, 1);
-      set_comp_log(PDCP,    LOG_DEBUG,   LOG_HIGH, 1);
-      set_comp_log(OTG,     LOG_INFO,   LOG_HIGH, 1);
-      set_comp_log(RRC,     LOG_DEBUG,   LOG_HIGH, 1);
+      set_comp_log(MAC,     mac_log_level,  mac_log_verbosity, 1);
+      set_comp_log(RLC,     rlc_log_level,   rlc_log_verbosity, 1);
+      set_comp_log(PDCP,    pdcp_log_level,  pdcp_log_verbosity, 1);
+      set_comp_log(RRC,     rrc_log_level,  rrc_log_verbosity, 1);
 #if defined(ENABLE_ITTI)
       set_comp_log(EMU,     LOG_INFO,   LOG_MED, 1);
 # if defined(ENABLE_USE_MME)
@@ -1967,6 +2015,7 @@ int main(int argc, char **argv) {
 #endif
 #endif
       set_comp_log(ENB_APP, LOG_INFO, LOG_HIGH, 1);
+      set_comp_log(OTG,     LOG_INFO,   LOG_HIGH, 1);
       if (online_log_messages == 1) { 
 	set_component_filelog(RRC);
 	set_component_filelog(PDCP);
diff --git a/targets/RT/USER/sched_dlsch.c b/targets/RT/USER/sched_dlsch.c
index c360ac99a9..905b7b57cc 100644
--- a/targets/RT/USER/sched_dlsch.c
+++ b/targets/RT/USER/sched_dlsch.c
@@ -223,6 +223,7 @@ static void * dlsch_thread(void *param) {
 	
 #ifdef OPENAIR2
 	mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
+			       0, // CC_id
                            phy_vars_ue->frame,
                            phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->b,
                            phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->TBS>>3,
-- 
GitLab