Commit 4c42a20e authored by Sakthivel Velumani's avatar Sakthivel Velumani

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.
parent 3f01ec0e
...@@ -851,8 +851,11 @@ void *UE_thread(void *arg) ...@@ -851,8 +851,11 @@ void *UE_thread(void *arg)
stream_status = STREAM_STATUS_UNSYNC; stream_status = STREAM_STATUS_UNSYNC;
} else { } else {
if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) { if (IS_SOFTMODEM_IQPLAYER || IS_SOFTMODEM_IQRECORDER) {
// For IQ recorder-player we force synchronization to happen in 280 ms /* For IQ recorder-player we force synchronization to happen in a fixed duration so that
while (trashed_frames != 28) { 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); readFrame(UE, &sync_timestamp, true);
trashed_frames += 2; trashed_frames += 2;
} }
......
...@@ -72,6 +72,7 @@ typedef struct { ...@@ -72,6 +72,7 @@ typedef struct {
#define DEF_SF_DELAY_READ 700 // default read delay µs (860=real) #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_DELAY_WRITE 15 // default write delay µs (15=real)
#define DEF_SF_NB_LOOP 5 // default nb loops #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 */ /* 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 { ...@@ -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_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_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_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 */ /* 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_FILE "subframes-file"
#define CONFIG_OPT_SF_REC "subframes-record" #define CONFIG_OPT_SF_REC "subframes-record"
...@@ -93,6 +97,7 @@ typedef struct { ...@@ -93,6 +97,7 @@ typedef struct {
#define CONFIG_OPT_SF_WDELAY "subframes-write-delay" #define CONFIG_OPT_SF_WDELAY "subframes-write-delay"
#define CONFIG_OPT_USE_MMAP "use-mmap" #define CONFIG_OPT_USE_MMAP "use-mmap"
#define DEVICE_RECPLAY_SECTION "device.recplay" #define DEVICE_RECPLAY_SECTION "device.recplay"
#define CONFIG_OPT_F_SYNC "sync-in-frames"
/* For information only - the macro is not usable in C++ */ /* For information only - the macro is not usable in C++ */
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for USRP record/playback */ /* command line parameters for USRP record/playback */
...@@ -107,6 +112,7 @@ typedef struct { ...@@ -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_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_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_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 */ }/*! \brief Record Player Configuration and state */
typedef struct { typedef struct {
char *u_sf_filename; // subframes file path char *u_sf_filename; // subframes file path
...@@ -117,6 +123,7 @@ typedef struct { ...@@ -117,6 +123,7 @@ typedef struct {
unsigned int use_mmap; // default is to use mmap unsigned int use_mmap; // default is to use mmap
unsigned int u_sf_replay; // replay mode (if 1) unsigned int u_sf_replay; // replay mode (if 1)
unsigned int u_sf_record; // record 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; } recplay_conf_t;
typedef struct { typedef struct {
......
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