/usr/include/uhd/usrp/dboard_iface.hpp is in libuhd-dev 3.4.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | //
// 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{
//! Special properties that differentiate this daughterboard slot
struct UHD_API dboard_iface_special_props_t{
/*!
* Soft clock divider:
* When a motherboard cannot provided a divided dboard clock,
* it may provided a "soft" divided clock over an FPGA GPIO.
* The implementation must know the type of clock provided.
*/
bool soft_clock_divider;
/*!
* Mangle i2c addresses:
* When i2c is shared across multiple daugterboard slots,
* the i2c addresses will be mangled on the secondary slot
* to avoid conflicts between slots in the i2c address space.
* The mangling is daguhterboard specific so the implementation
* needs to know whether it should use mangled addresses or not.
*/
bool mangle_i2c_addrs;
};
/*!
* The daughter board dboard interface to be subclassed.
* A dboard instance interfaces with the mboard though this api.
* This interface provides i2c, spi, gpio, atr, aux dac/adc access.
* Each mboard should have a specially tailored iface for its dboard.
*/
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;
//! tells the host which unit to use
enum unit_t{
UNIT_RX = int('r'),
UNIT_TX = int('t')
};
//! possible atr registers
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')
};
//! aux dac selection enums (per unit)
enum aux_dac_t{
AUX_DAC_A = int('a'),
AUX_DAC_B = int('b'),
AUX_DAC_C = int('c'),
AUX_DAC_D = int('d')
};
//! aux adc selection enums (per unit)
enum aux_adc_t{
AUX_ADC_A = int('a'),
AUX_ADC_B = int('b')
};
/*!
* Get special properties information for this dboard slot.
* This call helps the dboard code to handle implementation
* differences between different motherboards and dboard slots.
* \return the special properties struct
*/
virtual special_props_t get_special_props(void) = 0;
/*!
* Write to an aux dac.
*
* \param unit which unit rx or tx
* \param which_dac the dac index 0, 1, 2, 3...
* \param value the value in volts
*/
virtual void write_aux_dac(unit_t unit, aux_dac_t which_dac, double value) = 0;
/*!
* Read from an aux adc.
*
* \param unit which unit rx or tx
* \param which_adc the adc index 0, 1, 2, 3...
* \return the value in volts
*/
virtual double read_aux_adc(unit_t unit, aux_adc_t which_adc) = 0;
/*!
* Set a daughterboard output pin control source.
*
* \param unit which unit rx or tx
* \param value 16-bits, 0=GPIO controlled, 1=ATR controlled
* \param mask 16-bits, 0=do not change, 1=change value
*/
virtual void set_pin_ctrl(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
/*!
* Read back the pin control setting.
*
* \param unit which unit rx or tx
* \return the 16-bit settings value
*/
virtual boost::uint16_t get_pin_ctrl(unit_t unit);
/*!
* Set a daughterboard ATR register.
*
* \param unit which unit rx or tx
* \param reg which ATR register
* \param value 16-bits, 0=ATR output low, 1=ATR output high
* \param mask 16-bits, 0=do not change, 1=change value
*/
virtual void set_atr_reg(
unit_t unit, atr_reg_t reg, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
/*!
* Read back an ATR register setting.
*
* \param unit which unit rx or tx
* \param reg which ATR register
* \return the 16-bit settings value
*/
virtual boost::uint16_t get_atr_reg(unit_t unit, atr_reg_t reg);
/*!
* Set daughterboard GPIO data direction setting.
*
* \param unit which unit rx or tx
* \param value 16-bits, 0=GPIO input, 1=GPIO output
* \param mask 16-bits, 0=do not change, 1=change value
*/
virtual void set_gpio_ddr(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
/*!
* Read back the GPIO data direction setting.
*
* \param unit which unit rx or tx
* \return the 16-bit settings value
*/
virtual boost::uint16_t get_gpio_ddr(unit_t unit);
/*!
* Set daughterboard GPIO pin output setting.
*
* \param unit which unit rx or tx
* \param value 16-bits, 0=GPIO output low, 1=GPIO output high
* \param mask 16-bits, 0=do not change, 1=change value
*/
virtual void set_gpio_out(
unit_t unit, boost::uint16_t value, boost::uint16_t mask = 0xffff
);
/*!
* Read back the GPIO pin output setting.
*
* \param unit which unit rx or tx
* \return the 16-bit settings value
*/
virtual boost::uint16_t get_gpio_out(unit_t unit);
/*!
* Setup the GPIO debug mux.
*
* \param unit which unit rx or tx
* \param which which debug: 0, 1
*/
virtual void set_gpio_debug(unit_t unit, int which) = 0;
/*!
* Read daughterboard GPIO pin values.
*
* \param unit which unit rx or tx
* \return the value of the gpio unit
*/
virtual boost::uint16_t read_gpio(unit_t unit) = 0;
/*!
* Write data to SPI bus peripheral.
*
* \param unit which unit, rx or tx
* \param config configuration settings
* \param data the bits to write MSB first
* \param num_bits the number of bits in data
*/
virtual void write_spi(
unit_t unit,
const spi_config_t &config,
boost::uint32_t data,
size_t num_bits
) = 0;
/*!
* Read and write data to SPI bus peripheral.
*
* \param unit which unit, rx or tx
* \param config configuration settings
* \param data the bits to write MSB first
* \param num_bits the number of bits in data
* \return the data that was read
*/
virtual boost::uint32_t read_write_spi(
unit_t unit,
const spi_config_t &config,
boost::uint32_t data,
size_t num_bits
) = 0;
/*!
* Set the rate of a dboard clock.
*
* \param unit which unit rx or tx
* \param rate the clock rate in Hz
*/
virtual void set_clock_rate(unit_t unit, double rate) = 0;
/*!
* Get the rate of a dboard clock.
*
* \param unit which unit rx or tx
* \return the clock rate in Hz
*/
virtual double get_clock_rate(unit_t unit) = 0;
/*!
* Get a list of possible rates for the dboard clock.
*
* \param unit which unit rx or tx
* \return a list of clock rates in Hz
*/
virtual std::vector<double> get_clock_rates(unit_t unit) = 0;
/*!
* Enable or disable a dboard clock.
*
* \param unit which unit rx or tx
* \param enb true for enabled
*/
virtual void set_clock_enabled(unit_t unit, bool enb) = 0;
/*!
* Get the rate of the codec.
* For rx, this is the rate the ADC feeds the DSP.
* For tx, this is the rate the DSP feeds the DAC.
* \param unit which unit rx or tx
* \return the codec rate in Hz
*/
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 */
|