All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
dboard_iface.hpp
Go to the documentation of this file.
//
// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef INCLUDED_UHD_USRP_DBOARD_IFACE_HPP
#define INCLUDED_UHD_USRP_DBOARD_IFACE_HPP
#include <uhd/config.hpp>
#include <uhd/utils/pimpl.hpp>
#include <uhd/types/serial.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <vector>
namespace uhd{ namespace usrp{
struct UHD_API dboard_iface_special_props_t{
bool soft_clock_divider;
bool mangle_i2c_addrs;
};
class UHD_API dboard_iface : public uhd::i2c_iface{
public:
typedef boost::shared_ptr<dboard_iface> sptr;
typedef dboard_iface_special_props_t special_props_t;
enum unit_t{
UNIT_RX = int('r'),
UNIT_TX = int('t')
};
enum atr_reg_t{
ATR_REG_IDLE = int('i'),
ATR_REG_TX_ONLY = int('t'),
ATR_REG_RX_ONLY = int('r'),
ATR_REG_FULL_DUPLEX = int('f')
};
enum aux_dac_t{
AUX_DAC_A = int('a'),
AUX_DAC_B = int('b'),
AUX_DAC_C = int('c'),
AUX_DAC_D = int('d')
};
enum aux_adc_t{
AUX_ADC_A = int('a'),
AUX_ADC_B = int('b')
};
virtual special_props_t get_special_props(void) = 0;
virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
virtual void set_pin_ctrl(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
virtual boost::uint16_t get_pin_ctrl(unit_t unit);
virtual void set_atr_reg(
unit_t unit, atr_reg_t reg, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
virtual boost::uint16_t get_atr_reg(unit_t unit, atr_reg_t reg);
virtual void set_gpio_ddr(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
virtual boost::uint16_t get_gpio_ddr(unit_t unit);
virtual void set_gpio_out(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
virtual boost::uint16_t get_gpio_out(unit_t unit);
virtual void set_gpio_debug(unit_t unit, int which) = 0;
virtual boost::uint16_t read_gpio(unit_t unit) = 0;
virtual void write_spi(
unit_t unit,
const spi_config_t &config,
boost::uint32_t data,
size_t num_bits
) = 0;
virtual boost::uint32_t read_write_spi(
unit_t unit,
const spi_config_t &config,
boost::uint32_t data,
size_t num_bits
) = 0;
virtual void set_clock_rate(unit_t unit, double rate) = 0;
virtual double get_clock_rate(unit_t unit) = 0;
virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
virtual double get_codec_rate(unit_t unit) = 0;
private:
UHD_PIMPL_DECL(impl) _impl;
virtual void _set_pin_ctrl(unit_t unit, boost::uint16_t value) = 0;
virtual void _set_atr_reg(unit_t unit, atr_reg_t reg, boost::uint16_t value) = 0;
virtual void _set_gpio_ddr(unit_t unit, boost::uint16_t value) = 0;
virtual void _set_gpio_out(unit_t unit, boost::uint16_t value) = 0;
protected:
dboard_iface(void);
};
}} //namespace
#endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_HPP */