Loading...
Searching...
No Matches
dboard_iface.hpp
Go to the documentation of this file.
//
// Copyright 2010-2013,2015-2016 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/types/time_spec.hpp>
#include <uhd/usrp/gpio_defs.hpp>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <vector>
namespace uhd { namespace usrp {
class fe_connection_t;
struct UHD_API dboard_iface_special_props_t
{
bool soft_clock_divider;
bool mangle_i2c_addrs;
};
class UHD_API dboard_iface : public uhd::i2c_iface
{
public:
typedef std::shared_ptr<dboard_iface> sptr;
typedef dboard_iface_special_props_t special_props_t;
enum unit_t {
UNIT_RX = int('r'),
UNIT_TX = int('t'),
UNIT_BOTH = int('b'),
};
enum aux_dac_t {
AUX_DAC_A = int('a'),
AUX_DAC_B = int('b'),
AUX_DAC_C = int('c'),
AUX_DAC_D = int('d')
};
enum aux_adc_t { AUX_ADC_A = int('a'), AUX_ADC_B = int('b') };
typedef uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t;
~dboard_iface(void) override{};
virtual special_props_t get_special_props(void) = 0;
virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
virtual void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
virtual uint32_t get_pin_ctrl(unit_t unit) = 0;
virtual void set_atr_reg(
unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffff) = 0;
virtual uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) = 0;
virtual void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
virtual uint32_t get_gpio_ddr(unit_t unit) = 0;
virtual void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
virtual uint32_t get_gpio_out(unit_t unit) = 0;
virtual uint32_t read_gpio(unit_t unit) = 0;
virtual void write_spi(
unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
virtual uint32_t read_write_spi(
unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
virtual void set_clock_rate(unit_t unit, double rate) = 0;
virtual double get_clock_rate(unit_t unit) = 0;
virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
virtual double get_codec_rate(unit_t unit) = 0;
virtual void set_fe_connection(unit_t unit,
const std::string& fe_name,
const uhd::usrp::fe_connection_t& fe_conn) = 0;
virtual bool has_set_fe_connection(const unit_t)
{
return false;
}
virtual uhd::time_spec_t get_command_time(void) = 0;
virtual void set_command_time(const uhd::time_spec_t& t) = 0;
virtual void sleep(const std::chrono::nanoseconds& time);
virtual void define_custom_register_space(const uint32_t,
const uint32_t,
std::function<void(uint32_t, uint32_t)>,
std::function<uint32_t(uint32_t)>)
{ /* noop*/
}
};
}} // namespace uhd::usrp
uhd::i2c_iface
Definition serial.hpp:37
uhd::time_spec_t
Definition time_spec.hpp:31
uhd::usrp::dboard_iface
Definition dboard_iface.hpp:54
uhd::usrp::dboard_iface::get_atr_reg
virtual uint32_t get_atr_reg(unit_t unit, atr_reg_t reg)=0
uhd::usrp::dboard_iface::get_gpio_ddr
virtual uint32_t get_gpio_ddr(unit_t unit)=0
uhd::usrp::dboard_iface::set_gpio_ddr
virtual void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask=0xffff)=0
uhd::usrp::dboard_iface::aux_adc_t
aux_adc_t
aux adc selection enums (per unit)
Definition dboard_iface.hpp:75
uhd::usrp::dboard_iface::AUX_ADC_A
@ AUX_ADC_A
Definition dboard_iface.hpp:75
uhd::usrp::dboard_iface::AUX_ADC_B
@ AUX_ADC_B
Definition dboard_iface.hpp:75
uhd::usrp::dboard_iface::set_clock_rate
virtual void set_clock_rate(unit_t unit, double rate)=0
uhd::usrp::dboard_iface::special_props_t
dboard_iface_special_props_t special_props_t
Definition dboard_iface.hpp:57
uhd::usrp::dboard_iface::sptr
std::shared_ptr< dboard_iface > sptr
Definition dboard_iface.hpp:56
uhd::usrp::dboard_iface::get_special_props
virtual special_props_t get_special_props(void)=0
uhd::usrp::dboard_iface::~dboard_iface
~dboard_iface(void) override
Definition dboard_iface.hpp:79
uhd::usrp::dboard_iface::set_atr_reg
virtual void set_atr_reg(unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask=0xffff)=0
uhd::usrp::dboard_iface::set_command_time
virtual void set_command_time(const uhd::time_spec_t &t)=0
uhd::usrp::dboard_iface::get_command_time
virtual uhd::time_spec_t get_command_time(void)=0
uhd::usrp::dboard_iface::write_aux_dac
virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value)=0
uhd::usrp::dboard_iface::get_gpio_out
virtual uint32_t get_gpio_out(unit_t unit)=0
uhd::usrp::dboard_iface::atr_reg_t
uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t
Definition dboard_iface.hpp:77
uhd::usrp::dboard_iface::set_pin_ctrl
virtual void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask=0xffff)=0
uhd::usrp::dboard_iface::set_gpio_out
virtual void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask=0xffff)=0
uhd::usrp::dboard_iface::unit_t
unit_t
tells the host which unit to use
Definition dboard_iface.hpp:60
uhd::usrp::dboard_iface::UNIT_RX
@ UNIT_RX
Definition dboard_iface.hpp:61
uhd::usrp::dboard_iface::UNIT_BOTH
@ UNIT_BOTH
Definition dboard_iface.hpp:63
uhd::usrp::dboard_iface::UNIT_TX
@ UNIT_TX
Definition dboard_iface.hpp:62
uhd::usrp::dboard_iface::set_fe_connection
virtual void set_fe_connection(unit_t unit, const std::string &fe_name, const uhd::usrp::fe_connection_t &fe_conn)=0
uhd::usrp::dboard_iface::get_codec_rate
virtual double get_codec_rate(unit_t unit)=0
uhd::usrp::dboard_iface::has_set_fe_connection
virtual bool has_set_fe_connection(const unit_t)
Definition dboard_iface.hpp:263
uhd::usrp::dboard_iface::get_pin_ctrl
virtual uint32_t get_pin_ctrl(unit_t unit)=0
uhd::usrp::dboard_iface::read_write_spi
virtual uint32_t read_write_spi(unit_t unit, const spi_config_t &config, uint32_t data, size_t num_bits)=0
uhd::usrp::dboard_iface::sleep
virtual void sleep(const std::chrono::nanoseconds &time)
uhd::usrp::dboard_iface::define_custom_register_space
virtual void define_custom_register_space(const uint32_t, const uint32_t, std::function< void(uint32_t, uint32_t)>, std::function< uint32_t(uint32_t)>)
Definition dboard_iface.hpp:290
uhd::usrp::dboard_iface::write_spi
virtual void write_spi(unit_t unit, const spi_config_t &config, uint32_t data, size_t num_bits)=0
uhd::usrp::dboard_iface::read_gpio
virtual uint32_t read_gpio(unit_t unit)=0
uhd::usrp::dboard_iface::get_clock_rate
virtual double get_clock_rate(unit_t unit)=0
uhd::usrp::dboard_iface::aux_dac_t
aux_dac_t
aux dac selection enums (per unit)
Definition dboard_iface.hpp:67
uhd::usrp::dboard_iface::AUX_DAC_D
@ AUX_DAC_D
Definition dboard_iface.hpp:71
uhd::usrp::dboard_iface::AUX_DAC_A
@ AUX_DAC_A
Definition dboard_iface.hpp:68
uhd::usrp::dboard_iface::AUX_DAC_B
@ AUX_DAC_B
Definition dboard_iface.hpp:69
uhd::usrp::dboard_iface::AUX_DAC_C
@ AUX_DAC_C
Definition dboard_iface.hpp:70
uhd::usrp::dboard_iface::read_aux_adc
virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc)=0
uhd::usrp::dboard_iface::set_clock_enabled
virtual void set_clock_enabled(unit_t unit, bool enb)=0
uhd::usrp::dboard_iface::get_clock_rates
virtual std::vector< double > get_clock_rates(unit_t unit)=0
uhd::usrp::fe_connection_t
Definition fe_connection.hpp:17
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
gpio_defs.hpp
uhd::usrp::gpio_atr::gpio_atr_reg_t
gpio_atr_reg_t
Definition gpio_defs.hpp:12
uhd::usrp
Definition container.hpp:15
uhd
Definition build_info.hpp:12
serial.hpp
uhd::spi_config_t
Definition serial.hpp:84
uhd::usrp::dboard_iface_special_props_t
Special properties that differentiate this daughterboard slot.
Definition dboard_iface.hpp:27
uhd::usrp::dboard_iface_special_props_t::mangle_i2c_addrs
bool mangle_i2c_addrs
Definition dboard_iface.hpp:44
uhd::usrp::dboard_iface_special_props_t::soft_clock_divider
bool soft_clock_divider
Definition dboard_iface.hpp:34
time_spec.hpp