From f442a7c5f242b9794b93cf4429039799badad366 Mon Sep 17 00:00:00 2001
From: winckel <winckel@eurecom.fr>
Date: Mon, 27 Jan 2014 15:53:59 +0000
Subject: [PATCH] Modified -O option used for eNB configuration.
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4961 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
targets/RTAI/USER/emos-raw.c | 173 ++++++++++++-------------
targets/RTAI/USER/lte-softmodem.c | 181 +++++++++++++--------------
targets/SIMU/USER/oaisim.c | 2 +-
targets/SIMU/USER/oaisim_functions.c | 24 +---
4 files changed, 177 insertions(+), 203 deletions(-)
diff --git a/targets/RTAI/USER/emos-raw.c b/targets/RTAI/USER/emos-raw.c
index d1d63d2d95..1e3bbc4ae9 100644
--- a/targets/RTAI/USER/emos-raw.c
+++ b/targets/RTAI/USER/emos-raw.c
@@ -140,6 +140,7 @@ char UE_flag=0;
u8 eNB_id=0,UE_id=0;
u32 carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000};
+char *g_conf_config_file_name = NULL;
unsigned int lost_bytes=0;
@@ -699,100 +700,88 @@ int main(int argc, char **argv) {
#endif
break;
case 'O':
-#if defined(ENABLE_USE_MME)
- EPC_MODE_ENABLED = 1;
- if (optarg == NULL) /* No IP address provided: use localhost */
- {
- memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
- } else {
- u8 ip_length = strlen(optarg) + 1;
- memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
- ip_length > 16 ? 16 : ip_length);
- }
-#else
- printf("You enabled mme mode without s1ap compiled...\n");
-#endif
+ g_conf_config_file_name = optarg;
break;
- case 'F':
- sprintf(rxg_fname,"%srxg.lime",optarg);
- rxg_fd = fopen(rxg_fname,"r");
- if (rxg_fd) {
- printf("Loading RX Gain parameters from %s\n",rxg_fname);
- l=0;
- while (fgets(line, sizeof(line), rxg_fd)) {
- if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
- else {
- if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
- if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
- if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
- l++;
- }
- }
- }
- else
- printf("%s not found, running with defaults\n",rxg_fname);
-
- sprintf(txg_fname,"%stxg.lime",optarg);
- txg_fd = fopen(txg_fname,"r");
- if (txg_fd) {
- printf("Loading TX Gain parameters from %s\n",txg_fname);
- l=0;
- while (fgets(line, sizeof(line), txg_fd)) {
- if ((strlen(line)==0) || (*line == '#')) {
- continue; //ignore empty or comment lines
- }
- else {
- if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
- if (l==1) sscanf(line,"%d",&tx_max_power);
- l++;
- }
- }
- }
- else
- printf("%s not found, running with defaults\n",txg_fname);
-
- sprintf(rflo_fname,"%srflo.lime",optarg);
- rflo_fd = fopen(rflo_fname,"r");
- if (rflo_fd) {
- printf("Loading RF LO parameters from %s\n",rflo_fname);
- fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
- }
- else
- printf("%s not found, running with defaults\n",rflo_fname);
-
- sprintf(rfdc_fname,"%srfdc.lime",optarg);
- rfdc_fd = fopen(rfdc_fname,"r");
- if (rfdc_fd) {
- printf("Loading RF DC parameters from %s\n",rfdc_fname);
- fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
- }
- else
- printf("%s not found, running with defaults\n",rfdc_fname);
+ case 'F':
+ sprintf(rxg_fname,"%srxg.lime",optarg);
+ rxg_fd = fopen(rxg_fname,"r");
+ if (rxg_fd) {
+ printf("Loading RX Gain parameters from %s\n",rxg_fname);
+ l=0;
+ while (fgets(line, sizeof(line), rxg_fd)) {
+ if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
+ else {
+ if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
+ if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
+ if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
+ l++;
+ }
+ }
+ }
+ else
+ printf("%s not found, running with defaults\n",rxg_fname);
+
+ sprintf(txg_fname,"%stxg.lime",optarg);
+ txg_fd = fopen(txg_fname,"r");
+ if (txg_fd) {
+ printf("Loading TX Gain parameters from %s\n",txg_fname);
+ l=0;
+ while (fgets(line, sizeof(line), txg_fd)) {
+ if ((strlen(line)==0) || (*line == '#')) {
+ continue; //ignore empty or comment lines
+ }
+ else {
+ if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
+ if (l==1) sscanf(line,"%d",&tx_max_power);
+ l++;
+ }
+ }
+ }
+ else
+ printf("%s not found, running with defaults\n",txg_fname);
+
+ sprintf(rflo_fname,"%srflo.lime",optarg);
+ rflo_fd = fopen(rflo_fname,"r");
+ if (rflo_fd) {
+ printf("Loading RF LO parameters from %s\n",rflo_fname);
+ fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]);
+ }
+ else
+ printf("%s not found, running with defaults\n",rflo_fname);
+
+ sprintf(rfdc_fname,"%srfdc.lime",optarg);
+ rfdc_fd = fopen(rfdc_fname,"r");
+ if (rfdc_fd) {
+ printf("Loading RF DC parameters from %s\n",rfdc_fname);
+ fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]);
+ }
+ else
+ printf("%s not found, running with defaults\n",rfdc_fname);
- break;
- /*
- case 256:
- mode = rx_calib_ue;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 257:
- mode = rx_calib_ue_med;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 258:
- mode = rx_calib_ue_byp;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 259:
- mode = debug_prach;
- break;
- case 260:
- mode = no_L2_connect;
- break;
- */
+ break;
+ /*
+ case 256:
+ mode = rx_calib_ue;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 257:
+ mode = rx_calib_ue_med;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 258:
+ mode = rx_calib_ue_byp;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 259:
+ mode = debug_prach;
+ break;
+ case 260:
+ mode = no_L2_connect;
+ break;
+ */
default:
break;
}
diff --git a/targets/RTAI/USER/lte-softmodem.c b/targets/RTAI/USER/lte-softmodem.c
index 42c6b557c0..d930ce0c9c 100644
--- a/targets/RTAI/USER/lte-softmodem.c
+++ b/targets/RTAI/USER/lte-softmodem.c
@@ -168,6 +168,7 @@ char UE_flag=0;
u8 eNB_id=0,UE_id=0;
u32 carrier_freq[4]= {1907600000,1907600000,1907600000,1907600000};
+char *g_conf_config_file_name = NULL;
struct timing_info_t {
//unsigned int frame, hw_slot, last_slot, next_slot;
@@ -1126,100 +1127,88 @@ int main(int argc, char **argv) {
#endif
break;
case 'O':
-#if defined(ENABLE_USE_MME)
- EPC_MODE_ENABLED = 1;
- if (optarg == NULL) /* No IP address provided: use localhost */
- {
- memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
- } else {
- u8 ip_length = strlen(optarg) + 1;
- memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
- ip_length > 16 ? 16 : ip_length);
- }
-#else
- printf("You enabled mme mode without s1ap compiled...\n");
-#endif
+ g_conf_config_file_name = optarg;
break;
- case 'F':
- sprintf(rxg_fname,"%srxg.lime",optarg);
- rxg_fd = fopen(rxg_fname,"r");
- if (rxg_fd) {
- printf("Loading RX Gain parameters from %s\n",rxg_fname);
- l=0;
- while (fgets(line, sizeof(line), rxg_fd)) {
- if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
- else {
- if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
- if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
- if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
- l++;
- }
- }
- }
- else
- printf("%s not found, running with defaults\n",rxg_fname);
-
- sprintf(txg_fname,"%stxg.lime",optarg);
- txg_fd = fopen(txg_fname,"r");
- if (txg_fd) {
- printf("Loading TX Gain parameters from %s\n",txg_fname);
- l=0;
- while (fgets(line, sizeof(line), txg_fd)) {
- if ((strlen(line)==0) || (*line == '#')) {
- continue; //ignore empty or comment lines
- }
- else {
- if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
- if (l==1) sscanf(line,"%d",&tx_max_power);
- l++;
- }
- }
- }
- else
- printf("%s not found, running with defaults\n",txg_fname);
-
- sprintf(rflo_fname,"%srflo.lime",optarg);
- rflo_fd = fopen(rflo_fname,"r");
- if (rflo_fd) {
- printf("Loading RF LO parameters from %s\n",rflo_fname);
- if (fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]) < 4)
- LOG_E(EMU, "Error parsing \"%s\"", rflo_fname);
- }
- else
- printf("%s not found, running with defaults\n",rflo_fname);
-
- sprintf(rfdc_fname,"%srfdc.lime",optarg);
- rfdc_fd = fopen(rfdc_fname,"r");
- if (rfdc_fd) {
- printf("Loading RF DC parameters from %s\n",rfdc_fname);
- if (fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]) < 4)
- LOG_E(EMU, "Error parsing \"%s\"", rfdc_fname);
- }
- else
- printf("%s not found, running with defaults\n",rfdc_fname);
+ case 'F':
+ sprintf(rxg_fname,"%srxg.lime",optarg);
+ rxg_fd = fopen(rxg_fname,"r");
+ if (rxg_fd) {
+ printf("Loading RX Gain parameters from %s\n",rxg_fname);
+ l=0;
+ while (fgets(line, sizeof(line), rxg_fd)) {
+ if ((strlen(line)==0) || (*line == '#')) continue; //ignore empty or comment lines
+ else {
+ if (l==0) sscanf(line,"%d %d %d %d",&rxg_max[0],&rxg_max[1],&rxg_max[2],&rxg_max[3]);
+ if (l==1) sscanf(line,"%d %d %d %d",&rxg_med[0],&rxg_med[1],&rxg_med[2],&rxg_med[3]);
+ if (l==2) sscanf(line,"%d %d %d %d",&rxg_byp[0],&rxg_byp[1],&rxg_byp[2],&rxg_byp[3]);
+ l++;
+ }
+ }
+ }
+ else
+ printf("%s not found, running with defaults\n",rxg_fname);
+
+ sprintf(txg_fname,"%stxg.lime",optarg);
+ txg_fd = fopen(txg_fname,"r");
+ if (txg_fd) {
+ printf("Loading TX Gain parameters from %s\n",txg_fname);
+ l=0;
+ while (fgets(line, sizeof(line), txg_fd)) {
+ if ((strlen(line)==0) || (*line == '#')) {
+ continue; //ignore empty or comment lines
+ }
+ else {
+ if (l==0) sscanf(line,"%d %d %d %d",&txgain[0],&txgain[1],&txgain[2],&txgain[3]);
+ if (l==1) sscanf(line,"%d",&tx_max_power);
+ l++;
+ }
+ }
+ }
+ else
+ printf("%s not found, running with defaults\n",txg_fname);
+
+ sprintf(rflo_fname,"%srflo.lime",optarg);
+ rflo_fd = fopen(rflo_fname,"r");
+ if (rflo_fd) {
+ printf("Loading RF LO parameters from %s\n",rflo_fname);
+ if (fscanf(rflo_fd,"%d %d %d %d",&rf_local[0],&rf_local[1],&rf_local[2],&rf_local[3]) < 4)
+ LOG_E(EMU, "Error parsing \"%s\"", rflo_fname);
+ }
+ else
+ printf("%s not found, running with defaults\n",rflo_fname);
+
+ sprintf(rfdc_fname,"%srfdc.lime",optarg);
+ rfdc_fd = fopen(rfdc_fname,"r");
+ if (rfdc_fd) {
+ printf("Loading RF DC parameters from %s\n",rfdc_fname);
+ if (fscanf(rfdc_fd,"%d %d %d %d",&rf_rxdc[0],&rf_rxdc[1],&rf_rxdc[2],&rf_rxdc[3]) < 4)
+ LOG_E(EMU, "Error parsing \"%s\"", rfdc_fname);
+ }
+ else
+ printf("%s not found, running with defaults\n",rfdc_fname);
- break;
- case 256:
- mode = rx_calib_ue;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 257:
- mode = rx_calib_ue_med;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 258:
- mode = rx_calib_ue_byp;
- rx_input_level_dBm = atoi(optarg);
- printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
- break;
- case 259:
- mode = debug_prach;
- break;
- case 260:
- mode = no_L2_connect;
- break;
+ break;
+ case 256:
+ mode = rx_calib_ue;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 257:
+ mode = rx_calib_ue_med;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 258:
+ mode = rx_calib_ue_byp;
+ rx_input_level_dBm = atoi(optarg);
+ printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm);
+ break;
+ case 259:
+ mode = debug_prach;
+ break;
+ case 260:
+ mode = no_L2_connect;
+ break;
default:
break;
}
@@ -1344,6 +1333,14 @@ int main(int argc, char **argv) {
g_log->log_component[OTG].flag = LOG_HIGH;
g_log->log_component[RRC].level = LOG_INFO;
g_log->log_component[RRC].flag = LOG_HIGH;
+#if defined(ENABLE_ITTI)
+ g_log->log_component[EMU].level = LOG_INFO;
+ g_log->log_component[EMU].flag = LOG_HIGH;
+# if defined(ENABLE_USE_MME)
+ g_log->log_component[NAS].level = LOG_INFO;
+ g_log->log_component[NAS].flag = LOG_HIGH;
+# endif
+#endif
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE*));
PHY_vars_UE_g[0] = init_lte_UE(frame_parms, UE_id,abstraction_flag,transmission_mode);
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 05e59c2b73..bdf805958a 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -202,7 +202,7 @@ void help(void) {
printf ("-m Gives a fixed DL mcs\n");
printf ("-M Set the machine ID for Ethernet-based emulation\n");
printf ("-n Set the number of frames for the simulation\n");
- printf ("-O [mme ipv4 address] Enable MME mode\n");
+ printf ("-O [enb_conf_file] eNB configuration file name\n");
printf ("-p Set the total number of machine in emulation - valid if M is set\n");
printf ("-P [trace type] Enable protocol analyzer. Possible values for OPT:\n");
printf (" - wireshark: Enable tracing of layers above PHY using an UDP socket\n");
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 464e2f27eb..c9efc3b33d 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -118,9 +118,9 @@ void get_simulation_options(int argc, char *argv[]) {
char c;
int option_index;
static struct option long_options[] = {
- {"config-file", required_argument, 0, 0},
- {"pdcp_period", 1, 0, 0},
- {"omg_period", 1, 0, 0},
+ {"enb-conf", required_argument, 0, 0},
+ {"pdcp_period", required_argument, 0, 0},
+ {"omg_period", required_argument, 0, 0},
{"enb-ral-listening-port", required_argument, 0, 0},
{"enb-ral-ip-address", required_argument, 0, 0},
{"enb-ral-link-id", required_argument, 0, 0},
@@ -141,10 +141,10 @@ void get_simulation_options(int argc, char *argv[]) {
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hHi:IJ:j:k:K:l:L:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vV:w:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) {
switch (c) {
case 0:
- if (! strcmp(long_options[option_index].name, "config-file")) {
+ if (! strcmp(long_options[option_index].name, "enb-conf")) {
if (optarg) {
g_conf_config_file_name = strdup(optarg);
- printf("config file is %s\n", g_conf_config_file_name);
+ printf("eNB configuration file is %s\n", g_conf_config_file_name);
}
} else if (! strcmp(long_options[option_index].name, "pdcp_period")) {
if (optarg) {
@@ -462,19 +462,7 @@ void get_simulation_options(int argc, char *argv[]) {
/* Sebastien ROUX: Reserved for future use (currently used in ltenow branch) */
break;
case 'O':
-#if defined(ENABLE_USE_MME)
- EPC_MODE_ENABLED = 1;
- if (optarg == NULL) /* No IP address provided: use localhost */
- {
- memcpy(&EPC_MODE_MME_ADDRESS[0], "127.0.0.1", 10);
- } else {
- u8 ip_length = strlen(optarg) + 1;
- memcpy(&EPC_MODE_MME_ADDRESS[0], optarg,
- ip_length > 16 ? 16 : ip_length);
- }
-#else
- printf("You enabled MME mode without compiling using ENABLE_USE_MME=1 ...\n");
-#endif
+ g_conf_config_file_name = optarg;
break;
case 'o':
oai_emulation.info.slot_isr = 1;
--
GitLab