uhd: rework handling of timestamp errors
On a lapses of time monotonicity (and possibly other errors), stop and restart the receive streaming with a buffer flush in between. This is a cleaner replacement to the previous clock reset with that didn't attempt to stop steaming. Signed-off-by: Thomas Tsou <ttsou@vt.edu> git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2647 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
parent
c7cb817cb1
commit
68292106af
|
@ -141,6 +141,7 @@ public:
|
||||||
bool open();
|
bool open();
|
||||||
bool start();
|
bool start();
|
||||||
bool stop();
|
bool stop();
|
||||||
|
void restart(uhd::time_spec_t ts);
|
||||||
void setPriority();
|
void setPriority();
|
||||||
|
|
||||||
int readSamples(short *buf, int len, bool *overrun,
|
int readSamples(short *buf, int len, bool *overrun,
|
||||||
|
@ -205,7 +206,6 @@ private:
|
||||||
|
|
||||||
void init_gains();
|
void init_gains();
|
||||||
void set_ref_clk(bool ext_clk);
|
void set_ref_clk(bool ext_clk);
|
||||||
void reset_clk(uhd::time_spec_t ts);
|
|
||||||
double set_rates(double rate);
|
double set_rates(double rate);
|
||||||
bool flush_recv(size_t num_pkts);
|
bool flush_recv(size_t num_pkts);
|
||||||
|
|
||||||
|
@ -387,13 +387,19 @@ bool uhd_device::flush_recv(size_t num_pkts)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uhd_device::reset_clk(uhd::time_spec_t ts)
|
void uhd_device::restart(uhd::time_spec_t ts)
|
||||||
{
|
{
|
||||||
double time;
|
uhd::stream_cmd_t cmd = uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS;
|
||||||
|
usrp_dev->issue_stream_cmd(cmd);
|
||||||
|
|
||||||
usrp_dev->set_time_now(uhd::time_spec_t(ts));
|
flush_recv(50);
|
||||||
time = usrp_dev->get_time_now().get_real_secs();
|
|
||||||
LOG(INFO) << "Reset USRP clock to " << time << " seconds";
|
usrp_dev->set_time_now(ts);
|
||||||
|
aligned = false;
|
||||||
|
|
||||||
|
cmd = uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS;
|
||||||
|
cmd.stream_now = true;
|
||||||
|
usrp_dev->issue_stream_cmd(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool uhd_device::start()
|
bool uhd_device::start()
|
||||||
|
@ -515,7 +521,7 @@ int uhd_device::readSamples(short *buf, int len, bool *overrun,
|
||||||
|
|
||||||
// Other metadata timing checks
|
// Other metadata timing checks
|
||||||
if (check_rx_md_err(metadata, prev_ts) < 0) {
|
if (check_rx_md_err(metadata, prev_ts) < 0) {
|
||||||
reset_clk(prev_ts);
|
restart(prev_ts);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue