Loading...
Searching...
No Matches
radio_control.hpp
Go to the documentation of this file.
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/features/discoverable_feature_getter_iface.hpp>
#include <uhd/rfnoc/noc_block_base.hpp>
#include <uhd/rfnoc/rf_control/core_iface.hpp>
#include <uhd/rfnoc/rf_control/power_reference_iface.hpp>
#include <uhd/types/device_addr.hpp>
#include <uhd/types/direction.hpp>
#include <uhd/types/eeprom.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/types/stream_cmd.hpp>
namespace uhd { namespace rfnoc {
class radio_control : public noc_block_base,
public rf_control::core_iface,
public rf_control::power_reference_iface,
public virtual ::uhd::features::discoverable_feature_getter_iface
{
public:
static const std::string ALL_LOS;
static const std::string ALL_GAINS;
static constexpr size_t ALL_CHANS = size_t(~0);
RFNOC_DECLARE_BLOCK(radio_control)
/**************************************************************************
* Rate-Related API Calls
*************************************************************************/
//
// This function will coerce the rate and return the actual, current value.
virtual double set_rate(const double rate) = 0;
virtual double get_rate() const = 0;
virtual uhd::meta_range_t get_rate_range() const = 0;
//
// Some radios may operate on multiple samples per clock cycle, usually in
// order to handle large bandwidths without requiring very fast FPGA clock
// rates.
//
// When the SPC value is greater than one, certain API calls may behave
// slightly differently. This is most relevant for issue_stream_cmd(). Other
// commands may round their execution time to the next integer multiple of
// SPC as well.
//
// Ultimately, the exact impact of SPC is device-dependent.
virtual size_t get_spc() const = 0;
/**************************************************************************
* Time-Related API Calls
*************************************************************************/
virtual uint64_t get_ticks_now() = 0;
virtual uhd::time_spec_t get_time_now() = 0;
/**************************************************************************
* RF-Related API Calls
*************************************************************************/
virtual std::vector<std::string> get_tx_gain_profile_names(
const size_t chan) const = 0;
virtual std::vector<std::string> get_rx_gain_profile_names(
const size_t chan) const = 0;
virtual void set_tx_gain_profile(const std::string& profile, const size_t chan) = 0;
virtual void set_rx_gain_profile(const std::string& profile, const size_t chan) = 0;
virtual std::string get_tx_gain_profile(const size_t chan) const = 0;
virtual std::string get_rx_gain_profile(const size_t chan) const = 0;
/**************************************************************************
* Calibration-Related API Calls
*************************************************************************/
virtual void set_tx_dc_offset(const std::complex<double>& offset, size_t chan) = 0;
virtual meta_range_t get_tx_dc_offset_range(size_t chan) const = 0;
virtual void set_tx_iq_balance(
const std::complex<double>& correction, size_t chan) = 0;
virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) = 0;
virtual void set_rx_dc_offset(const std::complex<double>& offset, size_t chan) = 0;
virtual meta_range_t get_rx_dc_offset_range(size_t chan) const = 0;
virtual void set_rx_iq_balance(const bool enb, size_t chan) = 0;
virtual void set_rx_iq_balance(
const std::complex<double>& correction, size_t chan) = 0;
/**************************************************************************
* GPIO Controls
*************************************************************************/
virtual std::vector<std::string> get_gpio_banks() const = 0;
virtual void set_gpio_attr(
const std::string& bank, const std::string& attr, const uint32_t value) = 0;
virtual uint32_t get_gpio_attr(const std::string& bank, const std::string& attr) = 0;
/**************************************************************************
* Sensor API
*************************************************************************/
virtual std::vector<std::string> get_rx_sensor_names(size_t chan) const = 0;
virtual uhd::sensor_value_t get_rx_sensor(const std::string& name, size_t chan) = 0;
virtual std::vector<std::string> get_tx_sensor_names(size_t chan) const = 0;
virtual uhd::sensor_value_t get_tx_sensor(const std::string& name, size_t chan) = 0;
/**************************************************************************
* Streaming-Related API Calls
*************************************************************************/
virtual void issue_stream_cmd(
const uhd::stream_cmd_t& stream_cmd, const size_t port) = 0;
virtual void enable_rx_timestamps(const bool enable, const size_t chan) = 0;
/**************************************************************************
* Radio Identification API Calls
*************************************************************************/
virtual std::string get_slot_name() const = 0;
//
// Example: "0" -> 0 (for UBX), or "A" -> 0 (for E310)
virtual size_t get_chan_from_dboard_fe(
const std::string& fe, const uhd::direction_t direction) const = 0;
//
// Example: 0 -> "0" (for UBX), or 0 -> "A" (for E310)
virtual std::string get_dboard_fe_from_chan(
const size_t chan, const uhd::direction_t direction) const = 0;
virtual std::string get_fe_name(
const size_t chan, const uhd::direction_t direction) const = 0;
/**************************************************************************
* EEPROM API Calls
*************************************************************************/
//
// Note: EEPROMs have finite numbers of write cycles, so don't overuse this
// method!
virtual void set_db_eeprom(const uhd::eeprom_map_t& db_eeprom) = 0;
virtual uhd::eeprom_map_t get_db_eeprom() = 0;
};
}} // namespace uhd::rfnoc
uhd::features::discoverable_feature_getter_iface
Definition discoverable_feature_getter_iface.hpp:18
uhd::rfnoc::noc_block_base::noc_block_base
noc_block_base(make_args_ptr make_args)
uhd::rfnoc::radio_control
Definition radio_control.hpp:105
uhd::rfnoc::radio_control::get_rx_sensor_names
virtual std::vector< std::string > get_rx_sensor_names(size_t chan) const =0
uhd::rfnoc::radio_control::get_dboard_fe_from_chan
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.
uhd::rfnoc::radio_control::get_gpio_attr
virtual uint32_t get_gpio_attr(const std::string &bank, const std::string &attr)=0
uhd::rfnoc::radio_control::get_rx_dc_offset_range
virtual meta_range_t get_rx_dc_offset_range(size_t chan) const =0
uhd::rfnoc::radio_control::set_tx_dc_offset
virtual void set_tx_dc_offset(const std::complex< double > &offset, size_t chan)=0
uhd::rfnoc::radio_control::get_slot_name
virtual std::string get_slot_name() const =0
Returns this radio's slot name (typically "A" or "B").
uhd::rfnoc::radio_control::get_time_now
virtual uhd::time_spec_t get_time_now()=0
uhd::rfnoc::radio_control::issue_stream_cmd
virtual void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd, const size_t port)=0
uhd::rfnoc::radio_control::set_rx_iq_balance
virtual void set_rx_iq_balance(const bool enb, size_t chan)=0
uhd::rfnoc::radio_control::ALL_LOS
static const std::string ALL_LOS
Definition radio_control.hpp:107
uhd::rfnoc::radio_control::enable_rx_timestamps
virtual void enable_rx_timestamps(const bool enable, const size_t chan)=0
uhd::rfnoc::radio_control::set_db_eeprom
virtual void set_db_eeprom(const uhd::eeprom_map_t &db_eeprom)=0
Update the daughterboard EEPROM.
uhd::rfnoc::radio_control::get_gpio_banks
virtual std::vector< std::string > get_gpio_banks() const =0
uhd::rfnoc::radio_control::get_db_eeprom
virtual uhd::eeprom_map_t get_db_eeprom()=0
Return the content of the daughterboard EEPROM.
uhd::rfnoc::radio_control::get_tx_sensor_names
virtual std::vector< std::string > get_tx_sensor_names(size_t chan) const =0
uhd::rfnoc::radio_control::get_rx_gain_profile_names
virtual std::vector< std::string > get_rx_gain_profile_names(const size_t chan) const =0
uhd::rfnoc::radio_control::get_rate_range
virtual uhd::meta_range_t get_rate_range() const =0
Return a list of valid rates.
uhd::rfnoc::radio_control::get_rate
virtual double get_rate() const =0
Get the sample rate.
uhd::rfnoc::radio_control::set_tx_iq_balance
virtual void set_tx_iq_balance(const std::complex< double > &correction, size_t chan)=0
uhd::rfnoc::radio_control::set_rate
virtual double set_rate(const double rate)=0
Set the sample rate.
uhd::rfnoc::radio_control::set_rx_dc_offset
virtual void set_rx_dc_offset(const bool enb, size_t chan=ALL_CHANS)=0
uhd::rfnoc::radio_control::get_rx_sensor
virtual uhd::sensor_value_t get_rx_sensor(const std::string &name, size_t chan)=0
uhd::rfnoc::radio_control::get_tx_dc_offset_range
virtual meta_range_t get_tx_dc_offset_range(size_t chan) const =0
uhd::rfnoc::radio_control::set_rx_gain_profile
virtual void set_rx_gain_profile(const std::string &profile, const size_t chan)=0
uhd::rfnoc::radio_control::get_tx_gain_profile_names
virtual std::vector< std::string > get_tx_gain_profile_names(const size_t chan) const =0
uhd::rfnoc::radio_control::get_tx_gain_profile
virtual std::string get_tx_gain_profile(const size_t chan) const =0
uhd::rfnoc::radio_control::ALL_GAINS
static const std::string ALL_GAINS
Definition radio_control.hpp:108
uhd::rfnoc::radio_control::ALL_CHANS
static constexpr size_t ALL_CHANS
Definition radio_control.hpp:109
uhd::rfnoc::radio_control::set_gpio_attr
virtual void set_gpio_attr(const std::string &bank, const std::string &attr, const uint32_t value)=0
uhd::rfnoc::radio_control::set_tx_gain_profile
virtual void set_tx_gain_profile(const std::string &profile, const size_t chan)=0
uhd::rfnoc::radio_control::get_spc
virtual size_t get_spc() const =0
Return the samples per clock (SPC) value of this radio.
uhd::rfnoc::radio_control::get_fe_name
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.
uhd::rfnoc::radio_control::get_chan_from_dboard_fe
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.
uhd::rfnoc::radio_control::get_ticks_now
virtual uint64_t get_ticks_now()=0
uhd::rfnoc::radio_control::get_tx_sensor
virtual uhd::sensor_value_t get_tx_sensor(const std::string &name, size_t chan)=0
uhd::rfnoc::radio_control::get_rx_gain_profile
virtual std::string get_rx_gain_profile(const size_t chan) const =0
uhd::rfnoc::rf_control::core_iface
Definition core_iface.hpp:26
uhd::rfnoc::rf_control::power_reference_iface
Definition power_reference_iface.hpp:23
uhd::time_spec_t
Definition time_spec.hpp:31
config.hpp
core_iface.hpp
device_addr.hpp
direction.hpp
discoverable_feature_getter_iface.hpp
eeprom.hpp
std
STL namespace.
uhd::rfnoc
Definition actions.hpp:24
uhd
Definition build_info.hpp:12
uhd::direction_t
direction_t
Definition direction.hpp:12
uhd::eeprom_map_t
std::map< std::string, std::vector< uint8_t > > eeprom_map_t
Definition eeprom.hpp:16
noc_block_base.hpp
RFNOC_DECLARE_BLOCK
#define RFNOC_DECLARE_BLOCK(CLASS_NAME)
Definition noc_block_base.hpp:22
power_reference_iface.hpp
ranges.hpp
sensors.hpp
stream_cmd.hpp
uhd::meta_range_t
Definition ranges.hpp:66
uhd::sensor_value_t
Definition sensors.hpp:29
uhd::stream_cmd_t
Definition stream_cmd.hpp:40