diff options
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 + ); +} |