UHD 003.005.002-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
dboard_iface.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 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
32 struct UHD_API dboard_iface_special_props_t{
39 bool soft_clock_divider;
40
49 bool mangle_i2c_addrs;
50 };
51
58 class UHD_API dboard_iface : public uhd::i2c_iface{
59 public:
60 typedef boost::shared_ptr<dboard_iface> sptr;
61 typedef dboard_iface_special_props_t special_props_t;
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
294 };
295
296 }} //namespace
297
298 #endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_HPP */
pimpl.hpp
uhd::usrp::dboard_iface::aux_adc_t
aux_adc_t
aux adc selection enums (per unit)
Definition: dboard_iface.hpp:86
uhd::i2c_iface
Definition: serial.hpp:45
config.hpp
serial.hpp
UHD_API
#define UHD_API
Definition: config.hpp:76
uhd::usrp::dboard_iface::aux_dac_t
aux_dac_t
aux dac selection enums (per unit)
Definition: dboard_iface.hpp:78
uhd::usrp::dboard_iface
Definition: dboard_iface.hpp:58
uhd::usrp::dboard_iface_special_props_t::soft_clock_divider
bool soft_clock_divider
Definition: dboard_iface.hpp:39
uhd::spi_config_t
Definition: serial.hpp:100
UHD_PIMPL_DECL
#define UHD_PIMPL_DECL(_name)
Definition: pimpl.hpp:42
uhd::usrp::dboard_iface::sptr
boost::shared_ptr< dboard_iface > sptr
Definition: dboard_iface.hpp:60
uhd::usrp::dboard_iface::special_props_t
dboard_iface_special_props_t special_props_t
Definition: dboard_iface.hpp:61
uhd::usrp::dboard_iface_special_props_t
Special properties that differentiate this daughterboard slot.
Definition: dboard_iface.hpp:32
uhd::usrp::dboard_iface::unit_t
unit_t
tells the host which unit to use
Definition: dboard_iface.hpp:64
uhd::usrp::dboard_iface_special_props_t::mangle_i2c_addrs
bool mangle_i2c_addrs
Definition: dboard_iface.hpp:49
uhd::usrp::dboard_iface::atr_reg_t
atr_reg_t
possible atr registers
Definition: dboard_iface.hpp:70