USRP Hardware Driver and USRP Manual Version: 4.1.0.3
UHD and USRP Manual
radio_control.hpp
Go to the documentation of this file.
1//
2// Copyright 2019 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
9#include <uhd/config.hpp>
16#include <uhd/types/eeprom.hpp>
17#include <uhd/types/ranges.hpp>
18#include <uhd/types/sensors.hpp>
20
21namespace uhd { namespace rfnoc {
22
29{
30public:
31 static const std::string ALL_LOS;
32 static const std::string ALL_GAINS;
33 static constexpr size_t ALL_CHANS = size_t(~0);
34
36
37 /**************************************************************************
38 * Rate-Related API Calls
39 *************************************************************************/
41 //
42 // This function will coerce the rate and return the actual, current value.
43 virtual double set_rate(const double rate) = 0;
44
46 virtual double get_rate() const = 0;
47
49 virtual uhd::meta_range_t get_rate_range() const = 0;
50
52 //
53 // Some radios may operate on multiple samples per clock cycle, usually in
54 // order to handle large bandwidths without requiring very fast FPGA clock
55 // rates.
56 //
57 // When the SPC value is greater than one, certain API calls may behave
58 // slightly differently. This is most relevant for issue_stream_cmd(). Other
59 // commands may round their execution time to the next integer multiple of
60 // SPC as well.
61 //
62 // Ultimately, the exact impact of SPC is device-dependent.
63 virtual size_t get_spc() const = 0;
64
65 /**************************************************************************
66 * RF-Related API Calls
67 *************************************************************************/
70 virtual std::vector<std::string> get_tx_gain_profile_names(
71 const size_t chan) const = 0;
72
75 virtual std::vector<std::string> get_rx_gain_profile_names(
76 const size_t chan) const = 0;
77
80 virtual void set_tx_gain_profile(const std::string& profile, const size_t chan) = 0;
81
84 virtual void set_rx_gain_profile(const std::string& profile, const size_t chan) = 0;
85
88 virtual std::string get_tx_gain_profile(const size_t chan) const = 0;
89
92 virtual std::string get_rx_gain_profile(const size_t chan) const = 0;
93
94 /**************************************************************************
95 * Calibration-Related API Calls
96 *************************************************************************/
104 virtual void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) = 0;
105
110 virtual meta_range_t get_tx_dc_offset_range(size_t chan) const = 0;
111
119 virtual void set_tx_iq_balance(
120 const std::complex<double>& correction, size_t chan) = 0;
121
133 virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) = 0;
134
142 virtual void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) = 0;
143
148 virtual meta_range_t get_rx_dc_offset_range(size_t chan) const = 0;
149
155 virtual void set_rx_iq_balance(const bool enb, size_t chan) = 0;
156
162 virtual void set_rx_iq_balance(
163 const std::complex<double>& correction, size_t chan) = 0;
164
165 /**************************************************************************
166 * GPIO Controls
167 *************************************************************************/
172 virtual std::vector<std::string> get_gpio_banks() const = 0;
173
188 virtual void set_gpio_attr(
189 const std::string& bank, const std::string& attr, const uint32_t value) = 0;
190
206 virtual uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) = 0;
207
208 /**************************************************************************
209 * Sensor API
210 *************************************************************************/
215 virtual std::vector<std::string> get_rx_sensor_names(size_t chan) const = 0;
216
223 virtual uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan) = 0;
224
229 virtual std::vector<std::string> get_tx_sensor_names(size_t chan) const = 0;
230
237 virtual uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) = 0;
238
239 /**************************************************************************
240 * Streaming-Related API Calls
241 *************************************************************************/
256 virtual void issue_stream_cmd(
257 const uhd::stream_cmd_t& stream_cmd, const size_t port) = 0;
258
261 virtual void enable_rx_timestamps(const bool enable, const size_t chan) = 0;
262
263 /**************************************************************************
264 * Radio Identification API Calls
265 *************************************************************************/
267 virtual std::string get_slot_name() const = 0;
268
270 //
271 // Example: "0" -> 0 (for UBX), or "A" -> 0 (for E310)
273 const std::string& fe, const uhd::direction_t direction) const = 0;
274
276 //
277 // Example: 0 -> "0" (for UBX), or 0 -> "A" (for E310)
279 const size_t chan, const uhd::direction_t direction) const = 0;
280
282 virtual std::string get_fe_name(
283 const size_t chan, const uhd::direction_t direction) const = 0;
284
285 /**************************************************************************
286 * EEPROM API Calls
287 *************************************************************************/
289 //
290 // Note: EEPROMs have finite numbers of write cycles, so don't overuse this
291 // method!
292 virtual void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) = 0;
293
296};
297
298}} // namespace uhd::rfnoc
Definition: discoverable_feature_getter_iface.hpp:18
Definition: noc_block_base.hpp:42
Definition: radio_control.hpp:29
virtual std::vector< std::string > get_rx_sensor_names(size_t chan) const =0
virtual std::string get_dboard_fe_from_chan(const size_t chan, const uhd::direction_t direction) const =0
Return the frontend name for a channel index.
virtual uint32_t get_gpio_attr(const std::string &bank, const std::string &attr)=0
virtual meta_range_t get_rx_dc_offset_range(size_t chan) const =0
virtual void set_tx_dc_offset(const std::complex< double > &offset, size_t chan)=0
virtual std::string get_slot_name() const =0
Returns this radio's slot name (typically "A" or "B")
virtual void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd, const size_t port)=0
virtual void set_rx_iq_balance(const bool enb, size_t chan)=0
static const std::string ALL_LOS
Definition: radio_control.hpp:31
virtual void enable_rx_timestamps(const bool enable, const size_t chan)=0
virtual void set_db_eeprom(const uhd::eeprom_map_t &db_eeprom)=0
Update the daughterboard EEPROM.
virtual std::vector< std::string > get_gpio_banks() const =0
virtual uhd::eeprom_map_t get_db_eeprom()=0
Return the content of the daughterboard EEPROM.
virtual std::vector< std::string > get_tx_sensor_names(size_t chan) const =0
virtual std::vector< std::string > get_rx_gain_profile_names(const size_t chan) const =0
virtual uhd::meta_range_t get_rate_range() const =0
Return a list of valid rates.
virtual double get_rate() const =0
Get the sample rate.
virtual void set_tx_iq_balance(const std::complex< double > &correction, size_t chan)=0
virtual double set_rate(const double rate)=0
Set the sample rate.
virtual void set_rx_dc_offset(const bool enb, size_t chan=ALL_CHANS)=0
virtual uhd::sensor_value_t get_rx_sensor(const std::string &name, size_t chan)=0
virtual meta_range_t get_tx_dc_offset_range(size_t chan) const =0
virtual void set_rx_gain_profile(const std::string &profile, const size_t chan)=0
virtual std::vector< std::string > get_tx_gain_profile_names(const size_t chan) const =0
virtual std::string get_tx_gain_profile(const size_t chan) const =0
static const std::string ALL_GAINS
Definition: radio_control.hpp:32
static constexpr size_t ALL_CHANS
Definition: radio_control.hpp:33
virtual void set_gpio_attr(const std::string &bank, const std::string &attr, const uint32_t value)=0
virtual void set_tx_gain_profile(const std::string &profile, const size_t chan)=0
virtual size_t get_spc() const =0
Return the samples per clock (SPC) value of this radio.
virtual std::string get_fe_name(const size_t chan, const uhd::direction_t direction) const =0
Return the name of the frontend, as given by the dboard driver.
virtual size_t get_chan_from_dboard_fe(const std::string &fe, const uhd::direction_t direction) const =0
Return the channel that corresponds to a frontend's name.
virtual uhd::sensor_value_t get_tx_sensor(const std::string &name, size_t chan)=0
virtual std::string get_rx_gain_profile(const size_t chan) const =0
Definition: core_iface.hpp:25
Definition: power_reference_iface.hpp:23
STL namespace.
Definition: build_info.hpp:12
direction_t
Definition: direction.hpp:12
std::map< std::string, std::vector< uint8_t > > eeprom_map_t
Definition: eeprom.hpp:15
#define RFNOC_DECLARE_BLOCK(CLASS_NAME)
Definition: noc_block_base.hpp:21
Definition: ranges.hpp:66
Definition: sensors.hpp:29
Definition: stream_cmd.hpp:40