GNU Radio C++ API Reference  gcd20ee2
The Free & Open Software Radio Ecosystem
rfnoc_mb_controller.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2025 Ettus Research, a National Instruments Brand
4  *
5  * SPDX-License-Identifier: GPL-3.0-or-later
6  */
7 
8 #ifndef INCLUDED_GR_UHD_RFNOC_MB_CONTROLLER_H
9 #define INCLUDED_GR_UHD_RFNOC_MB_CONTROLLER_H
10 
11 #include <gnuradio/block.h>
12 #include <gnuradio/uhd/api.h>
14 #include <uhd/types/time_spec.hpp>
15 #include <memory>
16 
17 namespace gr {
18 namespace uhd {
19 
20 /*! GNU Radio block for RFNoC motherboard controller
21  *
22  * This block provides GNU Radio access to RFNoC motherboard controller
23  * functionality, allowing control of motherboard-level features such as
24  * time synchronization, reference clocks, and other system-level settings.
25  */
27 {
28 public:
29  static constexpr size_t DEFAULT_MB_INDEX = 0;
30  static constexpr size_t ALL_MBOARDS = static_cast<size_t>(-1);
31 
32  using sptr = std::shared_ptr<rfnoc_mb_controller>;
33 
34  //! Factory function to create an RFNoC motherboard controller block
35  //
36  // \param graph Reference to the flowgraph's RFNoC graph.
37  // \param mb_index Motherboard index to control
38  static sptr make(rfnoc_graph::sptr graph = nullptr,
39  const size_t mb_index = ALL_MBOARDS);
40 
41 
42  //! Set the RFNoC graph this controller is associated with
43  //
44  // If the graph is changed after construction, the internal
45  // motherboard controller will be updated to reflect the new graph.
46  // If no graph was provided at construction time, this must be called
47  // before any other method is used.
48  virtual void set_rfnoc_graph(rfnoc_graph::sptr graph) = 0;
49 
50  //! Set the motherboard index this controller manages
51  virtual void set_mb_index(const size_t mb_index) = 0;
52 
53  //! Get the motherboard index this controller manages
54  virtual size_t get_mb_index() const = 0;
55 
56  //! Set the time source for the motherboard
57  //
58  // \param source The time source (e.g., "internal", "external", "gpsdo")
59  virtual void set_time_source(const std::string& source) = 0;
60 
61  //! Get the current time source
62  virtual std::string get_time_source() const = 0;
63 
64  //! Get available time sources
65  virtual std::vector<std::string> get_time_sources() const = 0;
66 
67  //! Set the clock source for the motherboard
68  //
69  // \param source The clock source (e.g., "internal", "external", "gpsdo")
70  virtual void set_clock_source(const std::string& source) = 0;
71 
72  //! Get the current clock source
73  virtual std::string get_clock_source() const = 0;
74 
75  //! Get available clock sources
76  virtual std::vector<std::string> get_clock_sources() const = 0;
77 
78  //! Set the motherboard time
79  //
80  // \param time The time to set
81  // \param tk_idx The timekeeper index
82  virtual void set_time_now(const ::uhd::time_spec_t& time,
83  const size_t tk_idx = 0) = 0;
84 
85  //! Set the motherboard time at the next PPS edge
86  //
87  // \param time The time to set at next PPS
88  // \param tk_idx The timekeeper index
89  virtual void set_time_next_pps(const ::uhd::time_spec_t& time,
90  const size_t tk_idx = 0) = 0;
91 
92  //! Get the current motherboard time
93  // \param tk_idx The timekeeper index
94  virtual ::uhd::time_spec_t get_time_now(const size_t tk_idx = 0) const = 0;
95 
96  //! Get the time at the last PPS edge
97  // \param tk_idx The timekeeper index
98  virtual ::uhd::time_spec_t get_time_last_pps(const size_t tk_idx = 0) const = 0;
99 
100  //! Synchronize time across multiple motherboards
101  //
102  // \param mb_controllers Vector of motherboard controllers to synchronize
103  virtual void synchronize(::uhd::time_spec_t& time) = 0;
104 };
105 
106 } // namespace uhd
107 } // namespace gr
108 
109 #endif /* INCLUDED_GR_UHD_RFNOC_MB_CONTROLLER_H */
The abstract base class for all 'terminal' processing blocks.
Definition: gnuradio-runtime/include/gnuradio/block.h:65
std::shared_ptr< rfnoc_graph > sptr
Definition: rfnoc_graph.h:32
Definition: rfnoc_mb_controller.h:27
virtual std::string get_time_source() const =0
Get the current time source.
virtual std::vector< std::string > get_clock_sources() const =0
Get available clock sources.
virtual void set_time_next_pps(const ::uhd::time_spec_t &time, const size_t tk_idx=0)=0
Set the motherboard time at the next PPS edge.
virtual void set_time_source(const std::string &source)=0
Set the time source for the motherboard.
virtual ::uhd::time_spec_t get_time_now(const size_t tk_idx=0) const =0
Get the current motherboard time.
virtual std::string get_clock_source() const =0
Get the current clock source.
std::shared_ptr< rfnoc_mb_controller > sptr
Definition: rfnoc_mb_controller.h:32
virtual void set_mb_index(const size_t mb_index)=0
Set the motherboard index this controller manages.
virtual void set_clock_source(const std::string &source)=0
Set the clock source for the motherboard.
virtual void synchronize(::uhd::time_spec_t &time)=0
Synchronize time across multiple motherboards.
virtual void set_rfnoc_graph(rfnoc_graph::sptr graph)=0
Set the RFNoC graph this controller is associated with.
virtual ::uhd::time_spec_t get_time_last_pps(const size_t tk_idx=0) const =0
Get the time at the last PPS edge.
static sptr make(rfnoc_graph::sptr graph=nullptr, const size_t mb_index=ALL_MBOARDS)
Factory function to create an RFNoC motherboard controller block.
virtual std::vector< std::string > get_time_sources() const =0
Get available time sources.
virtual size_t get_mb_index() const =0
Get the motherboard index this controller manages.
virtual void set_time_now(const ::uhd::time_spec_t &time, const size_t tk_idx=0)=0
Set the motherboard time.
#define GR_UHD_API
Definition: gr-uhd/include/gnuradio/uhd/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29