Commit 28425d4e authored by Laurent THOMAS's avatar Laurent THOMAS Committed by laurent

mr2553 move command line sample offset and 3/4 sampling option at top level,...

mr2553 move command line sample offset and 3/4 sampling option at top level, as it is common option for 4G,5G xNB and UE
parent b830c9c5
...@@ -103,7 +103,6 @@ struct timing_info_t { ...@@ -103,7 +103,6 @@ struct timing_info_t {
} timing_info; } timing_info;
// Fix per CC openair rf/if device update // Fix per CC openair rf/if device update
// extern openair0_device openair0;
extern int oai_exit; extern int oai_exit;
......
...@@ -808,26 +808,31 @@ void tx_rf(RU_t *ru, ...@@ -808,26 +808,31 @@ void tx_rf(RU_t *ru,
/* add fail safe for late command end */ /* add fail safe for late command end */
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers // prepare tx buffer pointers
txs = ru->rfdevice.trx_write_func(&ru->rfdevice, txs = ru->rfdevice
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, .trx_write_func(&ru->rfdevice, timestamp + ru->ts_offset - sf_extension, txp, siglen + sf_extension, ru->nb_tx, flags);
txp, ru->south_out_cnt++;
siglen+sf_extension, LOG_D(PHY, "south_out_cnt %d\n", ru->south_out_cnt);
ru->nb_tx, int se = dB_fixed(signal_energy(txp[0], siglen + sf_extension));
flags);
ru->south_out_cnt++; if (SF_type == SF_S)
LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt); LOG_D(PHY,
int se = dB_fixed(signal_energy(txp[0],siglen+sf_extension)); "[TXPATH] RU %d tx_rf (en %d,len %d), writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",
ru->idx,
if (SF_type == SF_S) LOG_D(PHY,"[TXPATH] RU %d tx_rf (en %d,len %d), writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx, se, se,
siglen+sf_extension, (long long unsigned int)timestamp, frame, proc->frame_tx_unwrap, subframe); siglen + sf_extension,
(long long unsigned int)timestamp,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); frame,
proc->frame_tx_unwrap,
// AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen); subframe);
if( usrp_tx_thread == 0 && (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ) { /* add fail safe for late command */
late_control=STATE_BURST_TERMINATE; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0);
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control);
} // AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
if (usrp_tx_thread == 0 && (txs != siglen + sf_extension)
&& (late_control == STATE_BURST_NORMAL)) { /* add fail safe for late command */
late_control = STATE_BURST_TERMINATE;
LOG_E(PHY, "TX : Timeout (sent %d/%d) state =%d\n", txs, siglen, late_control);
}
} else if (IS_SOFTMODEM_RFSIM ) { } else if (IS_SOFTMODEM_RFSIM ) {
// in case of rfsim, we always enable tx because we need to feed rx of the opposite side // in case of rfsim, we always enable tx because we need to feed rx of the opposite side
// we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q) // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q)
...@@ -836,15 +841,15 @@ void tx_rf(RU_t *ru, ...@@ -836,15 +841,15 @@ void tx_rf(RU_t *ru,
memset(dummy_tx_data,0,sizeof(dummy_tx_data)); memset(dummy_tx_data,0,sizeof(dummy_tx_data));
for (int i=0; i<ru->frame_parms->nb_antennas_tx; i++) for (int i=0; i<ru->frame_parms->nb_antennas_tx; i++)
dummy_tx[i]= dummy_tx_data[i]; dummy_tx[i]= dummy_tx_data[i];
AssertFatal( 1 == AssertFatal(1
ru->rfdevice.trx_write_func(&ru->rfdevice, == ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, timestamp + ru->ts_offset - sf_extension,
dummy_tx, dummy_tx,
1, 1,
ru->frame_parms->nb_antennas_tx, ru->frame_parms->nb_antennas_tx,
4),""); 4),
"");
} }
} }
......
...@@ -74,15 +74,7 @@ ...@@ -74,15 +74,7 @@
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n" #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_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"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters specific to UE */ /* command line parameters specific to UE */
...@@ -106,7 +98,6 @@ ...@@ -106,7 +98,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}, \
} }
......
...@@ -169,7 +169,6 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -169,7 +169,6 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
} }
ue->hw_timing_advance=get_softmodem_params()->hw_timing_advance;
ue->Mod_id = UE_id; ue->Mod_id = UE_id;
ue->mac_enabled = 1; ue->mac_enabled = 1;
...@@ -1940,16 +1939,15 @@ void *UE_thread(void *arg) { ...@@ -1940,16 +1939,15 @@ void *UE_thread(void *arg) {
rxp, rxp,
readBlockSize, readBlockSize,
UE->frame_parms.nb_antennas_rx),""); UE->frame_parms.nb_antennas_rx),"");
AssertFatal( writeBlockSize == AssertFatal(writeBlockSize
UE->rfdevice.trx_write_func(&UE->rfdevice, == UE->rfdevice.trx_write_func(&UE->rfdevice,
timestamp+ timestamp + (2 * UE->frame_parms.samples_per_tti)
(2*UE->frame_parms.samples_per_tti) - - UE->frame_parms.ofdm_symbol_size - UE->frame_parms.nb_prefix_samples0,
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 - txp,
openair0_cfg[0].tx_sample_advance, writeBlockSize,
txp, UE->frame_parms.nb_antennas_tx,
writeBlockSize, 1),
UE->frame_parms.nb_antennas_tx, "");
1),"");
if( sub_frame==9) { if( sub_frame==9) {
// read in first symbol of next frame and adjust for timing drift // read in first symbol of next frame and adjust for timing drift
......
...@@ -274,8 +274,7 @@ static void get_options(configmodule_interface_t *cfg) ...@@ -274,8 +274,7 @@ 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;
......
...@@ -90,12 +90,8 @@ ...@@ -90,12 +90,8 @@
#include <openair1/PHY/NR_TRANSPORT/nr_dlsch.h> #include <openair1/PHY/NR_TRANSPORT/nr_dlsch.h>
#include <PHY/NR_ESTIMATION/nr_ul_estimation.h> #include <PHY/NR_ESTIMATION/nr_ul_estimation.h>
//#define USRP_DEBUG 1 // #define USRP_DEBUG 1
// Fix per CC openair rf/if device update // Fix per CC openair rf/if device update
// extern openair0_device openair0;
//pthread_t main_gNB_thread;
time_stats_t softmodem_stats_mt; // main thread time_stats_t softmodem_stats_mt; // main thread
time_stats_t softmodem_stats_hw; // hw acquisition time_stats_t softmodem_stats_hw; // hw acquisition
......
...@@ -102,7 +102,6 @@ int attach_rru(RU_t *ru); ...@@ -102,7 +102,6 @@ int attach_rru(RU_t *ru);
int connect_rau(RU_t *ru); int connect_rau(RU_t *ru);
static void NRRCconfig_RU(configmodule_interface_t *cfg); static void NRRCconfig_RU(configmodule_interface_t *cfg);
extern uint32_t timing_advance;
extern int emulate_rf; extern int emulate_rf;
extern int numerology; extern int numerology;
...@@ -857,22 +856,17 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { ...@@ -857,22 +856,17 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
for (i = 0; i < ru->nb_tx; i++) for (i = 0; i < ru->nb_tx; i++)
txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot, fp, 0)] - sf_extension * sizeof(int32_t); txp[i] = (void *)&ru->common.txdata[i][fp->get_samples_slot_timestamp(slot, fp, 0)] - sf_extension * sizeof(int32_t);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp + ru->ts_offset) & 0xffffffff);
(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance) & 0xffffffff);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1);
// prepare tx buffer pointers // prepare tx buffer pointers
txs = ru->rfdevice.trx_write_func(&ru->rfdevice, txs = ru->rfdevice
timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance - sf_extension, .trx_write_func(&ru->rfdevice, timestamp + ru->ts_offset - sf_extension, txp, siglen + sf_extension, ru->nb_tx, flags);
txp,
siglen + sf_extension,
ru->nb_tx,
flags);
LOG_D(PHY, LOG_D(PHY,
"[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, %d.%d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, " "[TXPATH] RU %d aa %d tx_rf, writing to TS %llu, %d.%d, unwrapped_frame %d, slot %d, flags %d, siglen+sf_extension %d, "
"returned %d, E %f\n", "returned %d, E %f\n",
ru->idx, ru->idx,
i, i,
(long long unsigned int)(timestamp + ru->ts_offset - ru->openair0_cfg.tx_sample_advance - timing_advance - sf_extension), (long long unsigned int)(timestamp + ru->ts_offset - sf_extension),
frame, frame,
slot, slot,
proc->frame_tx_unwrap, proc->frame_tx_unwrap,
......
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
#define CONFIG_HLP_DMAMAP "use DMA memory mapping\n" #define CONFIG_HLP_DMAMAP "use DMA memory mapping\n"
#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"
...@@ -80,8 +79,7 @@ ...@@ -80,8 +79,7 @@
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
#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];
...@@ -145,12 +143,6 @@ int rx_input_level_dBm; ...@@ -145,12 +143,6 @@ int rx_input_level_dBm;
int otg_enabled; int otg_enabled;
//int number_of_cards = 1;
//static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs];
//static nfapi_nr_config_request_t *config[MAX_NUM_CCs];
uint32_t timing_advance = 0;
uint64_t num_missed_slots=0; // counter for the number of missed slots uint64_t num_missed_slots=0; // counter for the number of missed slots
#include <SIMULATION/ETH_TRANSPORT/proto.h> #include <SIMULATION/ETH_TRANSPORT/proto.h>
...@@ -171,8 +163,6 @@ static char *worker_config = NULL; ...@@ -171,8 +163,6 @@ static char *worker_config = NULL;
/* struct for ethernet specific parameters given in eNB conf file */ /* struct for ethernet specific parameters given in eNB conf file */
eth_params_t *eth_params; eth_params_t *eth_params;
openair0_config_t openair0_cfg[MAX_CARDS];
double cpuf; double cpuf;
/* hack: pdcp_run() is required by 4G scheduler which is compiled into /* hack: pdcp_run() is required by 4G scheduler which is compiled into
...@@ -633,7 +623,6 @@ int main( int argc, char **argv ) { ...@@ -633,7 +623,6 @@ int main( int argc, char **argv ) {
setvbuf(stderr, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0);
#endif #endif
mode = normal_txrx; mode = normal_txrx;
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
logInit(); logInit();
set_latency_target(); set_latency_target();
...@@ -647,8 +636,6 @@ int main( int argc, char **argv ) { ...@@ -647,8 +636,6 @@ int main( int argc, char **argv ) {
exit(-1); exit(-1);
} }
openair0_cfg[0].threequarter_fs = 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}, \
......
...@@ -930,8 +930,7 @@ void *UE_thread(void *arg) ...@@ -930,8 +930,7 @@ void *UE_thread(void *arg)
// use previous timing_advance value to compute writeTimestamp // use previous timing_advance value to compute writeTimestamp
writeTimestamp = timestamp + writeTimestamp = timestamp +
UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX)
- firstSymSamp - openair0_cfg[0].tx_sample_advance - - firstSymSamp - UE->N_TA_offset - timing_advance;
UE->N_TA_offset - timing_advance;
// but use current UE->timing_advance value to compute writeBlockSize // but use current UE->timing_advance value to compute writeBlockSize
if (UE->timing_advance != timing_advance) { if (UE->timing_advance != timing_advance) {
......
...@@ -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}, \
...@@ -72,16 +70,14 @@ typedef struct { ...@@ -72,16 +70,14 @@ typedef struct {
int max_ldpc_iterations; // number of maximum LDPC iterations int max_ldpc_iterations; // number of maximum LDPC iterations
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;
int chest_time; int chest_time;
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;
......
...@@ -84,7 +84,9 @@ extern "C" ...@@ -84,7 +84,9 @@ 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"
...@@ -108,6 +110,9 @@ extern "C" ...@@ -108,6 +110,9 @@ extern "C"
#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_SYNC_REF "UE acts a Sync Reference in Sidelink. 0-none 1-GNB 2-GNSS 4-localtiming\n" #define CONFIG_HLP_SYNC_REF "UE acts a Sync Reference in Sidelink. 0-none 1-GNB 2-GNSS 4-localtiming\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 */
...@@ -187,6 +192,8 @@ extern int usrp_tx_thread; ...@@ -187,6 +192,8 @@ extern int usrp_tx_thread;
{"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}, \
{"sync-ref", CONFIG_HLP_SYNC_REF, 0, .uptr=&SYNC_REF, .defintval=0, TYPE_UINT, 0}, \ {"sync-ref", CONFIG_HLP_SYNC_REF, 0, .uptr=&SYNC_REF, .defintval=0, TYPE_UINT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, .iptr=&softmodem_params.command_line_sample_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
...@@ -236,6 +243,9 @@ extern int usrp_tx_thread; ...@@ -236,6 +243,9 @@ extern int usrp_tx_thread;
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \ { .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
{ .s5 = { NULL } }, \
} }
// clang-format on // clang-format on
...@@ -332,7 +342,7 @@ typedef struct { ...@@ -332,7 +342,7 @@ typedef struct {
uint32_t clock_source; uint32_t clock_source;
uint32_t timing_source; uint32_t timing_source;
double tune_offset; double tune_offset;
int hw_timing_advance; int command_line_sample_advance;
uint32_t send_dmrs_sync; uint32_t send_dmrs_sync;
int use_256qam_table; int use_256qam_table;
int chest_time; int chest_time;
...@@ -346,16 +356,17 @@ typedef struct { ...@@ -346,16 +356,17 @@ typedef struct {
uint32_t sync_ref; uint32_t sync_ref;
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); uint64_t get_softmodem_optmask(void);
extern uint64_t set_softmodem_optmask(uint64_t bitmask); uint64_t set_softmodem_optmask(uint64_t bitmask);
extern uint64_t clear_softmodem_optmask(uint64_t bitmask); uint64_t clear_softmodem_optmask(uint64_t bitmask);
extern softmodem_params_t *get_softmodem_params(void); softmodem_params_t *get_softmodem_params(void);
extern void get_common_options(configmodule_interface_t *cfg, uint32_t execmask); void get_common_options(configmodule_interface_t *cfg, uint32_t execmask);
extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1) #define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
extern void set_softmodem_sighandler(void); void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern int usrp_tx_thread; extern int usrp_tx_thread;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "executables/softmodem-common.h"
#include "executables/nr-softmodem-common.h" #include "executables/nr-softmodem-common.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
#include "common/ran_context.h" #include "common/ran_context.h"
...@@ -540,7 +541,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) ...@@ -540,7 +541,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config)
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset); LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
fp->threequarter_fs = openair0_cfg[0].threequarter_fs; fp->threequarter_fs = get_softmodem_params()->threequarter_fs;
LOG_A(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n", LOG_A(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
Mod_id, Mod_id,
gNB_config->cell_config.phy_cell_id.value, gNB_config->cell_config.phy_cell_id.value,
......
...@@ -81,13 +81,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 ...@@ -81,13 +81,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
int i, prach_len; int i, prach_len;
uint16_t first_nonzero_root_idx=0; uint16_t first_nonzero_root_idx=0;
prach_start = (ue->rx_offset+subframe*ue->frame_parms.samples_per_tti-ue->hw_timing_advance-ue->N_TA_offset); prach_start = (ue->rx_offset + subframe * ue->frame_parms.samples_per_tti - ue->N_TA_offset);
#ifdef PRACH_DEBUG #ifdef PRACH_DEBUG
LOG_I(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id, LOG_I(PHY, "[UE %d] prach_start %d, rx_offset %d, N_TA_offset %d\n", ue->Mod_id, prach_start, ue->rx_offset, ue->N_TA_offset);
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
#endif #endif
if (prach_start<0) if (prach_start<0)
......
...@@ -207,8 +207,8 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, ...@@ -207,8 +207,8 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
unsigned short rx_power_avg_dB; unsigned short rx_power_avg_dB;
unsigned short rx_power_tot_dB; unsigned short rx_power_tot_dB;
double rx_gain = openair0_cfg[0].rx_gain[0]; double rx_gain = gNB->RU_list[0]->rfdevice.openair0_cfg->rx_gain[0];
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; double rx_gain_offset = gNB->RU_list[0]->rfdevice.openair0_cfg->rx_gain_offset[0];
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol; int ch_offset = fp->ofdm_symbol_size * symbol;
......
...@@ -637,8 +637,6 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { ...@@ -637,8 +637,6 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
/// ///
uint32_t total_system_throughput; uint32_t total_system_throughput;
/// ///
int hw_timing_advance;
///
time_stats_t phy_proc; time_stats_t phy_proc;
time_stats_t phy_proc_tx; time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx; time_stats_t phy_proc_rx;
...@@ -873,7 +871,6 @@ typedef struct { ...@@ -873,7 +871,6 @@ typedef struct {
int rx_offset; /// Timing offset int rx_offset; /// Timing offset
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
int timing_advance; ///timing advance signalled from eNB int timing_advance; ///timing advance signalled from eNB
int hw_timing_advance;
int N_TA_offset; ///timing offset used in TDD int N_TA_offset; ///timing offset used in TDD
/// Flag to tell if UE is secondary user (cognitive mode) /// Flag to tell if UE is secondary user (cognitive mode)
unsigned char is_secondary_ue; unsigned char is_secondary_ue;
......
...@@ -721,8 +721,7 @@ typedef struct { ...@@ -721,8 +721,7 @@ typedef struct {
int rx_offset; /// Timing offset int rx_offset; /// Timing offset
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
int time_sync_cell; int time_sync_cell;
int timing_advance; ///timing advance signalled from eNB int timing_advance; /// timing advance signalled from eNB
int hw_timing_advance;
int N_TA_offset; ///timing offset used in TDD int N_TA_offset; ///timing offset used in TDD
/// Flag to tell if UE is secondary user (cognitive mode) /// Flag to tell if UE is secondary user (cognitive mode)
unsigned char is_secondary_ue; unsigned char is_secondary_ue;
......
...@@ -713,8 +713,6 @@ typedef struct PHY_VARS_eNB_s { ...@@ -713,8 +713,6 @@ typedef struct PHY_VARS_eNB_s {
uint32_t total_transmitted_bits; uint32_t total_transmitted_bits;
uint32_t total_system_throughput; uint32_t total_system_throughput;
int hw_timing_advance;
time_stats_t phy_proc_tx; time_stats_t phy_proc_tx;
time_stats_t phy_proc_rx; time_stats_t phy_proc_rx;
time_stats_t rx_prach; time_stats_t rx_prach;
......
...@@ -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
......
...@@ -1151,8 +1151,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, ...@@ -1151,8 +1151,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue,
nsymb = (frame_parms->Ncp == 0) ? 14 : 12; nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti ulsch_start = ue->rx_offset + subframe_tx * frame_parms->samples_per_tti - ue->timing_advance - ue->N_TA_offset + 5;
- ue->hw_timing_advance - ue->timing_advance - ue->N_TA_offset + 5;
if(ulsch_start < 0) if(ulsch_start < 0)
ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); ulsch_start = ulsch_start + (LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti);
...@@ -1210,16 +1209,6 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, ...@@ -1210,16 +1209,6 @@ void ulsch_common_procedures(PHY_VARS_UE *ue,
((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l]; ((short *)ue->common_vars.txdata[aa])[2*k] = ((short *)dummy_tx_buffer)[2*l];
((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1]; ((short *)ue->common_vars.txdata[aa])[2*k+1] = ((short *)dummy_tx_buffer)[2*l+1];
} }
/*
only for debug
LOG_I(PHY,"ul-signal [subframe: %d, ulsch_start %d, TA: %d, rxOffset: %d, timing_advance: %d, hw_timing_advance: %d]\n",subframe_tx, ulsch_start, ue->N_TA_offset, ue->rx_offset, ue->timing_advance, ue->hw_timing_advance);
if( (crash == 1) && (subframe_tx == 0) )
{
LOG_E(PHY,"***** DUMP TX Signal [ulsch_start %d] *****\n",ulsch_start);
LOG_M("txBuff.m","txSignal",&ue->common_vars.txdata[aa][ulsch_start],frame_parms->samples_per_tti,1,1);
}
*/
} //nb_antennas_tx } //nb_antennas_tx
if ( LOG_DEBUGFLAG(UE_TIMING)) { if ( LOG_DEBUGFLAG(UE_TIMING)) {
......
...@@ -138,7 +138,7 @@ static int trx_brf_write(openair0_device *device, ...@@ -138,7 +138,7 @@ static int trx_brf_write(openair0_device *device,
brf_state_t *brf = (brf_state_t*)device->priv; brf_state_t *brf = (brf_state_t*)device->priv;
/* BRF has only 1 rx/tx chaine : is it correct? */ /* BRF has only 1 rx/tx chaine : is it correct? */
int16_t *samples = (int16_t*)buff[0]; int16_t *samples = (int16_t*)buff[0];
timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance;
//memset(&brf->meta_tx, 0, sizeof(brf->meta_tx)); //memset(&brf->meta_tx, 0, sizeof(brf->meta_tx));
// When BLADERF_META_FLAG_TX_NOW is used the timestamp is not used, so one can't schedule a tx // When BLADERF_META_FLAG_TX_NOW is used the timestamp is not used, so one can't schedule a tx
if (brf->meta_tx.flags == 0 ) if (brf->meta_tx.flags == 0 )
......
...@@ -96,7 +96,7 @@ int load_lib(openair0_device *device, ...@@ -96,7 +96,7 @@ int load_lib(openair0_device *device,
loader_shlibfunc_t shlib_fdesc[1]; loader_shlibfunc_t shlib_fdesc[1];
int ret=0; int ret=0;
char *deflibname=OAI_RF_LIBNAME; char *deflibname=OAI_RF_LIBNAME;
openair0_cfg->command_line_sample_advance = get_softmodem_params()->command_line_sample_advance;
openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state)); openair0_cfg->recplay_mode = read_recplayconfig(&(openair0_cfg->recplay_conf),&(device->recplay_state));
if (openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { if (openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) {
......
...@@ -215,6 +215,7 @@ typedef struct openair0_config { ...@@ -215,6 +215,7 @@ typedef struct openair0_config {
int mmapped_dma; int mmapped_dma;
//! offset in samples between TX and RX paths //! offset in samples between TX and RX paths
int tx_sample_advance; int tx_sample_advance;
int command_line_sample_advance;
//! samples per packet on the fronthaul interface //! samples per packet on the fronthaul interface
int samples_per_packet; int samples_per_packet;
//! number of RX channels (=RX antennas) //! number of RX channels (=RX antennas)
......
...@@ -137,7 +137,7 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf ...@@ -137,7 +137,7 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf
using namespace std::chrono; using namespace std::chrono;
int flag = 0; int flag = 0;
timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance;
iris_state_t *s = (iris_state_t *) device->priv; iris_state_t *s = (iris_state_t *) device->priv;
int nsamps2; // aligned to upper 32 or 16 byte boundary int nsamps2; // aligned to upper 32 or 16 byte boundary
nsamps2 = (nsamps+7)>>3; nsamps2 = (nsamps+7)>>3;
...@@ -164,8 +164,7 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf ...@@ -164,8 +164,7 @@ trx_iris_write(openair0_device *device, openair0_timestamp timestamp, void **buf
flag |= SOAPY_SDR_END_BURST; flag |= SOAPY_SDR_END_BURST;
} }
long long timeNs = SoapySDR::ticksToTimeNs(timestamp - device.command_line_sample_advance, s->sample_rate / SAMPLE_RATE_DOWN);
long long timeNs = SoapySDR::ticksToTimeNs(timestamp, s->sample_rate / SAMPLE_RATE_DOWN);
uint32_t *samps[2]; //= (uint32_t **)buff; uint32_t *samps[2]; //= (uint32_t **)buff;
int r; int r;
int m = s->tx_num_channels; int m = s->tx_num_channels;
......
...@@ -73,15 +73,13 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d ...@@ -73,15 +73,13 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
\returns 0 on success \returns 0 on success
*/ */
int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int antenna_id, int flags) { int trx_lms_write(openair0_device *device, openair0_timestamp timestamp, void **buff, int nsamps, int antenna_id, int flags) {
timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance;
lms_stream_meta_t meta;
meta.waitForTimestamp = true;
meta.flushPartialPacket = false;
meta.timestamp = timestamp;
return LMS_SendStream(&tx_stream, (const void *)buff[0], nsamps, &meta, 30);
lms_stream_meta_t meta;
meta.waitForTimestamp = true;
meta.flushPartialPacket = false;
meta.timestamp = timestamp;
return LMS_SendStream(&tx_stream,(const void*)buff[0],nsamps,&meta,30);
} }
/*! \brief Receive samples from hardware. /*! \brief Receive samples from hardware.
......
...@@ -428,6 +428,7 @@ static int trx_usrp_write(openair0_device *device, ...@@ -428,6 +428,7 @@ static int trx_usrp_write(openair0_device *device,
int flags) { int flags) {
int ret=0; int ret=0;
usrp_state_t *s = (usrp_state_t *)device->priv; usrp_state_t *s = (usrp_state_t *)device->priv;
timestamp -= device->openair0_cfg->command_line_sample_advance - device->openair0_cfg->tx_sample_advance;
int nsamps2; // aligned to upper 32 or 16 byte boundary int nsamps2; // aligned to upper 32 or 16 byte boundary
radio_tx_burst_flag_t flags_burst = (radio_tx_burst_flag_t) (flags & 0xf); radio_tx_burst_flag_t flags_burst = (radio_tx_burst_flag_t) (flags & 0xf);
......
...@@ -755,6 +755,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp ...@@ -755,6 +755,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
} }
static int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags) { static int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags) {
timestamp -= device->openair0_cfg->command_line_sample_advance;
return rfsimulator_write_internal(device->priv, timestamp, samplesVoid, nsamps, nbAnt, flags, false); // false = with lock return rfsimulator_write_internal(device->priv, timestamp, samplesVoid, nsamps, nbAnt, flags, false); // false = with lock
// return rfsimulator_write_internal(device->priv, timestamp, samplesVoid, nsamps, nbAnt, flags, true); // return rfsimulator_write_internal(device->priv, timestamp, samplesVoid, nsamps, nbAnt, flags, true);
} }
......
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