| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
uhd::rfnoc::mb_controller::timekeeper Class Referenceabstract

`#include <uhd/rfnoc/mb_controller.hpp>`

## Detailed Description

Interface to interact with timekeepers

A timekeeper is an entity within a USRPs FPGA to track the time. For example, the execution of timed commands requires the existence of a timekeeper.

Timekeepers are objects separate from RFNoC blocks, but RFNoC blocks can have access to the time provided by timekeepers in order to execute commands at a certain time (e.g., the radio blocks use this to be able to assign a timestamp to samples). Note that most other RFNoC blocks do not require access to a timekeeper to execute timed commands, as they will execute commands relative to the incoming data.

## Public Types
using | sptr = std::shared_ptr<timekeeper>
using | write_period_fn_t = std::function<void(uint64_t)>

## Public Member Functions
| timekeeper ()
virtual | ~timekeeper ()
uhd::time_spec_t | get_time_now (void)
virtual uint64_t | get_ticks_now ()=0
uhd::time_spec_t | get_time_last_pps (void)
virtual uint64_t | get_ticks_last_pps ()=0
void | set_time_now (const uhd::time_spec_t &time)
virtual void | set_ticks_now (const uint64_t ticks)=0
void | set_time_next_pps (const uhd::time_spec_t &time)
virtual void | set_ticks_next_pps (const uint64_t ticks)=0
double | get_tick_rate ()

## Protected Member Functions
void | set_tick_rate (const double rate)
virtual void | set_period (const uint64_t period_ns)=0

## Member Typedef Documentation

## ◆ sptr

using uhd::rfnoc::mb_controller::timekeeper::sptr = std::shared_ptr<timekeeper>

## ◆ write_period_fn_t

using uhd::rfnoc::mb_controller::timekeeper::write_period_fn_t = std::function<void(uint64_t)>

## Constructor & Destructor Documentation

## ◆ timekeeper()

uhd::rfnoc::mb_controller::timekeeper::timekeeper | ( |  | ) |

## ◆ ~timekeeper()

virtual uhd::rfnoc::mb_controller::timekeeper::~timekeeper | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ get_tick_rate()

double uhd::rfnoc::mb_controller::timekeeper::get_tick_rate | ( |  | ) |
| inline

Return the current tick rate

## ◆ get_ticks_last_pps()

virtual uint64_t uhd::rfnoc::mb_controller::timekeeper::get_ticks_last_pps | ( |  | ) |
| pure virtual

Return the time from the last PPS as a tick count

See also get_time_last_pps()

## ◆ get_ticks_now()

virtual uint64_t uhd::rfnoc::mb_controller::timekeeper::get_ticks_now | ( |  | ) |
| pure virtual

Return the current time as a tick count

When using the RFNoC API, radio blocks also provide API calls (uhd::rfnoc::radio_control::get_time_now() and uhd::rfnoc::radio_control::get_ticks_now()) which directly returns the current time from the radio block itself. This has the advantage that it is not necessary to know which timekeeper is providing the time to which radio block when reading the current time, and generally has a lower latency than executing this call.

See also get_time_now().

Returns
  the current time

## ◆ get_time_last_pps()

uhd::time_spec_t uhd::rfnoc::mb_controller::timekeeper::get_time_last_pps | ( | void |  | ) |

Return the time from the last PPS as a time spec

Note that there is no control over when this command gets executed, it will read the time "as soon as possible", and then return that value. Calling this on two synchronized clocks sequentially will definitely return two different values.

## ◆ get_time_now()

uhd::time_spec_t uhd::rfnoc::mb_controller::timekeeper::get_time_now | ( | void |  | ) |

Return the current time as a time spec

Note that there is no control over when this command gets executed, it will read the time "as soon as possible", and then return that value. Calling this on two synchronized clocks sequentially will definitely return two different values.

When using the RFNoC API, radio blocks also provide API calls (uhd::rfnoc::radio_control::get_time_now() and uhd::rfnoc::radio_control::get_ticks_now()) which directly returns the current time from the radio block itself. This has the advantage that it is not necessary to know which timekeeper is providing the time to which radio block when reading the current time, and generally has a lower latency than executing this call.

Returns
  the current time

## ◆ set_period()

virtual void uhd::rfnoc::mb_controller::timekeeper::set_period | ( | const uint64_t | period_ns | ) |
| protected pure virtual

Set the time period as a 64-bit Q32 value

Parameters

  period_ns | The period as nanoseconds per tick, in Q32 format

## ◆ set_tick_rate()

void uhd::rfnoc::mb_controller::timekeeper::set_tick_rate | ( | const double | rate | ) |
| protected

Set the tick rate

This doesn't change the input clock to the timekeeper, but does two things:

- Update the local value of the tick rate, so the time-spec based API calls work
- Convert the tick rate to a period and call set_period()

## ◆ set_ticks_next_pps()

virtual void uhd::rfnoc::mb_controller::timekeeper::set_ticks_next_pps | ( | const uint64_t | ticks | ) |
| pure virtual

Set the ticks at next PPS

This will instruct the remote device to set its tick count when the next PPS edge is detected. Use this to set multiple devices to the same time (assuming they are synchronized in time and frequency).

To guarantee that devices are synchronized in time it is recommended to wait for a PPS edge before calling this command. Otherwise, it could happen that due to network latency or other reasons, this command reaches different devices on different sides of the same PPS edge, causing devices to be unsynchronized in time by exactly one second.

## ◆ set_ticks_now()

virtual void uhd::rfnoc::mb_controller::timekeeper::set_ticks_now | ( | const uint64_t | ticks | ) |
| pure virtual

Set the ticks "now"

This will set the tick count on the remote device's timekeeper as soon as possible. Note that there is some amount of lag between executing this call and when the device's time will be updated, e.g., due to network latency.

## ◆ set_time_next_pps()

void uhd::rfnoc::mb_controller::timekeeper::set_time_next_pps | ( | const uhd::time_spec_t & | time | ) |

Set the time at next PPS from a time spec

Note: When changing clock sources, a previously set time will most likely be lost. It is recommended to set the time after changing the clock source. Otherwise, an unexpected time may line up with future PPS edges.

This will convert `time` into a tick count value and use that to call set_ticks_next_pps().

## ◆ set_time_now()

void uhd::rfnoc::mb_controller::timekeeper::set_time_now | ( | const uhd::time_spec_t & | time | ) |

Set the time "now" from a time spec

This will convert `time` into a tick count value and call set_ticks_now().

The documentation for this class was generated from the following file:

- mb_controller.hpp