summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/CMakeLists.txt2
-rw-r--r--host/include/uhd/props.hpp145
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt15
-rw-r--r--host/include/uhd/usrp/dboard_interface.hpp75
-rw-r--r--host/include/uhd/usrp/dboard_manager.hpp2
-rw-r--r--host/include/uhd/usrp/dboard_props.hpp38
-rw-r--r--host/include/uhd/usrp/device_props.hpp57
-rw-r--r--host/include/uhd/usrp/dsp_props.hpp40
-rw-r--r--host/include/uhd/usrp/mboard_props.hpp50
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp (renamed from host/include/uhd/simple_device.hpp)27
-rw-r--r--host/include/uhd/usrp/subdev_props.hpp49
-rw-r--r--host/include/uhd/usrp/tune_helper.hpp (renamed from host/include/uhd/utils/tune_helper.hpp)10
-rw-r--r--host/include/uhd/utils/CMakeLists.txt2
-rw-r--r--host/include/uhd/utils/props.hpp48
14 files changed, 348 insertions, 212 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt
index b364f78cd..d63062032 100644
--- a/host/include/uhd/CMakeLists.txt
+++ b/host/include/uhd/CMakeLists.txt
@@ -24,8 +24,6 @@ ADD_SUBDIRECTORY(utils)
INSTALL(FILES
config.hpp
device.hpp
- props.hpp
- simple_device.hpp
wax.hpp
DESTINATION ${INCLUDE_DIR}/uhd
)
diff --git a/host/include/uhd/props.hpp b/host/include/uhd/props.hpp
deleted file mode 100644
index 01746f853..000000000
--- a/host/include/uhd/props.hpp
+++ /dev/null
@@ -1,145 +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_PROPS_HPP
-#define INCLUDED_UHD_PROPS_HPP
-
-#include <uhd/config.hpp>
-#include <uhd/wax.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <vector>
-#include <string>
-
-namespace uhd{
-
- //typedef for handling named properties
- typedef std::vector<std::string> prop_names_t;
- typedef boost::tuple<wax::obj, std::string> named_prop_t;
-
- /*!
- * Utility function to separate a named property into its components.
- * \param key a reference to the prop object
- * \param name a reference to the name object
- */
- inline UHD_API named_prop_t //must be exported as part of the api to work (TODO move guts to cpp file)
- extract_named_prop(const wax::obj &key, const std::string &name = ""){
- if (key.type() == typeid(named_prop_t)){
- return key.as<named_prop_t>();
- }
- return named_prop_t(key, name);
- }
-
- /*!
- * Possible device properties:
- * In general, a device will have a single mboard.
- * In certain mimo applications, multiple boards
- * will be present in the interface for configuration.
- */
- enum device_prop_t{
- DEVICE_PROP_NAME, //ro, std::string
- DEVICE_PROP_MBOARD, //ro, wax::obj
- DEVICE_PROP_MBOARD_NAMES, //ro, prop_names_t
- DEVICE_PROP_MAX_RX_SAMPLES, //ro, size_t
- DEVICE_PROP_MAX_TX_SAMPLES //ro, size_t
- };
-
- /*!
- * Possible device mboard properties:
- * The general mboard properties are listed below.
- * Custom properties can be identified with a string
- * and discovered though the others property.
- */
- enum mboard_prop_t{
- MBOARD_PROP_NAME, //ro, std::string
- MBOARD_PROP_OTHERS, //ro, prop_names_t
- MBOARD_PROP_CLOCK_RATE, //ro, freq_t
- MBOARD_PROP_RX_DSP, //ro, wax::obj
- MBOARD_PROP_RX_DSP_NAMES, //ro, prop_names_t
- MBOARD_PROP_TX_DSP, //ro, wax::obj
- MBOARD_PROP_TX_DSP_NAMES, //ro, prop_names_t
- MBOARD_PROP_RX_DBOARD, //ro, wax::obj
- MBOARD_PROP_RX_DBOARD_NAMES, //ro, prop_names_t
- MBOARD_PROP_TX_DBOARD, //ro, wax::obj
- MBOARD_PROP_TX_DBOARD_NAMES, //ro, prop_names_t
- MBOARD_PROP_CLOCK_CONFIG, //rw, clock_config_t
- MBOARD_PROP_TIME_NOW, //wo, time_spec_t
- MBOARD_PROP_TIME_NEXT_PPS //wo, time_spec_t
- };
-
- /*!
- * Possible device dsp properties:
- * A dsp can have a wide range of possible properties.
- * A ddc would have a properties "decim", "freq", "taps"...
- * Other properties could be gains, complex scalars, enables...
- * For this reason the only required properties of a dsp is a name
- * and a property to get list of other possible properties.
- */
- enum dsp_prop_t{
- DSP_PROP_NAME, //ro, std::string
- DSP_PROP_OTHERS //ro, prop_names_t
- };
-
- /*!
- * Possible device dboard properties
- */
- enum dboard_prop_t{
- DBOARD_PROP_NAME, //ro, std::string
- DBOARD_PROP_SUBDEV, //ro, wax::obj
- DBOARD_PROP_SUBDEV_NAMES, //ro, prop_names_t
- DBOARD_PROP_USED_SUBDEVS //ro, prop_names_t
- //DBOARD_PROP_CODEC //ro, wax::obj //----> not sure, dont have to deal with yet
- };
-
- /*! ------ not dealing with yet, commented out ------------
- * Possible device codec properties:
- * A codec is expected to have a rate and gain elements.
- * Other properties can be discovered through the others prop.
- */
- /*enum codec_prop_t{
- CODEC_PROP_NAME, //ro, std::string
- CODEC_PROP_OTHERS, //ro, prop_names_t
- CODEC_PROP_GAIN, //rw, gain_t
- CODEC_PROP_GAIN_RANGE, //ro, gain_range_t
- CODEC_PROP_GAIN_NAMES, //ro, prop_names_t
- //CODEC_PROP_CLOCK_RATE //ro, freq_t //----> not sure we care to know
- };*/
-
- /*!
- * Possible device subdev properties
- */
- enum subdev_prop_t{
- SUBDEV_PROP_NAME, //ro, std::string
- SUBDEV_PROP_OTHERS, //ro, prop_names_t
- SUBDEV_PROP_GAIN, //rw, gain_t
- SUBDEV_PROP_GAIN_RANGE, //ro, gain_range_t
- SUBDEV_PROP_GAIN_NAMES, //ro, prop_names_t
- SUBDEV_PROP_FREQ, //rw, freq_t
- SUBDEV_PROP_FREQ_RANGE, //ro, freq_range_t
- SUBDEV_PROP_ANTENNA, //rw, std::string
- SUBDEV_PROP_ANTENNA_NAMES, //ro, prop_names_t
- SUBDEV_PROP_ENABLED, //rw, bool
- SUBDEV_PROP_QUADRATURE, //ro, bool
- SUBDEV_PROP_IQ_SWAPPED, //ro, bool
- SUBDEV_PROP_SPECTRUM_INVERTED, //ro, bool
- SUBDEV_PROP_LO_INTERFERES //ro, bool
- //SUBDEV_PROP_RSSI, //ro, gain_t //----> not on all boards, use named prop
- //SUBDEV_PROP_BANDWIDTH //rw, freq_t //----> not on all boards, use named prop
- };
-
-} //namespace uhd
-
-#endif /* INCLUDED_UHD_PROPS_HPP */
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index b9be370bd..c00daaaf0 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -17,11 +17,26 @@
INSTALL(FILES
+ #### props headers ###
+ dboard_props.hpp
+ device_props.hpp
+ dsp_props.hpp
+ mboard_props.hpp
+ subdev_props.hpp
+
+ #### dboard headers ###
dboard_base.hpp
dboard_id.hpp
dboard_interface.hpp
dboard_manager.hpp
+
+ ### usrp headers ###
usrp_e.hpp
usrp2.hpp
+
+ ### utilities ###
+ tune_helper.hpp
+ simple_usrp.hpp
+
DESTINATION ${INCLUDE_DIR}/uhd/usrp
)
diff --git a/host/include/uhd/usrp/dboard_interface.hpp b/host/include/uhd/usrp/dboard_interface.hpp
index c779431ab..b3bab131d 100644
--- a/host/include/uhd/usrp/dboard_interface.hpp
+++ b/host/include/uhd/usrp/dboard_interface.hpp
@@ -38,32 +38,34 @@ public:
//tells the host which unit to use
enum unit_type_t{
- UNIT_TYPE_RX,
- UNIT_TYPE_TX
+ UNIT_TYPE_RX = 'r',
+ UNIT_TYPE_TX = 't'
};
//tells the host which device to use
enum spi_dev_t{
- SPI_TX_DEV,
- SPI_RX_DEV
+ SPI_DEV_RX = 'r',
+ SPI_DEV_TX = 't'
};
- //args for writing spi data
- enum spi_push_t{
- SPI_PUSH_RISE,
- SPI_PUSH_FALL
- };
-
- //args for reading spi data
- enum spi_latch_t{
- SPI_LATCH_RISE,
- SPI_LATCH_FALL
+ //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_TX_BANK,
- GPIO_RX_BANK
+ 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
@@ -87,17 +89,13 @@ public:
virtual int read_aux_adc(unit_type_t unit, int which_adc) = 0;
/*!
- * Set daughterboard ATR register.
- * The ATR register for a particular bank has 2 values:
- * one value when transmitting, one when receiving.
- * The mask controls which pins are controlled by ATR.
+ * Set a daughterboard ATR register.
*
- * \param bank GPIO_TX_BANK or GPIO_RX_BANK
- * \param tx_value 16-bits, 0=FPGA output low, 1=FPGA output high
- * \param rx_value 16-bits, 0=FPGA output low, 1=FPGA output high
- * \param mask 16-bits, 0=software, 1=atr
+ * \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, boost::uint16_t tx_value, boost::uint16_t rx_value, boost::uint16_t mask) = 0;
+ virtual void set_atr_reg(gpio_bank_t bank, atr_reg_t reg, boost::uint16_t value) = 0;
/*!
* Set daughterboard GPIO data direction register.
@@ -108,14 +106,6 @@ public:
virtual void set_gpio_ddr(gpio_bank_t bank, boost::uint16_t value) = 0;
/*!
- * Set daughterboard GPIO pin values.
- *
- * \param bank GPIO_TX_BANK or GPIO_RX_BANK
- * \param value 16 bits, 0=low, 1=high
- */
- virtual void write_gpio(gpio_bank_t bank, boost::uint16_t value) = 0;
-
- /*!
* Read daughterboard GPIO pin values
*
* \param bank GPIO_TX_BANK or GPIO_RX_BANK
@@ -142,32 +132,31 @@ public:
* \brief Write data to SPI bus peripheral.
*
* \param dev which spi device
- * \param push args for writing
+ * \param edge args for format
* \param buf the data to write
*/
- void write_spi(spi_dev_t dev, spi_push_t push, const byte_vector_t &buf);
+ 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 latch args for reading
+ * \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_latch_t latch, size_t num_bytes);
+ 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 latch args for reading
- * \param push args for clock
+ * \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_latch_t latch, spi_push_t push, const byte_vector_t &buf);
+ 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.
@@ -186,16 +175,14 @@ private:
* \brief Read and write data to SPI bus peripheral.
*
* \param dev which spi device
- * \param latch args for reading
- * \param push args for clock
+ * \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_latch_t latch,
- spi_push_t push,
+ spi_edge_t edge,
const byte_vector_t &buf,
bool readback
) = 0;
diff --git a/host/include/uhd/usrp/dboard_manager.hpp b/host/include/uhd/usrp/dboard_manager.hpp
index c7c091220..ed8ee73ef 100644
--- a/host/include/uhd/usrp/dboard_manager.hpp
+++ b/host/include/uhd/usrp/dboard_manager.hpp
@@ -19,7 +19,7 @@
#define INCLUDED_UHD_USRP_DBOARD_MANAGER_HPP
#include <uhd/config.hpp>
-#include <uhd/props.hpp>
+#include <uhd/utils/props.hpp>
#include <uhd/usrp/dboard_base.hpp>
#include <uhd/usrp/dboard_id.hpp>
#include <boost/utility.hpp>
diff --git a/host/include/uhd/usrp/dboard_props.hpp b/host/include/uhd/usrp/dboard_props.hpp
new file mode 100644
index 000000000..3b290319f
--- /dev/null
+++ b/host/include/uhd/usrp/dboard_props.hpp
@@ -0,0 +1,38 @@
+//
+// 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_PROPS_HPP
+#define INCLUDED_UHD_USRP_DBOARD_PROPS_HPP
+
+#include <uhd/utils/props.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Possible device dboard properties
+ */
+ enum dboard_prop_t{
+ DBOARD_PROP_NAME = 'n', //ro, std::string
+ DBOARD_PROP_SUBDEV = 's', //ro, wax::obj
+ DBOARD_PROP_SUBDEV_NAMES = 'S', //ro, prop_names_t
+ DBOARD_PROP_USED_SUBDEVS = 'u' //ro, prop_names_t
+ //DBOARD_PROP_CODEC //ro, wax::obj //----> not sure, dont have to deal with yet
+ };
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_DBOARD_PROPS_HPP */
diff --git a/host/include/uhd/usrp/device_props.hpp b/host/include/uhd/usrp/device_props.hpp
new file mode 100644
index 000000000..b8f6f5cd4
--- /dev/null
+++ b/host/include/uhd/usrp/device_props.hpp
@@ -0,0 +1,57 @@
+//
+// 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_DEVICE_PROPS_HPP
+#define INCLUDED_UHD_USRP_DEVICE_PROPS_HPP
+
+#include <uhd/utils/props.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Possible device properties:
+ * In general, a device will have a single mboard.
+ * In certain mimo applications, multiple boards
+ * will be present in the interface for configuration.
+ */
+ enum device_prop_t{
+ DEVICE_PROP_NAME = 'n', //ro, std::string
+ DEVICE_PROP_MBOARD = 'm', //ro, wax::obj
+ DEVICE_PROP_MBOARD_NAMES = 'M', //ro, prop_names_t
+ DEVICE_PROP_MAX_RX_SAMPLES = 'r', //ro, size_t
+ DEVICE_PROP_MAX_TX_SAMPLES = 't' //ro, size_t
+ };
+
+ ////////////////////////////////////////////////////////////////////////
+ /*! ------ not dealing with yet, commented out ------------
+ * Possible device codec properties:
+ * A codec is expected to have a rate and gain elements.
+ * Other properties can be discovered through the others prop.
+ */
+ /*enum codec_prop_t{
+ CODEC_PROP_NAME, //ro, std::string
+ CODEC_PROP_OTHERS, //ro, prop_names_t
+ CODEC_PROP_GAIN, //rw, gain_t
+ CODEC_PROP_GAIN_RANGE, //ro, gain_range_t
+ CODEC_PROP_GAIN_NAMES, //ro, prop_names_t
+ //CODEC_PROP_CLOCK_RATE //ro, freq_t //----> not sure we care to know
+ };*/
+
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_DEVICE_PROPS_HPP */
diff --git a/host/include/uhd/usrp/dsp_props.hpp b/host/include/uhd/usrp/dsp_props.hpp
new file mode 100644
index 000000000..60c0df942
--- /dev/null
+++ b/host/include/uhd/usrp/dsp_props.hpp
@@ -0,0 +1,40 @@
+//
+// 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_DSP_PROPS_HPP
+#define INCLUDED_UHD_USRP_DSP_PROPS_HPP
+
+#include <uhd/utils/props.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Possible device dsp properties:
+ * A dsp can have a wide range of possible properties.
+ * A ddc would have a properties "decim", "freq", "taps"...
+ * Other properties could be gains, complex scalars, enables...
+ * For this reason the only required properties of a dsp is a name
+ * and a property to get list of other possible properties.
+ */
+ enum dsp_prop_t{
+ DSP_PROP_NAME = 'n', //ro, std::string
+ DSP_PROP_OTHERS = 'o' //ro, prop_names_t
+ };
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_DSP_PROPS_HPP */
diff --git a/host/include/uhd/usrp/mboard_props.hpp b/host/include/uhd/usrp/mboard_props.hpp
new file mode 100644
index 000000000..cfc1f412e
--- /dev/null
+++ b/host/include/uhd/usrp/mboard_props.hpp
@@ -0,0 +1,50 @@
+//
+// 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_MBOARD_PROPS_HPP
+#define INCLUDED_UHD_USRP_MBOARD_PROPS_HPP
+
+#include <uhd/utils/props.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Possible device mboard properties:
+ * The general mboard properties are listed below.
+ * Custom properties can be identified with a string
+ * and discovered though the others property.
+ */
+ 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
+ MBOARD_PROP_TX_DSP_NAMES = 'U', //ro, prop_names_t
+ MBOARD_PROP_RX_DBOARD = 'e', //ro, wax::obj
+ MBOARD_PROP_RX_DBOARD_NAMES = 'E', //ro, prop_names_t
+ MBOARD_PROP_TX_DBOARD = 'v', //ro, wax::obj
+ MBOARD_PROP_TX_DBOARD_NAMES = 'V', //ro, prop_names_t
+ MBOARD_PROP_CLOCK_CONFIG = 'C', //rw, clock_config_t
+ MBOARD_PROP_TIME_NOW = 't', //wo, time_spec_t
+ MBOARD_PROP_TIME_NEXT_PPS = 'T' //wo, time_spec_t
+ };
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_MBOARD_PROPS_HPP */
diff --git a/host/include/uhd/simple_device.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index 52928367a..2d6ad2a0f 100644
--- a/host/include/uhd/simple_device.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -15,29 +15,30 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#ifndef INCLUDED_UHD_SIMPLE_DEVICE_HPP
-#define INCLUDED_UHD_SIMPLE_DEVICE_HPP
+#ifndef INCLUDED_UHD_USRP_SIMPLE_USRP_HPP
+#define INCLUDED_UHD_USRP_SIMPLE_USRP_HPP
#include <uhd/config.hpp>
#include <uhd/device.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/stream_cmd.hpp>
+#include <uhd/types/clock_config.hpp>
#include <uhd/types/tune_result.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <vector>
-namespace uhd{
+namespace uhd{ namespace usrp{
/*!
- * The simple UHD device class:
- * A simple device facilitates ease-of-use for most use-case scenarios.
+ * The simple USRP device class:
+ * A simple usrp facilitates ease-of-use for most use-case scenarios.
* The wrapper provides convenience functions to tune the devices
* as well as to set the dboard gains, antennas, and other properties.
*/
-class UHD_API simple_device : boost::noncopyable{
+class UHD_API simple_usrp : boost::noncopyable{
public:
- typedef boost::shared_ptr<simple_device> sptr;
+ typedef boost::shared_ptr<simple_usrp> sptr;
static sptr make(const std::string &args);
virtual device::sptr get_device(void) = 0;
@@ -45,15 +46,13 @@ public:
virtual std::string get_name(void) = 0;
/*******************************************************************
- * Timing
+ * Misc
******************************************************************/
virtual void set_time_now(const time_spec_t &time_spec) = 0;
virtual void set_time_next_pps(const time_spec_t &time_spec) = 0;
-
- /*******************************************************************
- * Streaming
- ******************************************************************/
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
@@ -92,6 +91,6 @@ public:
virtual std::vector<std::string> get_tx_antennas(void) = 0;
};
-} //namespace uhd
+}}
-#endif /* INCLUDED_UHD_SIMPLE_DEVICE_HPP */
+#endif /* INCLUDED_UHD_USRP_SIMPLE_USRP_HPP */
diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp
new file mode 100644
index 000000000..92d18340b
--- /dev/null
+++ b/host/include/uhd/usrp/subdev_props.hpp
@@ -0,0 +1,49 @@
+//
+// 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_SUBDEV_PROPS_HPP
+#define INCLUDED_UHD_USRP_SUBDEV_PROPS_HPP
+
+#include <uhd/utils/props.hpp>
+
+namespace uhd{ namespace usrp{
+
+ /*!
+ * Possible device subdev properties
+ */
+ enum subdev_prop_t{
+ SUBDEV_PROP_NAME = 'n', //ro, std::string
+ SUBDEV_PROP_OTHERS = 'o', //ro, prop_names_t
+ SUBDEV_PROP_GAIN = 'g', //rw, float
+ SUBDEV_PROP_GAIN_RANGE = 'r', //ro, gain_range_t
+ SUBDEV_PROP_GAIN_NAMES = 'G', //ro, prop_names_t
+ SUBDEV_PROP_FREQ = 'f', //rw, double
+ 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_QUADRATURE = 'q', //ro, bool
+ SUBDEV_PROP_IQ_SWAPPED = 'i', //ro, bool
+ SUBDEV_PROP_SPECTRUM_INVERTED = 's', //ro, bool
+ SUBDEV_PROP_LO_INTERFERES = 'l' //ro, bool
+ //SUBDEV_PROP_RSSI, //ro, float //----> not on all boards, use named prop
+ //SUBDEV_PROP_BANDWIDTH //rw, double //----> not on all boards, use named prop
+ };
+
+}} //namespace
+
+#endif /* INCLUDED_UHD_USRP_SUBDEV_PROPS_HPP */
diff --git a/host/include/uhd/utils/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp
index 958d1eceb..f1e276d4f 100644
--- a/host/include/uhd/utils/tune_helper.hpp
+++ b/host/include/uhd/usrp/tune_helper.hpp
@@ -15,14 +15,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#ifndef INCLUDED_UHD_UTILS_TUNE_HELPER_HPP
-#define INCLUDED_UHD_UTILS_TUNE_HELPER_HPP
+#ifndef INCLUDED_UHD_USRP_TUNE_HELPER_HPP
+#define INCLUDED_UHD_USRP_TUNE_HELPER_HPP
#include <uhd/config.hpp>
#include <uhd/wax.hpp>
#include <uhd/types/tune_result.hpp>
-namespace uhd{
+namespace uhd{ namespace usrp{
/*!
* Tune a rx chain to the desired frequency:
@@ -74,6 +74,6 @@ UHD_API tune_result_t tune_tx_subdev_and_duc(
wax::obj subdev, wax::obj duc, double target_freq
);
-} //namespace uhd
+}}
-#endif /* INCLUDED_UHD_UTILS_TUNE_HELPER_HPP */
+#endif /* INCLUDED_UHD_USRP_TUNE_HELPER_HPP */
diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt
index 1b673f44a..2831ab0b0 100644
--- a/host/include/uhd/utils/CMakeLists.txt
+++ b/host/include/uhd/utils/CMakeLists.txt
@@ -19,8 +19,8 @@ INSTALL(FILES
algorithm.hpp
assert.hpp
gain_handler.hpp
+ props.hpp
safe_main.hpp
static.hpp
- tune_helper.hpp
DESTINATION ${INCLUDE_DIR}/uhd/utils
)
diff --git a/host/include/uhd/utils/props.hpp b/host/include/uhd/utils/props.hpp
new file mode 100644
index 000000000..6be0b2ce5
--- /dev/null
+++ b/host/include/uhd/utils/props.hpp
@@ -0,0 +1,48 @@
+//
+// 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_UTILS_PROPS_HPP
+#define INCLUDED_UHD_UTILS_PROPS_HPP
+
+#include <uhd/config.hpp>
+#include <uhd/wax.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <vector>
+#include <string>
+
+namespace uhd{
+
+ //typedef for handling named properties
+ typedef std::vector<std::string> prop_names_t;
+ typedef boost::tuple<wax::obj, std::string> named_prop_t;
+
+ /*!
+ * Utility function to separate a named property into its components.
+ * \param key a reference to the prop object
+ * \param name a reference to the name object
+ */
+ inline UHD_API named_prop_t //must be exported as part of the api to work (TODO move guts to cpp file)
+ extract_named_prop(const wax::obj &key, const std::string &name = ""){
+ if (key.type() == typeid(named_prop_t)){
+ return key.as<named_prop_t>();
+ }
+ return named_prop_t(key, name);
+ }
+
+} //namespace uhd
+
+#endif /* INCLUDED_UHD_UTILS_PROPS_HPP */