diff options
| author | steviez <steve.czabaniuk@ni.com> | 2020-02-11 09:58:01 -0600 | 
|---|---|---|
| committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-02-18 13:36:57 -0600 | 
| commit | 28bf20a19c98c7e99a67d7186d539aea28133df0 (patch) | |
| tree | 5c7bac0443b40e12cef5392bba8e79af0902fba5 | |
| parent | 28ca94661c365007916e05e8c84c3eaa7563c677 (diff) | |
| download | uhd-28bf20a19c98c7e99a67d7186d539aea28133df0.tar.gz uhd-28bf20a19c98c7e99a67d7186d539aea28133df0.tar.bz2 uhd-28bf20a19c98c7e99a67d7186d539aea28133df0.zip  | |
rfnoc: actions: Fix uninitialized timestamps
tx_event_action_info objects were being created with uninitialized
timestamp members which led to uhd::tx_streamer::recv_async_msg()
returning with invalid timestamps
| -rw-r--r-- | host/include/uhd/rfnoc/actions.hpp | 7 | ||||
| -rw-r--r-- | host/lib/rfnoc/actions.cpp | 16 | ||||
| -rw-r--r-- | host/lib/rfnoc/radio_control_impl.cpp | 6 | 
3 files changed, 18 insertions, 11 deletions
diff --git a/host/include/uhd/rfnoc/actions.hpp b/host/include/uhd/rfnoc/actions.hpp index 7326cfd6d..681a9da3d 100644 --- a/host/include/uhd/rfnoc/actions.hpp +++ b/host/include/uhd/rfnoc/actions.hpp @@ -11,6 +11,7 @@  #include <uhd/types/device_addr.hpp>  #include <uhd/types/metadata.hpp>  #include <uhd/types/stream_cmd.hpp> +#include <boost/optional.hpp>  #include <memory>  #include <string>  #include <vector> @@ -93,10 +94,12 @@ public:      uint64_t tsf;      //! Factory function -    static sptr make(uhd::async_metadata_t::event_code_t event_code); +    static sptr make(uhd::async_metadata_t::event_code_t event_code, +        const boost::optional<uint64_t>& tsf);  protected: -    tx_event_action_info(uhd::async_metadata_t::event_code_t event_code); +    tx_event_action_info(uhd::async_metadata_t::event_code_t event_code, +        const boost::optional<uint64_t>& tsf);  };  }} /* namespace uhd::rfnoc */ diff --git a/host/lib/rfnoc/actions.cpp b/host/lib/rfnoc/actions.cpp index 4de05b304..ecc1b3f20 100644 --- a/host/lib/rfnoc/actions.cpp +++ b/host/lib/rfnoc/actions.cpp @@ -66,20 +66,24 @@ rx_event_action_info::sptr rx_event_action_info::make()  /*** TX Metadata Action Info *************************************************/  tx_event_action_info::tx_event_action_info( -    uhd::async_metadata_t::event_code_t event_code_) -    : action_info(ACTION_KEY_TX_EVENT), event_code(event_code_) +    uhd::async_metadata_t::event_code_t event_code_, const boost::optional<uint64_t>& tsf_) +    : action_info(ACTION_KEY_TX_EVENT), event_code(event_code_), has_tsf(tsf_)  { +    if (has_tsf) { +        tsf = tsf_.get(); +    }  }  tx_event_action_info::sptr tx_event_action_info::make( -    uhd::async_metadata_t::event_code_t event_code) +    uhd::async_metadata_t::event_code_t event_code, const boost::optional<uint64_t>& tsf)  {      struct tx_event_action_info_make_shared : public tx_event_action_info      { -        tx_event_action_info_make_shared(uhd::async_metadata_t::event_code_t event_code) -            : tx_event_action_info(event_code) +        tx_event_action_info_make_shared(uhd::async_metadata_t::event_code_t event_code, +            const boost::optional<uint64_t>& tsf) +            : tx_event_action_info(event_code, tsf)          {          }      }; -    return std::make_shared<tx_event_action_info_make_shared>(event_code); +    return std::make_shared<tx_event_action_info_make_shared>(event_code, tsf);  } diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index 4d03708bf..6c7a769df 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -930,7 +930,7 @@ void radio_control_impl::async_message_handler(              switch (code) {                  case err_codes::ERR_TX_UNDERRUN: {                      auto tx_event_action = tx_event_action_info::make( -                        uhd::async_metadata_t::EVENT_CODE_UNDERFLOW); +                        uhd::async_metadata_t::EVENT_CODE_UNDERFLOW, timestamp);                      post_action(res_source_info{res_source_info::INPUT_EDGE, chan},                          tx_event_action);                      UHD_LOG_FASTPATH("U"); @@ -939,7 +939,7 @@ void radio_control_impl::async_message_handler(                  }                  case err_codes::ERR_TX_LATE_DATA: {                      auto tx_event_action = tx_event_action_info::make( -                        uhd::async_metadata_t::EVENT_CODE_TIME_ERROR); +                        uhd::async_metadata_t::EVENT_CODE_TIME_ERROR, timestamp);                      post_action(res_source_info{res_source_info::INPUT_EDGE, chan},                          tx_event_action);                      UHD_LOG_FASTPATH("L"); @@ -948,7 +948,7 @@ void radio_control_impl::async_message_handler(                  }                  case err_codes::EVENT_TX_BURST_ACK: {                      auto tx_event_action = tx_event_action_info::make( -                        uhd::async_metadata_t::EVENT_CODE_BURST_ACK); +                        uhd::async_metadata_t::EVENT_CODE_BURST_ACK, timestamp);                      post_action(res_source_info{res_source_info::INPUT_EDGE, chan},                          tx_event_action);                      RFNOC_LOG_TRACE("Posting burst ack event action message.");  | 
