USRP Hardware Driver and USRP Manual  Version: 4.7.0.0
UHD and USRP Manual
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>
14 #include <uhd/usrp/gpio_defs.hpp>
15 #include <uhd/utils/pimpl.hpp>
16 #include <stdint.h>
17 #include <chrono>
18 #include <functional>
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 namespace uhd { namespace usrp {
24 
27 {
35 
45 };
46 
54 {
55 public:
56  typedef std::shared_ptr<dboard_iface> sptr;
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 
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
aux_adc_t
aux adc selection enums (per unit)
Definition: dboard_iface.hpp:75
Definition: serial.hpp:35
~dboard_iface(void) override
Definition: dboard_iface.hpp:79
uhd::usrp::gpio_atr::gpio_atr_reg_t atr_reg_t
Definition: dboard_iface.hpp:77
Definition: time_spec.hpp:28
aux_dac_t
aux dac selection enums (per unit)
Definition: dboard_iface.hpp:67
Definition: build_info.hpp:12
Definition: dboard_iface.hpp:53
bool soft_clock_divider
Definition: dboard_iface.hpp:34
Definition: serial.hpp:82
Definition: fe_connection.hpp:16
gpio_atr_reg_t
Definition: gpio_defs.hpp:12
std::shared_ptr< dboard_iface > sptr
Definition: dboard_iface.hpp:56
#define UHD_API
Definition: config.h:87
UHD_INLINE data_t mask(const soft_reg_field_t field)
Definition: soft_register.hpp:86
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
dboard_iface_special_props_t special_props_t
Definition: dboard_iface.hpp:57
Special properties that differentiate this daughterboard slot.
Definition: dboard_iface.hpp:26
virtual bool has_set_fe_connection(const unit_t)
Definition: dboard_iface.hpp:263
unit_t
tells the host which unit to use
Definition: dboard_iface.hpp:60
bool mangle_i2c_addrs
Definition: dboard_iface.hpp:44