Commit a116072a authored by Laurent THOMAS's avatar Laurent THOMAS

fix timing advance HW imperfections and ta algorithm in ue

parent 513f060f
...@@ -161,16 +161,12 @@ extern "C" { ...@@ -161,16 +161,12 @@ extern "C" {
{NULL,-1}\ {NULL,-1}\
} }
#define SET_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask | B) #define SET_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask | B)
#define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B)) #define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B))
#define SET_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask | B) #define SET_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B)) #define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B))
typedef enum { typedef enum {
MIN_LOG_COMPONENTS = 0, MIN_LOG_COMPONENTS = 0,
PHY = MIN_LOG_COMPONENTS, PHY = MIN_LOG_COMPONENTS,
...@@ -232,8 +228,7 @@ comp_name_t; ...@@ -232,8 +228,7 @@ comp_name_t;
#define MAX_LOG_DYNALLOC_COMPONENTS 20 #define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS) #define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
typedef struct { typedef struct {
char *name; /*!< \brief string name of item */ char *name; /*!< \brief string name of item */
int value; /*!< \brief integer value of mapping */ int value; /*!< \brief integer value of mapping */
...@@ -265,8 +260,6 @@ typedef struct { ...@@ -265,8 +260,6 @@ typedef struct {
uint64_t dump_mask; uint64_t dump_mask;
} log_t; } log_t;
#ifdef LOG_MAIN #ifdef LOG_MAIN
log_t *g_log; log_t *g_log;
#else #else
...@@ -365,9 +358,6 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -365,9 +358,6 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
" level: add log level indication in log messages\n"\ " level: add log level indication in log messages\n"\
" thread: add threads names in log messages\n" " thread: add threads names in log messages\n"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOG global configuration parameters */ /* LOG global configuration parameters */
/* optname help paramflags XXXptr defXXXval type numelt */ /* optname help paramflags XXXptr defXXXval type numelt */
...@@ -401,6 +391,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -401,6 +391,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_A(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x);} } while (0) # define LOG_A(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x);} } while (0)
# define LOG_I(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} } while (0) # define LOG_I(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} } while (0)
# define LOG_D(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} } while (0) # define LOG_D(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} } while (0)
# define LOG_DDUMP(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) log_dump(c, b, s, f, x) ;} } while (0)
# define LOG_T(c, x...) do { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} } while (0) # define LOG_T(c, x...) do { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} } while (0)
# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0) # define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
...@@ -419,6 +410,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -419,6 +410,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_A(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x);} while (0) # define LOG_A(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ANALYSIS) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ANALYSIS, x);} while (0)
# define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0) # define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0)
# define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0) # define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0)
# define LOG_DDUMP(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) log_dump(c, b, s, f, x) ;} while (0)
# define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0) # define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0)
# define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0) # define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0)
......
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
#define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n" #define CONFIG_HLP_USRP_ARGS "set the arguments to identify USRP (same syntax as in UHD)\n"
#define CONFIG_HLP_DMAMAP "use DMA memory mapping\n" #define CONFIG_HLP_DMAMAP "use DMA memory mapping\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_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"
...@@ -106,7 +105,6 @@ ...@@ -106,7 +105,6 @@
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&usrp_args, .defstrval="type=b200",TYPE_STRING, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&usrp_args, .defstrval="type=b200",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, .uptr=&mmapped_dma, .defintval=0, TYPE_INT, 0}, \ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, .uptr=&mmapped_dma, .defintval=0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, .iptr=&tddflag, .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}, \
{"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \ {"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \
{"node-number", NULL, 0, .u16ptr=&node_number, .defuintval=2, TYPE_UINT16, 0}, \ {"node-number", NULL, 0, .u16ptr=&node_number, .defuintval=2, TYPE_UINT16, 0}, \
} }
......
...@@ -275,7 +275,6 @@ static void get_options(configmodule_interface_t *cfg) ...@@ -275,7 +275,6 @@ static void get_options(configmodule_interface_t *cfg)
int CC_id=0; int CC_id=0;
int tddflag=0; int tddflag=0;
int dumpframe=0; int dumpframe=0;
int timingadv=0;
uint8_t nfapi_mode = NFAPI_MONOLITHIC; uint8_t nfapi_mode = NFAPI_MONOLITHIC;
set_default_frame_parms(frame_parms); set_default_frame_parms(frame_parms);
...@@ -289,8 +288,6 @@ static void get_options(configmodule_interface_t *cfg) ...@@ -289,8 +288,6 @@ static void get_options(configmodule_interface_t *cfg)
config_process_cmdline(cfg, cmdline_ueparams, sizeofArray(cmdline_ueparams), NULL); config_process_cmdline(cfg, cmdline_ueparams, sizeofArray(cmdline_ueparams), NULL);
nfapi_setmode(nfapi_mode); nfapi_setmode(nfapi_mode);
get_softmodem_params()->hw_timing_advance = timingadv;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med; if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med;
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#define CONFIG_HLP_EXCCLK "tells hardware to use a clock reference (0:internal(default), 1:external, 2:gpsdo)\n" #define CONFIG_HLP_EXCCLK "tells hardware to use a clock reference (0:internal(default), 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\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_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n" #define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_ULOFF "Set the uplink frequnecy offset for all component carriers\n" #define CONFIG_HLP_ULOFF "Set the uplink frequnecy offset for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset\n" #define CONFIG_HLP_CHOFF "Channel id offset\n"
...@@ -81,7 +80,6 @@ ...@@ -81,7 +80,6 @@
#define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n" #define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n"
#define CONFIG_HLP_MAC "Disable the MAC procedures at UE side (default is enabled)\n" #define CONFIG_HLP_MAC "Disable the MAC procedures at UE side (default is enabled)\n"
#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n" #define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n"
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n"
#define CONFIG_HLP_TPORT "tracer port\n" #define CONFIG_HLP_TPORT "tracer port\n"
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n" #define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n" #define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
...@@ -109,6 +107,7 @@ ...@@ -109,6 +107,7 @@
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_NOS1 "Disable s1 interface\n" #define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
/*--------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */ /* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
......
...@@ -108,8 +108,6 @@ static int wait_for_sync = 0; ...@@ -108,8 +108,6 @@ static int wait_for_sync = 0;
unsigned int mmapped_dma=0; unsigned int mmapped_dma=0;
int single_thread_flag=1; int single_thread_flag=1;
int8_t threequarter_fs=0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
...@@ -648,7 +646,7 @@ int main( int argc, char **argv ) { ...@@ -648,7 +646,7 @@ int main( int argc, char **argv ) {
exit(-1); exit(-1);
} }
openair0_cfg[0].threequarter_fs = threequarter_fs; openair0_cfg[0].threequarter_fs = get_softmodem_params()->threequarter_fs;
if (get_softmodem_params()->do_ra) if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
// clang-format off // clang-format off
#define CMDLINE_PARAMS_DESC_GNB { \ #define CMDLINE_PARAMS_DESC_GNB { \
{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, .iptr=&single_thread_flag, .defintval=1, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, .iptr=&single_thread_flag, .defintval=1, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, .uptr=&timing_advance, .defintval=0, TYPE_UINT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .i8ptr=&threequarter_fs, .defintval=0, TYPE_INT8, 0}, \
{"m" , CONFIG_HLP_DLMCS_PHYTEST, 0, .uptr=&target_dl_mcs, .defintval=0, TYPE_UINT, 0}, \ {"m" , CONFIG_HLP_DLMCS_PHYTEST, 0, .uptr=&target_dl_mcs, .defintval=0, TYPE_UINT, 0}, \
{"l" , CONFIG_HLP_DLNL_PHYTEST, 0, .uptr=&target_dl_Nl, .defintval=0, TYPE_UINT, 0}, \ {"l" , CONFIG_HLP_DLNL_PHYTEST, 0, .uptr=&target_dl_Nl, .defintval=0, TYPE_UINT, 0}, \
{"L" , CONFIG_HLP_ULNL_PHYTEST, 0, .uptr=&target_ul_Nl, .defintval=0, TYPE_UINT, 0}, \ {"L" , CONFIG_HLP_ULNL_PHYTEST, 0, .uptr=&target_ul_Nl, .defintval=0, TYPE_UINT, 0}, \
......
...@@ -293,7 +293,6 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ ...@@ -293,7 +293,6 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
UE->chest_freq = nrUE_params.chest_freq; UE->chest_freq = nrUE_params.chest_freq;
UE->chest_time = nrUE_params.chest_time; UE->chest_time = nrUE_params.chest_time;
UE->no_timing_correction = nrUE_params.no_timing_correction; UE->no_timing_correction = nrUE_params.no_timing_correction;
UE->timing_advance = nrUE_params.timing_advance;
LOG_I(PHY,"Set UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, chest-freq %d, chest-time %d\n", LOG_I(PHY,"Set UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, chest-freq %d, chest-time %d\n",
UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->chest_freq, UE->chest_time); UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->chest_freq, UE->chest_time);
...@@ -307,7 +306,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ ...@@ -307,7 +306,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
fp->nb_antennas_rx = nrUE_params.nb_antennas_rx; fp->nb_antennas_rx = nrUE_params.nb_antennas_rx;
fp->nb_antennas_tx = nrUE_params.nb_antennas_tx; fp->nb_antennas_tx = nrUE_params.nb_antennas_tx;
fp->threequarter_fs = nrUE_params.threequarter_fs; fp->threequarter_fs = get_softmodem_params()->threequarter_fs;
fp->N_RB_DL = nrUE_params.N_RB_DL; fp->N_RB_DL = nrUE_params.N_RB_DL;
fp->ssb_start_subcarrier = nrUE_params.ssb_start_subcarrier; fp->ssb_start_subcarrier = nrUE_params.ssb_start_subcarrier;
fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor;
......
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_scan_carrier), .defintval=0, TYPE_INT, 0}, \ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_scan_carrier), .defintval=0, TYPE_INT, 0}, \
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_fo_compensation), .defintval=0, TYPE_INT, 0}, \ {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, .iptr=&(nrUE_params.UE_fo_compensation), .defintval=0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, .iptr=&(tx_max_power[0]), .defintval=90, TYPE_INT, 0}, \ {"ue-max-power", NULL, 0, .iptr=&(tx_max_power[0]), .defintval=90, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, .iptr=&(nrUE_params.timing_advance), .defintval=0, TYPE_INT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .iptr=&(nrUE_params.threequarter_fs), .defintval=0, TYPE_UINT8, 0}, \
{"r" , CONFIG_HLP_PRB_SA, 0, .iptr=&(nrUE_params.N_RB_DL), .defintval=106, TYPE_UINT, 0}, \ {"r" , CONFIG_HLP_PRB_SA, 0, .iptr=&(nrUE_params.N_RB_DL), .defintval=106, TYPE_UINT, 0}, \
{"ssb", CONFIG_HLP_SSC, 0, .iptr=&(nrUE_params.ssb_start_subcarrier), .defintval=516, TYPE_UINT16, 0}, \ {"ssb", CONFIG_HLP_SSC, 0, .iptr=&(nrUE_params.ssb_start_subcarrier), .defintval=516, TYPE_UINT16, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, .iptr=&tddflag, .defintval=0, TYPE_INT, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, .iptr=&tddflag, .defintval=0, TYPE_INT, 0}, \
...@@ -73,7 +71,6 @@ typedef struct { ...@@ -73,7 +71,6 @@ typedef struct {
tpool_t Tpool; // thread pool tpool_t Tpool; // thread pool
int UE_scan_carrier; int UE_scan_carrier;
int UE_fo_compensation; int UE_fo_compensation;
int timing_advance;
uint64_t if_freq; uint64_t if_freq;
int if_freq_off; int if_freq_off;
int chest_freq; int chest_freq;
...@@ -81,7 +78,6 @@ typedef struct { ...@@ -81,7 +78,6 @@ typedef struct {
int no_timing_correction; int no_timing_correction;
int nb_antennas_rx; int nb_antennas_rx;
int nb_antennas_tx; int nb_antennas_tx;
int threequarter_fs;
int N_RB_DL; int N_RB_DL;
int ssb_start_subcarrier; int ssb_start_subcarrier;
} nrUE_params_t; } nrUE_params_t;
......
...@@ -85,7 +85,7 @@ extern "C" ...@@ -85,7 +85,7 @@ extern "C"
#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" #define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n" #define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, (example 23.04 Msps for LTE 20MHz) to reduce the data rate on USB/PCIe transfers (only valid for some bandwidths)\n"
#define CONFIG_HLP_TPORT "tracer port\n" #define CONFIG_HLP_TPORT "tracer port\n"
#define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n" #define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n"
#define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n" #define CONFIG_HLP_TNOFORK "to ease debugging with gdb\n"
...@@ -111,6 +111,8 @@ extern "C" ...@@ -111,6 +111,8 @@ extern "C"
#define CONFIG_HLP_NID2 "Set NID2 value in Sidelink\n" #define CONFIG_HLP_NID2 "Set NID2 value in Sidelink\n"
#define CONFIG_HLP_NOITTI "Do not start itti threads, call queue processing in place, inside the caller thread" #define CONFIG_HLP_NOITTI "Do not start itti threads, call queue processing in place, inside the caller thread"
#define CONFIG_HLP_LDPC_OFFLOAD "Enable LDPC offload to AMD Xilinx T2 telco card\n" #define CONFIG_HLP_LDPC_OFFLOAD "Enable LDPC offload to AMD Xilinx T2 telco card\n"
#define CONFIG_HLP_TADV "Set RF board timing_advance to compensate fix delay inside the RF board between Rx and Tx timestamps (RF board internal issues)\n"
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters common to eNodeB and UE */ /* command line parameters common to eNodeB and UE */
...@@ -195,6 +197,8 @@ extern int usrp_tx_thread; ...@@ -195,6 +197,8 @@ extern int usrp_tx_thread;
{"nid2", CONFIG_HLP_NID2, 0, .iptr=&NID2, .defintval=1, TYPE_INT, 0}, \ {"nid2", CONFIG_HLP_NID2, 0, .iptr=&NID2, .defintval=1, TYPE_INT, 0}, \
{"no-itti-threads", CONFIG_HLP_NOITTI, PARAMFLAG_BOOL, .iptr=&softmodem_params.no_itti, .defintval=0, TYPE_INT, 0}, \ {"no-itti-threads", CONFIG_HLP_NOITTI, PARAMFLAG_BOOL, .iptr=&softmodem_params.no_itti, .defintval=0, TYPE_INT, 0}, \
{"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, PARAMFLAG_BOOL, .iptr=&LDPC_OFFLOAD_FLAG, .defstrval=0, TYPE_INT, 0}, \ {"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, PARAMFLAG_BOOL, .iptr=&LDPC_OFFLOAD_FLAG, .defstrval=0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, .iptr=&softmodem_params.hw_timing_advance,.defintval=0, TYPE_INT, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, .iptr=&softmodem_params.threequarter_fs, .defintval=0, TYPE_INT, 0}, \
} }
// clang-format on // clang-format on
...@@ -245,6 +249,8 @@ extern int usrp_tx_thread; ...@@ -245,6 +249,8 @@ extern int usrp_tx_thread;
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
} }
// clang-format on // clang-format on
...@@ -358,6 +364,7 @@ typedef struct { ...@@ -358,6 +364,7 @@ typedef struct {
int nid2; int nid2;
int no_itti; int no_itti;
int ldpc_offload_flag; int ldpc_offload_flag;
int threequarter_fs;
} softmodem_params_t; } softmodem_params_t;
extern uint64_t get_softmodem_optmask(void); extern uint64_t get_softmodem_optmask(void);
......
...@@ -175,7 +175,7 @@ struct NR_DL_FRAME_PARMS { ...@@ -175,7 +175,7 @@ struct NR_DL_FRAME_PARMS {
/// subcarrier spacing (15,30,60,120) /// subcarrier spacing (15,30,60,120)
uint32_t subcarrier_spacing; uint32_t subcarrier_spacing;
/// 3/4 sampling /// 3/4 sampling
uint8_t threequarter_fs; int threequarter_fs;
/// Size of FFT /// Size of FFT
uint16_t ofdm_symbol_size; uint16_t ofdm_symbol_size;
/// Number of prefix samples in all but first symbol of slot /// Number of prefix samples in all but first symbol of slot
......
...@@ -209,7 +209,6 @@ int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); ...@@ -209,7 +209,6 @@ int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
//int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti); //int mac_phy_remove_ue(module_id_t Mod_idP,rnti_t rnti);
void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance); void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint16_t timing_advance);
unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb); unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
......
...@@ -358,12 +358,12 @@ void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command ...@@ -358,12 +358,12 @@ void configure_ta_command(PHY_VARS_NR_UE *ue, fapi_nr_ta_command_pdu *ta_command
const double t_subframe = 1.0; // subframe duration of 1 msec const double t_subframe = 1.0; // subframe duration of 1 msec
const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe); const int ul_tx_timing_adjustment = 1 + (int)ceil(slots_per_subframe*(N_t_1 + N_t_2 + N_TA_max + 0.5)/t_subframe);
ue->ta_slot = (ta_command_pdu->ta_slot + ul_tx_timing_adjustment) % slots_per_frame; ue->ta_slot = ta_command_pdu->ta_slot + ul_tx_timing_adjustment;
if (ta_command_pdu->ta_slot + ul_tx_timing_adjustment > slots_per_frame) ue->ta_frame = ta_command_pdu->ta_frame;
ue->ta_frame = (ta_command_pdu->ta_frame + 1) % 1024; if (ue->ta_slot > slots_per_frame) {
else ue->ta_slot-=slots_per_frame;
ue->ta_frame = ta_command_pdu->ta_frame; ue->ta_frame=(ue->ta_frame+1)%1024;
}
ue->ta_command = ta_command_pdu->ta_command; ue->ta_command = ta_command_pdu->ta_command;
LOG_D(PHY,"TA command received in Frame.Slot %d.%d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n", LOG_D(PHY,"TA command received in Frame.Slot %d.%d -- Starting UL time alignment procedures. TA update will be applied at frame %d slot %d\n",
ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot); ta_command_pdu->ta_frame, ta_command_pdu->ta_slot, ue->ta_frame, ue->ta_slot);
......
...@@ -232,7 +232,6 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){ ...@@ -232,7 +232,6 @@ int get_tx_amp_prach(int power_dBm, int power_max_dBm, int N_RB_UL){
// - If the current tx frame and slot match the TA configuration // - If the current tx frame and slot match the TA configuration
// then timing advance is processed and set to be applied in the next UL transmission // then timing advance is processed and set to be applied in the next UL transmission
// - Application of timing adjustment according to TS 38.213 p4.2 // - Application of timing adjustment according to TS 38.213 p4.2
// todo:
// - handle RAR TA application as per ch 4.2 TS 38.213 // - handle RAR TA application as per ch 4.2 TS 38.213
void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx) void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx)
{ {
......
...@@ -317,7 +317,7 @@ UE_MODE_t get_ue_mode(uint8_t Mod_id, ...@@ -317,7 +317,7 @@ UE_MODE_t get_ue_mode(uint8_t Mod_id,
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index]); return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index]);
} }
void process_timing_advance_rar(PHY_VARS_UE *ue, static void process_timing_advance_rar(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc, UE_rxtx_proc_t *proc,
uint16_t timing_advance) { uint16_t timing_advance) {
ue->timing_advance = timing_advance*4; ue->timing_advance = timing_advance*4;
......
...@@ -176,11 +176,6 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui ...@@ -176,11 +176,6 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1); uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
void process_timing_advance(module_id_t Mod_id,uint8_t CC_id,int16_t timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint16_t timing_advance);
unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb); unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb);
void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
......
...@@ -112,7 +112,7 @@ typedef struct { ...@@ -112,7 +112,7 @@ typedef struct {
uint8_t R: 2; // octet 1 [7:6] uint8_t R: 2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED; } __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
static inline int get_mac_len(uint8_t* pdu, int pdu_len, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) { static inline int get_mac_len(uint8_t* pdu, int pdu_len, uint *mac_ce_len, uint *mac_subheader_len) {
if ( pdu_len < (int)sizeof(NR_MAC_SUBHEADER_SHORT)) if ( pdu_len < (int)sizeof(NR_MAC_SUBHEADER_SHORT))
return false; return false;
NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu; NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu;
......
...@@ -396,7 +396,6 @@ and fills the PRACH PDU per each FD occasion. ...@@ -396,7 +396,6 @@ and fills the PRACH PDU per each FD occasion.
void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, void *phy_data); void nr_ue_pucch_scheduler(module_id_t module_idP, frame_t frameP, int slotP, void *phy_data);
void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot); void nr_schedule_csirs_reception(NR_UE_MAC_INST_t *mac, int frame, int slot);
void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot); void nr_schedule_csi_for_im(NR_UE_MAC_INST_t *mac, int frame, int slot);
void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
/* \brief This function schedules the Msg3 transmission /* \brief This function schedules the Msg3 transmission
@param @param
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include "LAYER2/RLC/rlc.h" #include "LAYER2/RLC/rlc.h"
//#define SRS_DEBUG //#define SRS_DEBUG
static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment);
static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t slotP);
...@@ -3337,7 +3338,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP, ...@@ -3337,7 +3338,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
return num_sdus > 0 ? 1 : 0; return num_sdus > 0 ? 1 : 0;
} }
void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment) static void schedule_ta_command(fapi_nr_dl_config_request_t *dl_config, NR_UL_TIME_ALIGNMENT_t *ul_time_alignment)
{ {
fapi_nr_ta_command_pdu *ta = &dl_config->dl_config_list[dl_config->number_pdus].ta_command_pdu; fapi_nr_ta_command_pdu *ta = &dl_config->dl_config_list[dl_config->number_pdus].ta_command_pdu;
ta->ta_frame = ul_time_alignment->frame; ta->ta_frame = ul_time_alignment->frame;
......
...@@ -2064,29 +2064,16 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_RA_t *ra, uint8_t *dlsch_buffer, nfa ...@@ -2064,29 +2064,16 @@ static void nr_fill_rar(uint8_t Mod_idP, NR_RA_t *ra, uint8_t *dlsch_buffer, nfa
LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1);
LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2);
#endif #endif
int mcs = (unsigned char) (rar->UL_GRANT_4 >> 4);
// time alloc
int Msg3_t_alloc = (unsigned char) (rar->UL_GRANT_3 & 0x0f);
// frequency alloc
int Msg3_f_alloc = (uint16_t) ((rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12));
// frequency hopping
int freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2);
// TA command
int ta_command = rar->TA2 + (rar->TA1 << 5);
// TC-RNTI
int t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
LOG_D(NR_MAC, "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n", LOG_D(NR_MAC, "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n",
__FUNCTION__, __FUNCTION__,
Msg3_t_alloc, rar->UL_GRANT_3 & 0x0f,
Msg3_f_alloc, (rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12),
ta_command, rar->TA2 + (rar->TA1 << 5),
mcs, rar->UL_GRANT_4 >> 4,
freq_hopping, rar->UL_GRANT_1 >> 2,
tpc_command, tpc_command,
csi_req, csi_req,
t_crnti); rar->TCRNTI_2 + (rar->TCRNTI_1 << 8));
} }
void nr_schedule_RA(module_id_t module_idP, void nr_schedule_RA(module_id_t module_idP,
......
...@@ -131,8 +131,8 @@ static int nr_process_mac_pdu(instance_t module_idP, ...@@ -131,8 +131,8 @@ static int nr_process_mac_pdu(instance_t module_idP,
#endif #endif
while (!done && pdu_len > 0){ while (!done && pdu_len > 0){
uint16_t mac_len=0; uint mac_len=0;
uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED); uint mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED);
uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len);
......
...@@ -287,7 +287,7 @@ typedef struct openair0_config { ...@@ -287,7 +287,7 @@ typedef struct openair0_config {
//! the sample rate for transmit. //! the sample rate for transmit.
double tx_sample_rate; double tx_sample_rate;
//! check for threequarter sampling rate //! check for threequarter sampling rate
int8_t threequarter_fs; int threequarter_fs;
//! Flag to indicate this configuration is for NR //! Flag to indicate this configuration is for NR
int nr_flag; int nr_flag;
//! NR band number //! NR band number
......
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