pax_global_header00006660000000000000000000000064137317551120014517gustar00rootroot0000000000000052 comment=d8aba947a01a530b1d9c2f4a07e4241bbd04d327 SoapyUHD-soapy-uhd-0.4.1/000077500000000000000000000000001373175511200150645ustar00rootroot00000000000000SoapyUHD-soapy-uhd-0.4.1/.gitignore000066400000000000000000000000071373175511200170510ustar00rootroot00000000000000/build SoapyUHD-soapy-uhd-0.4.1/.travis.yml000066400000000000000000000032151373175511200171760ustar00rootroot00000000000000######################################################################## ## Travis CI config for SoapyUHD ## ## * installs UHD from PPA ## * installs SoapySDR from source ## * matrix tests multiple UHD versions ## * confirms build and install ## * checks that drivers load ######################################################################## sudo: required dist: trusty language: cpp compiler: gcc env: global: - INSTALL_PREFIX=/usr/local - SOAPY_SDR_BRANCH=master matrix: - BUILD_TYPE=Debug - BUILD_TYPE=Release before_install: # regular ubuntu packages - sudo add-apt-repository main - sudo add-apt-repository universe # driver development files from ppa - sudo add-apt-repository -y ppa:myriadrf/drivers # update after package changes - sudo apt-get update install: #boost development files - sudo apt-get install -qq libboost-all-dev #sdr development files - sudo apt-get install --no-install-recommends -q -y libuhd-dev # install SoapySDR from source - git clone https://github.com/pothosware/SoapySDR.git - pushd SoapySDR - git checkout ${SOAPY_SDR_BRANCH} - mkdir build && cd build - cmake ../ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF - make && sudo make install - popd script: - mkdir build && cd build - cmake ../ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} - make && sudo make install # print info about the install - export LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH} - export PATH=${INSTALL_PREFIX}/bin:${PATH} - SoapySDRUtil --info - SoapySDRUtil --check=uhd SoapyUHD-soapy-uhd-0.4.1/CMakeLists.txt000066400000000000000000000171001373175511200176230ustar00rootroot00000000000000# Copyright 2012-2015 Free Software Foundation, Inc. # Copyright 2015-2016 Josh Blum # # This file is part of SoapyUHD support modules # # SoapyUHD 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, or (at your option) # any later version. # # SoapyUHD 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 GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. ######################################################################## # Project setup ######################################################################## cmake_minimum_required(VERSION 2.8.7) project(SoapyUHD CXX C) enable_testing() #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") message(STATUS "Build type not specified: defaulting to release.") endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") ######################################################################## # Dependencies ######################################################################## find_package(SoapySDR "0.4" NO_MODULE REQUIRED) find_package(UHD NO_MODULE) #try old-style find script if (NOT UHD_FOUND) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) find_package(UHD) endif() if (NOT UHD_FOUND) message(WARNING "UHD not found -- required for Soapy UHD support") return() endif() if (NOT UHD_ROOT) get_filename_component(UHD_ROOT "${UHD_INCLUDE_DIRS}/.." ABSOLUTE) endif() message(STATUS "UHD root directory: ${UHD_ROOT}") message(STATUS "UHD include directories: ${UHD_INCLUDE_DIRS}") message(STATUS "UHD libraries: ${UHD_LIBRARIES}") include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${SoapySDR_INCLUDE_DIRS}) include_directories(${UHD_INCLUDE_DIRS}) message(STATUS "Checking uhd::device::register_device() API...") message(STATUS " Reading ${UHD_INCLUDE_DIRS}/uhd/device.hpp...") file(READ ${UHD_INCLUDE_DIRS}/uhd/device.hpp device_hpp) string(FIND "${device_hpp}" "device_filter_t" has_device_filter) if ("${has_device_filter}" STREQUAL "-1") message(STATUS " has original API") else() add_definitions(-DUHD_HAS_DEVICE_FILTER) message(STATUS " has filter API") endif() message(STATUS "Checking uhd::usrp::multi_usrp::set_rx_agc() API...") message(STATUS " Reading ${UHD_INCLUDE_DIRS}/uhd/usrp/multi_usrp.hpp...") file(READ ${UHD_INCLUDE_DIRS}/uhd/usrp/multi_usrp.hpp multi_usrp_hpp) string(FIND "${multi_usrp_hpp}" "set_rx_agc" has_set_rx_agc) if ("${has_set_rx_agc}" STREQUAL "-1") message(STATUS " missing set_rx_agc() API") else() add_definitions(-DUHD_HAS_SET_RX_AGC) message(STATUS " has set_rx_agc() API") endif() message(STATUS "Checking uhd::property::set_publisher() API...") message(STATUS " Reading ${UHD_INCLUDE_DIRS}/uhd/property_tree.hpp...") file(READ ${UHD_INCLUDE_DIRS}/uhd/property_tree.hpp property_tree_hpp) string(FIND "${property_tree_hpp}" "set_publisher" has_set_publisher) if ("${has_set_publisher}" STREQUAL "-1") message(STATUS " missing set_publisher() API") else() add_definitions(-DUHD_HAS_SET_PUBLISHER) message(STATUS " has set_publisher() API") endif() if (EXISTS "${UHD_INCLUDE_DIRS}/uhd/utils/msg.hpp") add_definitions(-DUHD_HAS_MSG_HPP) message(STATUS " use msg.hpp for logging") else() message(STATUS " use log.hpp for logging") endif() ######################################################################## # Setup boost ######################################################################## MESSAGE(STATUS "Configuring Boost C++ Libraries...") # Although not required on my system, some users have linking issues without SET(BOOST_REQUIRED_COMPONENTS thread system ) if(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix endif(UNIX AND NOT BOOST_ROOT AND EXISTS "/usr/lib64") set(Boost_ADDITIONAL_VERSIONS "1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39" "1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44" "1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49" "1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54" "1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59" "1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64" "1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69" ) find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) if(NOT Boost_FOUND) message(WARNING "Boost required to build -- ignoring uhd support") return() endif() ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) message(STATUS "Boost include directories: ${Boost_INCLUDE_DIRS}") message(STATUS "Boost library directories: ${Boost_LIBRARY_DIRS}") message(STATUS "Boost libraries: ${Boost_LIBRARIES}") ######################################################################## # Build a Soapy module to support UHD devices ######################################################################## SOAPY_SDR_MODULE_UTIL( TARGET uhdSupport SOURCES SoapyUHDDevice.cpp LIBRARIES ${UHD_LIBRARIES} ${Boost_LIBRARIES} ) ######################################################################## # Build a UHD module to support Soapy devices ######################################################################## add_library(soapySupport MODULE UHDSoapyDevice.cpp) target_link_libraries(soapySupport ${UHD_LIBRARIES} ${SoapySDR_LIBRARIES} ${Boost_LIBRARIES}) install(TARGETS soapySupport DESTINATION ${UHD_ROOT}/lib${LIB_SUFFIX}/uhd/modules ) #using C++11 features for this uhd module set_target_properties(soapySupport PROPERTIES CXX_STANDARD 11) ######################################################################## # rpath setup - http://www.cmake.org/Wiki/CMake_RPATH_handling ######################################################################## # use, i.e. don't skip the full RPATH for the build tree option(CMAKE_SKIP_BUILD_RPATH "skip rpath build" FALSE) # when building, don't use the install RPATH already # (but later on when installing) option(CMAKE_BUILD_WITH_INSTALL_RPATH "build with install rpath" FALSE) # the RPATH to be used when installing, but only if it's not a system directory option(CMAKE_AUTOSET_INSTALL_RPATH TRUE) if(CMAKE_AUTOSET_INSTALL_RPATH) LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}") ENDIF("${isSystemDir}" STREQUAL "-1") endif(CMAKE_AUTOSET_INSTALL_RPATH) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "build with automatic rpath" TRUE) if(APPLE) set(CMAKE_MACOSX_RPATH ON) endif() ######################################################################## # Print Summary ######################################################################## MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}") SoapyUHD-soapy-uhd-0.4.1/COPYING000066400000000000000000001045131373175511200161230ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . SoapyUHD-soapy-uhd-0.4.1/Changelog.txt000066400000000000000000000053531373175511200175220ustar00rootroot00000000000000Release 0.4.1 (2020-09-20) ========================== - Fix for UHD_VERSION define and 4.0 release compilation Release 0.4.0 (2020-09-17) ========================== - Support for compilation with UHD 4.0 release Release 0.3.6 (2019-06-22) ========================== - Support tuning on boards without a CORDIC in the DSP by registering a dummy second tuning element Release 0.3.5 (2018-12-07) ========================== - Create fake channels if the number of TX and RX channels are not equal to fix segmentation faults in UHD based tools Release 0.3.4 (2017-12-14) ========================== - Optional check for dsp freq range in property tree - Tx de/activateStream() return 0 for NOP, not an error - Support timestamp for deactivateStream() stream command - Conditional support for new logging API (replaces msg.hpp) - Tx stream activation hooks based on start and end of burst Release 0.3.3 (2017-04-29) ========================== - Results for frequency component with no tune result - Fix arg for set_rx_subdev_spec() in UHDSoapyDevice - Support getBandwidthRange()/getSampleRateRange() - UHDSoapyDevice supports zero length buffer send() - Implement timestamp interpolation for uhd rx streams - Added label convention to soapy uhd discovery routine - Support for optional gain range step in type conversions Release 0.3.2 (2017-01-22) ========================== - Added tx/rx_subdev device argument for uhd device - Added corrections hooks for soapy devices in uhd - Symlinks to workaround uhd 3.10 multi-arch bug - Minor corrections for license and copyright text - Update debian files for SoapySDR module ABI format Release 0.3.1 (2016-08-13) ========================== - support setHardwareTime("CMD"), deprecated setCommandTime() - support changes to property tree API (backwards compatible) - support property tree API changes for uhd v3.10.0 Release 0.3.0 (2015-11-20) ========================== - SoapyUHDDevice - implement getSensorInfo() for SoapySDR v0.4 - SoapyUHDDevice - implement getStreamArgsInfo() for SoapySDR v0.4 - SoapyUHDDevice - implement getNativeStreamFormat() for SoapySDR v0.4 - SoapyUHDDevice - implement getStreamFormats() for SoapySDR v0.4 - UHDSoapyDevice - use getSensorInfo() for sensors Release 0.2.0 (2015-10-10) ========================== - Hooks for 'has' DC offset mode, DC offset, and IQ balance - Switched to using per-channel and global sensors API - Added GPIO access support for Soapy UHD and vice-versa Release 0.1.2 (2015-09-13) ========================== - Fix metaRangeToNumericList for single element entries Release 0.1.1 (2015-08-15) ========================== - Modifications for ubuntu 12.04 w/ cmake 2.8.7 Release 0.1.0 (2015-06-15) ========================== - Initial release of Soapy UHD support module SoapyUHD-soapy-uhd-0.4.1/FindUHD.cmake000066400000000000000000000013421373175511200173070ustar00rootroot00000000000000######################################################################## # Find the library for the USRP Hardware Driver ######################################################################## INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_UHD uhd) FIND_PATH( UHD_INCLUDE_DIRS NAMES uhd/config.hpp HINTS $ENV{UHD_DIR}/include ${PC_UHD_INCLUDEDIR} PATHS /usr/local/include /usr/include ) FIND_LIBRARY( UHD_LIBRARIES NAMES uhd HINTS $ENV{UHD_DIR}/lib ${PC_UHD_LIBDIR} PATHS /usr/local/lib /usr/lib ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) SoapyUHD-soapy-uhd-0.4.1/README.md000066400000000000000000000007661373175511200163540ustar00rootroot00000000000000# Soapy SDR plugins for UHD devices ## Build Status - Travis: [![Travis Build Status](https://travis-ci.org/pothosware/SoapyUHD.svg?branch=master)](https://travis-ci.org/pothosware/SoapyUHD) ## Dependencies * UHD - https://github.com/EttusResearch/uhd/wiki * SoapySDR - https://github.com/pothosware/SoapySDR/wiki * boost libraries - http://www.boost.org/ ## Documentation * https://github.com/pothosware/SoapyUHD/wiki ## Licensing information * GPLv3: http://www.gnu.org/licenses/gpl-3.0.html SoapyUHD-soapy-uhd-0.4.1/SoapyUHDDevice.cpp000066400000000000000000001224261373175511200203530ustar00rootroot00000000000000// Copyright (c) 2014-2017 Josh Blum // 2019 Nicholas Corgan // SPDX-License-Identifier: GPL-3.0 /*********************************************************************** * A Soapy module that supports UHD devices within the Soapy API. **********************************************************************/ #include "TypeHelpers.hpp" #include #include #include #include #include #ifdef UHD_HAS_MSG_HPP #include #else #include #endif #include #include #include #include /*********************************************************************** * Stream wrapper **********************************************************************/ struct SoapyUHDStream { uhd::rx_streamer::sptr rx; uhd::tx_streamer::sptr tx; }; /*********************************************************************** * Device interface **********************************************************************/ class SoapyUHDDevice : public SoapySDR::Device { public: SoapyUHDDevice(uhd::usrp::multi_usrp::sptr dev, const SoapySDR::Kwargs &args): _dev(dev), _type(args.at("type")), _isNetworkDevice(args.count("addr") != 0) { if (args.count("rx_subdev") != 0) _dev->set_rx_subdev_spec(args.at("rx_subdev")); if (args.count("tx_subdev") != 0) _dev->set_tx_subdev_spec(args.at("tx_subdev")); } /******************************************************************* * Identification API ******************************************************************/ std::string getDriverKey(void) const { return _type; } std::string getHardwareKey(void) const { return _dev->get_mboard_name(); } SoapySDR::Kwargs getHardwareInfo(void) const { SoapySDR::Kwargs out; for (size_t i = 0; i < this->getNumChannels(SOAPY_SDR_TX); i++) { const uhd::dict info = _dev->get_usrp_tx_info(i); for (const std::string &key : info.keys()) { if (key.size() > 3 and key.substr(0, 3) == "tx_") out[str(boost::format("tx%d_%s") % i % key.substr(3))] = info[key]; else out[key] = info[key]; } } for (size_t i = 0; i < this->getNumChannels(SOAPY_SDR_RX); i++) { const uhd::dict info = _dev->get_usrp_rx_info(i); for (const std::string &key : info.keys()) { if (key.size() > 3 and key.substr(0, 3) == "rx_") out[str(boost::format("rx%d_%s") % i % key.substr(3))] = info[key]; else out[key] = info[key]; } } uhd::property_tree::sptr tree = _dev->get_device()->get_tree(); if (tree->exists("/mboards/0/fw_version")) out["fw_version"] = tree->access("/mboards/0/fw_version").get(); if (tree->exists("/mboards/0/fpga_version")) out["fpga_version"] = tree->access("/mboards/0/fpga_version").get(); return out; } /******************************************************************* * Channels support ******************************************************************/ void setFrontendMapping(const int dir, const std::string &mapping) { if (dir == SOAPY_SDR_TX) return _dev->set_tx_subdev_spec(mapping); if (dir == SOAPY_SDR_RX) return _dev->set_rx_subdev_spec(mapping); } std::string getFrontendMapping(const int dir) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_subdev_spec().to_string(); if (dir == SOAPY_SDR_RX) return _dev->get_rx_subdev_spec().to_string(); return SoapySDR::Device::getFrontendMapping(dir); } size_t getNumChannels(const int dir) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_num_channels(); if (dir == SOAPY_SDR_RX) return _dev->get_rx_num_channels(); return SoapySDR::Device::getNumChannels(dir); } /******************************************************************* * Stream support ******************************************************************/ std::vector getStreamFormats(const int, const size_t) const { std::vector formats; formats.push_back("CS8"); formats.push_back("CS12"); formats.push_back("CS16"); formats.push_back("CF32"); formats.push_back("CF64"); return formats; } std::string getNativeStreamFormat(const int, const size_t, double &fullScale) const { fullScale = (1 << 15); return "CS16"; } SoapySDR::ArgInfoList getStreamArgsInfo(const int direction, const size_t) const { SoapySDR::ArgInfoList streamArgs; SoapySDR::ArgInfo sppArg; sppArg.key = "spp"; sppArg.value = "0"; sppArg.name = "Samples per packet"; sppArg.description = "The number of samples per packet."; sppArg.units = "samples"; sppArg.type = SoapySDR::ArgInfo::INT; streamArgs.push_back(sppArg); SoapySDR::ArgInfo wireFormatArg; wireFormatArg.key = "WIRE"; wireFormatArg.value = ""; wireFormatArg.name = "Bus format"; wireFormatArg.description = "The format of samples over the bus."; wireFormatArg.type = SoapySDR::ArgInfo::STRING; wireFormatArg.options.push_back("sc8"); wireFormatArg.options.push_back("sc16"); wireFormatArg.optionNames.push_back("Complex bytes"); wireFormatArg.optionNames.push_back("Complex shorts"); streamArgs.push_back(wireFormatArg); SoapySDR::ArgInfo peakArgs; peakArgs.key = "peak"; peakArgs.value = "1.0"; peakArgs.name = "Peak value"; peakArgs.description = "The peak value for scaling in complex byte mode."; peakArgs.type = SoapySDR::ArgInfo::FLOAT; streamArgs.push_back(peakArgs); const std::string key = (direction == SOAPY_SDR_RX)?"recv":"send"; const std::string name = (direction == SOAPY_SDR_RX)?"Receive":"Send"; SoapySDR::ArgInfo bufSizeArgs; bufSizeArgs.key = key+"_buff_size"; bufSizeArgs.value = "0"; bufSizeArgs.name = name + " socket buffer size"; bufSizeArgs.description = "The size of the kernel socket buffer in bytes. Use 0 for automatic."; bufSizeArgs.units = "bytes"; bufSizeArgs.type = SoapySDR::ArgInfo::INT; if (_isNetworkDevice) streamArgs.push_back(bufSizeArgs); SoapySDR::ArgInfo frameSizeArgs; frameSizeArgs.key = key+"_frame_size"; frameSizeArgs.value = ""; frameSizeArgs.name = name + " frame buffer size"; frameSizeArgs.description = "The size an individual datagram or frame in bytes."; frameSizeArgs.units = "bytes"; frameSizeArgs.type = SoapySDR::ArgInfo::INT; streamArgs.push_back(frameSizeArgs); SoapySDR::ArgInfo numFrameArgs; numFrameArgs.key = "num_"+key+"_frames"; numFrameArgs.value = ""; numFrameArgs.name = name + " number of buffers"; numFrameArgs.description = "The number of available buffers."; numFrameArgs.units = "buffers"; numFrameArgs.type = SoapySDR::ArgInfo::INT; streamArgs.push_back(numFrameArgs); return streamArgs; } SoapySDR::Stream *setupStream(const int dir, const std::string &format, const std::vector &channels, const SoapySDR::Kwargs &args) { std::string hostFormat; for(const char ch : format) { if (ch == 'C') hostFormat += "c"; else if (ch == 'F') hostFormat = "f" + hostFormat; else if (ch == 'S') hostFormat = "s" + hostFormat; else if (std::isdigit(ch)) hostFormat += ch; else throw std::runtime_error("SoapyUHDDevice::setupStream("+format+") unknown format"); } //convert input to stream args uhd::stream_args_t stream_args(hostFormat); stream_args.channels = channels; stream_args.args = kwargsToDict(args); if (args.count("WIRE") != 0) stream_args.otw_format = args.at("WIRE"); //create streamers SoapyUHDStream *stream = new SoapyUHDStream(); if (dir == SOAPY_SDR_TX) stream->tx = _dev->get_tx_stream(stream_args); if (dir == SOAPY_SDR_RX) stream->rx = _dev->get_rx_stream(stream_args); return reinterpret_cast(stream); } void closeStream(SoapySDR::Stream *handle) { SoapyUHDStream *stream = reinterpret_cast(handle); delete stream; } size_t getStreamMTU(SoapySDR::Stream *handle) const { SoapyUHDStream *stream = reinterpret_cast(handle); if (stream->rx) return stream->rx->get_max_num_samps(); if (stream->tx) return stream->tx->get_max_num_samps(); return SoapySDR::Device::getStreamMTU(handle); } int activateStream(SoapySDR::Stream *handle, const int flags, const long long timeNs, const size_t numElems) { SoapyUHDStream *stream = reinterpret_cast(handle); if (not stream->rx) return 0; //NOP, does nothing, but not an error //determine stream mode uhd::stream_cmd_t::stream_mode_t mode; if (numElems == 0) mode = uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS; else if ((flags & SOAPY_SDR_END_BURST) != 0) mode = uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE; else mode = uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE; //fill in the command uhd::stream_cmd_t cmd(mode); cmd.stream_now = (flags & SOAPY_SDR_HAS_TIME) == 0; cmd.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9); cmd.num_samps = numElems; //issue command stream->rx->issue_stream_cmd(cmd); return 0; } int deactivateStream(SoapySDR::Stream *handle, const int flags, const long long timeNs) { SoapyUHDStream *stream = reinterpret_cast(handle); if (not stream->rx) return 0; //NOP, does nothing, but not an error //stop the stream (stop mode might support a timestamp) uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); cmd.stream_now = (flags & SOAPY_SDR_HAS_TIME) == 0; cmd.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9); //issue command stream->rx->issue_stream_cmd(cmd); return 0; } int readStream(SoapySDR::Stream *handle, void * const *buffs, const size_t numElems, int &flags, long long &timeNs, const long timeoutUs) { uhd::rx_streamer::sptr &stream = reinterpret_cast(handle)->rx; //receive into buffers and metadata uhd::rx_metadata_t md; uhd::rx_streamer::buffs_type stream_buffs(buffs, stream->get_num_channels()); int ret = stream->recv(stream_buffs, numElems, md, timeoutUs/1e6, (flags & SOAPY_SDR_ONE_PACKET) != 0); //parse the metadata flags = 0; if (md.has_time_spec) flags |= SOAPY_SDR_HAS_TIME; if (md.end_of_burst) flags |= SOAPY_SDR_END_BURST; if (md.more_fragments) flags |= SOAPY_SDR_MORE_FRAGMENTS; timeNs = md.time_spec.to_ticks(1e9); switch (md.error_code) { case uhd::rx_metadata_t::ERROR_CODE_NONE: return ret; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: return SOAPY_SDR_OVERFLOW; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: return SOAPY_SDR_TIMEOUT; case uhd::rx_metadata_t::ERROR_CODE_BAD_PACKET: return SOAPY_SDR_CORRUPTION; case uhd::rx_metadata_t::ERROR_CODE_ALIGNMENT: return SOAPY_SDR_CORRUPTION; case uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND: return SOAPY_SDR_STREAM_ERROR; case uhd::rx_metadata_t::ERROR_CODE_BROKEN_CHAIN: return SOAPY_SDR_STREAM_ERROR; } return ret; } int writeStream(SoapySDR::Stream *handle, const void * const *buffs, const size_t numElems, int &flags, const long long timeNs, const long timeoutUs) { uhd::tx_streamer::sptr &stream = reinterpret_cast(handle)->tx; //load metadata uhd::tx_metadata_t md; md.has_time_spec = (flags & SOAPY_SDR_HAS_TIME) != 0; md.end_of_burst = (flags & SOAPY_SDR_END_BURST) != 0; md.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9); //send buffers and metadata uhd::tx_streamer::buffs_type stream_buffs(buffs, stream->get_num_channels()); int ret = stream->send(stream_buffs, numElems, md, timeoutUs/1e6); flags = 0; //consider a return of 0 to be a complete timeout if (ret == 0) return SOAPY_SDR_TIMEOUT; return ret; } int readStreamStatus(SoapySDR::Stream *handle, size_t &chanMask, int &flags, long long &timeNs, const long timeoutUs) { if (reinterpret_cast(handle)->rx) return SOAPY_SDR_NOT_SUPPORTED; uhd::tx_streamer::sptr &stream = reinterpret_cast(handle)->tx; uhd::async_metadata_t md; if (not stream->recv_async_msg(md, timeoutUs/1e6)) return SOAPY_SDR_TIMEOUT; chanMask = (1 << md.channel); flags = 0; if (md.has_time_spec) flags |= SOAPY_SDR_HAS_TIME; timeNs = md.time_spec.to_ticks(1e9); switch (md.event_code) { case uhd::async_metadata_t::EVENT_CODE_BURST_ACK: flags |= SOAPY_SDR_END_BURST; break; case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW: return SOAPY_SDR_UNDERFLOW; case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR: return SOAPY_SDR_CORRUPTION; case uhd::async_metadata_t::EVENT_CODE_TIME_ERROR: return SOAPY_SDR_TIME_ERROR; case uhd::async_metadata_t::EVENT_CODE_UNDERFLOW_IN_PACKET: return SOAPY_SDR_UNDERFLOW; case uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR_IN_BURST: return SOAPY_SDR_CORRUPTION; case uhd::async_metadata_t::EVENT_CODE_USER_PAYLOAD: break; } return 0; } /******************************************************************* * Antenna support ******************************************************************/ std::vector listAntennas(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_antennas(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_antennas(channel); return SoapySDR::Device::listAntennas(dir, channel); } void setAntenna(const int dir, const size_t channel, const std::string &name) { if (dir == SOAPY_SDR_TX) _dev->set_tx_antenna(name, channel); if (dir == SOAPY_SDR_RX) _dev->set_rx_antenna(name, channel); } std::string getAntenna(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_antenna(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_antenna(channel); return SoapySDR::Device::getAntenna(dir, channel); } /******************************************************************* * Frontend corrections support ******************************************************************/ bool hasDCOffsetMode(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return false; if (dir == SOAPY_SDR_RX) { // This is usually on the motherboard's layer, but for some devices // (ex. the B2XX), it is done on the RF frontend. return __doesMBoardFEPropTreeEntryExist(dir, channel, "dc_offset/enable") || __doesDBoardFEPropTreeEntryExist(dir, channel, "dc_offset/enable"); } return SoapySDR::Device::hasDCOffsetMode(dir, channel); } void setDCOffsetMode(const int dir, const size_t channel, const bool automatic) { if (dir == SOAPY_SDR_RX) _dev->set_rx_dc_offset(automatic, channel); } bool getDCOffsetMode(const int dir, const size_t channel) const { // multi_usrp has no getter for this, so we need to query the // property tree itself. if (dir == SOAPY_SDR_TX) return false; if((dir == SOAPY_SDR_RX) && this->hasDCOffsetMode(dir, channel)) { auto tree = _dev->get_device()->get_tree(); const std::string subpath = "/dc_offset/enable"; auto mboardPath = __getMBoardFEPropTreePath(dir, channel) + subpath; if(tree->exists(mboardPath)) { return tree->access(mboardPath).get(); } auto dboardPath = __getDBoardFEPropTreePath(dir, channel) + subpath; if(tree->exists(dboardPath)) { return tree->access(dboardPath).get(); } } return SoapySDR::Device::getDCOffsetMode(dir, channel); } bool hasDCOffset(const int dir, const size_t channel) const { return __doesMBoardFEPropTreeEntryExist(dir, channel, "dc_offset/value"); } void setDCOffset(const int dir, const size_t channel, const std::complex &offset) { if (dir == SOAPY_SDR_TX) _dev->set_tx_dc_offset(offset, channel); if (dir == SOAPY_SDR_RX) _dev->set_rx_dc_offset(offset, channel); } std::complex getDCOffset(const int dir, const size_t channel) const { // multi_usrp has no getter for this, so we need to query the // property tree itself. if(this->hasDCOffset(dir, channel)) { auto tree = _dev->get_device()->get_tree(); const std::string subpath = "/dc_offset/value"; auto path = __getMBoardFEPropTreePath(dir, channel) + subpath; return tree->access>(path).get(); } return SoapySDR::Device::getDCOffset(dir, channel); } bool hasIQBalance(const int dir, const size_t channel) const { return __doesMBoardFEPropTreeEntryExist(dir, channel, "iq_balance/value"); } void setIQBalance(const int dir, const size_t channel, const std::complex &balance) { if (dir == SOAPY_SDR_TX) _dev->set_tx_iq_balance(balance, channel); if (dir == SOAPY_SDR_RX) _dev->set_rx_iq_balance(balance, channel); } std::complex getIQBalance(const int dir, const size_t channel) const { // multi_usrp has no getter for this, so we need to query the // property tree itself. if(this->hasIQBalance(dir, channel)) { auto tree = _dev->get_device()->get_tree(); const std::string subpath = "/iq_balance/value"; auto path = __getMBoardFEPropTreePath(dir, channel) + subpath; return tree->access>(path).get(); } return SoapySDR::Device::getIQBalance(dir, channel); } bool hasIQBalanceMode(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return false; if (dir == SOAPY_SDR_RX) { return __doesMBoardFEPropTreeEntryExist(dir, channel, "iq_balance/enable"); } return SoapySDR::Device::hasDCOffsetMode(dir, channel); } void setIQBalanceMode(const int dir, const size_t channel, const bool automatic) { if (dir == SOAPY_SDR_RX) _dev->set_rx_iq_balance(automatic, channel); } bool getIQBalanceMode(const int dir, const size_t channel) const { // multi_usrp has no getter for this, so we need to query the // property tree itself. if (dir == SOAPY_SDR_TX) return false; if((dir == SOAPY_SDR_RX) && this->hasIQBalanceMode(dir, channel)) { auto tree = _dev->get_device()->get_tree(); const std::string subpath = "/iq_balance/enable"; auto path = __getMBoardFEPropTreePath(dir, channel) + subpath; return tree->access(path).get(); } return false; } /******************************************************************* * Gain support ******************************************************************/ std::vector listGains(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_gain_names(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_gain_names(channel); return SoapySDR::Device::listGains(dir, channel); } bool hasGainMode(const int dir, const size_t channel) const { #ifdef UHD_HAS_SET_RX_AGC if (dir == SOAPY_SDR_TX) return false; if (dir == SOAPY_SDR_RX) { return __doesDBoardFEPropTreeEntryExist(dir, channel, "gain/agc/enable"); } #endif return SoapySDR::Device::hasGainMode(dir, channel); } void setGainMode(const int dir, const size_t channel, const bool automatic) { #ifdef UHD_HAS_SET_RX_AGC if (dir == SOAPY_SDR_RX) return _dev->set_rx_agc(automatic, channel); #endif return SoapySDR::Device::setGainMode(dir, channel, automatic); } void setGain(const int dir, const size_t channel, const double value) { if (dir == SOAPY_SDR_TX) _dev->set_tx_gain(value, channel); if (dir == SOAPY_SDR_RX) _dev->set_rx_gain(value, channel); } void setGain(const int dir, const size_t channel, const std::string &name, const double value) { if (dir == SOAPY_SDR_TX) _dev->set_tx_gain(value, name, channel); if (dir == SOAPY_SDR_RX) _dev->set_rx_gain(value, name, channel); } double getGain(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_gain(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_gain(channel); return SoapySDR::Device::getGain(dir, channel); } double getGain(const int dir, const size_t channel, const std::string &name) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_gain(name, channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_gain(name, channel); return SoapySDR::Device::getGain(dir, channel, name); } SoapySDR::Range getGainRange(const int dir, const size_t channel, const std::string &name) const { if (dir == SOAPY_SDR_TX) return metaRangeToRange(_dev->get_tx_gain_range(name, channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRange(_dev->get_rx_gain_range(name, channel)); return SoapySDR::Device::getGainRange(dir, channel, name); } SoapySDR::Range getGainRange(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToRange(_dev->get_tx_gain_range(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRange(_dev->get_rx_gain_range(channel)); return SoapySDR::Device::getGainRange(dir, channel); } /******************************************************************* * Frequency support ******************************************************************/ void setFrequency(const int dir, const size_t channel, const double frequency, const SoapySDR::Kwargs &args) { uhd::tune_request_t tr(frequency); if (args.count("OFFSET") != 0) { tr = uhd::tune_request_t(frequency, boost::lexical_cast(args.at("OFFSET"))); } if (args.count("RF") != 0) { try { tr.rf_freq = boost::lexical_cast(args.at("RF")); tr.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL; } catch (...) { tr.rf_freq_policy = uhd::tune_request_t::POLICY_NONE; } } if (args.count("BB") != 0) { try { tr.dsp_freq = boost::lexical_cast(args.at("BB")); tr.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL; } catch (...) { tr.dsp_freq_policy = uhd::tune_request_t::POLICY_NONE; } } tr.args = kwargsToDict(args); if (dir == SOAPY_SDR_TX) _trCache[dir][channel] = _dev->set_tx_freq(tr, channel); if (dir == SOAPY_SDR_RX) _trCache[dir][channel] = _dev->set_rx_freq(tr, channel); } void setFrequency(const int dir, const size_t channel, const std::string &name, const double frequency, const SoapySDR::Kwargs &args) { //use tune request to get individual elements -- could use property tree here uhd::tune_request_t tr(frequency); tr.rf_freq_policy = uhd::tune_request_t::POLICY_NONE; tr.dsp_freq_policy = uhd::tune_request_t::POLICY_NONE; tr.args = kwargsToDict(args); if (name == "RF") { tr.rf_freq = frequency; tr.rf_freq_policy = uhd::tune_request_t::POLICY_MANUAL; } if (name == "BB") { tr.dsp_freq = frequency; tr.dsp_freq_policy = uhd::tune_request_t::POLICY_MANUAL; } if (dir == SOAPY_SDR_TX) _trCache[dir][channel] = _dev->set_tx_freq(tr, channel); if (dir == SOAPY_SDR_RX) _trCache[dir][channel] = _dev->set_rx_freq(tr, channel); } std::map > _trCache; double getFrequency(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_freq(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_freq(channel); return SoapySDR::Device::getFrequency(dir, channel); } double getFrequency(const int dir, const size_t channel, const std::string &name) const { //we have never tuned before, return the overall freq for RF, assume 0.0 for all else if (_trCache.count(dir) == 0 or _trCache.at(dir).count(channel) == 0) { if (name == "RF") return this->getFrequency(dir, channel); else return 0.0; } const uhd::tune_result_t tr = _trCache.at(dir).at(channel); if (name == "RF") return tr.actual_rf_freq; if (name == "BB") return tr.actual_dsp_freq; return SoapySDR::Device::getFrequency(dir, channel, name); } std::vector listFrequencies(const int, const size_t) const { std::vector comps; comps.push_back("RF"); comps.push_back("BB"); return comps; } SoapySDR::RangeList getFrequencyRange(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_freq_range(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_rx_freq_range(channel)); return SoapySDR::Device::getFrequencyRange(dir, channel); } SoapySDR::RangeList getFrequencyRange(const int dir, const size_t channel, const std::string &name) const { if (name == "RF") { //use overall range - could use property tree, but close enough if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_freq_range(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_rx_freq_range(channel)); } if (name == "BB") { //read the range from the property tree uhd::property_tree::sptr tree = _dev->get_device()->get_tree(); const std::string path = str(boost::format("/mboards/0/%s_dsps/%u/freq/range") % ((dir == SOAPY_SDR_TX)?"tx":"rx") % channel); if (tree->exists(path)) return metaRangeToRangeList(tree->access(path).get()); else return SoapySDR::RangeList(1, SoapySDR::Range(-getSampleRate(dir, channel)/2, getSampleRate(dir, channel)/2)); } return SoapySDR::Device::getFrequencyRange(dir, channel, name); } /******************************************************************* * Sample Rate support ******************************************************************/ void setSampleRate(const int dir, const size_t channel, const double rate) { if (dir == SOAPY_SDR_TX) return _dev->set_tx_rate(rate, channel); if (dir == SOAPY_SDR_RX) return _dev->set_rx_rate(rate, channel); } double getSampleRate(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_rate(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_rate(channel); return SoapySDR::Device::getSampleRate(dir, channel); } std::vector listSampleRates(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToNumericList(_dev->get_tx_rates(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToNumericList(_dev->get_rx_rates(channel)); return SoapySDR::Device::listSampleRates(dir, channel); } SoapySDR::RangeList getSampleRateRange(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_rates(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_rx_rates(channel)); return SoapySDR::Device::getSampleRateRange(dir, channel); } void setBandwidth(const int dir, const size_t channel, const double bw) { if (dir == SOAPY_SDR_TX) return _dev->set_tx_bandwidth(bw, channel); if (dir == SOAPY_SDR_RX) return _dev->set_rx_bandwidth(bw, channel); } double getBandwidth(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_bandwidth(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_bandwidth(channel); return SoapySDR::Device::getBandwidth(dir, channel); } std::vector listBandwidths(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToNumericList(_dev->get_tx_bandwidth_range(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToNumericList(_dev->get_rx_bandwidth_range(channel)); return SoapySDR::Device::listBandwidths(dir, channel); } SoapySDR::RangeList getBandwidthRange(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return metaRangeToRangeList(_dev->get_tx_bandwidth_range(channel)); if (dir == SOAPY_SDR_RX) return metaRangeToRangeList(_dev->get_tx_bandwidth_range(channel)); return SoapySDR::Device::getBandwidthRange(dir, channel); } /******************************************************************* * Clocking support ******************************************************************/ void setMasterClockRate(const double rate) { _dev->set_master_clock_rate(rate); } double getMasterClockRate(void) const { return _dev->get_master_clock_rate(); } std::vector listClockSources(void) const { return _dev->get_clock_sources(0); } void setClockSource(const std::string &source) { _dev->set_clock_source(source, 0); } std::string getClockSource(void) const { return _dev->get_clock_source(0); } std::vector listTimeSources(void) const { return _dev->get_time_sources(0); } void setTimeSource(const std::string &source) { _dev->set_time_source(source, 0); } std::string getTimeSource(void) const { return _dev->get_time_source(0); } /******************************************************************* * Time support ******************************************************************/ bool hasHardwareTime(const std::string &what) const { return (what == "PPS" or what.empty()); } long long getHardwareTime(const std::string &what) const { if (what == "PPS") return _dev->get_time_last_pps().to_ticks(1e9); return _dev->get_time_now().to_ticks(1e9); } void setHardwareTime(const long long timeNs, const std::string &what) { uhd::time_spec_t time = uhd::time_spec_t::from_ticks(timeNs, 1e9); if (what == "PPS") return _dev->set_time_next_pps(time); if (what == "UNKNOWN_PPS") return _dev->set_time_unknown_pps(time); if (what == "CMD" and timeNs == 0) return _dev->clear_command_time(); if (what == "CMD") return _dev->set_command_time(time); return _dev->set_time_now(time); } //deprecated call, just forwards to setHardwareTime with CMD arg void setCommandTime(const long long timeNs, const std::string &) { this->setHardwareTime(timeNs, "CMD"); } /******************************************************************* * Sensor support ******************************************************************/ std::vector listSensors(void) const { return _dev->get_mboard_sensor_names(); } SoapySDR::ArgInfo getSensorInfo(const std::string &name) const { return sensorToArgInfo(_dev->get_mboard_sensor(name), name); } std::string readSensor(const std::string &name) const { return _dev->get_mboard_sensor(name).value; } std::vector listSensors(const int dir, const size_t channel) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_sensor_names(channel); if (dir == SOAPY_SDR_RX) return _dev->get_rx_sensor_names(channel); return SoapySDR::Device::listSensors(dir, channel); } SoapySDR::ArgInfo getSensorInfo(const int dir, const size_t channel, const std::string &name) const { if (dir == SOAPY_SDR_TX) return sensorToArgInfo(_dev->get_tx_sensor(name, channel), name); if (dir == SOAPY_SDR_RX) return sensorToArgInfo(_dev->get_rx_sensor(name, channel), name); return SoapySDR::Device::getSensorInfo(dir, channel, name); } std::string readSensor(const int dir, const size_t channel, const std::string &name) const { if (dir == SOAPY_SDR_TX) return _dev->get_tx_sensor(name, channel).value; if (dir == SOAPY_SDR_RX) return _dev->get_rx_sensor(name, channel).value; return SoapySDR::Device::readSensor(dir, channel, name); } /******************************************************************* * GPIO API ******************************************************************/ /*! * Helpful markup to set the ATRs and CTRL from the writeGPIO API. * dev->writeGPIO("BANKFOO:ATR_TX", 0xffff); */ void __splitBankName(const std::string &name, std::string &bank, std::string &attr) { const size_t sepPos = name.find(':'); if (sepPos == std::string::npos) { bank = name; attr = "OUT"; return; } bank = name.substr(0, sepPos); attr = name.substr(sepPos+1); } std::vector listGPIOBanks(void) const { return _dev->get_gpio_banks(0); } void writeGPIO(const std::string &name, const unsigned value) { std::string bank, attr; __splitBankName(name, bank, attr); _dev->set_gpio_attr(bank, attr, value); } void writeGPIO(const std::string &name, const unsigned value, const unsigned mask) { std::string bank, attr; __splitBankName(name, bank, attr); _dev->set_gpio_attr(bank, attr, value, mask); } unsigned readGPIO(const std::string &bank) const { return _dev->get_gpio_attr(bank, "READBACK"); } void writeGPIODir(const std::string &bank, const unsigned dir) { _dev->set_gpio_attr(bank, "DDR", dir); } void writeGPIODir(const std::string &bank, const unsigned dir, const unsigned mask) { _dev->set_gpio_attr(bank, "DDR", dir, mask); } unsigned readGPIODir(const std::string &bank) const { return _dev->get_gpio_attr(bank, "DDR"); } /******************************************************************* * Helpers for searching property tree ******************************************************************/ std::string __getMBoardFEPropTreePath(const int dir, const size_t channel) const { auto tree = _dev->get_device()->get_tree(); const std::string directionName = (dir == SOAPY_SDR_TX) ? "tx" : "rx"; auto subdevSpec = (dir == SOAPY_SDR_TX) ? _dev->get_tx_subdev_spec(0).at(channel) : _dev->get_rx_subdev_spec(0).at(channel); const std::string path = str(boost::format("/mboards/0/%s_frontends/%s") % directionName % subdevSpec.db_name); return path; } std::string __getDBoardFEPropTreePath(const int dir, const size_t channel) const { auto tree = _dev->get_device()->get_tree(); const std::string directionName = (dir == SOAPY_SDR_TX) ? "tx" : "rx"; auto subdevSpec = (dir == SOAPY_SDR_TX) ? _dev->get_tx_subdev_spec(0).at(channel) : _dev->get_rx_subdev_spec(0).at(channel); const std::string path = str(boost::format("/mboards/0/dboards/%s/%s_frontends/%s") % subdevSpec.db_name % directionName % subdevSpec.sd_name); return path; } bool __doesMBoardFEPropTreeEntryExist(const int dir, const size_t channel, const std::string &subpath) const { auto path = __getMBoardFEPropTreePath(dir, channel) + "/" + subpath; return _dev->get_device()->get_tree()->exists(path); } bool __doesDBoardFEPropTreeEntryExist(const int dir, const size_t channel, const std::string &subpath) const { auto path = __getDBoardFEPropTreePath(dir, channel) + "/" + subpath; return _dev->get_device()->get_tree()->exists(path); } private: uhd::usrp::multi_usrp::sptr _dev; const std::string _type; const bool _isNetworkDevice; }; /*********************************************************************** * Register into logger **********************************************************************/ #ifdef UHD_HAS_MSG_HPP static void SoapyUHDLogger(uhd::msg::type_t t, const std::string &s) { if (s.empty()) return; if (s[s.size()-1] == '\n') return SoapyUHDLogger(t, s.substr(0, s.size()-1)); switch (t) { case uhd::msg::status: SoapySDR::log(SOAPY_SDR_INFO, s); break; case uhd::msg::warning: SoapySDR::log(SOAPY_SDR_WARNING, s); break; case uhd::msg::error: SoapySDR::log(SOAPY_SDR_ERROR, s); break; case uhd::msg::fastpath: SoapySDR::log(SOAPY_SDR_SSI, s); break; } } #else static void SoapyUHDLogger(const uhd::log::logging_info &info) { //build a log message formatted from the information std::string message; if (not info.file.empty()) { std::string shortfile = info.file.substr(info.file.find_last_of("/\\") + 1); message += "[" + shortfile + ":" + std::to_string(info.line) + "] "; } if (not info.component.empty()) { message += "[" + info.component + "] "; } message += info.message; switch(info.verbosity) { case uhd::log::trace: SoapySDR::log(SOAPY_SDR_TRACE, message); break; case uhd::log::debug: SoapySDR::log(SOAPY_SDR_DEBUG, message); break; case uhd::log::info: SoapySDR::log(SOAPY_SDR_INFO, message); break; case uhd::log::warning: SoapySDR::log(SOAPY_SDR_WARNING, message); break; case uhd::log::error: SoapySDR::log(SOAPY_SDR_ERROR, message); break; case uhd::log::fatal: SoapySDR::log(SOAPY_SDR_FATAL, message); break; default: break; } } #endif /*********************************************************************** * Registration **********************************************************************/ std::vector find_uhd(const SoapySDR::Kwargs &args_) { //prevent going into the the UHDSoapyDevice SoapySDR::Kwargs args(args_); if (args.count(SOAPY_UHD_NO_DEEPER) != 0) return std::vector(); args[SOAPY_UHD_NO_DEEPER] = ""; //perform the discovery #ifdef UHD_HAS_DEVICE_FILTER const uhd::device_addrs_t addrs = uhd::device::find(kwargsToDict(args), uhd::device::USRP); #else const uhd::device_addrs_t addrs = uhd::device::find(kwargsToDict(args)); #endif //convert addrs to results std::vector results; for (size_t i = 0; i < addrs.size(); i++) { SoapySDR::Kwargs result(dictToKwargs(addrs[i])); //create displayable label if not present if (result.count("label") == 0) { if (result.count("product") != 0) result["label"] = result.at("product"); if (result.count("serial") != 0) result["label"] += " " + result.at("serial"); } result.erase(SOAPY_UHD_NO_DEEPER); results.push_back(result); } return results; } SoapySDR::Device *make_uhd(const SoapySDR::Kwargs &args) { if(std::string(UHD_VERSION_ABI_STRING) != uhd::get_abi_string()) throw std::runtime_error(str(boost::format( "SoapySDR detected ABI compatibility mismatch with UHD library.\n" "SoapySDR UHD support was build against ABI: %s,\n" "but UHD library reports ABI: %s\n" "Suggestion: install an ABI compatible version of UHD,\n" "or rebuild SoapySDR UHD support against this ABI version.\n" ) % UHD_VERSION_ABI_STRING % uhd::get_abi_string())); #ifdef UHD_HAS_MSG_HPP uhd::msg::register_handler(&SoapyUHDLogger); #else uhd::log::add_logger("SoapyUHDDevice", &SoapyUHDLogger); #endif return new SoapyUHDDevice(uhd::usrp::multi_usrp::make(kwargsToDict(args)), args); } static SoapySDR::Registry register__uhd("uhd", &find_uhd, &make_uhd, SOAPY_SDR_ABI_VERSION); SoapyUHD-soapy-uhd-0.4.1/TypeHelpers.hpp000066400000000000000000000113141373175511200200410ustar00rootroot00000000000000// Copyright (c) 2014-2017 Josh Blum // SPDX-License-Identifier: GPL-3.0 #pragma once #include #include //feature constants #include #include #include #include #define SOAPY_UHD_NO_DEEPER "soapy_uhd_no_deeper" /*********************************************************************** * Helpful type conversions **********************************************************************/ static inline SoapySDR::Kwargs dictToKwargs(const uhd::device_addr_t &addr) { SoapySDR::Kwargs kwargs; const std::vector keys = addr.keys(); for (size_t i = 0; i < keys.size(); i++) { kwargs[keys[i]] = addr[keys[i]]; } return kwargs; } static inline uhd::device_addr_t kwargsToDict(const SoapySDR::Kwargs &kwargs) { uhd::device_addr_t addr; for (SoapySDR::Kwargs::const_iterator it = kwargs.begin(); it != kwargs.end(); ++it) { addr[it->first] = it->second; } return addr; } static inline SoapySDR::RangeList metaRangeToRangeList(const uhd::meta_range_t &metaRange) { SoapySDR::RangeList out; for (size_t i = 0; i < metaRange.size(); i++) { #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP out.push_back(SoapySDR::Range(metaRange[i].start(), metaRange[i].stop(), metaRange[i].step())); #else out.push_back(SoapySDR::Range(metaRange[i].start(), metaRange[i].stop())); #endif } return out; } static inline uhd::meta_range_t rangeListToMetaRange(const SoapySDR::RangeList &ranges) { uhd::meta_range_t out; for (size_t i = 0; i < ranges.size(); i++) { #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP out.push_back(uhd::range_t(ranges[i].minimum(), ranges[i].maximum(), ranges[i].step())); #else out.push_back(uhd::range_t(ranges[i].minimum(), ranges[i].maximum())); #endif } if (out.empty()) out.push_back(uhd::range_t(0.0)); return out; } static inline SoapySDR::Range metaRangeToRange(const uhd::meta_range_t &metaRange) { #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP return SoapySDR::Range(metaRange.start(), metaRange.stop(), metaRange.step()); #else return SoapySDR::Range(metaRange.start(), metaRange.stop()); #endif } static inline uhd::meta_range_t numberListToMetaRange(const std::vector &nums) { uhd::meta_range_t out; for (size_t i = 0; i < nums.size(); i++) { out.push_back(uhd::range_t(nums[i])); } if (out.empty()) out.push_back(uhd::range_t(0.0)); return out; } static inline std::vector metaRangeToNumericList(const uhd::meta_range_t &metaRange) { std::vector out; //in this case, the bounds are in element 0 if (metaRange.size() == 1) { out.push_back(metaRange[0].start()); out.push_back(metaRange[0].stop()); return out; } for (size_t i = 0; i < metaRange.size(); i++) { //in these cases start == stop out.push_back(metaRange[i].start()); } return out; } static inline uhd::meta_range_t rangeToMetaRange(const SoapySDR::Range &range, double step = 0.0) { //when range step is supported, use it only if initialized to non-zero #ifdef SOAPY_SDR_API_HAS_RANGE_TYPE_STEP if (range.step() != 0.0) step = range.step(); #endif return uhd::meta_range_t(range.minimum(), range.maximum(), step); } static inline SoapySDR::ArgInfo sensorToArgInfo(const uhd::sensor_value_t &sensor, const std::string &key) { SoapySDR::ArgInfo argInfo; argInfo.key = key; argInfo.value = sensor.value; argInfo.name = sensor.name; argInfo.units = sensor.unit; switch (sensor.type) { case uhd::sensor_value_t::BOOLEAN: argInfo.type = SoapySDR::ArgInfo::BOOL; break; case uhd::sensor_value_t::INTEGER: argInfo.type = SoapySDR::ArgInfo::INT; break; case uhd::sensor_value_t::REALNUM: argInfo.type = SoapySDR::ArgInfo::FLOAT; break; case uhd::sensor_value_t::STRING: argInfo.type = SoapySDR::ArgInfo::STRING; break; } return argInfo; } static inline uhd::sensor_value_t argInfoToSensor(const SoapySDR::ArgInfo &argInfo, const std::string &value) { switch (argInfo.type) { case SoapySDR::ArgInfo::BOOL: return uhd::sensor_value_t(argInfo.name, value == "true", argInfo.units, argInfo.units); case SoapySDR::ArgInfo::INT: return uhd::sensor_value_t(argInfo.name, atoi(value.c_str()), argInfo.units); case SoapySDR::ArgInfo::FLOAT: return uhd::sensor_value_t(argInfo.name, atof(value.c_str()), argInfo.units); case SoapySDR::ArgInfo::STRING: return uhd::sensor_value_t(argInfo.name, value, argInfo.units); } return uhd::sensor_value_t(argInfo.name, value, argInfo.units); } SoapyUHD-soapy-uhd-0.4.1/UHDSoapyDevice.cpp000066400000000000000000001067121373175511200203530ustar00rootroot00000000000000// Copyright (c) 2015-2020 Josh Blum // Copyright (c) 2018 Deepwave Digital, Inc. // SPDX-License-Identifier: GPL-3.0 #ifdef UHD_HAS_SET_PUBLISHER #define publish set_publisher #define subscribe add_desired_subscriber #endif /*********************************************************************** * A UHD module that supports Soapy devices within the UHD API. **********************************************************************/ #include "TypeHelpers.hpp" #include #include #include #include #include #ifdef UHD_HAS_MSG_HPP #include #else #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include //Report a positive gain step value for UHD's automatic distribution algorithm. //This prevents the gain group rounding algorithm from producing zero values. static const double MIN_GAIN_STEP = 0.1; /*********************************************************************** * Custom UHD Device to support Soapy **********************************************************************/ class UHDSoapyDevice : public uhd::device { public: UHDSoapyDevice(const uhd::device_addr_t &args); ~UHDSoapyDevice(void); uhd::rx_streamer::sptr get_rx_stream(const uhd::stream_args_t &args); uhd::tx_streamer::sptr get_tx_stream(const uhd::stream_args_t &args); bool recv_async_msg(uhd::async_metadata_t &, double); uhd::time_spec_t get_hardware_time(const std::string &what) { return uhd::time_spec_t::from_ticks(_device->getHardwareTime(what), 1e9); } void set_hardware_time(const std::string &what, const uhd::time_spec_t &time) { _device->setHardwareTime(time.to_ticks(1e9), what); } uhd::usrp::subdev_spec_t get_frontend_mapping(const int dir) { //return uhd::usrp::subdev_spec_t(_device->getFrontendMapping(dir)); uhd::usrp::subdev_spec_t spec; for (size_t ch = 0; ch < _device->getNumChannels(dir); ch++) { const std::string chName(boost::lexical_cast(ch)); spec.push_back(uhd::usrp::subdev_spec_pair_t(chName, chName)); } //spec cant be empty, we make a fake spec for apps work if (spec.empty()) spec.push_back(uhd::usrp::subdev_spec_pair_t("0", "0")); return spec; } void set_frontend_mapping(const int, const uhd::usrp::subdev_spec_t &) { //there is no translation from spec to frontend map //however, frontend map can be set by device args //_device->setFrontendMapping(dir, spec.to_string()); } uhd::meta_range_t get_freq_range(const int dir, const size_t chan, const std::string &name) { return rangeListToMetaRange(_device->getFrequencyRange(dir, chan, name)); } void stash_tune_args(const int dir, const size_t chan, const uhd::device_addr_t &args) { _tuneArgsStash[dir][chan] = dictToKwargs(args); } std::map > _tuneArgsStash; void set_frequency(const int dir, const size_t chan, const std::string &name, const double freq) { _device->setFrequency(dir, chan, name, freq, _tuneArgsStash[dir][chan]); } uhd::meta_range_t get_bw_range(const int dir, const size_t chan) { #ifdef SOAPY_SDR_API_HAS_GET_BANDWIDTH_RANGE return rangeListToMetaRange(_device->getBandwidthRange(dir, chan)); #else return numberListToMetaRange(_device->listBandwidths(dir, chan)); #endif } uhd::meta_range_t get_rate_range(const int dir, const size_t chan) { #ifdef SOAPY_SDR_API_HAS_GET_SAMPLE_RATE_RANGE return rangeListToMetaRange(_device->getSampleRateRange(dir, chan)); #else return numberListToMetaRange(_device->listSampleRates(dir, chan)); #endif } void set_sample_rate(const int dir, const size_t chan, const double rate) { _device->setSampleRate(dir, chan, rate); //cache the sample rate for the streamer to use _sampleRates[dir][chan] = _device->getSampleRate(dir, chan); } uhd::meta_range_t get_gain_range(const int dir, const size_t chan, const std::string &name) { return rangeToMetaRange(_device->getGainRange(dir, chan, name), MIN_GAIN_STEP); } uhd::sensor_value_t get_mboard_sensor(const std::string &name) { return argInfoToSensor(_device->getSensorInfo(name), _device->readSensor(name)); } uhd::sensor_value_t get_channel_sensor(const int dir, const size_t chan, const std::string &name) { return argInfoToSensor(_device->getSensorInfo(dir, chan, name), _device->readSensor(dir, chan, name)); } void old_issue_stream_cmd(const size_t chan, const uhd::stream_cmd_t &cmd) { auto stream = _rx_streamers[chan].lock(); if (stream) stream->issue_stream_cmd(cmd); } void setupChannelHooks(); void setupChannelHooks(const int dir, const size_t chan, const std::string &dirName, const std::string &chName); void setupFakeChannelHooks(const int dir, const size_t chan, const std::string &dirName, const std::string &chName); void set_gpio_attr(const std::string &bank, const std::string &attr, const boost::uint32_t value) { if (attr == "READBACK") return; //readback is never written if (attr == "OUT") return _device->writeGPIO(bank, value); if (attr == "DDR") return _device->writeGPIODir(bank, value); return _device->writeGPIO(bank+":"+attr, value); } boost::uint32_t get_gpio_attr(const std::string &bank, const std::string &attr) { if (attr == "READBACK") return _device->readGPIO(bank); if (attr == "OUT") return _device->readGPIO(bank); //usually OUT is cached output setting if (attr == "DDR") return _device->readGPIODir(bank); return _device->readGPIO(bank+":"+attr); } private: SoapySDR::Device *_device; std::map> _sampleRates; //stash streamers to implement old-style issue stream cmd and async message #if UHD_VERSION >= 4000000 std::map > _rx_streamers; std::map > _tx_streamers; #else std::map > _rx_streamers; std::map > _tx_streamers; #endif }; /*********************************************************************** * Factory and initialization **********************************************************************/ static boost::mutex &suMutexMaker(void) { static boost::mutex m; return m; } UHDSoapyDevice::UHDSoapyDevice(const uhd::device_addr_t &args) { { boost::mutex::scoped_lock l(suMutexMaker()); _device = SoapySDR::Device::make(dictToKwargs(args)); } //optional frontend map args if (args.has_key("rx_map")) _device->setFrontendMapping(SOAPY_SDR_RX, args.get("rx_map")); if (args.has_key("tx_map")) _device->setFrontendMapping(SOAPY_SDR_TX, args.get("tx_map")); //setup property tree _tree = uhd::property_tree::make(); const uhd::fs_path mb_path = "/mboards/0"; _tree->create("/name").set(_device->getDriverKey()); _tree->create(mb_path / "name").set(_device->getHardwareKey()); //mb eeprom filled with hardware info uhd::usrp::mboard_eeprom_t mb_eeprom; const uhd::device_addr_t hardware_info(kwargsToDict(_device->getHardwareInfo())); for(const std::string &key : hardware_info.keys()) mb_eeprom[key] = hardware_info[key]; _tree->create(mb_path / "eeprom").set(mb_eeprom); //the frontend mapping _tree->create(mb_path / "rx_subdev_spec") .publish(boost::bind(&UHDSoapyDevice::get_frontend_mapping, this, SOAPY_SDR_RX)) .subscribe(boost::bind(&UHDSoapyDevice::set_frontend_mapping, this, SOAPY_SDR_RX, _1)); _tree->create(mb_path / "tx_subdev_spec") .publish(boost::bind(&UHDSoapyDevice::get_frontend_mapping, this, SOAPY_SDR_TX)) .subscribe(boost::bind(&UHDSoapyDevice::set_frontend_mapping, this, SOAPY_SDR_TX, _1)); //timed command support _tree->create(mb_path / "time" / "cmd") .subscribe(boost::bind(&UHDSoapyDevice::set_hardware_time, this, "CMD", _1)); _tree->create(mb_path / "tick_rate") .publish(boost::bind(&SoapySDR::Device::getMasterClockRate, _device)) .subscribe(boost::bind(&SoapySDR::Device::setMasterClockRate, _device, _1)); //hardware time support _tree->create(mb_path / "time" / "now") .publish(boost::bind(&UHDSoapyDevice::get_hardware_time, this, "")) .subscribe(boost::bind(&UHDSoapyDevice::set_hardware_time, this, "", _1)); _tree->create(mb_path / "time" / "pps") .publish(boost::bind(&UHDSoapyDevice::get_hardware_time, this, "PPS")) .subscribe(boost::bind(&UHDSoapyDevice::set_hardware_time, this, "PPS", _1)); //clock and time sources _tree->create >(mb_path / "clock_source"/ "options") .publish(boost::bind(&SoapySDR::Device::listClockSources, _device)); _tree->create(mb_path / "clock_source" / "value") .publish(boost::bind(&SoapySDR::Device::getClockSource, _device)) .subscribe(boost::bind(&SoapySDR::Device::setClockSource, _device, _1)); _tree->create >(mb_path / "time_source"/ "options") .publish(boost::bind(&SoapySDR::Device::listTimeSources, _device)); _tree->create(mb_path / "time_source" / "value") .publish(boost::bind(&SoapySDR::Device::getTimeSource, _device)) .subscribe(boost::bind(&SoapySDR::Device::setTimeSource, _device, _1)); //mboard sensors _tree->create(mb_path / "sensors"); //ensure this path exists for(const std::string &name : _device->listSensors()) { _tree->create(mb_path / "sensors" / name) .publish(boost::bind(&UHDSoapyDevice::get_mboard_sensor, this, name)); } //gpio banks for(const std::string &bank : _device->listGPIOBanks()) { std::vector attrs; attrs.push_back("CTRL"); attrs.push_back("DDR"); attrs.push_back("OUT"); attrs.push_back("ATR_0X"); attrs.push_back("ATR_RX"); attrs.push_back("ATR_TX"); attrs.push_back("ATR_XX"); attrs.push_back("READBACK"); for(const std::string &attr : attrs) { _tree->create(mb_path / "gpio" / bank / attr) .subscribe(boost::bind(&UHDSoapyDevice::set_gpio_attr, this, bank, attr, _1)) .publish(boost::bind(&UHDSoapyDevice::get_gpio_attr, this, bank, attr)); } } //setup channel and frontend hooks this->setupChannelHooks(); } UHDSoapyDevice::~UHDSoapyDevice(void) { boost::mutex::scoped_lock l(suMutexMaker()); SoapySDR::Device::unmake(_device); } void UHDSoapyDevice::setupChannelHooks() { static const std::string kRxDirName = "rx"; static const std::string kTxDirName = "tx"; const size_t numRxChannels = _device->getNumChannels(SOAPY_SDR_RX); const size_t numTxChannels = _device->getNumChannels(SOAPY_SDR_TX); //We have to build up the same number of TX and RX channels to make UHD //happy. If there are less channels in one direction than another, we fill //in the direction with dummy channels. const size_t numChannels = std::max(numRxChannels, numTxChannels); for (size_t ch = 0; ch < numChannels; ch++) { const std::string chName(boost::lexical_cast(ch)); if (ch < numRxChannels) this->setupChannelHooks(SOAPY_SDR_RX, ch, kRxDirName, chName); else this->setupFakeChannelHooks(SOAPY_SDR_RX, ch, kRxDirName, chName); if (ch < numTxChannels) this->setupChannelHooks(SOAPY_SDR_TX, ch, kTxDirName, chName); else this->setupFakeChannelHooks(SOAPY_SDR_TX, ch, kTxDirName, chName); } } void UHDSoapyDevice::setupChannelHooks(const int dir, const size_t chan, const std::string &dirName, const std::string &chName) { const uhd::fs_path mb_path = "/mboards/0"; const uhd::fs_path rf_fe_path = mb_path / "dboards" / chName / (dirName+"_frontends") / chName; const uhd::fs_path dsp_path = mb_path / (dirName+"_dsps") / chName; const uhd::fs_path codec_path = mb_path / (dirName+"_codecs") / chName; _tree->create(codec_path / "name").set("Soapy"+std::string((dir==SOAPY_SDR_RX)?"ADC":"DAC")); _tree->create(codec_path / "gains"); //empty, gains in frontend _tree->create(rf_fe_path / "gains"); //in case its empty _tree->create(rf_fe_path / "name").set("SoapyRF"); _tree->create(rf_fe_path / "connection").set("IQ"); //names of the tunable components const std::vector comps = _device->listFrequencies(dir, chan); const std::string rfCompName = (comps.size()>0)?comps.at(0):"RF"; const std::string bbCompName = (comps.size()>1)?comps.at(1):""; //samp rate _tree->create(dsp_path / "rate" / "range") .publish(boost::bind(&UHDSoapyDevice::get_rate_range, this, dir, chan)); _tree->create(dsp_path / "rate" / "value") .publish(boost::bind(&SoapySDR::Device::getSampleRate, _device, dir, chan)) .subscribe(boost::bind(&UHDSoapyDevice::set_sample_rate, this, dir, chan, _1)); //dsp freq (when there is no tunable cordic) if (bbCompName.empty()) { _tree->create(dsp_path / "freq" / "value").set(0.0); _tree->create(dsp_path / "freq" / "range").set(uhd::meta_range_t(0.0, 0.0)); } //dsp freq else { _tree->create(dsp_path / "freq" / "value") .publish(boost::bind(&SoapySDR::Device::getFrequency, _device, dir, chan, bbCompName)) .subscribe(boost::bind(&UHDSoapyDevice::set_frequency, this, dir, chan, bbCompName, _1)); _tree->create(dsp_path / "freq" / "range") .publish(boost::bind(&UHDSoapyDevice::get_freq_range, this, dir, chan, bbCompName)); } //old style stream cmd if (dir == SOAPY_SDR_RX) { _tree->create(dsp_path / "stream_cmd") .subscribe(boost::bind(&UHDSoapyDevice::old_issue_stream_cmd, this, chan, _1)); } //frontend sensors _tree->create(rf_fe_path / "sensors"); //ensure this path exists for(const std::string &name : _device->listSensors(dir, chan)) { //install the sensor _tree->create(rf_fe_path / "sensors" / name) .publish(boost::bind(&UHDSoapyDevice::get_channel_sensor, this, dir, chan, name)); } //dummy eeprom values if (dir == SOAPY_SDR_RX) { _tree->create(mb_path / "dboards" / chName / "rx_eeprom") .set(uhd::usrp::dboard_eeprom_t()); } else { _tree->create(mb_path / "dboards" / chName / "tx_eeprom") .set(uhd::usrp::dboard_eeprom_t()); _tree->create(mb_path / "dboards" / chName / "gdb_eeprom") .set(uhd::usrp::dboard_eeprom_t()); } //gains for(const std::string &name : _device->listGains(dir, chan)) { _tree->create(rf_fe_path / "gains" / name / "range") .publish(boost::bind(&UHDSoapyDevice::get_gain_range, this, dir, chan, name)); _tree->create(rf_fe_path / "gains" / name / "value") .publish(boost::bind(&SoapySDR::Device::getGain, _device, dir, chan, name)) .subscribe(boost::bind(&SoapySDR::Device::setGain, _device, dir, chan, name, _1)); } //agc _tree->create(rf_fe_path / "gain" / "agc" / "enable") .publish(boost::bind(&SoapySDR::Device::getGainMode, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setGainMode, _device, dir, chan, _1)); //freq _tree->create(rf_fe_path / "freq" / "value") .publish(boost::bind(&SoapySDR::Device::getFrequency, _device, dir, chan, rfCompName)) .subscribe(boost::bind(&UHDSoapyDevice::set_frequency, this, dir, chan, rfCompName, _1)); _tree->create(rf_fe_path / "freq" / "range") .publish(boost::bind(&UHDSoapyDevice::get_freq_range, this, dir, chan, rfCompName)); _tree->create(rf_fe_path / "use_lo_offset").set(false); _tree->create(rf_fe_path / "tune_args") .subscribe(boost::bind(&UHDSoapyDevice::stash_tune_args, this, dir, chan, _1)); //ant _tree->create >(rf_fe_path / "antenna" / "options") .publish(boost::bind(&SoapySDR::Device::listAntennas, _device, dir, chan)); _tree->create(rf_fe_path / "antenna" / "value") .publish(boost::bind(&SoapySDR::Device::getAntenna, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setAntenna, _device, dir, chan, _1)); //bw _tree->create(rf_fe_path / "bandwidth" / "value") .publish(boost::bind(&SoapySDR::Device::getBandwidth, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setBandwidth, _device, dir, chan, _1)); _tree->create(rf_fe_path / "bandwidth" / "range") .publish(boost::bind(&UHDSoapyDevice::get_bw_range, this, dir, chan)); //corrections if (_device->hasDCOffsetMode(dir, chan)) { _tree->create(rf_fe_path / "dc_offset" / "enable") .publish(boost::bind(&SoapySDR::Device::getDCOffsetMode, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setDCOffsetMode, _device, dir, chan, _1)); } if (_device->hasDCOffset(dir, chan)) { _tree->create>(rf_fe_path / "dc_offset" / "value") .publish(boost::bind(&SoapySDR::Device::getDCOffset, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setDCOffset, _device, dir, chan, _1)); } if (_device->hasIQBalance(dir, chan)) { _tree->create>(rf_fe_path / "iq_balance" / "value") .publish(boost::bind(&SoapySDR::Device::getIQBalance, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setIQBalance, _device, dir, chan, _1)); } #ifdef SOAPY_SDR_API_HAS_IQ_BALANCE_MODE if (_device->hasIQBalanceMode(dir, chan)) { _tree->create(rf_fe_path / "iq_balance" / "enable") .publish(boost::bind(&SoapySDR::Device::getIQBalanceMode, _device, dir, chan)) .subscribe(boost::bind(&SoapySDR::Device::setIQBalanceMode, _device, dir, chan, _1)); } #endif } void UHDSoapyDevice::setupFakeChannelHooks(const int dir, const size_t /*chan*/, const std::string &dirName, const std::string &chName) { const uhd::fs_path mb_path = "/mboards/0"; const uhd::fs_path rf_fe_path = mb_path / "dboards" / chName / (dirName+"_frontends") / chName; const uhd::fs_path dsp_path = mb_path / (dirName+"_dsps") / chName; const uhd::fs_path codec_path = mb_path / (dirName+"_codecs") / chName; _tree->create(codec_path / "name").set("None"); _tree->create(codec_path / "gains"); //empty, gains in frontend _tree->create(rf_fe_path / "gains"); //in case its empty _tree->create(rf_fe_path / "name").set("None"); _tree->create(rf_fe_path / "connection").set("IQ"); //samp rate _tree->create(dsp_path / "rate" / "range").set(uhd::meta_range_t(0.0, 0.0)); _tree->create(dsp_path / "rate" / "value").set(0.0); //dsp freq _tree->create(dsp_path / "freq" / "value").set(0.0); _tree->create(dsp_path / "freq" / "range").set(uhd::meta_range_t(0.0, 0.0)); //frontend sensors _tree->create(rf_fe_path / "sensors"); //ensure this path exists //dummy eeprom values if (dir == SOAPY_SDR_RX) { _tree->create(mb_path / "dboards" / chName / "rx_eeprom") .set(uhd::usrp::dboard_eeprom_t()); } else { _tree->create(mb_path / "dboards" / chName / "tx_eeprom") .set(uhd::usrp::dboard_eeprom_t()); _tree->create(mb_path / "dboards" / chName / "gdb_eeprom") .set(uhd::usrp::dboard_eeprom_t()); } //freq _tree->create(rf_fe_path / "freq" / "value").set(0.0); _tree->create(rf_fe_path / "freq" / "range").set(uhd::meta_range_t(0.0, 0.0)); _tree->create(rf_fe_path / "use_lo_offset").set(false); //ant _tree->create(rf_fe_path / "antenna" / "value").set(""); _tree->create >(rf_fe_path / "antenna" / "options").set(std::vector()); //bw _tree->create(rf_fe_path / "bandwidth" / "value").set(0.0); _tree->create(rf_fe_path / "bandwidth" / "range").set(uhd::meta_range_t(0.0, 0.0)); } /*********************************************************************** * RX Streaming **********************************************************************/ static SoapySDR::Stream *make_stream(SoapySDR::Device *d, const int direction, const uhd::stream_args_t &args) { //ensure at least one channel selected std::vector chans = args.channels; if (chans.empty()) chans.push_back(0); //load keyword args from stream args SoapySDR::Kwargs kwargs(dictToKwargs(args.args)); //fill in WIRE keyword when specified if (not args.otw_format.empty() and kwargs.count("WIRE") == 0) { kwargs["WIRE"] = args.otw_format; } //the format string std::string hostFormat; for(const char ch : args.cpu_format) { if (ch == 'c') hostFormat = "C" + hostFormat; else if (ch == 'f') hostFormat += "F"; else if (ch == 's') hostFormat += "S"; else if (std::isdigit(ch)) hostFormat += ch; else throw std::runtime_error("UHDSoapyDevice::setupStream("+args.cpu_format+") unknown format"); } return d->setupStream(direction, hostFormat, chans, kwargs); } class UHDSoapyRxStream : public uhd::rx_streamer { public: UHDSoapyRxStream(SoapySDR::Device *d, const uhd::stream_args_t &args, const double &sampRate): _device(d), _stream(make_stream(d, SOAPY_SDR_RX, args)), _nchan(std::max(1, args.channels.size())), _elemSize(uhd::convert::get_bytes_per_item(args.cpu_format)), _nextTimeValid(false), _sampRate(sampRate) { _offsetBuffs.resize(_nchan); } ~UHDSoapyRxStream(void) { _device->deactivateStream(_stream); _device->closeStream(_stream); } size_t get_num_channels(void) const { return _nchan; } size_t get_max_num_samps(void) const { return _device->getStreamMTU(_stream); } size_t recv( const buffs_type &buffs, const size_t nsamps_per_buff, uhd::rx_metadata_t &md, const double timeout = 0.1, const bool one_packet = false ) { size_t total = 0; md.reset(); while (total < nsamps_per_buff) { int flags = 0; if (one_packet) flags |= SOAPY_SDR_ONE_PACKET; long long timeNs = 0; size_t numElems = (nsamps_per_buff-total); for (size_t i = 0; i < _nchan; i++) _offsetBuffs[i] = ((char *)buffs[i]) + total*_elemSize; int ret = _device->readStream(_stream, &(_offsetBuffs[0]), numElems, flags, timeNs, long(timeout*1e6)); //deal with return error codes switch (ret) { case SOAPY_SDR_TIMEOUT: md.error_code = uhd::rx_metadata_t::ERROR_CODE_TIMEOUT; break; case SOAPY_SDR_STREAM_ERROR: md.error_code = uhd::rx_metadata_t::ERROR_CODE_BROKEN_CHAIN; break; case SOAPY_SDR_CORRUPTION: md.error_code = uhd::rx_metadata_t::ERROR_CODE_BAD_PACKET; break; case SOAPY_SDR_OVERFLOW: md.error_code = uhd::rx_metadata_t::ERROR_CODE_OVERFLOW; break; case SOAPY_SDR_TIME_ERROR: md.error_code = uhd::rx_metadata_t::ERROR_CODE_LATE_COMMAND; break; } if (ret < 0) break; total += ret; //more fragments always over written by last recv md.more_fragments = (flags & SOAPY_SDR_MORE_FRAGMENTS) != 0; //apply time if this is the first recv if (total == size_t(ret)) { md.has_time_spec = (flags & SOAPY_SDR_HAS_TIME) != 0; md.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9); if (md.has_time_spec) { _nextTimeValid = true; _nextTime = md.time_spec; } } //mark end of burst and exit call if ((flags & SOAPY_SDR_END_BURST) != 0) { md.end_of_burst = true; break; } //inline overflow indication if ((flags & SOAPY_SDR_END_ABRUPT) != 0) { md.error_code = uhd::rx_metadata_t::ERROR_CODE_OVERFLOW; break; } //one pkt mode, end loop if (one_packet) break; } //time interpolation support if (_sampRate != 0.0 and _nextTimeValid) { //if the metadata does not have a time, use the incremented time if (not md.has_time_spec) { md.has_time_spec = true; md.time_spec = _nextTime; } //increment for the next call _nextTime += uhd::time_spec_t::from_ticks(total, _sampRate); } return total; } void issue_stream_cmd(const uhd::stream_cmd_t &stream_cmd) { int flags = 0; if (not stream_cmd.stream_now) flags |= SOAPY_SDR_HAS_TIME; long long timeNs = stream_cmd.time_spec.to_ticks(1e9); size_t numElems = 0; bool activate = true; switch(stream_cmd.stream_mode) { case uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS: break; case uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS: activate = false; break; case uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE: flags |= SOAPY_SDR_END_BURST; numElems = stream_cmd.num_samps; break; case uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE: numElems = stream_cmd.num_samps; break; } int ret = 0; if (activate) ret = _device->activateStream(_stream, flags, timeNs, numElems); else ret = _device->deactivateStream(_stream, flags, timeNs); if (ret != 0) throw std::runtime_error(str(boost::format("UHDSoapyRxStream::issue_stream_cmd() = %d") % ret)); } private: SoapySDR::Device *_device; SoapySDR::Stream *_stream; const size_t _nchan; const size_t _elemSize; std::vector _offsetBuffs; bool _doErrorOnNextRecv; bool _nextTimeValid; uhd::time_spec_t _nextTime; const double &_sampRate; }; uhd::rx_streamer::sptr UHDSoapyDevice::get_rx_stream(const uhd::stream_args_t &args) { size_t ch = 0; if (not args.channels.empty()) ch = args.channels.front(); uhd::rx_streamer::sptr stream(new UHDSoapyRxStream(_device, args, _sampleRates[SOAPY_SDR_RX][ch])); for(const size_t ch : args.channels) _rx_streamers[ch] = stream; if (args.channels.empty()) _rx_streamers[0] = stream; return stream; } /*********************************************************************** * TX Streaming **********************************************************************/ class UHDSoapyTxStream : public uhd::tx_streamer { public: UHDSoapyTxStream(SoapySDR::Device *d, const uhd::stream_args_t &args): _active(false), _device(d), _stream(make_stream(d, SOAPY_SDR_TX, args)), _nchan(std::max(1, args.channels.size())), _elemSize(uhd::convert::get_bytes_per_item(args.cpu_format)) { _offsetBuffs.resize(_nchan); } ~UHDSoapyTxStream(void) { if (_active) _device->deactivateStream(_stream); _device->closeStream(_stream); } size_t get_num_channels(void) const { return _nchan; } size_t get_max_num_samps(void) const { return _device->getStreamMTU(_stream); } size_t send( const buffs_type &buffs, size_t nsamps_per_buff, const uhd::tx_metadata_t &md, const double timeout = 0.1 ) { //perform activation at the latest/on the first call to send if (not _active) { _device->activateStream(_stream); _active = true; } size_t total = 0; const long long timeNs(md.time_spec.to_ticks(1e9)); while (total < nsamps_per_buff) { int flags = 0; size_t numElems = (nsamps_per_buff-total); if (md.has_time_spec and total == 0) flags |= SOAPY_SDR_HAS_TIME; if (md.end_of_burst) flags |= SOAPY_SDR_END_BURST; for (size_t i = 0; i < _nchan; i++) _offsetBuffs[i] = ((char *)buffs[i]) + total*_elemSize; int ret = _device->writeStream(_stream, &(_offsetBuffs[0]), numElems, flags, timeNs, long(timeout*1e6)); if (ret == SOAPY_SDR_TIMEOUT) break; if (ret < 0) throw std::runtime_error(str(boost::format("UHDSoapyTxStream::send() = %d") % ret)); total += ret; } //implement deactivation hook for very last sample consumed on end of burst if (_active and md.end_of_burst and total == nsamps_per_buff) { _device->deactivateStream(_stream); _active = false; } return total; } bool recv_async_msg(uhd::async_metadata_t &md, double timeout = 0.1) { size_t chanMask = 0; int flags = 0; long long timeNs = 0; int ret = _device->readStreamStatus(_stream, chanMask, flags, timeNs, long(timeout*1e6)); //save the first channel found in the mask md.channel = 0; for (size_t i = 0; i < _nchan; i++) { if ((chanMask & (1 << i)) == 0) continue; md.channel = i; break; } //convert the time md.has_time_spec = (flags & SOAPY_SDR_HAS_TIME) != 0; md.time_spec = uhd::time_spec_t::from_ticks(timeNs, 1e9); //check flags if ((flags & SOAPY_SDR_END_BURST) != 0) { md.event_code = uhd::async_metadata_t::EVENT_CODE_BURST_ACK; } //set event code based on ret switch (ret) { case SOAPY_SDR_TIMEOUT: return false; case SOAPY_SDR_STREAM_ERROR: md.event_code = uhd::async_metadata_t::EVENT_CODE_SEQ_ERROR; break; case SOAPY_SDR_NOT_SUPPORTED: md.event_code = uhd::async_metadata_t::EVENT_CODE_USER_PAYLOAD; break; case SOAPY_SDR_TIME_ERROR: md.event_code = uhd::async_metadata_t::EVENT_CODE_TIME_ERROR; break; case SOAPY_SDR_UNDERFLOW: md.event_code = uhd::async_metadata_t::EVENT_CODE_UNDERFLOW; break; } return true; } private: bool _active; SoapySDR::Device *_device; SoapySDR::Stream *_stream; const size_t _nchan; const size_t _elemSize; std::vector _offsetBuffs; }; uhd::tx_streamer::sptr UHDSoapyDevice::get_tx_stream(const uhd::stream_args_t &args) { uhd::tx_streamer::sptr stream(new UHDSoapyTxStream(_device, args)); for(const size_t ch : args.channels) _tx_streamers[ch] = stream; if (args.channels.empty()) _tx_streamers[0] = stream; return stream; } bool UHDSoapyDevice::recv_async_msg(uhd::async_metadata_t &md, double timeout) { auto stream = _tx_streamers[0].lock(); if (not stream) return false; return stream->recv_async_msg(md, timeout); } /*********************************************************************** * Soapy Logger handle forward to UHD **********************************************************************/ static void UHDSoapyLogger(const SoapySDR::LogLevel logLevel, const char *message) { #define component "UHDSoapyDevice" switch(logLevel) { #ifdef UHD_HAS_MSG_HPP case SOAPY_SDR_FATAL: case SOAPY_SDR_CRITICAL: case SOAPY_SDR_ERROR: UHD_MSG(error) << message << std::endl; break; case SOAPY_SDR_WARNING: UHD_MSG(warning) << message << std::endl; break; case SOAPY_SDR_NOTICE: case SOAPY_SDR_INFO: case SOAPY_SDR_DEBUG: case SOAPY_SDR_TRACE: UHD_MSG(status) << message << std::endl; break; case SOAPY_SDR_SSI: UHD_MSG(fastpath) << message << std::flush; break; #else case SOAPY_SDR_FATAL: case SOAPY_SDR_CRITICAL: UHD_LOG_FATAL(component, message); break; case SOAPY_SDR_ERROR: UHD_LOG_FATAL(component, message); break; case SOAPY_SDR_WARNING: UHD_LOG_WARNING(component, message); break; case SOAPY_SDR_NOTICE: case SOAPY_SDR_INFO: UHD_LOG_INFO(component, message); break; case SOAPY_SDR_DEBUG: case SOAPY_SDR_TRACE: UHD_LOG_TRACE(component, message); break; case SOAPY_SDR_SSI: UHD_LOG_FASTPATH(message); break; #endif } } /*********************************************************************** * Registration **********************************************************************/ static uhd::device::sptr makeUHDSoapyDevice(const uhd::device_addr_t &device_addr) { SoapySDR::registerLogHandler(&UHDSoapyLogger); return uhd::device::sptr(new UHDSoapyDevice(device_addr)); } static uhd::device_addrs_t findUHDSoapyDevice(const uhd::device_addr_t &args_) { //prevent going into the the SoapyUHDDevice SoapySDR::Kwargs args(dictToKwargs(args_)); if (args.count(SOAPY_UHD_NO_DEEPER) != 0) return uhd::device_addrs_t(); //when driver is specified and its not uhd, we can go deeper... if (args.count("driver") != 0 and args.at("driver") != "uhd"){} else args[SOAPY_UHD_NO_DEEPER] = ""; //otherwise no-deeper //type filter for soapy devices if (args.count("type") != 0 and args.at("type") != "soapy") return uhd::device_addrs_t(); uhd::device_addrs_t result; for(SoapySDR::Kwargs found : SoapySDR::Device::enumerate(args)) { found.erase(SOAPY_UHD_NO_DEEPER); result.push_back(kwargsToDict(found)); result.back()["type"] = "soapy"; if (found.count("serial") == 0) { auto serial = std::hash()(SoapySDR::KwargsToString(found)); result.back()["serial"] = std::to_string(serial); } } return result; } UHD_STATIC_BLOCK(registerUHDSoapyDevice) { #ifdef UHD_HAS_DEVICE_FILTER uhd::device::register_device(&findUHDSoapyDevice, &makeUHDSoapyDevice, uhd::device::USRP); #else uhd::device::register_device(&findUHDSoapyDevice, &makeUHDSoapyDevice); #endif } SoapyUHD-soapy-uhd-0.4.1/debian/000077500000000000000000000000001373175511200163065ustar00rootroot00000000000000SoapyUHD-soapy-uhd-0.4.1/debian/changelog000066400000000000000000000035031373175511200201610ustar00rootroot00000000000000soapyuhd (0.4.1-1) unstable; urgency=low * Release 0.4.1 (2020-09-20) -- Josh Blum Sun, 20 Sep 2020 17:40:02 -0000 soapyuhd (0.4.0-1) unstable; urgency=low * Release 0.4.0 (2020-09-17) -- Josh Blum Thu, 17 Sep 2020 10:06:00 -0000 soapyuhd (0.3.6-1) unstable; urgency=low * Release 0.3.6 (2019-06-22) -- Josh Blum Sat, 22 Jun 2019 07:51:53 -0000 soapyuhd (0.3.5-1) unstable; urgency=low * Release 0.3.5 (2018-12-07) -- Josh Blum Fri, 07 Dec 2018 21:13:46 -0000 soapyuhd (0.3.4-1) unstable; urgency=low * Release 0.3.4 (2017-12-14) -- Josh Blum Thu, 14 Dec 2017 19:43:38 -0000 soapyuhd (0.3.3-1) unstable; urgency=low * Release 0.3.3 (2017-04-29) -- Josh Blum Sat, 29 Apr 2017 15:11:18 -0000 soapyuhd (0.3.2-1) unstable; urgency=low * Release 0.3.2 (2017-01-22) -- Josh Blum Sun, 22 Jan 2017 14:54:04 -0800 soapyuhd (0.3.1) unstable; urgency=low * Release 0.3.1 (2016-08-13) -- Josh Blum Sat, 13 Aug 2016 09:28:14 -0700 soapyuhd (0.3.0) unstable; urgency=low * Release 0.3.0 (2015-11-20) -- Josh Blum Fri, 23 Oct 2015 21:01:40 -0700 soapyuhd (0.2.0) unstable; urgency=low * Release 0.2.0 (2015-10-10) -- Josh Blum Sat, 10 Oct 2015 11:16:37 -0700 soapyuhd (0.1.2) unstable; urgency=low * Release 0.1.2 (2015-09-13) -- Josh Blum Sun, 13 Sep 2015 00:01:42 -0700 soapyuhd (0.1.1) unstable; urgency=low * Release 0.1.1 (2015-08-15) -- Josh Blum Sat, 15 Aug 2015 11:32:27 -0700 soapyuhd (0.1.0) unstable; urgency=low * Release 0.1.0 (2015-06-15) -- Josh Blum Mon, 15 Jun 2015 12:29:52 -0400 SoapyUHD-soapy-uhd-0.4.1/debian/compat000066400000000000000000000000021373175511200175040ustar00rootroot000000000000009 SoapyUHD-soapy-uhd-0.4.1/debian/control000066400000000000000000000022031373175511200177060ustar00rootroot00000000000000Source: soapyuhd Section: libs Priority: optional Maintainer: Josh Blum Build-Depends: debhelper (>= 9.0.0), cmake, libboost-all-dev, libuhd-dev, libsoapysdr-dev Standards-Version: 4.1.4 Homepage: https://github.com/pothosware/SoapyUHD/wiki Vcs-Git: https://github.com/pothosware/SoapyUHD.git Vcs-Browser: https://github.com/pothosware/SoapyUHD Package: soapysdr0.7-module-uhd Architecture: any Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends} Description: Soapy UHD - UHD devices for Soapy SDR. A Soapy module that supports UHD devices within the Soapy API. Package: soapysdr-module-uhd Architecture: all Depends: soapysdr0.7-module-uhd, ${misc:Depends} Description: Soapy UHD - UHD devices for Soapy SDR. A Soapy module that supports UHD devices within the Soapy API. . This is an empty dependency package that pulls in the USRP module for the default version of libsoapysdr. Package: uhd-soapysdr Architecture: any Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends} Description: Soapy UHD - Soapy SDR devices for UHD. A UHD module that supports Soapy devices within the UHD API. SoapyUHD-soapy-uhd-0.4.1/debian/copyright000066400000000000000000000005611373175511200202430ustar00rootroot00000000000000Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: soapyuhd Source: https://github.com/pothosware/SoapyUHD/wiki Files: * Copyright: 2014-2016 Josh Blum License: GPL-3 On Debian systems, the full text of the GNU General Public License version 3 can be found in the file `/usr/share/common-licenses/GPL-3'. SoapyUHD-soapy-uhd-0.4.1/debian/docs000066400000000000000000000000221373175511200171530ustar00rootroot00000000000000COPYING README.md SoapyUHD-soapy-uhd-0.4.1/debian/rules000077500000000000000000000014001373175511200173610ustar00rootroot00000000000000#!/usr/bin/make -f # -*- makefile -*- DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) export DEB_HOST_MULTIARCH # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh $@ --buildsystem=cmake --parallel override_dh_auto_configure: dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" override_dh_installchangelogs: dh_installchangelogs Changelog.txt #Note: uhd 3.10 broke the multi-arch module support. #The rules file creates a symlink to work around this. override_dh_install: mkdir -p $(CURDIR)/debian/tmp/usr/lib/uhd/modules/$(DEB_HOST_MULTIARCH) ln -s /usr/lib/$(DEB_HOST_MULTIARCH)/uhd/modules/libsoapySupport.so \ $(CURDIR)/debian/tmp/usr/lib/uhd/modules/$(DEB_HOST_MULTIARCH)/libsoapySupport.so dh_install SoapyUHD-soapy-uhd-0.4.1/debian/soapysdr0.7-module-uhd.install000066400000000000000000000000341373175511200240250ustar00rootroot00000000000000usr/lib/*/SoapySDR/modules* SoapyUHD-soapy-uhd-0.4.1/debian/source/000077500000000000000000000000001373175511200176065ustar00rootroot00000000000000SoapyUHD-soapy-uhd-0.4.1/debian/source/format000066400000000000000000000000141373175511200210140ustar00rootroot000000000000003.0 (quilt) SoapyUHD-soapy-uhd-0.4.1/debian/uhd-soapysdr.install000066400000000000000000000002311373175511200223140ustar00rootroot00000000000000usr/lib/*/uhd/modules/ #Note: uhd 3.10 broke the multi-arch module support. #The rules file creates a symlink to work around this. usr/lib/uhd/modules/