Commit 77ec326c authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'enhancement-64-phy_test' into 'develop'

Enhancement 64 phy test

this branch (re)-introduces functionality that allows to run the eNB as a signal generator and the UE as a vector signal analyzer (old OPENAIR2=0). 
Tests mostly pass (as good as before).

See merge request !18
parents 949b1a8d 8f2a640b
......@@ -496,20 +496,20 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode)
#endif
if (phy_vars_ue->UE_scan_carrier == 0) {
#ifdef OPENAIR2
if (phy_vars_ue->mac_enabled==1) {
LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",phy_vars_ue->Mod_id);
//mac_resynch();
mac_xface->dl_phy_sync_success(phy_vars_ue->Mod_id,phy_vars_ue->frame_rx,0,1);//phy_vars_ue->lte_ue_common_vars.eNb_id);
#endif //OPENAIR2
phy_vars_ue->UE_mode[0] = PRACH;
}
else {
phy_vars_ue->UE_mode[0] = PUSCH;
}
generate_pcfich_reg_mapping(frame_parms);
generate_phich_reg_mapping(frame_parms);
// init_prach625(frame_parms);
#ifndef OPENAIR2
phy_vars_ue->UE_mode[0] = PUSCH;
#else
phy_vars_ue->UE_mode[0] = PRACH;
#endif
//phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors=0;
phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_conseq=0;
//phy_vars_ue->lte_ue_pbch_vars[0]->pdu_errors_last=0;
......
......@@ -107,10 +107,10 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance);
if (phy_vars_ue->UE_mode[0]==PUSCH) {
len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n",
PHY_vars_UE_g[0][0]->ulsch_ue[0]->Po_PUSCH,
phy_vars_ue->ulsch_ue[0]->Po_PUSCH,
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0),
mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0),
PHY_vars_UE_g[0][0]->ulsch_ue[0]->PHR);
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
phy_vars_ue->ulsch_ue[0]->PHR);
len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n",
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,0)+
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
......@@ -582,9 +582,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length)
len += sprintf(&buffer[len],"%4d ",
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_subband_power_tot_dBm[i]);
if ((i>0) && ((i%25) == 0))
len += sprintf(&buffer[len],"\n ",
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_subband_power_tot_dBm[i]);
len += sprintf(&buffer[len],"\n");
}
len += sprintf(&buffer[len],"\n");
len += sprintf(&buffer[len],"\n[eNB PROC] PERFORMANCE PARAMETERS\n");
......@@ -644,7 +642,6 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length)
dB_fixed(phy_vars_eNB->eNB_UE_stats[UE_id].Po_PUCCH/phy_vars_eNB->lte_frame_parms.N_RB_UL)-phy_vars_eNB->rx_total_gain_eNB_dB,
phy_vars_eNB->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
dB_fixed(phy_vars_eNB->eNB_UE_stats[UE_id].Po_PUCCH1_below/phy_vars_eNB->lte_frame_parms.N_RB_UL)-phy_vars_eNB->rx_total_gain_eNB_dB,
dB_fixed(phy_vars_eNB->eNB_UE_stats[UE_id].Po_PUCCH1_above/phy_vars_eNB->lte_frame_parms.N_RB_UL)-phy_vars_eNB->rx_total_gain_eNB_dB,
PUCCH1_THRES+phy_vars_eNB->PHY_measurements_eNB[0].n0_power_tot_dBm-dB_fixed(phy_vars_eNB->lte_frame_parms.N_RB_UL),
phy_vars_eNB->eNB_UE_stats[UE_id].sector);
......
......@@ -278,6 +278,9 @@ typedef struct PHY_VARS_eNB_s {
int **dl_precoder_SeNB[3];
char log2_maxp; /// holds the maximum channel/precoder coefficient
/// if ==0 enables phy only test mode
int mac_enabled;
/// For emulation only (used by UE abstraction to retrieve DCI)
uint8_t num_common_dci[2]; // num_dci in even/odd subframes
uint8_t num_ue_spec_dci[2]; // num_dci in even/odd subframes
......@@ -579,6 +582,9 @@ typedef struct {
/// holds the maximum channel/precoder coefficient
char log2_maxp;
/// if ==0 enables phy only test mode
int mac_enabled;
/// Flag to initialize averaging of PHY measurements
int init_averaging;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -47,8 +47,8 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id)
if (CC_id>0) {
LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n");
mac_xface->macphy_exit("MAC FATAL CC_id>0");
return 0; // not reached
//mac_xface->macphy_exit("MAC FATAL CC_id>0");
return 0;
}
if (UE_mac_inst[module_idP].radioResourceConfigCommon) {
......@@ -56,7 +56,8 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP,uint8_t CC_id)
}
else {
LOG_E(MAC,"[UE %d] CCid %d FATAL radioResourceConfigCommon is NULL !!!\n",module_idP,CC_id);
mac_xface->macphy_exit("FATAL radioResourceConfigCommon is NULL");
//mac_xface->macphy_exit("FATAL radioResourceConfigCommon is NULL");
return 0;
}
return(-120 + (rach_ConfigCommon->powerRampingParameters.preambleInitialReceivedTargetPower<<1) +
......
......@@ -293,6 +293,7 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char rf_config_file[1024];
int chain_offset=0;
int phy_test = 0;
#ifndef EXMIMO
char ref[128] = "internal";
......@@ -472,7 +473,7 @@ void help (void) {
printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n");
printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n");
printf(" -g Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n");
printf(" -G Set the global log level \n");
printf(" -G Set the global log verbosity \n");
printf(" -h provides this help message!\n");
printf(" -K Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n");
printf(" -m Set the maximum downlink MCS\n");
......@@ -577,12 +578,12 @@ static void *scope_thread(void *arg)
0,7);
} else {
#ifdef OPENAIR2
if (PHY_vars_eNB_g[0][0]->mac_enabled==1) {
len = dump_eNB_l2_stats (stats_buffer, 0);
//fl_set_object_label(form_stats_l2->stats_text, stats_buffer);
fl_clear_browser(form_stats_l2->stats_text);
fl_add_browser_line(form_stats_l2->stats_text, stats_buffer);
#endif
}
len = dump_eNB_stats (PHY_vars_eNB_g[0][0], stats_buffer, 0);
if (MAX_NUM_CCs>1)
......@@ -2117,7 +2118,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_SCANCARRIER,
LONG_OPTION_MAXPOWER,
LONG_OPTION_DUMP_FRAME,
LONG_OPTION_LOOPMEMORY
LONG_OPTION_LOOPMEMORY,
LONG_OPTION_PHYTEST
};
static const struct option long_options[] = {
......@@ -2135,6 +2137,7 @@ static void get_options (int argc, char **argv)
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
{"ue-dump-frame", no_argument, NULL, LONG_OPTION_DUMP_FRAME},
{"loop-memory", required_argument, NULL, LONG_OPTION_LOOPMEMORY},
{"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
{NULL, 0, NULL, 0}
};
......@@ -2217,6 +2220,11 @@ static void get_options (int argc, char **argv)
case LONG_OPTION_DUMP_FRAME:
mode = rx_dump_frame;
break;
case LONG_OPTION_PHYTEST:
phy_test = 1;
break;
case 'A':
timing_advance = atoi (optarg);
break;
......@@ -2272,7 +2280,6 @@ static void get_options (int argc, char **argv)
case 't':
target_ul_mcs = atoi (optarg);
break;
#ifdef OPENAIR2
case 'W':
opt_enabled=1;
......@@ -2307,7 +2314,6 @@ static void get_options (int argc, char **argv)
}
break;
#endif
case 'V':
ouput_vcd = 1;
......@@ -2415,8 +2421,8 @@ static void get_options (int argc, char **argv)
case 'x':
transmission_mode = atoi(optarg);
if (transmission_mode > 2) {
printf("Transmission mode > 2 (%d) not supported for the moment\n",transmission_mode);
if (transmission_mode > 7) {
printf("Transmission mode %d not supported for the moment\n",transmission_mode);
exit(-1);
}
break;
......@@ -2511,8 +2517,6 @@ static void get_options (int argc, char **argv)
}
#ifdef OPENAIR2
init_all_otg(0);
g_otg->seed = 0;
init_seeds(g_otg->seed);
......@@ -2530,7 +2534,6 @@ static void get_options (int argc, char **argv)
init_predef_traffic(enb_properties->properties[i]->num_otg_elements, 1);
#endif
glog_level = enb_properties->properties[i]->glog_level;
glog_verbosity = enb_properties->properties[i]->glog_verbosity;
......@@ -2592,9 +2595,7 @@ int main( int argc, char **argv )
int CC_id;
uint16_t Nid_cell = 0;
uint8_t cooperation_flag=0, abstraction_flag=0;
#ifndef OPENAIR2
uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
#endif
#ifdef ENABLE_TCXO
unsigned int tcxo = 114;
......@@ -2662,8 +2663,8 @@ int main( int argc, char **argv )
if (UE_flag==1) {
printf("configuring for UE\n");
set_comp_log(HW, LOG_INFO, LOG_HIGH, 1);
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1);
set_comp_log(HW, LOG_DEBUG, LOG_HIGH, 1);
set_comp_log(PHY, LOG_DEBUG, LOG_HIGH, 1);
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);
......@@ -2679,15 +2680,9 @@ int main( int argc, char **argv )
printf("configuring for eNB\n");
set_comp_log(HW, hw_log_level, hw_log_verbosity, 1);
#ifdef OPENAIR2
set_comp_log(PHY, phy_log_level, phy_log_verbosity, 1);
if (opt_enabled == 1 )
set_comp_log(OPT, opt_log_level, opt_log_verbosity, 1);
#else
set_comp_log(PHY, LOG_INFO, LOG_HIGH, 1);
#endif
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);
......@@ -2743,8 +2738,6 @@ int main( int argc, char **argv )
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
#endif
#ifdef OPENAIR2
if (opt_type != OPT_NONE) {
radio_type_t radio_type;
......@@ -2757,7 +2750,6 @@ int main( int argc, char **argv )
LOG_E(OPT,"failed to run OPT \n");
}
#endif
#ifdef PDCP_USE_NETLINK
netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES)
......@@ -2827,8 +2819,13 @@ int main( int argc, char **argv )
PHY_vars_UE_g[0][CC_id] = init_lte_UE(frame_parms[CC_id], 0,abstraction_flag,transmission_mode);
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]);
#ifndef OPENAIR2
if (phy_test==1)
UE[CC_id]->mac_enabled = 0;
else
UE[CC_id]->mac_enabled = 1;
if (UE[CC_id]->mac_enabled == 0) {
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
UE[CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
UE[CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
......@@ -2838,9 +2835,7 @@ int main( int argc, char **argv )
UE[CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(0%3);
UE[CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
#endif
}
UE[CC_id]->UE_scan = UE_scan;
UE[CC_id]->UE_scan_carrier = UE_scan_carrier;
......@@ -2850,13 +2845,12 @@ int main( int argc, char **argv )
UE[CC_id]->lte_frame_parms.frame_type,
UE[CC_id]->X_u);
if (UE[CC_id]->mac_enabled == 1)
UE[CC_id]->lte_ue_pdcch_vars[0]->crnti = 0x1234;
#ifndef OPENAIR2
else
UE[CC_id]->lte_ue_pdcch_vars[0]->crnti = 0x1235;
#endif
#ifdef EXMIMO
for (i=0; i<4; i++) {
UE[CC_id]->rx_gain_max[i] = rxg_max[i];
UE[CC_id]->rx_gain_med[i] = rxg_med[i];
......@@ -2890,9 +2884,7 @@ int main( int argc, char **argv )
UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id];
#ifdef EXMIMO
//N_TA_offset
if (UE[CC_id]->lte_frame_parms.frame_type == TDD) {
if (UE[CC_id]->lte_frame_parms.N_RB_DL == 100)
......@@ -2904,7 +2896,6 @@ int main( int argc, char **argv )
} else {
UE[CC_id]->N_TA_offset = 0;
}
#else
//already taken care of in lte-softmodem
UE[CC_id]->N_TA_offset = 0;
......@@ -2928,8 +2919,12 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id;
#ifndef OPENAIR2
if (phy_test==1)
PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else
PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
if (PHY_vars_eNB_g[0][CC_id]->mac_enabled == 0) {
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_ACK_Index = beta_ACK;
PHY_vars_eNB_g[0][CC_id]->pusch_config_dedicated[i].betaOffset_RI_Index = beta_RI;
......@@ -2939,8 +2934,7 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].sr_ConfigIndex = 7+(i%3);
PHY_vars_eNB_g[0][CC_id]->scheduling_request_config[i].dsr_TransMax = sr_n4;
}
#endif
}
compute_prach_seq(&PHY_vars_eNB_g[0][CC_id]->lte_frame_parms.prach_config_common,
PHY_vars_eNB_g[0][CC_id]->lte_frame_parms.frame_type,
......@@ -3150,16 +3144,12 @@ int main( int argc, char **argv )
mac_xface = malloc(sizeof(MAC_xface));
#ifdef OPENAIR2
int eMBMS_active=0;
l2_init(frame_parms[0],eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
0,// cba_group_active
0); // HO flag
#endif
mac_xface->macphy_exit = &exit_fun;
#if defined(ENABLE_ITTI)
......@@ -3172,15 +3162,14 @@ int main( int argc, char **argv )
printf("ITTI tasks created\n");
#endif
#ifdef OPENAIR2
if (phy_test==0) {
if (UE_flag==1) {
printf("Filling UE band info\n");
fill_ue_band_info();
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
} else
mac_xface->mrbch_phy_sync_failure (0, 0, 0);
#endif
}
/* #ifdef OPENAIR2
//if (otg_enabled) {
......@@ -3571,9 +3560,6 @@ int main( int argc, char **argv )
}
}
#ifdef OPENAIR2
//cleanup_pdcp_thread();
#endif
#ifdef RTAI
stop_rt_timer();
......@@ -3608,13 +3594,9 @@ int main( int argc, char **argv )
if (ouput_vcd)
VCD_SIGNAL_DUMPER_CLOSE();
#ifdef OPENAIR2
if (opt_enabled == 1)
terminate_opt();
#endif
logClean();
return 0;
......
......@@ -925,9 +925,7 @@ static void *UE_thread_rx(void *arg)
phy_procedures_UE_RX( UE, 0, 0, UE->mode, no_relay, NULL );
}
#ifdef OPENAIR2
if (i==0) {
if ((UE->mac_enabled==1) && (i==0)) {
ret = mac_xface->ue_scheduler(UE->Mod_id,
UE->frame_tx,
UE->slot_rx>>1,
......@@ -950,7 +948,6 @@ static void *UE_thread_rx(void *arg)
}
}
#endif
UE->slot_rx++;
if (UE->slot_rx == 20) {
......
......@@ -136,6 +136,8 @@ int td = 0;
int td_avg = 0;
int sleep_time_us = 0;
int phy_test = 0;
#ifdef OPENAIR2
// omv related info
//pid_t omv_pid;
......@@ -209,6 +211,7 @@ void get_simulation_options(int argc, char *argv[])
LONG_OPTION_CBA_BACKOFF_TIMER,
LONG_OPTION_PHYTEST,
LONG_OPTION_XFORMS,
};
......@@ -241,6 +244,7 @@ void get_simulation_options(int argc, char *argv[])
{"cba-backoff", required_argument, 0, LONG_OPTION_CBA_BACKOFF_TIMER},
{"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
{"xforms", no_argument, 0, LONG_OPTION_XFORMS},
{NULL, 0, NULL, 0}
......@@ -248,6 +252,10 @@ void get_simulation_options(int argc, char *argv[])
while ((option = 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:qQ:rR:s:S:t:T:u:U:vV:w:W:x:X:y:Y:z:Z:", long_options, NULL)) != -1) {
switch (option) {
case LONG_OPTION_PHYTEST:
phy_test = 1;
break;
case LONG_OPTION_ENB_CONF:
if (optarg) {
free(conf_config_file_name); // prevent memory leak if option is used multiple times
......@@ -986,6 +994,14 @@ void init_openair1(void)
}
}
for (eNB_id=0; eNB_id<NB_eNB_INST; eNB_id++)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
if (phy_test==1)
PHY_vars_eNB_g[eNB_id][CC_id]->mac_enabled=0;
else
PHY_vars_eNB_g[eNB_id][CC_id]->mac_enabled=1;
}
// init_ue_status();
for (UE_id=0; UE_id<NB_UE_INST; UE_id++)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
......@@ -1002,6 +1018,11 @@ void init_openair1(void)
PHY_vars_UE_g[UE_id][CC_id]->UE_mode[0] = PRACH;
}
if (phy_test==1)
PHY_vars_UE_g[UE_id][CC_id]->mac_enabled=0;
else
PHY_vars_UE_g[UE_id][CC_id]->mac_enabled=1;
PHY_vars_UE_g[UE_id][CC_id]->lte_ue_pdcch_vars[0]->crnti = 0x1235 + UE_id;
PHY_vars_UE_g[UE_id][CC_id]->current_dlsch_cqi[0] = 10;
......
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