aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2015-01-27 16:07:43 -0800
committerBen Hilburn <ben.hilburn@ettus.com>2015-01-27 16:07:43 -0800
commit75d519706b9b0956307a6a4bdc53c36376f19f03 (patch)
treeb2d2144c31c3ea04167ef7e3d1b14f7477c158cf /host/include
parent8d0d0d01c0a2a5ed1a01da4360226a64ab8117bc (diff)
downloaduhd-75d519706b9b0956307a6a4bdc53c36376f19f03.tar.gz
uhd-75d519706b9b0956307a6a4bdc53c36376f19f03.tar.bz2
uhd-75d519706b9b0956307a6a4bdc53c36376f19f03.zip
Merging new UHD_IMAGES_DIR utilities and bug fixes.
Also includes NI-USRP Windows Registry Key fixes.
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/config.hpp12
-rw-r--r--host/include/uhd/transport/nirio/nifpga_lvbitx.h2
-rw-r--r--host/include/uhd/utils/CMakeLists.txt1
-rw-r--r--host/include/uhd/utils/images.hpp53
-rw-r--r--host/include/uhd/utils/paths.hpp58
5 files changed, 70 insertions, 56 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 619bd0787..7ecc4924a 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -92,4 +92,16 @@ typedef ptrdiff_t ssize_t;
#define UHD_PLATFORM_BSD
#endif
+// Define 'stringize' preprocessor macros. The stringize macro, XSTR, takes
+// variable arguments so that it can deal with strings that contain commas.
+// There are two different versions because MSVC handles this syntax a bit
+// differently than other compilers.
+#if defined(BOOST_MSVC)
+ #define XSTR(x,...) #x
+#else
+ #define XSTR(x...) #x
+#endif
+
+#define STR(x) XSTR(x)
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/transport/nirio/nifpga_lvbitx.h b/host/include/uhd/transport/nirio/nifpga_lvbitx.h
index 598f7fcbe..f037ffd47 100644
--- a/host/include/uhd/transport/nirio/nifpga_lvbitx.h
+++ b/host/include/uhd/transport/nirio/nifpga_lvbitx.h
@@ -51,8 +51,8 @@ public:
protected:
std::string _get_bitstream_checksum(const std::string& file_path);
- std::string _get_fpga_images_dir(const std::string search_paths);
};
+
}}
#endif /* INCLUDED_UHD_TRANSPORT_NIRIO_NIFPGA_LVBITX_H */
diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt
index c308c9cde..05f6892d2 100644
--- a/host/include/uhd/utils/CMakeLists.txt
+++ b/host/include/uhd/utils/CMakeLists.txt
@@ -25,7 +25,6 @@ UHD_INSTALL(FILES
cast.hpp
csv.hpp
gain_group.hpp
- images.hpp
log.hpp
math.hpp
msg.hpp
diff --git a/host/include/uhd/utils/images.hpp b/host/include/uhd/utils/images.hpp
deleted file mode 100644
index a0934fb08..000000000
--- a/host/include/uhd/utils/images.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Copyright 2010,2012 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_IMAGES_HPP
-#define INCLUDED_UHD_UTILS_IMAGES_HPP
-
-#include <uhd/config.hpp>
-#include <string>
-
-namespace uhd{
-
- /*!
- * Search for an image in the system image paths:
- * Search compiled-in paths and environment variable paths
- * for a specific image file with the provided file name.
- * \param image_name the name of the file
- * \return the full system path to the file
- * \throw exception if the image was not found
- */
- UHD_API std::string find_image_path(const std::string &image_name);
-
- /*!
- * Search for the location of the UHD Images Downloader script.
- * \return the full system path to uhd_images_downloader.py
- */
-
- UHD_API std::string find_images_downloader(void);
-
- /*!
- * Return the error string for recommending using the UHD Images Downloader.
- * String depends on OS.
- * \return the message suggesting the use of uhd_images_downloader.py
- */
-
- UHD_API std::string print_images_error(void);
-
-} //namespace uhd
-
-#endif /* INCLUDED_UHD_UTILS_IMAGES_HPP */
diff --git a/host/include/uhd/utils/paths.hpp b/host/include/uhd/utils/paths.hpp
index e0f455e92..8edb87546 100644
--- a/host/include/uhd/utils/paths.hpp
+++ b/host/include/uhd/utils/paths.hpp
@@ -19,9 +19,15 @@
#define INCLUDED_UHD_UTILS_PATHS_HPP
#include <uhd/config.hpp>
+
+#include <boost/filesystem.hpp>
+
#include <string>
+#include <vector>
-namespace uhd{
+namespace fs = boost::filesystem;
+
+namespace uhd {
//! Get a string representing the system's temporary directory
UHD_API std::string get_tmp_path(void);
@@ -32,6 +38,56 @@ namespace uhd{
//! Get a string representing the system's pkg directory
UHD_API std::string get_pkg_path(void);
+ //! Get UHD library paths
+ std::vector<fs::path> get_module_paths(void);
+
+ /*! Return the UHD images directory path.
+ *
+ * This function returns the UHD images installation path on this system. The
+ * returned directory path is guaranteed to exist (assuming a valid path is
+ * found). This function will look for a directory that exists using this
+ * order of precedence:
+ *
+ * 1) `UHD_IMAGES_DIR` environment variable
+ * 2) Any paths passed to this function via `search_paths'
+ * 3) UHD package path / share / uhd / images
+ *
+ * The `search_paths` parameter may contain Windows registry keys. If no
+ * directory is found, an empty string is returned.
+ *
+ * \param search_paths A comma-separated list of hints for paths to include.
+ * \returns A path string if one is found, or an empty string on failure.
+ */
+ UHD_API std::string get_images_dir(const std::string search_paths);
+
+ /*! Return the full path to particular UHD binary image.
+ *
+ * This function searches for the passed image name, and returns an absolute
+ * path to it. The returned path is guaranteed to exist. The caller can also
+ * provide a full path to the image in the argument, and this function will
+ * validate it and convert it to an absolute system path.
+ *
+ * \param image_name The name of the file to search for, or the full path.
+ * \param search_paths Hints / paths to use when calling `get_images_dir`
+ * \return the full system path to the file
+ * \throw exception uhd::io_error if the file was not found.
+ */
+ UHD_API std::string find_image_path(const std::string &image_name, const std::string search_paths = "");
+
+ /*!
+ * Search for the location of a particular UHD utility.
+ * The utility must be installed in the `uhd/utils` directory.
+ * \param the name of the utility to search for
+ * \return the full system path to @param
+ */
+ UHD_API std::string find_utility(std::string name);
+
+ /*!
+ * Return an error string recommending the user run the utility.
+ * The error string will include the full path to the utility to run.
+ * \return the message suggesting the use of the named utility.
+ */
+ UHD_API std::string print_utility_error(std::string name);
} //namespace uhd
#endif /* INCLUDED_UHD_UTILS_PATHS_HPP */