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}")
# 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_TXRX "2" "Number of antennas in ????" "1" "2" "4")
......
......@@ -4,30 +4,34 @@
#include "UTIL/LOG/log.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) {
FILE *calibF_fd;
char calibF_file_name[1024];
int aa,re,calibF_e ;
char* openair_dir = getenv("OPENAIR_DIR");
//printf("Number of antennas = %d\n", frame_parms->nb_antennas_tx) ;
//printf("OFDM symbol size = %d\n", frame_parms->ofdm_symbol_size) ;
//char calibF_file_name[1024];
//char* openair_dir = getenv("OPENAIR_DIR");
if (openair_dir == NULL) {
printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
return(1);
}
//if (openair_dir == NULL) {
// printf("ERR: OPENAIR_DIR not defined (did you source oaienv?)\n");
// 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(calibF_file_name,"r") ;
calibF_fd = fopen(tdd_recip_calib_file, "r");
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);
}
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(re=0;re<frame_parms->N_RB_DL*12;re++) {
......
......@@ -70,7 +70,9 @@ typedef enum {
#include <enums.h>
#else
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;
#endif
......@@ -203,6 +205,9 @@ typedef struct {
unsigned int my_port;
//! Configuration file for LMS7002M
char *configFilename;
//! TDD Reciprocity calibration, when equals 1, card
//config by Octave rather than by softmodem
int tdd_recip_calib;
} openair0_config_t;
/*! \brief RF mapping */
......
......@@ -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};
extern volatile int oai_exit;
......@@ -798,6 +797,9 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
if (!openair0_cfg) {
printf("Error, openair0_cfg is null!!\n");
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++) {
......@@ -825,21 +827,21 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
if (openair0_cfg[card].sample_rate==30.72e6) {
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");
}
rx_filter = RXLPF10;
tx_filter = TXLPF10;
} else if (openair0_cfg[card].sample_rate==15.36e6) {
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;
else
rx_filter = RXLPF5;
tx_filter = TXLPF5;
} else if (openair0_cfg[card].sample_rate==7.68e6) {
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;
else
rx_filter = RXLPF25;
......@@ -847,7 +849,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
} else {
printf("Sampling rate not supported, using default 7.68MHz");
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;
else
rx_filter = RXLPF25;
......@@ -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];
// 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;
switch (openair0_cfg[card].rxg_mode[ant]) {
......@@ -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;
printf("!!!!!setting FDD (tdd_config=%d)\n",p_exmimo_config->framing.tdd_config);
}
else {
// TDD workaround
//p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
p_exmimo_config->framing.tdd_config = DUPLEXMODE_FDD + TXRXSWITCH_LSB;
else if (openair0_cfg[card].duplex_mode==duplex_mode_TDD) {
p_exmimo_config->framing.tdd_config = DUPLEXMODE_TDD + TXRXSWITCH_LSB + ACTIVE_RF;
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);
......
......@@ -574,7 +574,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
// ****************************************
// 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,1+(proc->subframe_rx<<1));
}
......
......@@ -164,6 +164,7 @@ volatile int oai_exit = 0;
static char UE_flag=0;
unsigned int mmapped_dma=0;
int single_thread_flag=1;
int exmimo_tdd_workaround=0;
static char threequarter_fs=0;
......@@ -202,6 +203,9 @@ static int tx_max_power[MAX_NUM_CCs]; /* = {0,0}*/;
char rf_config_file[1024];
int tdd_recip_calib = 0;
char tdd_recip_calib_file[1024];
int chain_offset=0;
int phy_test = 0;
uint8_t usim_test = 0;
......@@ -381,6 +385,8 @@ void help (void) {
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(" --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(" -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");
......@@ -680,7 +686,7 @@ static void get_options (int argc, char **argv)
LONG_OPTION_NO_L2_CONNECT,
LONG_OPTION_CALIB_PRACH_TX,
LONG_OPTION_RXGAIN,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_RXGAINOFF,
LONG_OPTION_TXGAIN,
LONG_OPTION_SCANCARRIER,
LONG_OPTION_MAXPOWER,
......@@ -690,6 +696,8 @@ static void get_options (int argc, char **argv)
LONG_OPTION_USIMTEST,
LONG_OPTION_MMAPPED_DMA,
LONG_OPTION_SINGLE_THREAD_DISABLE,
LONG_OPTION_TDD_RECIP_CALIB,
LONG_OPTION_EXMIMO_TDD_WORKAROUND,
#if T_TRACER
LONG_OPTION_T_PORT,
LONG_OPTION_T_NOWAIT,
......@@ -707,7 +715,7 @@ static void get_options (int argc, char **argv)
{"no-L2-connect", no_argument, NULL, LONG_OPTION_NO_L2_CONNECT},
{"calib-prach-tx", no_argument, NULL, LONG_OPTION_CALIB_PRACH_TX},
{"ue-rxgain", required_argument, NULL, LONG_OPTION_RXGAIN},
{"ue-rxgain-off", required_argument, NULL, LONG_OPTION_RXGAINOFF},
{"ue-rxgain-off", required_argument, NULL, LONG_OPTION_RXGAINOFF},
{"ue-txgain", required_argument, NULL, LONG_OPTION_TXGAIN},
{"ue-scan-carrier", no_argument, NULL, LONG_OPTION_SCANCARRIER},
{"ue-max-power", required_argument, NULL, LONG_OPTION_MAXPOWER},
......@@ -717,6 +725,8 @@ static void get_options (int argc, char **argv)
{"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST},
{"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA},
{"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
{"T_port", required_argument, 0, LONG_OPTION_T_PORT},
{"T_nowait", no_argument, 0, LONG_OPTION_T_NOWAIT},
......@@ -825,6 +835,23 @@ static void get_options (int argc, char **argv)
single_thread_flag = 0;
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
case LONG_OPTION_T_PORT: {
extern int T_port;
......@@ -1310,10 +1337,17 @@ void init_openair0() {
}
if (frame_parms[0]->frame_type==TDD)
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
if (exmimo_tdd_workaround == 1)
openair0_cfg[card].duplex_mode = duplex_mode_TDD_workaround;
else
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
else //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) {
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