From 1b87fe8f51422bb879019f549225851748a857d0 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 26 Jan 2018 23:53:02 +0100 Subject: [PATCH] split of external clock and external time sources --- targets/ARCH/COMMON/common_lib.h | 2 +- targets/RT/USER/lte-ru.c | 9 ++++++--- targets/RT/USER/lte-softmodem.c | 5 +++-- targets/RT/USER/lte-softmodem.h | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 3a4b83f4e66..e63b5ded040 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -200,7 +200,7 @@ typedef struct { //! clock source clock_source_t clock_source; //! timing_source - clock_source_t timing_source; + clock_source_t time_source; //! Auto calibration flag int autocal[4]; //! rf devices work with x bits iqs when oai have its own iq format diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 732c5a2ba76..e73b29fbde7 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -115,7 +115,7 @@ extern volatile int oai_exit; extern void phy_init_RU(RU_t*); -void init_RU(char*); +void init_RU(char*,clock_source_t,clock_source_t); void stop_RU(RU_t *ru); void do_ru_sync(RU_t *ru); @@ -1339,6 +1339,7 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) { } else AssertFatal(1==0,"Unknown N_RB_DL %d\n",fp->N_RB_DL); + if (fp->frame_type==TDD) cfg->duplex_mode = duplex_mode_TDD; else //FDD @@ -2198,7 +2199,7 @@ void init_precoding_weights(PHY_VARS_eNB *eNB) { extern void RCconfig_RU(void); -void init_RU(char *rf_config_file) { +void init_RU(char *rf_config_file, clock_source_t clock_source,clock_source_t time_source) { int ru_id; RU_t *ru; @@ -2228,7 +2229,9 @@ void init_RU(char *rf_config_file) { ru->in_synch = (ru->is_slave == 1) ? 0 : 1; // 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; +; eNB0 = ru->eNB_list[0]; if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5)) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 1fe3e4e0a0a..1d85db8a72c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -126,7 +126,7 @@ volatile int start_UE = 0; #endif volatile int oai_exit = 0; -static clock_source_t clock_source = internal; +static clock_source_t clock_source = internal,time_source=internal; static int wait_for_sync = 0; static char UE_flag=0; @@ -800,6 +800,7 @@ void init_openair0() { openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL; openair0_cfg[card].clock_source = clock_source; + openair0_cfg[card].time_source = time_source; openair0_cfg[card].tx_num_channels=min(2,((UE_flag==0) ? RC.eNB[0][0]->frame_parms.nb_antennas_tx : PHY_vars_UE_g[0][0]->frame_parms.nb_antennas_tx)); @@ -1249,7 +1250,7 @@ int main( int argc, char **argv ) if (RC.nb_RU >0) { printf("Initializing RU threads\n"); - init_RU(rf_config_file); + init_RU(rf_config_file,clock_source,time_source); for (ru_id=0;ru_id<RC.nb_RU;ru_id++) { RC.ru[ru_id]->rf_map.card=0; RC.ru[ru_id]->rf_map.chain=CC_id+chain_offset; diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index e1624760385..5cf43d5d95f 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -243,7 +243,7 @@ extern void stop_eNB(int); extern void kill_eNB_proc(int inst); // In lte-ru.c -extern void init_RU(const char*); +extern void init_RU(const char*,clock_source_t,clock_source_t); // In lte-ue.c extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg); -- GitLab