Commit b53959c1 authored by Xiwen JIANG's avatar Xiwen JIANG

add exmimo-tdd-workaround and tdd-recip-calib options into softmodem command line

parent 31413ac5
...@@ -476,7 +476,7 @@ include_directories ("${X2AP_DIR}") ...@@ -476,7 +476,7 @@ include_directories ("${X2AP_DIR}")
# Hardware dependant options # Hardware dependant options
################################### ###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4") add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")
......
...@@ -4,30 +4,34 @@ ...@@ -4,30 +4,34 @@
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "PHY/impl_defs_lte.h" #include "PHY/impl_defs_lte.h"
extern char tdd_recip_calib_file[1024];
int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms) { int read_calibration_matrix(int32_t **tdd_calib_coeffs, char *calibF_fname, LTE_DL_FRAME_PARMS *frame_parms) {
FILE *calibF_fd; FILE *calibF_fd;
char calibF_file_name[1024];
int aa,re,calibF_e ; int aa,re,calibF_e ;
char* openair_dir = getenv("OPENAIR_DIR");
//printf("Number of antennas = %d\n", frame_parms->nb_antennas_tx) ; //char calibF_file_name[1024];
//printf("OFDM symbol size = %d\n", frame_parms->ofdm_symbol_size) ; //char* openair_dir = getenv("OPENAIR_DIR");
if (openair_dir == NULL) { //if (openair_dir == NULL) {
printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n"); // printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
return(1); // return(1);
} //}
//sprintf(calibF_file_name, "%s/targets/PROJECTS/TDDREC/result/%s", openair_dir, calibF_fname);
//calibF_fd = fopen(calibF_file_name,"r") ;
sprintf(calibF_file_name, "%s/targets/PROJECTS/TDDREC/result/%s", openair_dir, calibF_fname); calibF_fd = fopen(tdd_recip_calib_file, "r");
calibF_fd = fopen(calibF_file_name,"r") ;
if (calibF_fd == NULL) { if (calibF_fd == NULL) {
printf("Warning: %s not found, running with defaults\n", calibF_file_name); //printf("Warning: %s not found, running with defaults\n", calibF_file_name);
printf("Warning: %s not found, running with defaults\n", tdd_recip_calib_file);
return(1); return(1);
} }
printf("Loading Calibration matrix from %s\n", calibF_file_name); //printf("Loading Calibration matrix from %s\n", calibF_file_name);
printf("Loading Calibration matrix from %s\n", tdd_recip_calib_file);
for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) { for (aa=0;aa<frame_parms->nb_antennas_tx;aa++) {
for(re=0;re<frame_parms->N_RB_DL*12;re++) { for(re=0;re<frame_parms->N_RB_DL*12;re++) {
......
...@@ -70,7 +70,9 @@ typedef enum { ...@@ -70,7 +70,9 @@ typedef enum {
#include <enums.h> #include <enums.h>
#else #else
typedef enum { typedef enum {
duplex_mode_TDD=1,duplex_mode_FDD=0 duplex_mode_FDD=0,
duplex_mode_TDD=1,
duplex_mode_TDD_workaround=2 // TDD workaround flag for EXMIMO2 card because of the PLL limitation in TDD mode for Lms6002D
} duplex_mode_t; } duplex_mode_t;
#endif #endif
...@@ -203,6 +205,9 @@ typedef struct { ...@@ -203,6 +205,9 @@ typedef struct {
unsigned int my_port; unsigned int my_port;
//! Configuration file for LMS7002M //! Configuration file for LMS7002M
char *configFilename; char *configFilename;
//! TDD Reciprocity calibration, when equals 1, card
//config by Octave rather than by softmodem
int tdd_recip_calib;
} openair0_config_t; } openair0_config_t;
/*! \brief RF mapping */ /*! \brief RF mapping */
......
...@@ -80,7 +80,6 @@ static uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015 ...@@ -80,7 +80,6 @@ static uint32_t rf_vcocal_850[4] = {2015, 2015, 2015, 2015
static uint32_t rf_rxdc[4] = {32896,32896,32896,32896}; static uint32_t rf_rxdc[4] = {32896,32896,32896,32896};
extern volatile int oai_exit; extern volatile int oai_exit;
...@@ -798,6 +797,9 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -798,6 +797,9 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
if (!openair0_cfg) { if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n"); printf("Error, openair0_cfg is null!!\n");
return(-1); return(-1);
} else if (openair0_cfg[0].tdd_recip_calib == 1) {
printf("Warning, doing TDD reciprocity calibration, configuration has been done in Octave!!\n");
return(-1);
} }
for (card=0; card<openair0_num_detected_cards; card++) { for (card=0; card<openair0_num_detected_cards; card++) {
...@@ -825,21 +827,21 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -825,21 +827,21 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
if (openair0_cfg[card].sample_rate==30.72e6) { if (openair0_cfg[card].sample_rate==30.72e6) {
resampling_factor = 0; resampling_factor = 0;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) { if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround) {
printf("Warning: TDD workaround may not work for bw 20"); printf("Warning: TDD workaround may not work for bw 20");
} }
rx_filter = RXLPF10; rx_filter = RXLPF10;
tx_filter = TXLPF10; tx_filter = TXLPF10;
} else if (openair0_cfg[card].sample_rate==15.36e6) { } else if (openair0_cfg[card].sample_rate==15.36e6) {
resampling_factor = 1; resampling_factor = 1;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF10; rx_filter = RXLPF10;
else else
rx_filter = RXLPF5; rx_filter = RXLPF5;
tx_filter = TXLPF5; tx_filter = TXLPF5;
} else if (openair0_cfg[card].sample_rate==7.68e6) { } else if (openair0_cfg[card].sample_rate==7.68e6) {
resampling_factor = 2; resampling_factor = 2;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) // TDD workaround for EXMIMO if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF5; rx_filter = RXLPF5;
else else
rx_filter = RXLPF25; rx_filter = RXLPF25;
...@@ -847,7 +849,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -847,7 +849,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
} else { } else {
printf("Sampling rate not supported, using default 7.68MHz"); printf("Sampling rate not supported, using default 7.68MHz");
resampling_factor = 2; resampling_factor = 2;
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
rx_filter = RXLPF5; rx_filter = RXLPF5;
else else
rx_filter = RXLPF25; rx_filter = RXLPF25;
...@@ -899,7 +901,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -899,7 +901,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant]; p_exmimo_config->rf.rf_freq_rx[ant] = (unsigned int)openair0_cfg[card].rx_freq[ant];
// TDD workaround // TDD workaround
if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) if (openair0_cfg[card].duplex_mode==duplex_mode_TDD_workaround)
p_exmimo_config->rf.rf_freq_rx[ant] += openair0_cfg[card].sample_rate/4; p_exmimo_config->rf.rf_freq_rx[ant] += openair0_cfg[card].sample_rate/4;
switch (openair0_cfg[card].rxg_mode[ant]) { switch (openair0_cfg[card].rxg_mode[ant]) {
...@@ -963,11 +965,12 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) ...@@ -963,11 +965,12 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD;// + TXRXSWITCH_LSB + TXRXSWITCH_LSB + ACTIVE_RF+ ACTIVE_RF; p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD;// + TXRXSWITCH_LSB + TXRXSWITCH_LSB + ACTIVE_RF+ ACTIVE_RF;
printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config); printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
} }
else { else if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) {
// TDD workaround p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
//p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
printf("!!!!!setting TDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config); printf("!!!!!setting TDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
} else {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
printf("!!!!!setting TDD WORKAROUND (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
} }
ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card); ret = ioctl(openair0_fd, openair_DUMP_CONFIG, card);
......
...@@ -574,7 +574,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -574,7 +574,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
// **************************************** // ****************************************
// TDD workaround // TDD workaround
if ((eNB->rfdevice.type == EXMIMO_DEV) && (eNB->frame_parms.frame_type == TDD) && subframe_select(&eNB->frame_parms,proc->subframe_rx)==SF_UL) { //if ((eNB->rfdevice.type == EXMIMO_DEV) && (eNB->frame_parms.frame_type == TDD) && subframe_select(&eNB->frame_parms,proc->subframe_rx)==SF_UL) {
if ((eNB->rfdevice.openair0_cfg->duplex_mode == duplex_mode_TDD_workaround) && (eNB->frame_parms.frame_type == TDD) && subframe_select(&eNB->frame_parms,proc->subframe_rx)==SF_UL) {
remove_1_4_fs(eNB,proc->subframe_rx<<1); // TDD workaround for EXMIMO2 card remove_1_4_fs(eNB,proc->subframe_rx<<1); // TDD workaround for EXMIMO2 card
remove_1_4_fs(eNB,1+(proc->subframe_rx<<1)); remove_1_4_fs(eNB,1+(proc->subframe_rx<<1));
} }
......
...@@ -164,6 +164,7 @@ volatile int oai_exit = 0; ...@@ -164,6 +164,7 @@ volatile int oai_exit = 0;
static char UE_flag=0; static char UE_flag=0;
unsigned int mmapped_dma=0; unsigned int mmapped_dma=0;
int single_thread_flag=1; int single_thread_flag=1;
int exmimo_tdd_workaround=0;
static char threequarter_fs=0; static char threequarter_fs=0;
...@@ -202,6 +203,9 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/; ...@@ -202,6 +203,9 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char rf_config_file[1024]; char rf_config_file[1024];
int tdd_recip_calib = 0;
char tdd_recip_calib_file[1024];
int chain_offset=0; int chain_offset=0;
int phy_test = 0; int phy_test = 0;
uint8_t usim_test = 0; uint8_t usim_test = 0;
...@@ -381,6 +385,8 @@ void help (void) { ...@@ -381,6 +385,8 @@ void help (void) {
printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n"); printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n");
printf(" --usim-test use XOR autentication algo in case of test usim mode\n"); printf(" --usim-test use XOR autentication algo in case of test usim mode\n");
printf(" --single-thread-disable. Disables single-thread mode in lte-softmodem\n"); printf(" --single-thread-disable. Disables single-thread mode in lte-softmodem\n");
printf(" --tdd-recip-calib. Enable TDD channel reciprocity calibration by giving a calibration file\n");
printf(" --exmimo-tdd-workaround. Enable EXMIMO2 TDD workaround\n");
printf(" -C Set the downlink frequency for all component carriers\n"); printf(" -C Set the downlink frequency for all component carriers\n");
printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n"); 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(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n");
...@@ -690,6 +696,8 @@ static void get_options (int argc, char **argv) ...@@ -690,6 +696,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_USIMTEST, LONG_OPTION_USIMTEST,
LONG_OPTION_MMAPPED_DMA, LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD_DISABLE, LONG_OPTION_SINGLE_THREAD_DISABLE,
LONG_OPTION_TDD_RECIP_CALIB,
LONG_OPTION_EXMIMO_TDD_WORKAROUND,
#if T_TRACER #if T_TRACER
LONG_OPTION_T_PORT, LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT, LONG_OPTION_T_NOWAIT,
...@@ -717,6 +725,8 @@ static void get_options (int argc, char **argv) ...@@ -717,6 +725,8 @@ static void get_options (int argc, char **argv)
{"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST}, {"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST},
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA}, {"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"single-thread-disable", no_argument, NULL, LONG_OPTION_SINGLE_THREAD_DISABLE}, {"single-thread-disable", no_argument, NULL, LONG_OPTION_SINGLE_THREAD_DISABLE},
{"tdd-recip-calib", required_argument, NULL, LONG_OPTION_TDD_RECIP_CALIB},
{"exmimo-tdd-workaround", no_argument, NULL, LONG_OPTION_EXMIMO_TDD_WORKAROUND},
#if T_TRACER #if T_TRACER
{"T_port", required_argument, 0, LONG_OPTION_T_PORT}, {"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT}, {"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
...@@ -825,6 +835,23 @@ static void get_options (int argc, char **argv) ...@@ -825,6 +835,23 @@ static void get_options (int argc, char **argv)
single_thread_flag = 0; single_thread_flag = 0;
break; break;
case LONG_OPTION_TDD_RECIP_CALIB:
if ((strcmp("null", optarg) == 0) || (strcmp("NULL", optarg) == 0)) {
printf("No tdd reciprocity filename is provided\n");
}
else if (strlen(optarg)<=1024){
strcpy(tdd_recip_calib_file,optarg);
tdd_recip_calib = 1;
}else {
printf("TDD calibration filename is too long\n");
exit(-1);
}
break;
case LONG_OPTION_EXMIMO_TDD_WORKAROUND:
exmimo_tdd_workaround = 1;
break;
#if T_TRACER #if T_TRACER
case LONG_OPTION_T_PORT: { case LONG_OPTION_T_PORT: {
extern int T_port; extern int T_port;
...@@ -1310,10 +1337,17 @@ void init_openair0() { ...@@ -1310,10 +1337,17 @@ void init_openair0() {
} }
if (frame_parms[0]->frame_type==TDD) if (frame_parms[0]->frame_type==TDD)
if (exmimo_tdd_workaround == 1)
openair0_cfg[card].duplex_mode = duplex_mode_TDD_workaround;
else
openair0_cfg[card].duplex_mode = duplex_mode_TDD; openair0_cfg[card].duplex_mode = duplex_mode_TDD;
else //FDD else //FDD
openair0_cfg[card].duplex_mode = duplex_mode_FDD; openair0_cfg[card].duplex_mode = duplex_mode_FDD;
if (tdd_recip_calib == 1)
openair0_cfg[card].tdd_recip_calib = 1;
else
openair0_cfg[card].tdd_recip_calib = 0;
if (local_remote_radio == BBU_REMOTE_RADIO_HEAD) { if (local_remote_radio == BBU_REMOTE_RADIO_HEAD) {
openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr; openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr;
......
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