aboutsummaryrefslogtreecommitdiffstats
path: root/host/include/uhd/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/include/uhd/usrp')
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt2
-rw-r--r--host/include/uhd/usrp/dboard_base.hpp10
-rw-r--r--host/include/uhd/usrp/dboard_iface.hpp190
-rw-r--r--host/include/uhd/usrp/dboard_interface.hpp193
-rw-r--r--host/include/uhd/usrp/dboard_manager.hpp6
-rw-r--r--host/include/uhd/usrp/mboard_props.hpp1
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp1
-rw-r--r--host/include/uhd/usrp/subdev_props.hpp2
8 files changed, 200 insertions, 205 deletions
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index c00daaaf0..4b880308e 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -27,7 +27,7 @@ INSTALL(FILES
#### dboard headers ###
dboard_base.hpp
dboard_id.hpp
- dboard_interface.hpp
+ dboard_iface.hpp
dboard_manager.hpp
### usrp headers ###
diff --git a/host/include/uhd/usrp/dboard_base.hpp b/host/include/uhd/usrp/dboard_base.hpp
index 907a7814a..2025760ee 100644
--- a/host/include/uhd/usrp/dboard_base.hpp
+++ b/host/include/uhd/usrp/dboard_base.hpp
@@ -24,7 +24,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include <uhd/usrp/dboard_id.hpp>
-#include <uhd/usrp/dboard_interface.hpp>
+#include <uhd/usrp/dboard_iface.hpp>
namespace uhd{ namespace usrp{
@@ -35,10 +35,10 @@ namespace uhd{ namespace usrp{
class UHD_API dboard_base : boost::noncopyable{
public:
typedef boost::shared_ptr<dboard_base> sptr;
- //the constructor args consist of a subdev name and an interface
+ //the constructor args consist of a subdev name, interface, and ids
//derived classes should pass the args into the dboard_base class ctor
//but should not have to deal with the internals of the args
- typedef boost::tuple<std::string, dboard_interface::sptr, dboard_id_t, dboard_id_t> ctor_args_t;
+ typedef boost::tuple<std::string, dboard_iface::sptr, dboard_id_t, dboard_id_t> ctor_args_t;
//structors
dboard_base(ctor_args_t const&);
@@ -52,13 +52,13 @@ public:
protected:
std::string get_subdev_name(void);
- dboard_interface::sptr get_interface(void);
+ dboard_iface::sptr get_iface(void);
dboard_id_t get_rx_id(void);
dboard_id_t get_tx_id(void);
private:
std::string _subdev_name;
- dboard_interface::sptr _dboard_interface;
+ dboard_iface::sptr _dboard_iface;
dboard_id_t _rx_id, _tx_id;
};
diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp
new file mode 100644
index 000000000..71c7be200
--- /dev/null
+++ b/host/include/uhd/usrp/dboard_iface.hpp
@@ -0,0 +1,190 @@
+//
+// Copyright 2010 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 <boost/shared_ptr.hpp>
+#include <boost/cstdint.hpp>
+#include <vector>
+
+namespace uhd{ namespace usrp{
+
+//spi configuration struct
+struct UHD_API spi_config_t{
+ /*!
+ * The edge type specifies when data is valid
+ * relative to the edge of the serial clock.
+ */
+ enum edge_t{
+ EDGE_RISE = 'r',
+ EDGE_FALL = 'f'
+ };
+
+ //! on what edge is the mosi data valid?
+ edge_t mosi_edge;
+
+ //! on what edge is the miso data valid?
+ edge_t miso_edge;
+
+ /*!
+ * Create a new spi config.
+ * \param edge the default edge for mosi and miso
+ */
+ spi_config_t(edge_t edge = EDGE_RISE){
+ mosi_edge = edge;
+ miso_edge = edge;
+ }
+};
+
+/*!
+ * 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:
+ typedef boost::shared_ptr<dboard_iface> sptr;
+ typedef std::vector<boost::uint8_t> byte_vector_t;
+
+ //tells the host which unit to use
+ enum unit_t{
+ UNIT_RX = 'r',
+ UNIT_TX = 't'
+ };
+
+ //possible atr registers
+ enum atr_reg_t{
+ ATR_REG_IDLE = 'i',
+ ATR_REG_TX_ONLY = 't',
+ ATR_REG_RX_ONLY = 'r',
+ ATR_REG_FULL_DUPLEX = 'f'
+ };
+
+ /*!
+ * 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, int which_dac, float 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 float read_aux_adc(unit_t unit, int which_adc) = 0;
+
+ /*!
+ * Set a daughterboard ATR register.
+ *
+ * \param unit which unit rx or tx
+ * \param reg which ATR register to set
+ * \param value 16-bits, 0=FPGA output low, 1=FPGA output high
+ */
+ virtual void set_atr_reg(unit_t unit, atr_reg_t reg, boost::uint16_t value) = 0;
+
+ /*!
+ * Set daughterboard GPIO data direction register.
+ *
+ * \param unit which unit rx or tx
+ * \param value 16-bits, 0=FPGA input, 1=FPGA output
+ */
+ virtual void set_gpio_ddr(unit_t unit, boost::uint16_t value) = 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 to an I2C peripheral.
+ *
+ * \param i2c_addr I2C bus address (7-bits)
+ * \param buf the data to write
+ */
+ virtual void write_i2c(int i2c_addr, const byte_vector_t &buf) = 0;
+
+ /*!
+ * Read from an I2C peripheral.
+ *
+ * \param i2c_addr I2C bus address (7-bits)
+ * \param num_bytes number of bytes to read
+ * \return the data read if successful, else a zero length string.
+ */
+ virtual byte_vector_t read_i2c(int i2c_addr, size_t num_bytes) = 0;
+
+ /*!
+ * Write data to SPI bus peripheral.
+ *
+ * \param unit which unit, rx or tx
+ * \param config configuration settings
+ * \param data the bits to write LSB 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 LSB 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;
+
+ /*!
+ * 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;
+
+ /*!
+ * 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;
+};
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_DBOARD_IFACE_HPP */
diff --git a/host/include/uhd/usrp/dboard_interface.hpp b/host/include/uhd/usrp/dboard_interface.hpp
deleted file mode 100644
index b3bab131d..000000000
--- a/host/include/uhd/usrp/dboard_interface.hpp
+++ /dev/null
@@ -1,193 +0,0 @@
-//
-// Copyright 2010 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_INTERFACE_HPP
-#define INCLUDED_UHD_USRP_DBOARD_INTERFACE_HPP
-
-#include <uhd/config.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/cstdint.hpp>
-#include <vector>
-
-namespace uhd{ namespace usrp{
-
-/*!
- * The daughter board dboard_interface to be subclassed.
- * A dboard instance dboard_interfaces with the mboard though this api.
- * This dboard_interface provides i2c, spi, gpio, atr, aux dac/adc access.
- * Each mboard should have a specially tailored dboard dboard_interface.
- */
-class UHD_API dboard_interface{
-public:
- typedef boost::shared_ptr<dboard_interface> sptr;
- typedef std::vector<boost::uint8_t> byte_vector_t;
-
- //tells the host which unit to use
- enum unit_type_t{
- UNIT_TYPE_RX = 'r',
- UNIT_TYPE_TX = 't'
- };
-
- //tells the host which device to use
- enum spi_dev_t{
- SPI_DEV_RX = 'r',
- SPI_DEV_TX = 't'
- };
-
- //args for spi format
- enum spi_edge_t{
- SPI_EDGE_RISE = 'r',
- SPI_EDGE_FALL = 'f'
- };
-
- //tell the host which gpio bank
- enum gpio_bank_t{
- GPIO_BANK_RX = 'r',
- GPIO_BANK_TX = 't'
- };
-
- //possible atr registers
- enum atr_reg_t{
- ATR_REG_IDLE = 'i',
- ATR_REG_TX_ONLY = 't',
- ATR_REG_RX_ONLY = 'r',
- ATR_REG_FULL_DUPLEX = 'f'
- };
-
- //structors
- dboard_interface(void);
- virtual ~dboard_interface(void);
-
- /*!
- * 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 to write
- */
- virtual void write_aux_dac(unit_type_t unit, int which_dac, int 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 that was read
- */
- virtual int read_aux_adc(unit_type_t unit, int which_adc) = 0;
-
- /*!
- * Set a daughterboard ATR register.
- *
- * \param bank GPIO_TX_BANK or GPIO_RX_BANK
- * \param reg which ATR register to set
- * \param value 16-bits, 0=FPGA output low, 1=FPGA output high
- */
- virtual void set_atr_reg(gpio_bank_t bank, atr_reg_t reg, boost::uint16_t value) = 0;
-
- /*!
- * Set daughterboard GPIO data direction register.
- *
- * \param bank GPIO_TX_BANK or GPIO_RX_BANK
- * \param value 16-bits, 0=FPGA input, 1=FPGA output
- */
- virtual void set_gpio_ddr(gpio_bank_t bank, boost::uint16_t value) = 0;
-
- /*!
- * Read daughterboard GPIO pin values
- *
- * \param bank GPIO_TX_BANK or GPIO_RX_BANK
- * \return the value of the gpio bank
- */
- virtual boost::uint16_t read_gpio(gpio_bank_t bank) = 0;
-
- /*!
- * \brief Write to I2C peripheral
- * \param i2c_addr I2C bus address (7-bits)
- * \param buf the data to write
- */
- virtual void write_i2c(int i2c_addr, const byte_vector_t &buf) = 0;
-
- /*!
- * \brief Read from I2C peripheral
- * \param i2c_addr I2C bus address (7-bits)
- * \param num_bytes number of bytes to read
- * \return the data read if successful, else a zero length string.
- */
- virtual byte_vector_t read_i2c(int i2c_addr, size_t num_bytes) = 0;
-
- /*!
- * \brief Write data to SPI bus peripheral.
- *
- * \param dev which spi device
- * \param edge args for format
- * \param buf the data to write
- */
- void write_spi(spi_dev_t dev, spi_edge_t edge, const byte_vector_t &buf);
-
- /*!
- * \brief Read data to SPI bus peripheral.
- *
- * \param dev which spi device
- * \param edge args for format
- * \param num_bytes number of bytes to read
- * \return the data that was read
- */
- byte_vector_t read_spi(spi_dev_t dev, spi_edge_t edge, size_t num_bytes);
-
- /*!
- * \brief Read and write data to SPI bus peripheral.
- * The data read back will be the same length as the input buffer.
- *
- * \param dev which spi device
- * \param edge args for format
- * \param buf the data to write
- * \return the data that was read
- */
- byte_vector_t read_write_spi(spi_dev_t dev, spi_edge_t edge, const byte_vector_t &buf);
-
- /*!
- * \brief Get the rate of the rx dboard clock.
- * \return the clock rate
- */
- virtual double get_rx_clock_rate(void) = 0;
-
- /*!
- * \brief Get the rate of the tx dboard clock.
- * \return the clock rate
- */
- virtual double get_tx_clock_rate(void) = 0;
-
-private:
- /*!
- * \brief Read and write data to SPI bus peripheral.
- *
- * \param dev which spi device
- * \param edge args for format
- * \param buf the data to write
- * \param readback false for write only
- * \return the data that was read
- */
- virtual byte_vector_t transact_spi(
- spi_dev_t dev,
- spi_edge_t edge,
- const byte_vector_t &buf,
- bool readback
- ) = 0;
-};
-
-}} //namespace
-
-#endif /* INCLUDED_UHD_USRP_DBOARD_INTERFACE_HPP */
diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp
index ed8ee73ef..6de64b02d 100644
--- a/host/include/uhd/usrp/dboard_manager.hpp
+++ b/host/include/uhd/usrp/dboard_manager.hpp
@@ -59,16 +59,16 @@ public:
* Make a new dboard manager.
* \param rx_dboard_id the id of the rx dboard
* \param tx_dboard_id the id of the tx dboard
- * \param interface the custom dboard interface
+ * \param iface the custom dboard interface
* \return an sptr to the new dboard manager
*/
static sptr make(
dboard_id_t rx_dboard_id,
dboard_id_t tx_dboard_id,
- dboard_interface::sptr interface
+ dboard_iface::sptr iface
);
- //dboard_interface
+ //dboard manager interface
virtual prop_names_t get_rx_subdev_names(void) = 0;
virtual prop_names_t get_tx_subdev_names(void) = 0;
virtual wax::obj get_rx_subdev(const std::string &subdev_name) = 0;
diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp
index 55c11b822..7ff454472 100644
--- a/host/include/uhd/usrp/mboard_props.hpp
+++ b/host/include/uhd/usrp/mboard_props.hpp
@@ -31,7 +31,6 @@ namespace uhd{ namespace usrp{
enum mboard_prop_t{
MBOARD_PROP_NAME = 'n', //ro, std::string
MBOARD_PROP_OTHERS = 'o', //ro, prop_names_t
- MBOARD_PROP_CLOCK_RATE = 'c', //ro, double
MBOARD_PROP_RX_DSP = 'd', //ro, wax::obj
MBOARD_PROP_RX_DSP_NAMES = 'D', //ro, prop_names_t
MBOARD_PROP_TX_DSP = 'u', //ro, wax::obj
diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index 6f74a406b..c4e0338f7 100644
--- a/host/include/uhd/usrp/simple_usrp.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -52,7 +52,6 @@ public:
virtual void set_time_next_pps(const time_spec_t &time_spec) = 0;
virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0;
virtual void set_clock_config(const clock_config_t &clock_config) = 0;
- virtual double get_clock_rate(void) = 0;
/*******************************************************************
* RX methods
diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp
index d35793c6b..cd6b14ef5 100644
--- a/host/include/uhd/usrp/subdev_props.hpp
+++ b/host/include/uhd/usrp/subdev_props.hpp
@@ -35,7 +35,7 @@ namespace uhd{ namespace usrp{
SUBDEV_PROP_FREQ_RANGE = 'F', //ro, freq_range_t
SUBDEV_PROP_ANTENNA = 'a', //rw, std::string
SUBDEV_PROP_ANTENNA_NAMES = 'A', //ro, prop_names_t
- SUBDEV_PROP_ENABLED = 'e', //rw, bool
+ //SUBDEV_PROP_ENABLED = 'e', //rw, bool //---> dont need, we have atr
SUBDEV_PROP_QUADRATURE = 'q', //ro, bool
SUBDEV_PROP_IQ_SWAPPED = 'i', //ro, bool
SUBDEV_PROP_SPECTRUM_INVERTED = 's', //ro, bool