diff options
Diffstat (limited to 'host/include')
| -rw-r--r-- | host/include/uhd/config.hpp | 9 | ||||
| -rw-r--r-- | host/include/uhd/transport/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | host/include/uhd/transport/chdr.hpp | 113 | ||||
| -rw-r--r-- | host/include/uhd/transport/nirio/nirio_driver_iface.h | 4 | ||||
| -rw-r--r-- | host/include/uhd/transport/usb_device_handle.hpp | 3 | ||||
| -rw-r--r-- | host/include/uhd/transport/vrt_if_packet.hpp | 74 | ||||
| -rw-r--r-- | host/include/uhd/types/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | host/include/uhd/types/direction.hpp | 34 | ||||
| -rw-r--r-- | host/include/uhd/types/sid.hpp | 238 | ||||
| -rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 5 | ||||
| -rw-r--r-- | host/include/uhd/utils/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | host/include/uhd/utils/images.hpp | 53 | ||||
| -rw-r--r-- | host/include/uhd/utils/math.hpp | 12 | ||||
| -rw-r--r-- | host/include/uhd/utils/paths.hpp | 25 | 
14 files changed, 516 insertions, 61 deletions
| diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index 619bd0787..173845fea 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.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 @@ -56,6 +56,13 @@ typedef ptrdiff_t ssize_t;      #define UHD_DEPRECATED     __declspec(deprecated)      #define UHD_ALIGNED(x)     __declspec(align(x))      #define UHD_UNUSED(x)      x +#elif defined(__MINGW32__) +    #define UHD_EXPORT         __declspec(dllexport) +    #define UHD_IMPORT         __declspec(dllimport) +    #define UHD_INLINE         inline +    #define UHD_DEPRECATED     __declspec(deprecated) +    #define UHD_ALIGNED(x)     __declspec(align(x)) +    #define UHD_UNUSED(x)      x  #elif defined(__GNUG__) && __GNUG__ >= 4      #define UHD_EXPORT         __attribute__((visibility("default")))      #define UHD_IMPORT         __attribute__((visibility("default"))) diff --git a/host/include/uhd/transport/CMakeLists.txt b/host/include/uhd/transport/CMakeLists.txt index 2118674c6..623c179e9 100644 --- a/host/include/uhd/transport/CMakeLists.txt +++ b/host/include/uhd/transport/CMakeLists.txt @@ -1,5 +1,5 @@  # -# Copyright 2010-2013 Ettus Research LLC +# Copyright 2010-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,11 +15,11 @@  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  # -  UHD_INSTALL(FILES      bounded_buffer.hpp      bounded_buffer.ipp      buffer_pool.hpp +    chdr.hpp      if_addrs.hpp      udp_constants.hpp      udp_simple.hpp diff --git a/host/include/uhd/transport/chdr.hpp b/host/include/uhd/transport/chdr.hpp new file mode 100644 index 000000000..5e8cd58a9 --- /dev/null +++ b/host/include/uhd/transport/chdr.hpp @@ -0,0 +1,113 @@ +// +// 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_TRANSPORT_CHDR_HPP +#define INCLUDED_UHD_TRANSPORT_CHDR_HPP + +#include <uhd/transport/vrt_if_packet.hpp> + +namespace uhd{ namespace transport{ namespace vrt{ + +/*! \brief CVITA/CHDR related function + * + * See \ref rtp_chdr for details on the CVITA/CHDR protocol. + * + * All packers take the host format into account. Choose the _le functions + * if the transport uses little endian format (e.g. PCIe) and the _be + * functions if the transport uses big endian format (e.g. Ethernet). + * + * Note 1: All packers assume there to be enough space at the address + * provided by \p packet_buff. See also \ref vrt_pack_contract. + * + * Note 2: All these packers assume the following options without checking them: + * - `if_packet_info.link_type == LINK_TYPE_CHDR` + * - `if_packet_info.has_cid == false` + * - `if_packet_info.has_sid == true` + * - `if_packet_info.has_tsi == false` + * - `if_packet_info.has_tlr == false` + * This relaxes some of \ref vrt_pack_contract, but adds the additional + * constraint that the input data must be CHDR. + * + * In the unpacker, these values will be set accordingly. + */ +namespace chdr{ + +    //! The maximum number of 64-bit words in a CVITA header +    static const size_t max_if_hdr_words64 = 2; // CHDR + tsf (fractional timestamp) + +    /*! +     * Pack a CHDR header from metadata (big endian format). +     * +     * See \ref vrt_pack_contract, but `link_type` is assumed to be +     * `LINK_TYPE_CHDR`. +     * +     * \param packet_buff memory to write the packed vrt header +     * \param if_packet_info the if packet info (read/write) +     */ +    UHD_API void if_hdr_pack_be( +        boost::uint32_t *packet_buff, +        if_packet_info_t &if_packet_info +    ); + +    /*! +     * Unpack a CHDR header to metadata (big endian format). +     * +     * See \ref vrt_unpack_contract, but `link_type` is assumed to be +     * `LINK_TYPE_CHDR`. +     * +     * \param packet_buff memory to read the packed vrt header +     * \param if_packet_info the if packet info (read/write) +     */ +    UHD_API void if_hdr_unpack_be( +        const boost::uint32_t *packet_buff, +        if_packet_info_t &if_packet_info +    ); + +    /*! +     * Pack a CHDR header from metadata (little endian format). +     * +     * See \ref vrt_pack_contract, but `link_type` is assumed to be +     * `LINK_TYPE_CHDR`. +     * +     * \param packet_buff memory to write the packed vrt header +     * \param if_packet_info the if packet info (read/write) +     */ +    UHD_API void if_hdr_pack_le( +        boost::uint32_t *packet_buff, +        if_packet_info_t &if_packet_info +    ); + +    /*! +     * Unpack a CHDR header to metadata (little endian format). +     * +     * See \ref vrt_unpack_contract, but `link_type` is assumed to be +     * `LINK_TYPE_CHDR`. +     * +     * \param packet_buff memory to read the packed vrt header +     * \param if_packet_info the if packet info (read/write) +     */ +    UHD_API void if_hdr_unpack_le( +        const boost::uint32_t *packet_buff, +        if_packet_info_t &if_packet_info +    ); + +} //namespace chdr + +}}} //namespace uhd::transport::vrt + +#endif /* INCLUDED_UHD_TRANSPORT_CHDR_HPP */ + diff --git a/host/include/uhd/transport/nirio/nirio_driver_iface.h b/host/include/uhd/transport/nirio/nirio_driver_iface.h index 83afd816a..3e0e56a7f 100644 --- a/host/include/uhd/transport/nirio/nirio_driver_iface.h +++ b/host/include/uhd/transport/nirio/nirio_driver_iface.h @@ -24,9 +24,9 @@  #include <uhd/transport/nirio/status.h>  #include <uhd/config.hpp>  #if defined(UHD_PLATFORM_WIN32) -    #include <Windows.h> +    #include <windows.h>      #pragma warning(disable:4201)  // nonstandard extension used : nameless struct/union -        #include <WinIoCtl.h> +        #include <winioctl.h>      #pragma warning(default:4201)  #elif !defined(UHD_PLATFORM_LINUX)      #include <IOKit/IOKitLib.h> diff --git a/host/include/uhd/transport/usb_device_handle.hpp b/host/include/uhd/transport/usb_device_handle.hpp index fdea9e2be..bf122f549 100644 --- a/host/include/uhd/transport/usb_device_handle.hpp +++ b/host/include/uhd/transport/usb_device_handle.hpp @@ -41,6 +41,7 @@ namespace uhd { namespace transport {  class UHD_API usb_device_handle : boost::noncopyable {  public:      typedef boost::shared_ptr<usb_device_handle> sptr; +    typedef std::pair<boost::uint16_t, boost::uint16_t> vid_pid_pair_t;      /*!       * Return the device's serial number @@ -83,6 +84,8 @@ public:       * \return a vector of USB device handles that match vid and pid       */      static std::vector<usb_device_handle::sptr> get_device_list(boost::uint16_t vid, boost::uint16_t pid); +    static std::vector<usb_device_handle::sptr> get_device_list(const std::vector<usb_device_handle::vid_pid_pair_t>& vid_pid_pair_list); +  }; //namespace usb diff --git a/host/include/uhd/transport/vrt_if_packet.hpp b/host/include/uhd/transport/vrt_if_packet.hpp index d16892281..8bc65cdf1 100644 --- a/host/include/uhd/transport/vrt_if_packet.hpp +++ b/host/include/uhd/transport/vrt_if_packet.hpp @@ -1,5 +1,5 @@  // -// Copyright 2010-2013 Ettus Research LLC +// Copyright 2010-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 @@ -52,9 +52,18 @@ namespace vrt{          //packet type          enum packet_type_t          { +            // VRT language:              PACKET_TYPE_DATA      = 0x0,              PACKET_TYPE_IF_EXT    = 0x1,              PACKET_TYPE_CONTEXT   = 0x2, //extension context: has_sid = true + +            // CVITA language: +            //PACKET_TYPE_DATA      = 0x0, // Data +            PACKET_TYPE_FC        = 0x1, // Flow control +            PACKET_TYPE_ACK       = 0x1, // Flow control (ack) +            PACKET_TYPE_CMD       = 0x2, // Command +            PACKET_TYPE_RESP      = 0x3, // Command response +            PACKET_TYPE_ERROR     = 0x3, // Command response: Error (the EOB bit is raised in this case)          } packet_type;          //size fields @@ -65,18 +74,46 @@ namespace vrt{          //header fields          size_t packet_count; +        //! Asserted for start- or end-of-burst          bool sob, eob; +        //! This is asserted for command responses that are errors (CHDR only) +        bool error;          //optional fields +        //! Stream ID (SID). See uhd::sid_t          bool has_sid; boost::uint32_t sid; +        //! Class ID.          bool has_cid; boost::uint64_t cid; +        //! Integer timestamp          bool has_tsi; boost::uint32_t tsi; +        //! Fractional timestamp          bool has_tsf; boost::uint64_t tsf; +        //! Trailer          bool has_tlr; boost::uint32_t tlr;      };      /*!       * Pack a vrt header from metadata (big endian format). +     * +     * \section vrt_pack_contract Packing contract +     * +     * \subsection Requirements: +     * - packet_buff points to a valid address space with enough space to write +     *   the entire buffer, regardless of its length. At the very least, it must +     *   be able to hold an entire header. +     * - `if_packet_info` has the following members set to correct values: +     *   - `has_*` members all set accordingly +     *   - For every true `has_*` member, the corresponding variable holds a valid +     *     value (e.g. if `has_sid` is true, `sid` contains a valid SID) +     *   - `num_payload_bytes` and `num_payload_words32` are both set to the correct values +     * +     * \subsection Result: +     * - `packet_buff` now points to a valid header that can be sent over the transport +     *   without further modification +     * - The following members on `if_packet_info` are set: +     *   - `num_header_words32` +     *   - `num_packet_words32` +     *       * \param packet_buff memory to write the packed vrt header       * \param if_packet_info the if packet info (read/write)       */ @@ -87,6 +124,34 @@ namespace vrt{      /*!       * Unpack a vrt header to metadata (big endian format). +     * +     * \section vrt_unpack_contract Unpacking contract +     * +     * \subsection Requirements +     * - `packet_buff` points to a readable address space with a +     *   CHDR packet, starting at the header. `packet_buff[0]` *must* always +     *   point to a valid first word of the header. This implies that num_packet_words32 +     *   must be at least 1. +     * - `if_packet_info` has the following members set to correct values: +     *   - `num_packet_words32`. This means all values `packet_buff[0]` +     *     through `packet_buff[if_packet_info.num_packet_words32-1]` are +     *     readable words from this packet. +     *   - `link_type` +     * +     * \subsection Result +     * - `if_packet_info` now has the following values set to correct values: +     *   - `packet_type` +     *   - `num_payload_bytes` +     *   - `num_payload_words32` +     *   - `num_header_words32` +     *   - `has_*` +     *   - `sob`, `eob`, `error`, `cid`, `sid` (if applicable) +     *   - `tsf`, `tsi` (if applicable) +     * +     * \subsection Exceptions +     * - If the header is invalid, but the requirements are still met, +     *   will throw a uhd::value_error. +     *       * \param packet_buff memory to read the packed vrt header       * \param if_packet_info the if packet info (read/write)       */ @@ -97,6 +162,9 @@ namespace vrt{      /*!       * Pack a vrt header from metadata (little endian format). +     * +     * See \ref vrt_pack_contract. +     *       * \param packet_buff memory to write the packed vrt header       * \param if_packet_info the if packet info (read/write)       */ @@ -107,6 +175,9 @@ namespace vrt{      /*!       * Unpack a vrt header to metadata (little endian format). +     * +     * See \ref vrt_unpack_contract. +     *       * \param packet_buff memory to read the packed vrt header       * \param if_packet_info the if packet info (read/write)       */ @@ -124,6 +195,7 @@ namespace vrt{          num_packet_words32(0),          packet_count(0),          sob(false), eob(false), +        error(false),          has_sid(false), sid(0),          has_cid(false), cid(0),          has_tsi(false), tsi(0), diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt index 334f1b41b..444ff71ae 100644 --- a/host/include/uhd/types/CMakeLists.txt +++ b/host/include/uhd/types/CMakeLists.txt @@ -21,6 +21,7 @@ UHD_INSTALL(FILES      device_addr.hpp      dict.ipp      dict.hpp +    direction.hpp      io_type.hpp      mac_addr.hpp      metadata.hpp @@ -29,6 +30,7 @@ UHD_INSTALL(FILES      ref_vector.hpp      sensors.hpp      serial.hpp +    sid.hpp      stream_cmd.hpp      time_spec.hpp      tune_request.hpp diff --git a/host/include/uhd/types/direction.hpp b/host/include/uhd/types/direction.hpp new file mode 100644 index 000000000..62fbde3f0 --- /dev/null +++ b/host/include/uhd/types/direction.hpp @@ -0,0 +1,34 @@ +// +// 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_TYPES_DIRECTION_HPP +#define INCLUDED_UHD_TYPES_DIRECTION_HPP + +namespace uhd { + +    enum direction_t { +        //! Receive +        RX_DIRECTION, +        //! Transmit +        TX_DIRECTION, +        //! Duplex +        DX_DIRECTION +    }; + +} //namespace uhd + +#endif /* INCLUDED_UHD_TYPES_DIRECTION_HPP */ diff --git a/host/include/uhd/types/sid.hpp b/host/include/uhd/types/sid.hpp new file mode 100644 index 000000000..95034c7a5 --- /dev/null +++ b/host/include/uhd/types/sid.hpp @@ -0,0 +1,238 @@ +// +// 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_TYPES_SID_HPP +#define INCLUDED_UHD_TYPES_SID_HPP + +#include <uhd/config.hpp> +#include <boost/cstdint.hpp> +#include <boost/shared_ptr.hpp> +#include <iostream> + +namespace uhd { +    /*! +     * \brief Represents a stream ID (SID). +     * +     * A stream ID (SID) is an identifier for data. +     * It is a 32-Bit value which consistst of 16 Bits +     * for the source address and 16 Bits for the destination +     * address. +     * Every address is split into two parts: The _address_, which +     * identifies the device used, and the _endpoint_, which identifies +     * a specific object inside the given device (e.g., a block). +     * *Note:* In the case where there are several crossbars on a single +     * device, each crossbar gets its own address. +     * Both address and endpoint are 8 bits in length. If a 16-bit address +     * is required, we use the combination of the 8-bit address and the 8-bit +     * endpoint. +     * +     * \section sid_str_repr String Representation +     * +     * The string representation of a SID is of the form +     * +     *     2.3>0.6 +     * +     * The '>' symbol shows the direction, so in this case, +     * data is flowing from address 2.3 to 0.6. +     * +     * As a convention, ':' is used instead of '.' when giving the +     * SID in hexadecimal numbers, and two characters are used for each +     * address part. As an example, the following two SIDs are identical: +     * +     *     2.3>0.16 (decimal) +     *     02:03>00:10 (hexadecimal) +     * +     * The format is: +     *     SRC_ADDRESS.SRC_ENDPOINT>DST_ADDRESS.DST_ENDPOINT +     * +     * +     * \section sid_block_ports Block Ports +     * +     * In the special case where a block on a crossbar is addressed, the +     * endpoint is further split up into two parts of four bits each: The +     * first four bits specify the port number on the crossbar, whereas the +     * lower four bits represent the *block port*. As an example, consider +     * the following SID, given in hexadecimal: +     * +     *    00:10>02:A1 +     * +     * In this example, assume data is flowing from the host computer to an +     * X300. The crossbar address is 02. The endpoint is A1, which means we +     * are accessing a block on crossbar port A (the tenth port), and are addressing +     * block port 1. +     * +     */ +    class UHD_API sid_t +    { +    public: +        //! Create an unset SID +        sid_t(); +        //! Create a sid_t object from a 32-Bit SID value +        sid_t(boost::uint32_t sid); +        //! Create a sid_t object from its four components +        sid_t(boost::uint8_t src_addr, boost::uint8_t src_ep, boost::uint8_t dst_addr, boost::uint8_t dst_ep); +        //! Convert a string representation of a SID into its numerical representation +        sid_t(const std::string &); + +        //! Return a decimal string representation of the SID. +        std::string to_pp_string() const; +        //! Return a hexadecimal string representation of the SID. +        std::string to_pp_string_hex() const; + +        //! Returns true if this actually holds a valid SID +        bool is_set() const { return _set; }; + +        // Getters +        // +        //! Alias for get_sid() +        UHD_INLINE boost::uint32_t get() const { return get_sid(); }; +        //! Returns a 32-Bit representation of the SID if set, or zero otherwise. +        UHD_INLINE boost::uint32_t get_sid() const { return _set ? _sid : 0; }; +        //! Return the 16-bit source address of this SID +        UHD_INLINE boost::uint32_t get_src() const { +            return (_sid >> 16) & 0xFFFF; +        } +        //! Return the 16-bit destination address of this SID +        UHD_INLINE boost::uint32_t get_dst() const { +            return _sid & 0xFFFF; +        } +        //! Return 8-bit address of the source +        UHD_INLINE boost::uint32_t get_src_addr() const { +            return (get_src() >> 8) & 0xFF; +        } +        //! Return endpoint of the source +        UHD_INLINE boost::uint32_t get_src_endpoint() const { +            return get_src() & 0xFF; +        } +        //! Return crossbar port of the source +        UHD_INLINE boost::uint32_t get_src_xbarport() const { +            return (get_src_endpoint() >> 4) & 0xF; +        } +        //! Return block port of the source +        UHD_INLINE boost::uint32_t get_src_blockport() const { +            return (get_src_endpoint()) & 0xF; +        } +        //! Return 8-bit address of the destination +        UHD_INLINE boost::uint32_t get_dst_addr() const { +            return (get_dst() >> 8) & 0xFF; +        } +        //! Return endpoint of the destination +        UHD_INLINE boost::uint32_t get_dst_endpoint() const { +            return get_dst() & 0xFF; +        } +        //! Return crossbar port of the source +        UHD_INLINE boost::uint32_t get_dst_xbarport() const { +            return (get_dst_endpoint() >> 4) & 0xF; +        } +        //! Return block port of the source +        UHD_INLINE boost::uint32_t get_dst_blockport() const { +            return (get_dst_endpoint()) & 0xF; +        } + +        // Setters + +        //! Alias for set_sid() +        void set(boost::uint32_t new_sid) { set_sid(new_sid); }; +        //! Convert a string representation of a SID into a numerical one +        // Throws uhd::value_error if the string is not a valid SID +        // representation. +        void set_from_str(const std::string &); +        void set_sid(boost::uint32_t new_sid); +        //! Set the source address of this SID +        //  (the first 16 Bits) +        void set_src(boost::uint32_t new_addr); +        //! Set the destination address of this SID +        //  (the last 16 Bits) +        void set_dst(boost::uint32_t new_addr); +        void set_src_addr(boost::uint32_t new_addr); +        void set_src_endpoint(boost::uint32_t new_addr); +        void set_dst_addr(boost::uint32_t new_addr); +        void set_dst_endpoint(boost::uint32_t new_addr); +        void set_dst_xbarport(boost::uint32_t new_xbarport); +        void set_dst_blockport(boost::uint32_t new_blockport); + +        // Manipulators + +        //! Swaps dst and src address and returns the new SID. +        sid_t reversed(); + +        //! Swaps dst and src in-place. +        void reverse(); + +        // Overloaded operators + +        sid_t operator = (boost::uint32_t new_sid) { +            set_sid(new_sid); +            return *this; +        } + +        sid_t operator = (sid_t &sid) { +            set_sid(sid.get_sid()); +            return *this; +        } + +        sid_t operator = (const std::string &sid_str) { +            set_from_str(sid_str); +            return *this; +        } + +        bool operator == (const sid_t &sid) const { +            return (not _set and not sid.is_set()) or (_sid == sid.get_sid()); +        } + +        bool operator == (boost::uint32_t sid) const { +            return _set and _sid == sid; +        } + +        bool operator == (const std::string &sid_str) const { +            sid_t rhs(sid_str); +            return *this == rhs; +        } + +        // overloaded type casts are tricky, but for now we'll need them +        // for backward compatibility. consider them deprecated. + +        //! If the SID is not set, always returns zero. +        //  Use is_set() to check if the return value is valid. +        operator boost::uint32_t() const { +            return get(); +        } + +        operator bool() const { +            return _set; +        } + +    private: +        boost::uint32_t _sid; +        bool _set; +    }; + +    //! Stream output operator. Honors std::ios::hex. +    UHD_INLINE std::ostream& operator<< (std::ostream& out, const sid_t &sid) { +        std::ios_base::fmtflags ff = out.flags(); +        if (ff & std::ios::hex) { +            out << sid.to_pp_string_hex(); +        } else { +            out << sid.to_pp_string(); +        } +        return out; +    } + +} //namespace uhd + +#endif /* INCLUDED_UHD_TYPES_SID_HPP */ +// vim: sw=4 et: diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 6fd22ff23..2362ebcd7 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -155,6 +155,11 @@ public:       * If the specified rate is not available, this method will throw.       * On other devices, this method notifies the software of the rate,       * but requires the the user has made the necessary hardware change. +     * +     * If the device has an 'auto clock rate' setting (e.g. B200, see also +     * \ref b200_auto_mcr), this will get disabled and the clock rate will be +     * fixed to \p rate. +     *       * \param rate the new master clock rate in Hz       * \param mboard the motherboard index 0 to M-1       */ 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/math.hpp b/host/include/uhd/utils/math.hpp index 21825c3dc..275a94f72 100644 --- a/host/include/uhd/utils/math.hpp +++ b/host/include/uhd/utils/math.hpp @@ -18,11 +18,11 @@  #ifndef INCLUDED_UHD_UTILS_MATH_HPP  #define INCLUDED_UHD_UTILS_MATH_HPP +#include <cmath>  #include <uhd/config.hpp>  #include <boost/cstdint.hpp>  #include <boost/numeric/conversion/bounds.hpp> -  namespace uhd {  /*! @@ -237,6 +237,16 @@ namespace fp_compare {                  == fp_compare::fp_compare_delta<double>(rhs, FREQ_COMPARISON_DELTA_HZ));      } +    //! Portable log2() +    template <typename float_t> UHD_INLINE +    float_t log2(float_t x) +    { +        // C++11 defines std::log2(), when that's universally supported +        // we can switch over. +        return std::log(x) / std::log(float_t(2)); +    } + +  } // namespace math  } // namespace uhd diff --git a/host/include/uhd/utils/paths.hpp b/host/include/uhd/utils/paths.hpp index e0f455e92..c1f32ba61 100644 --- a/host/include/uhd/utils/paths.hpp +++ b/host/include/uhd/utils/paths.hpp @@ -32,6 +32,31 @@ namespace uhd{      //! Get a string representing the system's pkg directory      UHD_API std::string get_pkg_path(void); +    /*! +     * 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 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 */ | 
