USRP Hardware Driver and USRP Manual  Version: 003.008.002-0-ge9d11b35
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 <boost/shared_ptr.hpp>
25 #include <boost/cstdint.hpp>
26 #include <string>
27 #include <vector>
28 
29 namespace uhd{ namespace usrp{
30 
40 
50 };
51 
59 public:
60  typedef boost::shared_ptr<dboard_iface> sptr;
62 
64  enum unit_t{
65  UNIT_RX = int('r'),
66  UNIT_TX = int('t')
67  };
68 
70  enum atr_reg_t{
71  ATR_REG_IDLE = int('i'),
72  ATR_REG_TX_ONLY = int('t'),
73  ATR_REG_RX_ONLY = int('r'),
74  ATR_REG_FULL_DUPLEX = int('f')
75  };
76 
78  enum aux_dac_t{
79  AUX_DAC_A = int('a'),
80  AUX_DAC_B = int('b'),
81  AUX_DAC_C = int('c'),
82  AUX_DAC_D = int('d')
83  };
84 
86  enum aux_adc_t{
87  AUX_ADC_A = int('a'),
88  AUX_ADC_B = int('b')
89  };
90 
97  virtual special_props_t get_special_props(void) = 0;
98 
106  virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
107 
115  virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
116 
124  virtual void set_pin_ctrl(
125  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
126  );
127 
134  virtual boost::uint16_t get_pin_ctrl(unit_t unit);
135 
144  virtual void set_atr_reg(
145  unit_t unit, atr_reg_t reg, boost::uint16_t value, boost::uint16_t mask = 0xffff
146  );
147 
155  virtual boost::uint16_t get_atr_reg(unit_t unit, atr_reg_t reg);
156 
164  virtual void set_gpio_ddr(
165  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
166  );
167 
174  virtual boost::uint16_t get_gpio_ddr(unit_t unit);
175 
183  virtual void set_gpio_out(
184  unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
185  );
186 
193  virtual boost::uint16_t get_gpio_out(unit_t unit);
194 
201  virtual void set_gpio_debug(unit_t unit, int which) = 0;
202 
209  virtual boost::uint16_t read_gpio(unit_t unit) = 0;
210 
219  virtual void write_spi(
220  unit_t unit,
221  const spi_config_t &config,
222  boost::uint32_t data,
223  size_t num_bits
224  ) = 0;
225 
235  virtual boost::uint32_t read_write_spi(
236  unit_t unit,
237  const spi_config_t &config,
238  boost::uint32_t data,
239  size_t num_bits
240  ) = 0;
241 
248  virtual void set_clock_rate(unit_t unit, double rate) = 0;
249 
256  virtual double get_clock_rate(unit_t unit) = 0;
257 
264  virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
265 
272  virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
273 
281  virtual double get_codec_rate(unit_t unit) = 0;
282 
283 private:
284  UHD_PIMPL_DECL(impl) _impl;
285 
286  virtual void _set_pin_ctrl(unit_t unit, boost::uint16_t value) = 0;
287  virtual void _set_atr_reg(unit_t unit, atr_reg_t reg, boost::uint16_t value) = 0;
288  virtual void _set_gpio_ddr(unit_t unit, boost::uint16_t value) = 0;
289  virtual void _set_gpio_out(unit_t unit, boost::uint16_t value) = 0;
290 
291 protected:
292  dboard_iface(void);
293 public:
294  virtual ~dboard_iface(void);
295 
296 };
297 
298 }} //namespace
299 
300 #endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_HPP */
aux_adc_t
aux adc selection enums (per unit)
Definition: dboard_iface.hpp:86
Definition: serial.hpp:45
#define UHD_API
Definition: config.hpp:79
aux_dac_t
aux dac selection enums (per unit)
Definition: dboard_iface.hpp:78
Definition: convert.hpp:28
Definition: dboard_iface.hpp:58
bool soft_clock_divider
Definition: dboard_iface.hpp:39
Definition: serial.hpp:105
#define UHD_PIMPL_DECL(_name)
Definition: pimpl.hpp:42
boost::shared_ptr< dboard_iface > sptr
Definition: dboard_iface.hpp:60
dboard_iface_special_props_t special_props_t
Definition: dboard_iface.hpp:61
Special properties that differentiate this daughterboard slot.
Definition: dboard_iface.hpp:32
unit_t
tells the host which unit to use
Definition: dboard_iface.hpp:64
bool mangle_i2c_addrs
Definition: dboard_iface.hpp:49
atr_reg_t
possible atr registers
Definition: dboard_iface.hpp:70