From efd8e88859421c0a1876cbe850536dc28a21df69 Mon Sep 17 00:00:00 2001 From: Ashish Chaudhari Date: Sat, 25 May 2019 20:45:34 -0700 Subject: rfnoc: Added clock_iface to convey info about clocks The inteface provides a mechanism for users of clocks to query information such as the running status or rate --- host/lib/include/uhdlib/rfnoc/clock_iface.hpp | 64 +++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 host/lib/include/uhdlib/rfnoc/clock_iface.hpp (limited to 'host/lib/include/uhdlib/rfnoc/clock_iface.hpp') diff --git a/host/lib/include/uhdlib/rfnoc/clock_iface.hpp b/host/lib/include/uhdlib/rfnoc/clock_iface.hpp new file mode 100644 index 000000000..807382f13 --- /dev/null +++ b/host/lib/include/uhdlib/rfnoc/clock_iface.hpp @@ -0,0 +1,64 @@ +// +// Copyright 2019 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_UHD_RFNOC_CLOCK_IFACE_HPP +#define INCLUDED_UHD_RFNOC_CLOCK_IFACE_HPP + +#include +#include +#include + +namespace uhd { namespace rfnoc { + +class clock_iface +{ +public: + clock_iface(const std::string& name) : _name(name) + { + _is_running = false; + _freq = 0.0; + } + + clock_iface() = delete; + clock_iface(const clock_iface& rhs) = delete; + clock_iface(clock_iface&& rhs) = delete; + + clock_iface& operator=(const clock_iface& fraction) = delete; + + inline const std::string& get_name() const + { + return _name; + } + + inline bool is_running() const + { + return _is_running; + } + + inline void set_running(bool is_running) + { + _is_running = is_running; + } + + inline double get_freq() const + { + return _freq; + } + + inline void set_freq(double freq) + { + _freq = freq; + } + +private: + const std::string _name; + std::atomic _is_running; + std::atomic _freq; +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_UHD_RFNOC_CLOCK_IFACE_HPP */ -- cgit v1.2.3