| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
dboard_iface.hpp
Go to the documentation of this file.
1//
2// Copyright 2010-2013,2015-2016 Ettus Research LLC
3// Copyright 2018 Ettus Research, a National Instruments Company
4//
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
7
8#pragma once
9
10#include <uhd/config.hpp>
11#include <uhd/exception.hpp>
12#include <uhd/types/serial.hpp>
13#include <uhd/types/time_spec.hpp>
14#include <uhd/usrp/gpio_defs.hpp>
15#include <chrono>
16#include <cstddef>
17#include <cstdint>
18#include <functional>
19#include <memory>
20#include <string>
21#include <vector>
22
23 namespace uhd { namespace usrp {
24 class fe_connection_t;
25
27 struct UHD_API dboard_iface_special_props_t
28{
35 bool soft_clock_divider;
36
45 bool mangle_i2c_addrs;
46};
47
54 class UHD_API dboard_iface : public uhd::i2c_iface
55{
56 public:
57 typedef std::shared_ptr<dboard_iface> sptr;
58 typedef dboard_iface_special_props_t special_props_t;
59
61 enum unit_t : uint32_t {
62 UNIT_RX = int('r'),
63 UNIT_TX = int('t'),
64 UNIT_BOTH = int('b'),
65 };
66
68 enum aux_dac_t : uint32_t {
69 AUX_DAC_A = int('a'),
70 AUX_DAC_B = int('b'),
71 AUX_DAC_C = int('c'),
72 AUX_DAC_D = int('d')
73 };
74
76 enum aux_adc_t : uint32_t { AUX_ADC_A = int('a'), AUX_ADC_B = int('b') };
77
78 typedef uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t;
79
80 ~dboard_iface(void) override{};
81
88 virtual special_props_t get_special_props(void) = 0;
89
97 virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
98
106 virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
107
115 virtual void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
116
123 virtual uint32_t get_pin_ctrl(unit_t unit) = 0;
124
133 virtual void set_atr_reg(
134 unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffff) = 0;
135
143 virtual uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) = 0;
144
152 virtual void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
153
160 virtual uint32_t get_gpio_ddr(unit_t unit) = 0;
161
169 virtual void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
170
177 virtual uint32_t get_gpio_out(unit_t unit) = 0;
178
185 virtual uint32_t read_gpio(unit_t unit) = 0;
186
195 virtual void write_spi(
196 unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
197
207 virtual uint32_t read_write_spi(
208 unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
209
216 virtual void set_clock_rate(unit_t unit, double rate) = 0;
217
224 virtual double get_clock_rate(unit_t unit) = 0;
225
232 virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
233
240 virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
241
249 virtual double get_codec_rate(unit_t unit) = 0;
250
257 virtual bool lock_clock_rate([[maybe_unused]] const unit_t unit)
258 {
259 return false; // default implementation does not support locking
260 }
261
269 virtual void set_fe_connection(unit_t unit,
270 const std::string& fe_name,
271 const uhd::usrp::fe_connection_t& fe_conn) = 0;
272
275 virtual bool has_set_fe_connection(const unit_t)
276 {
277 return false;
278 }
279
284 virtual uhd::time_spec_t get_command_time(void) = 0;
285
290 virtual void set_command_time(const uhd::time_spec_t& t) = 0;
291
296 virtual void sleep(const std::chrono::nanoseconds& time);
297
302 virtual void define_custom_register_space(const uint32_t,
303 const uint32_t,
304 std::function<void(uint32_t, uint32_t)>,
305 std::function<uint32_t(uint32_t)>)
306 { /* noop*/
307 }
308};
309
310}} // 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:55
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::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:58
uhd::usrp::dboard_iface::sptr
std::shared_ptr< dboard_iface > sptr
Definition dboard_iface.hpp:57
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:80
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:78
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::aux_adc_t
aux_adc_t
aux adc selection enums (per unit)
Definition dboard_iface.hpp:76
uhd::usrp::dboard_iface::AUX_ADC_A
@ AUX_ADC_A
Definition dboard_iface.hpp:76
uhd::usrp::dboard_iface::AUX_ADC_B
@ AUX_ADC_B
Definition dboard_iface.hpp:76
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::aux_dac_t
aux_dac_t
aux dac selection enums (per unit)
Definition dboard_iface.hpp:68
uhd::usrp::dboard_iface::AUX_DAC_D
@ AUX_DAC_D
Definition dboard_iface.hpp:72
uhd::usrp::dboard_iface::AUX_DAC_A
@ AUX_DAC_A
Definition dboard_iface.hpp:69
uhd::usrp::dboard_iface::AUX_DAC_B
@ AUX_DAC_B
Definition dboard_iface.hpp:70
uhd::usrp::dboard_iface::AUX_DAC_C
@ AUX_DAC_C
Definition dboard_iface.hpp:71
uhd::usrp::dboard_iface::unit_t
unit_t
tells the host which unit to use
Definition dboard_iface.hpp:61
uhd::usrp::dboard_iface::UNIT_RX
@ UNIT_RX
Definition dboard_iface.hpp:62
uhd::usrp::dboard_iface::UNIT_BOTH
@ UNIT_BOTH
Definition dboard_iface.hpp:64
uhd::usrp::dboard_iface::UNIT_TX
@ UNIT_TX
Definition dboard_iface.hpp:63
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:275
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:302
uhd::usrp::dboard_iface::lock_clock_rate
virtual bool lock_clock_rate(const unit_t unit)
Definition dboard_iface.hpp:257
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::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
exception.hpp
gpio_defs.hpp
uhd::usrp::gpio_atr::gpio_atr_reg_t
gpio_atr_reg_t
Definition gpio_defs.hpp:12
uhd::usrp
Definition cal_utils.hpp:11
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:28
uhd::usrp::dboard_iface_special_props_t::mangle_i2c_addrs
bool mangle_i2c_addrs
Definition dboard_iface.hpp:45
uhd::usrp::dboard_iface_special_props_t::soft_clock_divider
bool soft_clock_divider
Definition dboard_iface.hpp:35
time_spec.hpp