diff options
| author | Ashish Chaudhari <ashish@ettus.com> | 2019-05-25 20:45:34 -0700 | 
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 11:49:18 -0800 | 
| commit | efd8e88859421c0a1876cbe850536dc28a21df69 (patch) | |
| tree | 0835dbc9ef27a0471581bebedcba09a74f4d3de4 /host/lib/include/uhdlib | |
| parent | 15c058015f56cfcd0e42cf6779a6e6ef6e0da911 (diff) | |
| download | uhd-efd8e88859421c0a1876cbe850536dc28a21df69.tar.gz uhd-efd8e88859421c0a1876cbe850536dc28a21df69.tar.bz2 uhd-efd8e88859421c0a1876cbe850536dc28a21df69.zip  | |
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
Diffstat (limited to 'host/lib/include/uhdlib')
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp | 4 | ||||
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/clock_iface.hpp | 64 | ||||
| -rw-r--r-- | host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp | 5 | 
3 files changed, 69 insertions, 4 deletions
diff --git a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp index afaa22306..29f4da7c2 100644 --- a/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/chdr_ctrl_endpoint.hpp @@ -38,8 +38,8 @@ public:      virtual ctrlport_endpoint::sptr get_ctrlport_ep(uint16_t port,          size_t buff_capacity,          size_t max_outstanding_async_msgs, -        double ctrl_clk_freq, -        double timebase_freq) = 0; +        const clock_iface& client_clk, +        const clock_iface& timebase_clk) = 0;      //! Returns the number of dropped packets due to misclassification      virtual size_t get_num_drops() const = 0; 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 <uhd/config.hpp> +#include <atomic> +#include <string> + +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<bool> _is_running; +    std::atomic<double> _freq; +}; + +}} // namespace uhd::rfnoc + +#endif /* INCLUDED_UHD_RFNOC_CLOCK_IFACE_HPP */ diff --git a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp index d135f284c..00ebe38b9 100644 --- a/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp +++ b/host/lib/include/uhdlib/rfnoc/ctrlport_endpoint.hpp @@ -9,6 +9,7 @@  #include <uhd/rfnoc/register_iface.hpp>  #include <uhdlib/rfnoc/chdr/chdr_types.hpp> +#include <uhdlib/rfnoc/clock_iface.hpp>  #include <memory>  namespace uhd { namespace rfnoc { @@ -51,8 +52,8 @@ public:          uint16_t local_port,          size_t buff_capacity,          size_t max_outstanding_async_msgs, -        double ctrl_clk_freq, -        double timebase_freq); +        const clock_iface& client_clk, +        const clock_iface& timebase_clk);  }; // class ctrlport_endpoint  | 
