diff options
author | michael-west <michael.west@ettus.com> | 2021-11-04 13:53:20 -0700 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-11-17 14:04:34 -0800 |
commit | 9b78da222fb5e51c1ad9ccd6887d1cf85c4c7926 (patch) | |
tree | 2014c004d639a86d03504f89630c78d8333d2973 /host/lib/rfnoc | |
parent | 43ab4c8b43d8407fc9f345ca4b13634f03ad4a43 (diff) | |
download | uhd-9b78da222fb5e51c1ad9ccd6887d1cf85c4c7926.tar.gz uhd-9b78da222fb5e51c1ad9ccd6887d1cf85c4c7926.tar.bz2 uhd-9b78da222fb5e51c1ad9ccd6887d1cf85c4c7926.zip |
host: Add ability to get time from Radio block
Add API calls to Radio control to get ticks and time.
Signed-off-by: michael-west <michael.west@ettus.com>
Diffstat (limited to 'host/lib/rfnoc')
-rw-r--r-- | host/lib/rfnoc/radio_control_impl.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index c9b9b6bfe..53117176b 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -26,7 +26,7 @@ const std::string radio_control::ALL_LOS = "all"; const std::string radio_control::ALL_GAINS = ""; const uint16_t radio_control_impl::MAJOR_COMPAT = 0; -const uint16_t radio_control_impl::MINOR_COMPAT = 0; +const uint16_t radio_control_impl::MINOR_COMPAT = 1; const uint32_t radio_control_impl::regmap::REG_COMPAT_NUM; const uint32_t radio_control_impl::regmap::REG_RADIO_WIDTH; @@ -294,6 +294,24 @@ size_t radio_control_impl::get_spc() const return _spc; } + +/****************************************************************************** + * Time-Related API Calls + *****************************************************************************/ +uint64_t radio_control_impl::get_ticks_now() +{ + // Time registers added in 0.1 + if (_fpga_compat < 1) { + throw uhd::not_implemented_error("Radio does not support time readback"); + } + return regs().peek64(regmap::REG_TIME_LO); +} + +uhd::time_spec_t radio_control_impl::get_time_now() +{ + return uhd::time_spec_t::from_ticks(get_ticks_now(), get_rate()); +} + /**************************************************************************** * RF API ***************************************************************************/ |