Commit f13b4100 authored by winckel's avatar winckel
Browse files

Integrated TDD configuration settings from eNB conf file.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5039 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 35ac43ed
...@@ -1079,35 +1079,63 @@ static void *UE_thread(void *arg) ...@@ -1079,35 +1079,63 @@ static void *UE_thread(void *arg)
return 0; return 0;
} }
void get_options (int argc, char **argv) enum {
LONG_OPTION_START = 0x100, /* Start after regular single char options */
LONG_OPTION_CALIB_UE_RX,
LONG_OPTION_CALIB_UE_RX_MED,
LONG_OPTION_CALIB_UE_RX_BYP,
LONG_OPTION_DEBUG_UE_PRACH,
LONG_OPTION_NO_L2_CONNECT,
} long_option_e;
static void get_options (int argc, char **argv)
{ {
int c; int c;
char line[1000]; char line[1000];
int l; int l;
const Enb_properties_array_t *enb_properties;
static const struct option long_options[] = { static const struct option long_options[] = {
{"calib-ue-rx", required_argument, NULL, 256}, {"calib-ue-rx", required_argument, NULL, LONG_OPTION_CALIB_UE_RX},
{"calib-ue-rx-med", required_argument, NULL, 257}, {"calib-ue-rx-med", required_argument, NULL, LONG_OPTION_CALIB_UE_RX_MED},
{"calib-ue-rx-byp", required_argument, NULL, 258}, {"calib-ue-rx-byp", required_argument, NULL, LONG_OPTION_CALIB_UE_RX_BYP},
{"debug-ue-prach", no_argument, NULL, 259}, {"debug-ue-prach", no_argument, NULL, LONG_OPTION_DEBUG_UE_PRACH},
{"no-L2-connect", no_argument, NULL, 260}, {"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
while ((c = getopt_long (argc, argv, "C:K:O:ST:UdF:V",long_options,NULL)) != -1) while ((c = getopt_long (argc, argv, "C:dF:K:O:ST:UV",long_options,NULL)) != -1)
{ {
switch (c) switch (c)
{ {
case 'V': case LONG_OPTION_CALIB_UE_RX:
ouput_vcd = 1; 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; break;
case 'd':
#ifdef XFORMS case LONG_OPTION_CALIB_UE_RX_MED:
do_forms=1; mode = rx_calib_ue_med;
#endif rx_input_level_dBm = atoi(optarg);
printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
break; break;
case 'U':
UE_flag = 1; case LONG_OPTION_CALIB_UE_RX_BYP:
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; break;
case LONG_OPTION_DEBUG_UE_PRACH:
mode = debug_prach;
break;
case LONG_OPTION_NO_L2_CONNECT:
mode = no_L2_connect;
break;
case 'C': case 'C':
downlink_frequency[0] = atoi(optarg); downlink_frequency[0] = atoi(optarg);
downlink_frequency[1] = atoi(optarg); downlink_frequency[1] = atoi(optarg);
...@@ -1118,24 +1146,13 @@ void get_options (int argc, char **argv) ...@@ -1118,24 +1146,13 @@ void get_options (int argc, char **argv)
carrier_freq[2] = downlink_frequency[2]; carrier_freq[2] = downlink_frequency[2];
carrier_freq[3] = downlink_frequency[3]; carrier_freq[3] = downlink_frequency[3];
break; break;
case 'S':
fs4_test=1; case 'd':
break; #ifdef XFORMS
case 'T': do_forms=1;
#ifdef ENABLE_TCXO
tcxo=atoi(optarg);
#endif
break;
case 'K':
#if defined(ENABLE_ITTI)
itti_dump_file = strdup(optarg);
#else
printf("-K option is disabled when ENABLE_ITTI is not defined\n");
#endif #endif
break; break;
case 'O':
conf_config_file_name = optarg;
break;
case 'F': case 'F':
sprintf(rxg_fname,"%srxg.lime",optarg); sprintf(rxg_fname,"%srxg.lime",optarg);
rxg_fd = fopen(rxg_fname,"r"); rxg_fd = fopen(rxg_fname,"r");
...@@ -1193,39 +1210,67 @@ void get_options (int argc, char **argv) ...@@ -1193,39 +1210,67 @@ void get_options (int argc, char **argv)
} }
else else
printf("%s not found, running with defaults\n",rfdc_fname); printf("%s not found, running with defaults\n",rfdc_fname);
break;
case 'K':
#if defined(ENABLE_ITTI)
itti_dump_file = strdup(optarg);
#else
printf("-K option is disabled when ENABLE_ITTI is not defined\n");
#endif
break; break;
case 256:
mode = rx_calib_ue; case 'O':
rx_input_level_dBm = atoi(optarg); conf_config_file_name = optarg;
printf("Running with UE calibration on (LNA max), input level %d dBm\n",rx_input_level_dBm);
break; break;
case 257:
mode = rx_calib_ue_med; case 'S':
rx_input_level_dBm = atoi(optarg); fs4_test=1;
printf("Running with UE calibration on (LNA med), input level %d dBm\n",rx_input_level_dBm);
break; break;
case 258:
mode = rx_calib_ue_byp; case 'T':
rx_input_level_dBm = atoi(optarg); #ifdef ENABLE_TCXO
printf("Running with UE calibration on (LNA byp), input level %d dBm\n",rx_input_level_dBm); tcxo=atoi(optarg);
#endif
break; break;
case 259:
mode = debug_prach; case 'U':
UE_flag = 1;
break; break;
case 260:
mode = no_L2_connect; case 'V':
ouput_vcd = 1;
break; break;
default: default:
break; break;
} }
} }
if ((UE_flag == 0) && (conf_config_file_name != NULL)) {
int i;
NB_eNB_INST = 1;
/* Read eNB configuration file */
enb_properties = enb_config_init(conf_config_file_name);
AssertFatal (NB_eNB_INST <= enb_properties->number,
"Number of eNB is greater than eNB defined in configuration file %s (%d/%d)!",
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;
uplink_frequency_offset[i] = enb_properties->properties[0]->uplink_frequency_offset;
}
}
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
const Enb_properties_array_t *enb_properties;
#ifdef RTAI #ifdef RTAI
// RT_TASK *task; // RT_TASK *task;
#endif #endif
...@@ -1260,35 +1305,62 @@ int main(int argc, char **argv) { ...@@ -1260,35 +1305,62 @@ int main(int argc, char **argv) {
mode = normal_txrx; mode = normal_txrx;
get_options (argc, argv); //Command-line options
frame_parms = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS)); frame_parms = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
/* Set some default values that may be overwritten while reading options */
frame_parms->frame_type = 1;
frame_parms->tdd_config = 3;
frame_parms->tdd_config_S = 0;
if ((UE_flag == 0) && (conf_config_file_name != NULL)) { get_options (argc, argv); //Command-line options
int i;
NB_eNB_INST = 1;
/* Read eNB configuration file */
enb_properties = enb_config_init(conf_config_file_name);
AssertFatal (NB_eNB_INST <= enb_properties->number,
"Number of eNB is greater than eNB defined in configuration file %s (%d/%d)!",
conf_config_file_name, NB_eNB_INST, enb_properties->number);
/* Update some simulation parameters */
frame_parms->frame_type = enb_properties->properties[0]->frame_type;
for (i = 0 ; i < (sizeof(downlink_frequency) / sizeof (downlink_frequency[0])); i++) {
downlink_frequency[i] = enb_properties->properties[0]->downlink_frequency;
uplink_frequency_offset[i] = enb_properties->properties[0]->uplink_frequency_offset;
}
}
set_glog(LOG_WARNING, LOG_MED);
if (UE_flag==1) if (UE_flag==1)
{
printf("configuring for UE\n"); printf("configuring for UE\n");
set_comp_log(HW, LOG_DEBUG, LOG_HIGH, 1);
#ifdef OPENAIR2
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 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_INFO, LOG_HIGH, 1);
set_comp_log(PDCP, LOG_INFO, LOG_HIGH, 1);
set_comp_log(OTG, LOG_INFO, LOG_HIGH, 1);
set_comp_log(RRC, LOG_INFO, LOG_HIGH, 1);
#if defined(ENABLE_ITTI)
set_comp_log(EMU, LOG_INFO, LOG_HIGH, 1);
# if defined(ENABLE_USE_MME)
set_comp_log(NAS, LOG_INFO, LOG_HIGH, 1);
# endif
#endif
}
else else
{
printf("configuring for eNB\n"); printf("configuring for eNB\n");
set_comp_log(HW, LOG_DEBUG, LOG_HIGH, 1);
#ifdef OPENAIR2
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 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_INFO, LOG_HIGH, 1);
set_comp_log(PDCP, LOG_INFO, LOG_HIGH, 1);
set_comp_log(OTG, LOG_INFO, LOG_HIGH, 1);
set_comp_log(RRC, LOG_INFO, LOG_HIGH, 1);
#if defined(ENABLE_ITTI)
set_comp_log(EMU, LOG_INFO, LOG_HIGH, 1);
# if defined(ENABLE_USE_MME)
set_comp_log(S1AP, LOG_INFO, LOG_HIGH, 1);
set_comp_log(SCTP, LOG_INFO, LOG_HIGH, 1);
# endif
#endif
set_comp_log(ENB_APP, LOG_INFO, LOG_HIGH, 1);;
}
//randominit (0); //randominit (0);
set_taus_seed (0); set_taus_seed (0);
...@@ -1334,7 +1406,8 @@ int main(int argc, char **argv) { ...@@ -1334,7 +1406,8 @@ int main(int argc, char **argv) {
frame_parms->Ncp_UL = 0; frame_parms->Ncp_UL = 0;
frame_parms->Nid_cell = Nid_cell; frame_parms->Nid_cell = Nid_cell;
frame_parms->nushift = 0; frame_parms->nushift = 0;
if (UE_flag==0) { if (UE_flag==0)
{
switch (transmission_mode) { switch (transmission_mode) {
case 1: case 1:
frame_parms->nb_antennas_tx = 1; frame_parms->nb_antennas_tx = 1;
...@@ -1351,14 +1424,13 @@ int main(int argc, char **argv) { ...@@ -1351,14 +1424,13 @@ int main(int argc, char **argv) {
exit(-1); exit(-1);
} }
} }
else { //UE_flag==1 else
{ //UE_flag==1
frame_parms->nb_antennas_tx = 1; frame_parms->nb_antennas_tx = 1;
frame_parms->nb_antennas_rx = 1; frame_parms->nb_antennas_rx = 1;
} }
frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later
frame_parms->mode1_flag = (transmission_mode == 1) ? 1 : 0; frame_parms->mode1_flag = (transmission_mode == 1) ? 1 : 0;
frame_parms->tdd_config = 3;
frame_parms->tdd_config_S = 0;
frame_parms->phich_config_common.phich_resource = oneSixth; frame_parms->phich_config_common.phich_resource = oneSixth;
frame_parms->phich_config_common.phich_duration = normal; frame_parms->phich_config_common.phich_duration = normal;
// UL RS Config // UL RS Config
...@@ -1382,35 +1454,8 @@ int main(int argc, char **argv) { ...@@ -1382,35 +1454,8 @@ int main(int argc, char **argv) {
// prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type); // prach_fmt = get_prach_fmt(frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, frame_parms->frame_type);
// N_ZC = (prach_fmt <4)?839:139; // N_ZC = (prach_fmt <4)?839:139;
g_log->level = LOG_WARNING; if (UE_flag==1)
if (UE_flag==1) { {
g_log->log_component[HW].level = LOG_DEBUG;
g_log->log_component[HW].flag = LOG_HIGH;
#ifdef OPENAIR2
g_log->log_component[PHY].level = LOG_INFO;
#else
g_log->log_component[PHY].level = LOG_INFO;
#endif
g_log->log_component[PHY].flag = LOG_HIGH;
g_log->log_component[MAC].level = LOG_INFO;
g_log->log_component[MAC].flag = LOG_HIGH;
g_log->log_component[RLC].level = LOG_INFO;
g_log->log_component[RLC].flag = LOG_HIGH;
g_log->log_component[PDCP].level = LOG_INFO;
g_log->log_component[PDCP].flag = LOG_HIGH;
g_log->log_component[OTG].level = LOG_INFO;
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 = malloc(sizeof(PHY_VARS_UE*));
PHY_vars_UE_g[0] = init_lte_UE(frame_parms, UE_id,abstraction_flag,transmission_mode); PHY_vars_UE_g[0] = init_lte_UE(frame_parms, UE_id,abstraction_flag,transmission_mode);
...@@ -1482,39 +1527,8 @@ int main(int argc, char **argv) { ...@@ -1482,39 +1527,8 @@ int main(int argc, char **argv) {
// printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_power,tx_max_power)); // printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_power,tx_max_power));
} }
else { //this is eNB else
g_log->log_component[HW].level = LOG_DEBUG; { //this is eNB
g_log->log_component[HW].flag = LOG_HIGH;
#ifdef OPENAIR2
g_log->log_component[PHY].level = LOG_INFO;
#else
g_log->log_component[PHY].level = LOG_INFO;
#endif
g_log->log_component[PHY].flag = LOG_HIGH;
g_log->log_component[MAC].level = LOG_INFO;
g_log->log_component[MAC].flag = LOG_HIGH;
g_log->log_component[RLC].level = LOG_INFO;
g_log->log_component[RLC].flag = LOG_HIGH;
g_log->log_component[PDCP].level = LOG_INFO;
g_log->log_component[PDCP].flag = LOG_HIGH;
g_log->log_component[OTG].level = LOG_INFO;
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[S1AP].level = LOG_INFO;
g_log->log_component[S1AP].flag = LOG_HIGH;
g_log->log_component[SCTP].level = LOG_INFO;
g_log->log_component[SCTP].flag = LOG_HIGH;
# endif
#endif
g_log->log_component[ENB_APP].level = LOG_INFO;
g_log->log_component[ENB_APP].flag = LOG_HIGH;
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB*)); PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB*));
PHY_vars_eNB_g[0] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag); PHY_vars_eNB_g[0] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
...@@ -1691,8 +1705,8 @@ int main(int argc, char **argv) { ...@@ -1691,8 +1705,8 @@ int main(int argc, char **argv) {
printf("ITTI tasks created\n"); printf("ITTI tasks created\n");
#endif #endif
#ifdef OPENAIR2 #ifdef OPENAIR2
//if (otg_enabled) { //if (otg_enabled) {
init_all_otg(0); init_all_otg(0);
g_otg->seed = 0; g_otg->seed = 0;
init_seeds(g_otg->seed); init_seeds(g_otg->seed);
...@@ -1706,7 +1720,7 @@ int main(int argc, char **argv) { ...@@ -1706,7 +1720,7 @@ int main(int argc, char **argv) {
} }
} }
init_predef_traffic(UE_flag ? 1 : 0, UE_flag ? 0 : 1); init_predef_traffic(UE_flag ? 1 : 0, UE_flag ? 0 : 1);
// } // }
#endif #endif
#ifdef OPENAIR2 #ifdef OPENAIR2
...@@ -1720,7 +1734,8 @@ int main(int argc, char **argv) { ...@@ -1720,7 +1734,8 @@ int main(int argc, char **argv) {
openair_daq_vars.timing_advance = 0; openair_daq_vars.timing_advance = 0;
// connect the TX/RX buffers // connect the TX/RX buffers
if (UE_flag==1) { if (UE_flag==1)
{
setup_ue_buffers(PHY_vars_UE_g[0],frame_parms,ant_offset); setup_ue_buffers(PHY_vars_UE_g[0],frame_parms,ant_offset);
printf("Setting UE buffer to all-RX\n"); printf("Setting UE buffer to all-RX\n");
// Set LSBs for antenna switch (ExpressMIMO) // Set LSBs for antenna switch (ExpressMIMO)
...@@ -1730,7 +1745,8 @@ int main(int argc, char **argv) { ...@@ -1730,7 +1745,8 @@ int main(int argc, char **argv) {
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX; //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
} }
else { else
{
setup_eNB_buffers(PHY_vars_eNB_g[0],frame_parms,ant_offset); setup_eNB_buffers(PHY_vars_eNB_g[0],frame_parms,ant_offset);
if (fs4_test==0) if (fs4_test==0)
{ {
...@@ -1749,7 +1765,8 @@ int main(int argc, char **argv) { ...@@ -1749,7 +1765,8 @@ int main(int argc, char **argv) {
PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][aa][i] = 0x0; PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][aa][i] = 0x0;
*/ */
} }
else { else
{
printf("Setting eNB buffer to fs/4 test signal\n"); printf("Setting eNB buffer to fs/4 test signal\n");
for (j=0; j<PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti*10; j+=4) for (j=0; j<PHY_vars_eNB_g[0]->lte_frame_parms.samples_per_tti*10; j+=4)
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) for (aa=0; aa<frame_parms->nb_antennas_tx; aa++)
...@@ -2048,7 +2065,6 @@ void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms, ...@@ -2048,7 +2065,6 @@ void setup_ue_buffers(PHY_VARS_UE *phy_vars_ue, LTE_DL_FRAME_PARMS *frame_parms,
int i; int i;
if (phy_vars_ue) { if (phy_vars_ue) {
if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) { if ((frame_parms->nb_antennas_rx>1) && (carrier>0)) {
printf("RX antennas > 1 and carrier > 0 not possible\n"); printf("RX antennas > 1 and carrier > 0 not possible\n");
exit(-1); exit(-1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment