diff options
author | Nicolas Cuervo <nicolas.cuervo@ettus.com> | 2016-10-03 16:39:30 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-04-18 15:05:22 -0700 |
commit | a8c74853f9bc73a796c553fc7cebb14266775e59 (patch) | |
tree | 5f1294e4c1672ebb137c15054759dd188cfb4af7 /host/utils/usrp_cal_utils.hpp | |
parent | 0e909a2a9d2432c1f935f79953e78663b4129132 (diff) | |
download | uhd-a8c74853f9bc73a796c553fc7cebb14266775e59.tar.gz uhd-a8c74853f9bc73a796c553fc7cebb14266775e59.tar.bz2 uhd-a8c74853f9bc73a796c553fc7cebb14266775e59.zip |
cal_utils: logic to handle eventual U's during calibration
For every frequency point, the cal utils will detect underruns and retry
a calibration measurement up to 10 times before failing.
Diffstat (limited to 'host/utils/usrp_cal_utils.hpp')
-rw-r--r-- | host/utils/usrp_cal_utils.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/host/utils/usrp_cal_utils.hpp b/host/utils/usrp_cal_utils.hpp index 367ec44ab..88fedcbd4 100644 --- a/host/utils/usrp_cal_utils.hpp +++ b/host/utils/usrp_cal_utils.hpp @@ -35,6 +35,7 @@ static const size_t num_search_steps = 5; static const double default_precision = 0.0001; static const double default_freq_step = 7.3e6; static const size_t default_fft_bin_size = 1000; +static constexpr size_t MAX_NUM_TX_ERRORS = 10; /*********************************************************************** * Set standard defaults for devices @@ -375,3 +376,22 @@ UHD_INLINE void set_optimal_rx_gain( usrp->set_rx_gain(rx_gain); } + +/*! Returns true if any error on the TX stream has occured + */ +bool has_tx_error(uhd::tx_streamer::sptr tx_stream) +{ + uhd::async_metadata_t async_md; + if (!tx_stream->recv_async_msg(async_md, 0.0)) { + return false; + } + + return async_md.event_code & (0 + // Any of these errors are considered a problematic TX error: + | uhd::async_metadata_t::EVENT_CODE_UNDERFLOW + | uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR + | uhd::async_metadata_t::EVENT_CODE_TIME_ERROR + | uhd::async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET + | uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST + ); +} |