| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 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/types/serial.hpp>
12#include <uhd/types/time_spec.hpp>
13#include <uhd/usrp/gpio_defs.hpp>
14#include <chrono>
15#include <cstddef>
16#include <cstdint>
17#include <functional>
18#include <memory>
19#include <string>
20#include <vector>
21
22 namespace uhd { namespace usrp {
23 class fe_connection_t;
24
26 struct UHD_API dboard_iface_special_props_t
27{
34 bool soft_clock_divider;
35
44 bool mangle_i2c_addrs;
45};
46
53 class UHD_API dboard_iface : public uhd::i2c_iface
54{
55 public:
56 typedef std::shared_ptr<dboard_iface> sptr;
57 typedef dboard_iface_special_props_t special_props_t;
58
60 enum unit_t {
61 UNIT_RX = int('r'),
62 UNIT_TX = int('t'),
63 UNIT_BOTH = int('b'),
64 };
65
67 enum aux_dac_t {
68 AUX_DAC_A = int('a'),
69 AUX_DAC_B = int('b'),
70 AUX_DAC_C = int('c'),
71 AUX_DAC_D = int('d')
72 };
73
75 enum aux_adc_t { AUX_ADC_A = int('a'), AUX_ADC_B = int('b') };
76
77 typedef uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t;
78
79 ~dboard_iface(void) override{};
80
87 virtual special_props_t get_special_props(void) = 0;
88
96 virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
97
105 virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
106
114 virtual void set_pin_ctrl(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
115
122 virtual uint32_t get_pin_ctrl(unit_t unit) = 0;
123
132 virtual void set_atr_reg(
133 unit_t unit, atr_reg_t reg, uint32_t value, uint32_t mask = 0xffff) = 0;
134
142 virtual uint32_t get_atr_reg(unit_t unit, atr_reg_t reg) = 0;
143
151 virtual void set_gpio_ddr(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
152
159 virtual uint32_t get_gpio_ddr(unit_t unit) = 0;
160
168 virtual void set_gpio_out(unit_t unit, uint32_t value, uint32_t mask = 0xffff) = 0;
169
176 virtual uint32_t get_gpio_out(unit_t unit) = 0;
177
184 virtual uint32_t read_gpio(unit_t unit) = 0;
185
194 virtual void write_spi(
195 unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
196
206 virtual uint32_t read_write_spi(
207 unit_t unit, const spi_config_t& config, uint32_t data, size_t num_bits) = 0;
208
215 virtual void set_clock_rate(unit_t unit, double rate) = 0;
216
223 virtual double get_clock_rate(unit_t unit) = 0;
224
231 virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
232
239 virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
240
248 virtual double get_codec_rate(unit_t unit) = 0;
249
257 virtual void set_fe_connection(unit_t unit,
258 const std::string& fe_name,
259 const uhd::usrp::fe_connection_t& fe_conn) = 0;
260
263 virtual bool has_set_fe_connection(const unit_t)
264 {
265 return false;
266 }
267
272 virtual uhd::time_spec_t get_command_time(void) = 0;
273
278 virtual void set_command_time(const uhd::time_spec_t& t) = 0;
279
284 virtual void sleep(const std::chrono::nanoseconds& time);
285
290 virtual void define_custom_register_space(const uint32_t,
291 const uint32_t,
292 std::function<void(uint32_t, uint32_t)>,
293 std::function<uint32_t(uint32_t)>)
294 { /* noop*/
295 }
296};
297
298}} // 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