aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2014-07-17 11:50:50 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2014-07-23 07:37:32 -0700
commita6e18604befdb6a954542f7722c8d55424065621 (patch)
tree22168e6f4c41c931e38ccd07ff8881b56c8cd88a /host/include
parent7423d1691fff3af08f8e42e3e09d8c8d9ec99fe8 (diff)
downloaduhd-a6e18604befdb6a954542f7722c8d55424065621.tar.gz
uhd-a6e18604befdb6a954542f7722c8d55424065621.tar.bz2
uhd-a6e18604befdb6a954542f7722c8d55424065621.zip
OctoClock firmware upgrade, added host driver
* OctoClock can communicate with UHD over Ethernet * Can read NMEA strings from GPSDO and send to host * Added multi_usrp_clock class for clock devices * uhd::device can now filter to return only USRP devices or clock devices * New OctoClock bootloader can accept firmware download over Ethernet * Added octoclock_burn_eeprom,octoclock_firmware_burner utilities * Added test_clock_synch example to show clock API
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/CMakeLists.txt6
-rw-r--r--host/include/uhd/device.hpp32
-rw-r--r--host/include/uhd/usrp_clock/CMakeLists.txt23
-rw-r--r--host/include/uhd/usrp_clock/multi_usrp_clock.hpp105
-rw-r--r--host/include/uhd/usrp_clock/octoclock_eeprom.hpp61
5 files changed, 215 insertions, 12 deletions
diff --git a/host/include/uhd/CMakeLists.txt b/host/include/uhd/CMakeLists.txt
index 2827cb826..318577b7c 100644
--- a/host/include/uhd/CMakeLists.txt
+++ b/host/include/uhd/CMakeLists.txt
@@ -1,5 +1,5 @@
-
-# Copyright 2010-2011,2013 Ettus Research LLC
+#
+# Copyright 2010-2011,2013-2014 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
@@ -15,10 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-
ADD_SUBDIRECTORY(transport)
ADD_SUBDIRECTORY(types)
ADD_SUBDIRECTORY(usrp)
+ADD_SUBDIRECTORY(usrp_clock)
ADD_SUBDIRECTORY(utils)
UHD_INSTALL(FILES
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index b54ffc5f7..5b4a2fe07 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -1,5 +1,5 @@
//
-// Copyright 2010-2011 Ettus Research LLC
+// Copyright 2010-2011,2014 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
@@ -32,8 +32,8 @@ namespace uhd{
class property_tree; //forward declaration
/*!
- * The usrp device interface represents the usrp hardware.
- * The api allows for discovery, configuration, and streaming.
+ * The device interface represents the hardware.
+ * The API allows for discovery, configuration, and streaming.
*/
class UHD_API device : boost::noncopyable{
@@ -42,6 +42,13 @@ public:
typedef boost::function<device_addrs_t(const device_addr_t &)> find_t;
typedef boost::function<sptr(const device_addr_t &)> make_t;
+ //! Device type, used as a filter in make
+ enum device_filter_t {
+ ANY,
+ USRP,
+ CLOCK
+ };
+
/*!
* Register a device into the discovery and factory system.
*
@@ -50,32 +57,35 @@ public:
*/
static void register_device(
const find_t &find,
- const make_t &make
+ const make_t &make,
+ const device_filter_t filter
);
/*!
- * \brief Find usrp devices attached to the host.
+ * \brief Find devices attached to the host.
*
* The hint device address should be used to narrow down the search
* to particular transport types and/or transport arguments.
*
* \param hint a partially (or fully) filled in device address
- * \return a vector of device addresses for all usrps on the system
+ * \param filter an optional filter to exclude USRP or clock devices
+ * \return a vector of device addresses for all devices on the system
*/
- static device_addrs_t find(const device_addr_t &hint);
+ static device_addrs_t find(const device_addr_t &hint, device_filter_t filter = ANY);
/*!
- * \brief Create a new usrp device from the device address hint.
+ * \brief Create a new device from the device address hint.
*
* The make routine will call find and pick one of the results.
* By default, the first result will be used to create a new device.
* Use the which parameter as an index into the list of results.
*
* \param hint a partially (or fully) filled in device address
+ * \param filter an optional filter to exclude USRP or clock devices
* \param which which address to use when multiple are found
* \return a shared pointer to a new device instance
*/
- static sptr make(const device_addr_t &hint, size_t which = 0);
+ static sptr make(const device_addr_t &hint, device_filter_t filter = ANY, size_t which = 0);
/*! \brief Make a new receive streamer from the streamer arguments
*
@@ -94,10 +104,14 @@ public:
//! Get access to the underlying property structure
uhd::property_tree::sptr get_tree(void) const;
+ //! Get device type
+ device_filter_t get_device_type() const;
+
#include <uhd/device_deprecated.ipp>
protected:
uhd::property_tree::sptr _tree;
+ device_filter_t _type;
};
} //namespace uhd
diff --git a/host/include/uhd/usrp_clock/CMakeLists.txt b/host/include/uhd/usrp_clock/CMakeLists.txt
new file mode 100644
index 000000000..7cd5aa9d3
--- /dev/null
+++ b/host/include/uhd/usrp_clock/CMakeLists.txt
@@ -0,0 +1,23 @@
+#
+# Copyright 2014 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/>.
+#
+
+UHD_INSTALL(FILES
+ octoclock_eeprom.hpp
+ multi_usrp_clock.hpp
+ DESTINATION ${INCLUDE_DIR}/uhd/octoclock
+ COMPONENT headers
+)
diff --git a/host/include/uhd/usrp_clock/multi_usrp_clock.hpp b/host/include/uhd/usrp_clock/multi_usrp_clock.hpp
new file mode 100644
index 000000000..0b50b32ae
--- /dev/null
+++ b/host/include/uhd/usrp_clock/multi_usrp_clock.hpp
@@ -0,0 +1,105 @@
+//
+// Copyright 2014 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_MULTI_USRP_CLOCK_HPP
+#define INCLUDED_UHD_MULTI_USRP_CLOCK_HPP
+
+#include <string>
+#include <vector>
+
+#include <uhd/config.hpp>
+#include <uhd/device.hpp>
+#include <uhd/types/device_addr.hpp>
+#include <uhd/types/sensors.hpp>
+
+namespace uhd{ namespace usrp_clock{
+
+/*!
+ * The Multi-USRP-Clock device class:
+ *
+ * This class facilitates ease-of-use for must use-case scenarios when
+ * using clock devices with UHD. This class can be used with a
+ * single clock device or with multiple clock devices connected to the same
+ * host.
+ *
+ * To create a multi_usrp_clock out of a single USRP Clock:
+ *
+ * <pre>
+ * device_addr_t dev;
+ * dev["addr"] = 192.168.10.3;
+ * multi_usrp_clock::sptr clock = multi_usrp_clock::make(dev);
+ * </pre>
+ *
+ * To create a multi_usrp_clock out of multiple clock devices:
+ *
+ * <pre>
+ * device_addr_t dev;
+ * dev["addr0"] = 192.168.10.3;
+ * dev["addr1"] = 192.168.10.4;
+ * multi_usrp_clock::sptr clock = multi_usrp_clock::make(dev);
+ * </pre>
+ */
+class UHD_API multi_usrp_clock : boost::noncopyable {
+public:
+ typedef boost::shared_ptr<multi_usrp_clock> sptr;
+
+ /*!
+ * Make a new Multi-USRP-Clock from the given device address.
+ * \param dev_addr the device address
+ * \return a new Multi-USRP-Clock object
+ */
+ static sptr make(const device_addr_t &dev_addr);
+
+ /*!
+ * Return the underlying device.
+ * This allows direct access to the EEPROM and sensors.
+ * \return the device object within this Multi-USRP-Clock
+ */
+ virtual device::sptr get_device(void) = 0;
+
+ /*!
+ * Get a printable summary for this USRP Clock configuration.
+ * \return a printable string
+ */
+ virtual std::string get_pp_string(void) = 0;
+
+ //! Get the number of USRP Clocks in this configuration.
+ virtual size_t get_num_boards(void) = 0;
+
+ //! Get time from device
+ virtual boost::uint32_t get_time(size_t board = 0) = 0;
+
+ /*!
+ * Get a USRP Clock sensor value.
+ * \param name the name of the sensor
+ * \param board the board index (0 to M-1)
+ * \return a sensor value object
+ */
+ virtual sensor_value_t get_sensor(const std::string &name, size_t board = 0) = 0;
+
+ /*!
+ * Get a list of possible USRP Clock sensor names.
+ * \param board the board index (0 to M-1)
+ * \return a vector of sensor names
+ */
+ virtual std::vector<std::string> get_sensor_names(size_t board = 0) = 0;
+};
+
+} //namespace
+} //namespace
+
+#endif /* INCLUDED_UHD_MULTI_USRP_CLOCK_HPP */
diff --git a/host/include/uhd/usrp_clock/octoclock_eeprom.hpp b/host/include/uhd/usrp_clock/octoclock_eeprom.hpp
new file mode 100644
index 000000000..a521000dd
--- /dev/null
+++ b/host/include/uhd/usrp_clock/octoclock_eeprom.hpp
@@ -0,0 +1,61 @@
+//
+// Copyright 2014 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_CLOCK_OCTOCLOCK_EEPROM_HPP
+#define INCLUDED_UHD_USRP_CLOCK_OCTOCLOCK_EEPROM_HPP
+
+#include <uhd/config.hpp>
+#include <uhd/transport/udp_simple.hpp>
+#include <uhd/types/dict.hpp>
+#include <string>
+
+namespace uhd{ namespace usrp_clock{
+
+/*!
+ * The OctoClock EEPROM object:
+ * Knows how to read and write the OctoClock EEPROM.
+ * The class inherits from a string, string dictionary.
+ * Use the dictionary interface to get and set values.
+ * Commit to the EEPROM to save changed settings.
+ */
+class UHD_API octoclock_eeprom_t : public uhd::dict<std::string, std::string>{
+public:
+ //! Make a new empty OctoClock EEPROM handler
+ octoclock_eeprom_t(void);
+
+ /*!
+ * Make a new OctoClock EEPROM handler.
+ * \param transport the UDP transport to the OctoClock
+ */
+ octoclock_eeprom_t(transport::udp_simple::sptr transport);
+
+ /*!
+ * Write the contents of this object to the EEPROM.
+ */
+ void commit() const;
+
+private:
+ transport::udp_simple::sptr xport;
+ void _load();
+ void _store() const;
+
+};
+
+} //namespace
+} //namespace
+
+#endif /* INCLUDED_UHD_USRP_CLOCK_OCTOCLOCK_EEPROM_HPP */