GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
rfnoc_rx_radio.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2019 Ettus Research, a National Instruments Brand.
4  * Copyright 2020 Free Software Foundation, Inc.
5  *
6  * SPDX-License-Identifier: GPL-3.0-or-later
7  */
8 
9 #ifndef INCLUDED_GR_UHD_RFNOC_RX_RADIO_H
10 #define INCLUDED_GR_UHD_RFNOC_RX_RADIO_H
11 
12 #include <gnuradio/uhd/api.h>
15 
16 namespace gr {
17 namespace uhd {
18 
19 /*! RFNoC RX Radio
20  *
21  * This wraps a radio block into GNU Radio. Note: When doing TX and RX in the
22  * same flow graph, simply create an rfnoc_rx_radio and an rfnoc_tx_radio with
23  * the same block ID.
24  *
25  * \ingroup uhd_blk
26  */
27 class GR_UHD_API rfnoc_rx_radio : virtual public rfnoc_block
28 {
29 public:
30  const static size_t ALL_CHANS;
31 
32  typedef std::shared_ptr<rfnoc_rx_radio> sptr;
33 
34  /*!
35  * \param graph Reference to the underlying rfnoc_graph object
36  * \param block_args Additional block arguments
37  * \param device_select Device Selection
38  * \param instance Instance Selection
39  */
40  static sptr make(rfnoc_graph::sptr graph,
41  const ::uhd::device_addr_t& block_args,
42  const int device_select,
43  const int instance);
44 
45  /**************************************************************************
46  * Radio control
47  *************************************************************************/
48  //! Set the output sampling rate of the radio block
49  //
50  // Note: The actual rate of the radio will be coerced to whatever it is
51  // capable of.
52  //
53  // \param rate The new sampling rate
54  virtual double set_rate(const double rate) = 0;
55 
56  //! Set the antenna for this radio
57  //
58  // \param antenna The antenna name (e.g., "RX2"). Valid name depend on the
59  // underlying hardware.
60  // \param chan The channel for which this antenna setting is for
61  virtual void set_antenna(const std::string& antenna, const size_t chan) = 0;
62 
63  //! Set the RX frequency for this radio
64  //
65  // \param frequency The received frequency (e.g., 1e9)
66  // \param chan The channel for which this frequency setting is for
67  virtual double set_frequency(const double frequency, const size_t chan) = 0;
68 
69  //! Configure the tune args for this RX radio
70  //
71  // \param args The new args (e.g., "mode_n=1")
72  // \param chan The channel for which this setting is for
73  virtual void set_tune_args(const ::uhd::device_addr_t& args, const size_t chan) = 0;
74 
75  //! Configure the overall gain for this RX radio
76  //
77  // \param gain The new gain value (in dB)
78  // \param chan The channel for which this setting is for
79  virtual double set_gain(const double gain, const size_t chan) = 0;
80 
81  //! Configure a specific gain for this RX radio
82  //
83  // \param gain The new gain value (in dB)
84  // \param name The gain stage name to set
85  // \param chan The channel for which this setting is for
86  virtual double
87  set_gain(const double gain, const std::string& name, const size_t chan) = 0;
88 
89  //! Enable/disable the AGC for this RX radio (if available)
90  //
91  // \param enable The new setting for the AGC (on or off)
92  // \param chan The channel for which this setting is for
93  virtual void set_agc(const bool enable, const size_t chan) = 0;
94 
95  //! Switch the gain profile for this RX radio
96  //
97  // \param profile The name of the gain profile (e.g., "low-noise")
98  // \param chan The channel for which this setting is for
99  virtual void set_gain_profile(const std::string& profile, const size_t chan) = 0;
100 
101  //! Set the analog bandwidth for this RX radio
102  //
103  // \param bandwidth The new bandwidth, in Hz
104  // \param chan The channel for which this setting is for
105  virtual double set_bandwidth(const double bandwidth, const size_t chan) = 0;
106 
107  //! Set the LO source for this RX radio
108  //
109  // Note: Available sources depend on the underlying hardware.
110  //
111  // \param source The new LO source (e.g., "internal")
112  // \param name The LO name (e.g. "LO1")
113  // \param chan The channel for which this setting is for
114  virtual void set_lo_source(const std::string& source,
115  const std::string& name,
116  const size_t chan) = 0;
117 
118  //! Enable/disable LO export for this RX radio
119  //
120  // \param enabled When true, export this LO
121  // \param name The LO name (e.g. "LO1")
122  // \param chan The channel for which this setting is for
123  virtual void set_lo_export_enabled(const bool enabled,
124  const std::string& name,
125  const size_t chan) = 0;
126 
127  //! Configure the LO frequency explicitly
128  //
129  // Consult uhd::rfnoc::radio_control::set_rx_lo_freq() for more details.
130  // \param freq The new LO frequency
131  // \param name The LO name (e.g. "LO1")
132  // \param chan The channel for which this setting is for
133  virtual double
134  set_lo_freq(const double freq, const std::string& name, const size_t chan) = 0;
135 
136  //! Enable/disable DC offset tracking
137  //
138  // Consult uhd::rfnoc::radio_control::set_rx_dc_offset() for more details.
139  //
140  // \param enable When true, export this LO
141  // \param chan The channel for which this setting is for
142  virtual void set_dc_offset(const bool enable, const size_t chan) = 0;
143 
144  //! Set the DC offset value explicitly
145  //
146  // Consult uhd::rfnoc::radio_control::set_rx_dc_offset() for more details.
147  //
148  // \param offset The DC offset value that gets used for compensation
149  // \param chan The channel for which this setting is for
150  virtual void set_dc_offset(const std::complex<double>& offset, const size_t chan) = 0;
151 
152  //! Enable/disable IQ imbalance tracking
153  //
154  // Consult uhd::rfnoc::radio_control::set_rx_iq_balance() for more details.
155  //
156  // \param enable When true, export this LO
157  // \param chan The channel for which this setting is for
158  virtual void set_iq_balance(const bool enable, const size_t chan) = 0;
159 
160  //! Set the I/Q imbalance correction value explicitly
161  //
162  // Consult uhd::rfnoc::radio_control::set_rx_iq_balance() for more details.
163  //
164  // \param offset The DC offset value that gets used for compensation
165  // \param chan The channel for which this setting is for
166  virtual void set_iq_balance(const std::complex<double>& correction,
167  const size_t chan) = 0;
168 
169  /**************************************************************************
170  * Streaming control
171  *************************************************************************/
172  /*! Issue a stream command to specific channels
173  *
174  * This behaves differently from usrp_source::issue_stream_cmd() in two ways:
175  * - This block will never start streaming automatically after being started,
176  * so starting the stream explicitly needs to happen somehow. Use this API
177  * to directly issue a start stream command through the C++ or Python API.
178  * - Stream commands are submitted on a per-channel basis, not for all
179  * channels. However, unlike UHD's radio control, it will honor the ALL_CHANS
180  * value for \p \chan.
181  *
182  * \param cmd the stream command to issue to all source channels
183  */
184  virtual void issue_stream_cmd(const ::uhd::stream_cmd_t& cmd, const size_t chan) = 0;
185 
186  //! Enable/disable timestamp generation on a radio channel
187  //
188  // If set to false, packets produced by the radio will not contain timestamps.
189  // This can be useful when operation a loopback (radio to radio).
190  virtual void enable_rx_timestamps(const bool enable, const size_t chan) = 0;
191 };
192 
193 } // namespace uhd
194 } // namespace gr
195 
196 #endif /* INCLUDED_GR_UHD_RFNOC_RX_RADIO_H */
Definition: rfnoc_block.h:29
std::shared_ptr< rfnoc_block > sptr
Definition: rfnoc_block.h:37
std::shared_ptr< rfnoc_graph > sptr
Definition: rfnoc_graph.h:32
Definition: rfnoc_rx_radio.h:28
virtual double set_gain(const double gain, const std::string &name, const size_t chan)=0
Configure a specific gain for this RX radio.
virtual void set_lo_export_enabled(const bool enabled, const std::string &name, const size_t chan)=0
Enable/disable LO export for this RX radio.
virtual void set_dc_offset(const std::complex< double > &offset, const size_t chan)=0
Set the DC offset value explicitly.
virtual void issue_stream_cmd(const ::uhd::stream_cmd_t &cmd, const size_t chan)=0
virtual void set_agc(const bool enable, const size_t chan)=0
Enable/disable the AGC for this RX radio (if available)
virtual void set_lo_source(const std::string &source, const std::string &name, const size_t chan)=0
Set the LO source for this RX radio.
virtual void enable_rx_timestamps(const bool enable, const size_t chan)=0
Enable/disable timestamp generation on a radio channel.
virtual void set_iq_balance(const bool enable, const size_t chan)=0
Enable/disable IQ imbalance tracking.
static const size_t ALL_CHANS
Definition: rfnoc_rx_radio.h:30
virtual void set_antenna(const std::string &antenna, const size_t chan)=0
Set the antenna for this radio.
static sptr make(rfnoc_graph::sptr graph, const ::uhd::device_addr_t &block_args, const int device_select, const int instance)
virtual double set_lo_freq(const double freq, const std::string &name, const size_t chan)=0
Configure the LO frequency explicitly.
virtual void set_dc_offset(const bool enable, const size_t chan)=0
Enable/disable DC offset tracking.
virtual void set_iq_balance(const std::complex< double > &correction, const size_t chan)=0
Set the I/Q imbalance correction value explicitly.
virtual double set_rate(const double rate)=0
Set the output sampling rate of the radio block.
virtual double set_gain(const double gain, const size_t chan)=0
Configure the overall gain for this RX radio.
virtual void set_gain_profile(const std::string &profile, const size_t chan)=0
Switch the gain profile for this RX radio.
virtual void set_tune_args(const ::uhd::device_addr_t &args, const size_t chan)=0
Configure the tune args for this RX radio.
std::shared_ptr< rfnoc_rx_radio > sptr
Definition: rfnoc_rx_radio.h:32
virtual double set_frequency(const double frequency, const size_t chan)=0
Set the RX frequency for this radio.
virtual double set_bandwidth(const double bandwidth, const size_t chan)=0
Set the analog bandwidth for this RX radio.
#define GR_UHD_API
Definition: gr-uhd/include/gnuradio/uhd/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29