From 3f01ec0e71d8116b191388cb246ca240d75d46ab Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 11 Dec 2024 12:32:18 -0500 Subject: [PATCH 1/2] Fix iqrecord to work on AVX512 machine --- radio/COMMON/record_player.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/radio/COMMON/record_player.h b/radio/COMMON/record_player.h index 7869fe4cf3..4e6640b561 100644 --- a/radio/COMMON/record_player.h +++ b/radio/COMMON/record_player.h @@ -62,7 +62,10 @@ typedef struct { int64_t nbBytes; int64_t tv_sec; // nb of secs since EPOCH int64_t tv_usec; // nb of µsecs since EPOCH - int64_t rfu2; // pad for 256 bits alignement required by AVX2 + // pad for 512 bits alignement required by AVX512 + int64_t rfu2; + int64_t rfu3; + int64_t rfu4; } iqrec_t; #define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz) #define DEF_SF_FILE "/tmp/iqfile" // default subframes file name From 4c42a20eaa9f5dae02cba67145dcb111229cf980 Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Wed, 11 Dec 2024 12:34:43 -0500 Subject: [PATCH 2/2] Cmd line option for sync in frames for iqrecorder B200 with high clock drift will go out of sync within 280ms which was the default duration to sync in with iqrecorder. Now this value can be specified via cmd line so the user can change it according to needs. --- executables/nr-ue.c | 7 +++++-- radio/COMMON/record_player.h | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e2882b4224..f72a63d33b 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -851,8 +851,11 @@ void *UE_thread(void *arg) stream_status = STREAM_STATUS_UNSYNC; } else { if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { - // For IQ recorder-player we force synchronization to happen in 280 ms - while (trashed_frames != 28) { + /* For IQ recorder-player we force synchronization to happen in a fixed duration so that + the replay runs in sync with recorded samples. + */ + const unsigned int sync_in_frames = UE->rfdevice.openair0_cfg->recplay_conf->u_f_sync; + while (trashed_frames != sync_in_frames) { readFrame(UE, &sync_timestamp, true); trashed_frames += 2; } diff --git a/radio/COMMON/record_player.h b/radio/COMMON/record_player.h index 4e6640b561..686fe83d31 100644 --- a/radio/COMMON/record_player.h +++ b/radio/COMMON/record_player.h @@ -72,6 +72,7 @@ typedef struct { #define DEF_SF_DELAY_READ 700 // default read delay µs (860=real) #define DEF_SF_DELAY_WRITE 15 // default write delay µs (15=real) #define DEF_SF_NB_LOOP 5 // default nb loops +#define DEF_F_SYNC 28 // default frames to sync in (280ms) /* help strings definition for config options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ @@ -83,6 +84,9 @@ typedef struct { #define CONFIG_HLP_SF_RDELAY "Delay in microseconds to read a subframe in replay mode" #define CONFIG_HLP_SF_WDELAY "Delay in microseconds to write a subframe in replay mode" #define CONFIG_HLP_USE_MMAP "In replay mode, map iq file in memory before replaying" +#define CONFIG_HLP_F_SYNC "Number of frames the synchronization is forced to complete. Some b200 with worser \ + internal clock drift will not be able to stay synchronized and will require value \ + lesser than 28. Lesser values will require faster machine." /* keyword strings for config options, used in CMDLINE_XXX_DESC macros and printed when -h option is used */ #define CONFIG_OPT_SF_FILE "subframes-file" #define CONFIG_OPT_SF_REC "subframes-record" @@ -93,6 +97,7 @@ typedef struct { #define CONFIG_OPT_SF_WDELAY "subframes-write-delay" #define CONFIG_OPT_USE_MMAP "use-mmap" #define DEVICE_RECPLAY_SECTION "device.recplay" +#define CONFIG_OPT_F_SYNC "sync-in-frames" /* For information only - the macro is not usable in C++ */ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters for USRP record/playback */ @@ -107,6 +112,7 @@ typedef struct { {CONFIG_OPT_SF_RDELAY, CONFIG_HLP_SF_RDELAY, 0, .uptr=&((*recplay_conf)->u_sf_read_delay), .defintval=DEF_SF_DELAY_READ, TYPE_UINT, 0}, \ {CONFIG_OPT_SF_WDELAY, CONFIG_HLP_SF_WDELAY, 0, .uptr=&((*recplay_conf)->u_sf_write_delay), .defintval=DEF_SF_DELAY_WRITE, TYPE_UINT, 0}, \ {CONFIG_OPT_USE_MMAP, CONFIG_HLP_USE_MMAP, PARAMFLAG_BOOL, .uptr=&((*recplay_conf)->use_mmap), .defuintval=1, TYPE_UINT, 0}, \ + {CONFIG_OPT_F_SYNC, CONFIG_HLP_F_SYNC, 0, .uptr=&((*recplay_conf)->u_f_sync), .defuintval=DEF_F_SYNC, TYPE_UINT, 0}, \ }/*! \brief Record Player Configuration and state */ typedef struct { char *u_sf_filename; // subframes file path @@ -117,6 +123,7 @@ typedef struct { unsigned int use_mmap; // default is to use mmap unsigned int u_sf_replay; // replay mode (if 1) unsigned int u_sf_record; // record mode (if 1) + unsigned int u_f_sync; // number of frames sync will complete } recplay_conf_t; typedef struct {