USRP Hardware Driver and USRP Manual  Version: 003.009.007-0-g50839059
UHD and USRP Manual
dboard_iface.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2013 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_USRP_DBOARD_IFACE_HPP
19 #define INCLUDED_UHD_USRP_DBOARD_IFACE_HPP
20 
21 #include <uhd/config.hpp>
22 #include <uhd/utils/pimpl.hpp>
23 #include <uhd/types/serial.hpp>
24 #include <uhd/types/time_spec.hpp>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/cstdint.hpp>
27 #include <string>
28 #include <vector>
29 
30 namespace uhd{ namespace usrp{
31 
41 
51 };
52 
60 public:
61  typedef boost::shared_ptr<dboard_iface> sptr;
63 
65  enum unit_t{
66  UNIT_RX = int('r'),
67  UNIT_TX = int('t')
68  };
69 
71  enum atr_reg_t{
72  ATR_REG_IDLE = int('i'),
73  ATR_REG_TX_ONLY = int('t'),
74  ATR_REG_RX_ONLY = int('r'),
75  ATR_REG_FULL_DUPLEX = int('f')
76  };
77 
79  enum aux_dac_t{
80  AUX_DAC_A = int('a'),
81  AUX_DAC_B = int('b'),
82  AUX_DAC_C = int('c'),
83  AUX_DAC_D = int('d')
84  };
85 
87  enum aux_adc_t{
88  AUX_ADC_A = int('a'),
89  AUX_ADC_B = int('b')
90  };
91 
98  virtual special_props_t get_special_props(void) = 0;
99 
107  virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
108 
116  virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
117 
125  virtual void set_pin_ctrl(
126  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
127  );
128 
135  virtual boost::uint16_t get_pin_ctrl(unit_t unit);
136 
145  virtual void set_atr_reg(
146  unit_t unit, atr_reg_t reg, boost::uint16_t value, boost::uint16_t mask = 0xffff
147  );
148 
156  virtual boost::uint16_t get_atr_reg(unit_t unit, atr_reg_t reg);
157 
165  virtual void set_gpio_ddr(
166  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
167  );
168 
175  virtual boost::uint16_t get_gpio_ddr(unit_t unit);
176 
184  virtual void set_gpio_out(
185  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
186  );
187 
194  virtual boost::uint16_t get_gpio_out(unit_t unit);
195 
202  virtual void set_gpio_debug(unit_t unit, int which) = 0;
203 
210  virtual boost::uint16_t read_gpio(unit_t unit) = 0;
211 
220  virtual void write_spi(
221  unit_t unit,
222  const spi_config_t &config,
223  boost::uint32_t data,
224  size_t num_bits
225  ) = 0;
226 
236  virtual boost::uint32_t read_write_spi(
237  unit_t unit,
238  const spi_config_t &config,
239  boost::uint32_t data,
240  size_t num_bits
241  ) = 0;
242 
249  virtual void set_clock_rate(unit_t unit, double rate) = 0;
250 
257  virtual double get_clock_rate(unit_t unit) = 0;
258 
265  virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
266 
273  virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
274 
282  virtual double get_codec_rate(unit_t unit) = 0;
283 
288  virtual uhd::time_spec_t get_command_time(void);
289 
294  virtual void set_command_time(const uhd::time_spec_t& t);
295 
296 private:
297  UHD_PIMPL_DECL(impl) _impl;
298 
299  virtual void _set_pin_ctrl(unit_t unit, boost::uint16_t value) = 0;
300  virtual void _set_atr_reg(unit_t unit, atr_reg_t reg, boost::uint16_t value) = 0;
301  virtual void _set_gpio_ddr(unit_t unit, boost::uint16_t value) = 0;
302  virtual void _set_gpio_out(unit_t unit, boost::uint16_t value) = 0;
303 
304 protected:
305  dboard_iface(void);
306 public:
307  virtual ~dboard_iface(void);
308 
309 };
310 
311 }} //namespace
312 
313 #endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_HPP */
aux_adc_t
aux adc selection enums (per unit)
Definition: dboard_iface.hpp:87
Definition: serial.hpp:45
size_t mask(const soft_reg_field_t field)
Definition: soft_register.hpp:98
Definition: time_spec.hpp:39
aux_dac_t
aux dac selection enums (per unit)
Definition: dboard_iface.hpp:79
Definition: convert.hpp:28
Definition: dboard_iface.hpp:59
bool soft_clock_divider
Definition: dboard_iface.hpp:40
Definition: serial.hpp:105
#define UHD_PIMPL_DECL(_name)
Definition: pimpl.hpp:42
#define UHD_API
Definition: config.h:66
boost::shared_ptr< dboard_iface > sptr
Definition: dboard_iface.hpp:61
dboard_iface_special_props_t special_props_t
Definition: dboard_iface.hpp:62
Special properties that differentiate this daughterboard slot.
Definition: dboard_iface.hpp:33
unit_t
tells the host which unit to use
Definition: dboard_iface.hpp:65
bool mangle_i2c_addrs
Definition: dboard_iface.hpp:50
atr_reg_t
possible atr registers
Definition: dboard_iface.hpp:71