Commit 897ca561 authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding time_source command line parameter and removing duplications of clock_source

ignoring command line paramters clock_source and time_source in lte-softmodem and harmonizing it with nr-softmodem
time_source and clock_source handled separately in usrp_lib.cpp
parent d90f8da3
......@@ -2298,6 +2298,24 @@ void RCconfig_RU(void)
RC.ru[j]->openair0_cfg.clock_source = unset;
}
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
RC.ru[j]->openair0_cfg.time_source = internal;
LOG_D(PHY, "RU time source set as internal\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
RC.ru[j]->openair0_cfg.time_source = external;
LOG_D(PHY, "RU time source set as external\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
RC.ru[j]->openair0_cfg.time_source = gpsdo;
LOG_D(PHY, "RU time source set as gpsdo\n");
} else {
LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
}
}
else {
RC.ru[j]->openair0_cfg.time_source = unset;
}
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
RC.ru[j]->if_south = LOCAL_RF;
......
......@@ -127,7 +127,6 @@ volatile int start_eNB = 0;
volatile int start_UE = 0;
volatile int oai_exit = 0;
static clock_source_t clock_source = unset;
int single_thread_flag=1;
static double snr_dB=20;
......@@ -597,7 +596,8 @@ void init_openair0(void) {
PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
openair0_cfg[card].tx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx);
openair0_cfg[card].rx_num_channels=min(2,PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_rx);
......
......@@ -59,7 +59,6 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_PARAMS_DESC_UE { \
{"clock-source", CONFIG_HLP_EXCCLK, 0, iptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \
......
......@@ -53,6 +53,7 @@ extern "C"
#define CONFIG_HLP_EXTS "tells hardware to use an external timing reference\n"
#define CONFIG_HLP_DMRSSYNC "tells RU to insert DMRS in subframe 1 slot 0"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_TME "tells hardware to use a time reference (0:internal, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
......@@ -105,7 +106,8 @@ extern "C"
{"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&PHY_TEST, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&USIM_TEST, defintval:0, TYPE_UINT8, 0}, \
{"clock", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
{"clock-source", CONFIG_HLP_CLK, 0, uptr:&CLOCK_SOURCE, defintval:0, TYPE_UINT, 0}, \
{"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0, TYPE_UINT64, 0}, \
......
......@@ -90,6 +90,7 @@ typedef enum {
#define CONFIG_STRING_RU_NBIOTRRC_LIST "NbIoT_RRC_instances"
#define CONFIG_STRING_RU_SDR_ADDRS "sdr_addrs"
#define CONFIG_STRING_RU_SDR_CLK_SRC "clock_src"
#define CONFIG_STRING_RU_SDR_TME_SRC "time_src"
#define CONFIG_STRING_RU_SF_EXTENSION "sf_extension"
#define CONFIG_STRING_RU_END_OF_BURST_DELAY "end_of_burst_delay"
#define CONFIG_STRING_RU_OTA_SYNC_ENABLE "ota_sync_enabled"
......@@ -117,11 +118,12 @@ typedef enum {
#define RU_NBIOTRRC_LIST_IDX 18
#define RU_SDR_ADDRS 19
#define RU_SDR_CLK_SRC 20
#define RU_SF_EXTENSION_IDX 21
#define RU_END_OF_BURST_DELAY_IDX 22
#define RU_OTA_SYNC_ENABLE_IDX 23
#define RU_BF_WEIGHTS_LIST_IDX 24
#define RU_IF_FREQUENCY 25
#define RU_SDR_TME_SRC 21
#define RU_SF_EXTENSION_IDX 22
#define RU_END_OF_BURST_DELAY_IDX 23
#define RU_OTA_SYNC_ENABLE_IDX 24
#define RU_BF_WEIGHTS_LIST_IDX 25
#define RU_IF_FREQUENCY 26
/*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* RU configuration parameters */
......@@ -149,6 +151,7 @@ typedef enum {
{CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFENBS, TYPE_INTARRAY, 1}, \
{CONFIG_STRING_RU_SDR_ADDRS, NULL, 0, strptr:NULL, defstrval:"type=b200", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_SDR_CLK_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_SDR_TME_SRC, NULL, 0, strptr:NULL, defstrval:"internal", TYPE_STRING, 0}, \
{CONFIG_STRING_RU_SF_EXTENSION, NULL, 0, uptr:NULL, defuintval:312, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_END_OF_BURST_DELAY, NULL, 0, uptr:NULL, defuintval:400, TYPE_UINT, 0}, \
{CONFIG_STRING_RU_OTA_SYNC_ENABLE, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
......
......@@ -835,22 +835,16 @@ extern "C" {
if (args.find("clock_source")==std::string::npos) {
if (openair0_cfg[0].clock_source == internal) {
//in UHD 3.14 we could use
//s->usrp->set_sync_source("clock_source=internal","time_source=internal");
s->usrp->set_time_source("internal");
s->usrp->set_clock_source("internal");
LOG_D(HW,"Setting time and clock source to internal\n");
LOG_D(HW,"Setting clock source to internal\n");
}
else if (openair0_cfg[0].clock_source == external ) {
//s->usrp->set_sync_source("clock_source=external","time_source=external");
s->usrp->set_time_source("external");
s->usrp->set_clock_source("external");
LOG_D(HW,"Setting time and clock source to external\n");
LOG_D(HW,"Setting clock source to external\n");
}
else if (openair0_cfg[0].clock_source==gpsdo) {
s->usrp->set_clock_source("gpsdo");
s->usrp->set_time_source("gpsdo");
LOG_D(HW,"Setting time and clock source to gpsdo\n");
LOG_D(HW,"Setting clock source to gpsdo\n");
}
else {
LOG_W(HW,"Clock source set neither in usrp_args nor on command line, using default!\n");
......@@ -861,7 +855,31 @@ extern "C" {
LOG_W(HW,"Clock source set in both usrp_args and in clock_source, ingnoring the latter!\n");
}
}
if (args.find("time_source")==std::string::npos) {
if (openair0_cfg[0].time_source == internal) {
s->usrp->set_time_source("internal");
LOG_D(HW,"Setting time source to internal\n");
}
else if (openair0_cfg[0].time_source == external ) {
s->usrp->set_time_source("external");
LOG_D(HW,"Setting time source to external\n");
}
else if (openair0_cfg[0].time_source==gpsdo) {
s->usrp->set_time_source("gpsdo");
LOG_D(HW,"Setting time source to gpsdo\n");
}
else {
LOG_W(HW,"Time source set neither in usrp_args nor on command line, using default!\n");
}
}
else {
if (openair0_cfg[0].clock_source != unset) {
LOG_W(HW,"Time source set in both usrp_args and in time_source, ingnoring the latter!\n");
}
}
if (s->usrp->get_clock_source(0) == "gpsdo") {
s->use_gps = 1;
......@@ -1061,7 +1079,9 @@ extern "C" {
//s->usrp->set_time_source("external");
// display USRP settings
LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6);
sleep(1);
LOG_I(HW,"Actual clock source %s...\n",s->usrp->get_clock_source(0).c_str());
LOG_I(HW,"Actual time source %s...\n",s->usrp->get_time_source(0).c_str());
sleep(1);
// create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16");
int samples=openair0_cfg[0].sample_rate;
......
......@@ -1405,7 +1405,6 @@ void fill_rf_config(RU_t *ru,
cfg->num_rb_dl=fp->N_RB_DL;
cfg->tx_num_channels=ru->nb_tx;
cfg->rx_num_channels=ru->nb_rx;
cfg->clock_source=get_softmodem_params()->clock_source;
for (int i=0; i<ru->nb_tx; i++) {
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
......@@ -2683,7 +2682,7 @@ void set_function_spec_param(RU_t *ru) {
//extern void RCconfig_RU(void);
void init_RU(char *rf_config_file, clock_source_t clock_source, clock_source_t time_source, int send_dmrssync) {
void init_RU(char *rf_config_file, int send_dmrssync) {
int ru_id, i, CC_id;
RU_t *ru;
PHY_VARS_eNB *eNB0 = (PHY_VARS_eNB *)NULL;
......@@ -2718,8 +2717,6 @@ void init_RU(char *rf_config_file, clock_source_t clock_source, clock_source_t t
ru->south_out_cnt = 0;
// use eNB_list[0] as a reference for RU frame parameters
// NOTE: multiple CC_id are not handled here yet!
ru->openair0_cfg.clock_source = clock_source;
ru->openair0_cfg.time_source = time_source;
//ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0;
if ((ru->is_slave == 0) && (ru->ota_sync_enable == 1))
......@@ -2956,6 +2953,27 @@ void RCconfig_RU(void) {
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
}
}
else {
RC.ru[j]->openair0_cfg.clock_source = unset;
}
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) {
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) {
RC.ru[j]->openair0_cfg.time_source = internal;
LOG_D(PHY, "RU time source set as internal\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) {
RC.ru[j]->openair0_cfg.time_source = external;
LOG_D(PHY, "RU time source set as external\n");
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) {
RC.ru[j]->openair0_cfg.time_source = gpsdo;
LOG_D(PHY, "RU time source set as gpsdo\n");
} else {
LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
}
}
else {
RC.ru[j]->openair0_cfg.time_source = unset;
}
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
......
......@@ -654,7 +654,7 @@ int main ( int argc, char **argv )
// some initialization is necessary and init_ru_vnf do this.
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
printf("Initializing RU threads\n");
init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->clock_source,get_softmodem_params()->timing_source,get_softmodem_params()->send_dmrs_sync);
init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync);
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
RC.ru[ru_id]->rf_map.card=0;
......
......@@ -81,7 +81,6 @@
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
......@@ -115,7 +114,6 @@
{"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"clock-source", CONFIG_HLP_CLK, 0, iptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
}
......@@ -169,7 +167,7 @@ extern void init_RU_proc(RU_t *ru);
extern void stop_RU(int nb_ru);
extern void kill_RU_proc(RU_t *ru);
extern void set_function_spec_param(RU_t *ru);
extern void init_RU(char *, clock_source_t clock_source, clock_source_t time_source, int send_dmrssync);
extern void init_RU(char *, int send_dmrssync);
// In lte-ue.c
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg);
......
......@@ -113,10 +113,6 @@ uint16_t runtime_phy_tx[29][6]; // SISO [MCS 0-28][RBs 0-5 : 6, 15, 25, 50, 75,
volatile int oai_exit = 0;
clock_source_t clock_source = internal,time_source=internal;
unsigned int mmapped_dma=0;
......@@ -467,7 +463,8 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms->N_RB_DL;
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].clock_source = get_softmodem_params()->clock_source;
openair0_cfg[card].time_source = get_softmodem_params()->timing_source;
openair0_cfg[card].tx_num_channels=min(2,frame_parms->nb_antennas_tx);
openair0_cfg[card].rx_num_channels=min(2,frame_parms->nb_antennas_rx);
......
......@@ -64,7 +64,7 @@ sim_t sim;
void init_ru_devices(void);
void init_RU(char *,clock_source_t clock_source,clock_source_t time_source,int send_dmrssync);
void init_RU(char *,int send_dmrssync);
void *rfsim_top(void *n_frames);
......@@ -101,7 +101,7 @@ void RCConfig_sim(void) {
RC.nb_RU = RUParamList.numelt;
AssertFatal(RC.nb_RU>0,"we need at least 1 RU for simulation\n");
printf("returned with %d rus\n",RC.nb_RU);
init_RU(NULL,internal,internal,0);
init_RU(NULL,0);
printf("Waiting for RUs to get set up\n");
wait_RUs();
init_ru_devices();
......
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