aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/utils
Commit message (Collapse)AuthorAgeFilesLines
* utils: Check install-prefix for imagesSteven Koo2022-04-191-8/+11
| | | | | | | | On some installs, pkg-path and install-prefix aren't equivalent. Since uhd_images_downloader defaults to installing into $CMAKE_INSTALL_PREFIX/share/uhd/images, we should look there too. Signed-off-by: Steven Koo <steven.koo@ni.com>
* log: Add DPDK version to system infomattprost2022-04-011-2/+8
| | | | | | Log installed DPDK version on boot. Signed-off-by: mattprost <matt.prost@ni.com>
* host: test: Add UHD_UNITTEST_LOG_LEVEL overrideLane Kolbly2022-03-111-19/+35
|
* rfnoc: graph_utils: Add ability to declare back-edgesMartin Braun2022-02-241-3/+7
| | | | | | | rfnoc::connect_through_blocks(), unlike rfnoc_graph::connect(), did not have an argument to declare a back-edge. This patch remedies this situation by adding a skip_property_propagation argument that works exactly as with rfnoc_graph::connect().
* uhd: rfnoc: Let connect_through_blocks() return edge listMartin Braun2022-02-041-1/+2
| | | | | | This changes the return value of connect_through_blocks() from void to a list of edges. If the connection can be made, then it will now return the list of connections between the source block and port.
* uhd: Demote WARNING on minor compat mismatch to DEBUGMartin Braun2022-01-251-2/+2
| | | | | | | | | | | | When the minor FPGA compat number on the device is ahead of what MPM expects, we no longer print a warning. That's because by definition, the FPGA is still compatible with the software in this case. If UHD requires a certain minor compat number to enable a feature, the appropriate behaviour would be to print a warning only for that case. This is the equivalent change to the MPM-only change in 88d28481.
* rfnoc: Fix issue in uhd::rfnoc::connect_through_blocks()Martin Braun2021-12-011-6/+9
| | | | | | | | | | | | | | | | | | | | | | | When connect_through_blocks() was called on blocks within a single chain, there was a bug where the chain was incorrectly cropped. In a standard FPGA image, say one was to use this API call to connect the radio to the DDC. It would generate a chain of blocks hanging off the radio as such: Radio -> DDC -> SEP What the code should do, and what this fix provides, is that the chain gets cropped after the DDC, to look like this: Radio -> DDC With the current bug, it would assume the chain has a dangling edge, and incorrectly throw an exception. Note that this bug would not appear when source and destination block are on separate chains (i.e., both have an SEP in their chain). This patch includes minor logging and comment improvements around the offending lines of code.
* uhd: Fix spelling errorsA. Maitland Bottoms2021-10-221-1/+1
| | | | Thanks to Mait for pointing these out!
* uhd: Replace Boost mutexes and locks with standard optionsMartin Braun2021-10-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a very mechanical task that could almost have been done with sed. Boost versions of mutexes and locks were removed, and replaced with std:: versions. The replacement tables are as follows: == Mutexes == - boost::mutex -> std::mutex - boost::recursive_mutex -> std::recursive_mutex Mutexes behave identically between Boost and std:: and have the same API. == Locks == C++11 has only two types of lock that we use/need in UHD: - std::lock_guard: Identical to boost::lock_guard - std::unique_lock: Identical to boost::unique_lock Boost also has boost::mutex::scoped_lock, which is a typedef for boost::unique_lock<>. However, we often have used scoped_lock where we meant to use lock_guard<>. The name is a bit misleading, "scoped lock" sounding a bit like an RAII mechanism. Therefore, some previous boost::mutex::scoped_lock are now std::lock_guard<>. std::unique_lock is required when doing more than RAII locking (i.e., unlocking, relocking, usage with condition variables, etc.). == Condition Variables == Condition variables were out of the scope of this lock/mutex change, but in UHD, we inconsistently use boost::condition vs. boost::condition_variable. The former is a templated version of the latter, and thus works fine with std::mutex'es. Therefore, some boost::condition_variable where changed to boost::condition. All locks and mutexes use `#include <mutex>`. The corresponding Boost includes were removed. In some cases, this exposed issues with implicit Boost includes elsewhere. The missing explicit includes were added.
* cmake: Add check for libatomic linking requirementMartin Braun2021-08-271-0/+15
| | | | | | | | | | Some archs require linking against libatomic, others don't. We add some CMake code that checks for libatomic.so requirement if: - We are not on MSVC, AND - Compiling std::atomics code would cause a linker error. We then check for the existence of libatomic.so, and fail if we can't find it.
* uhd: Remove Boost version checks for Boost 1.61Martin Braun2021-08-241-19/+4
| | | | | UHD requires Boost 1.65, so checks for Boost 1.61 will always be satisfied.
* uhd: Replace boost::thread::id with std::thread::idMartin Braun2021-07-142-4/+4
| | | | | | | | The Boost version is identical to the std:: version (which is available since C++11) and thus is no longer needed. Because of implicit includes, this breaks compilation in other parts. Appropriate includes were added there also.
* cmake: remove redundant includeMichael Dickens2021-07-061-1/+0
|
* cmake: correctly set and unset any CMAKE_REQUIRED variablesMichael Dickens2021-07-061-5/+5
|
* host: Update code base using clang-tidyMartin Braun2021-03-042-8/+8
| | | | | | | | | The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json
* chdr: Fix u64_to_host vs. u64_from_host usageMartin Braun2021-01-111-1/+1
|
* lib: graph_utils: Error on single SEP edgeSteven Koo2020-09-251-10/+14
| | | | | It could be possible that we only find one SEP connected edge, which should be invalid.
* lib: graph_utils: Fix formatting and compiler warningsMartin Braun2020-09-251-13/+15
| | | | | | | | | | | The conditional setting of some variables lead the compiler to assume they might be used uninitialized. Circumventing compiler warning by initializing variables to a default value, even if that's not the right value (they will get set later). Also applied clang-format to the same code section. This fixes da1aeaeccc.
* rfnoc: enable SEPs with connect_through_blocksSteven Koo2020-08-281-2/+24
| | | | | | | | Calling on connect with SEPs in the path is not supported. This change enables connect_through_blocks to find SEPs in the connection chain and link the src and dest blocks directly. Signed-off-by: Steven Koo <steven.koo@ni.com>
* python: Add bindings for C++ CHDR ParserSamuel O'Brien2020-07-161-0/+369
| | | | | | | | | | | | | This commit adds pybind11 glue code for the userland chdr parsing code introduced in the uhd::utils::chdr namespace. Additionally, it moves some pybind11 adapter code to a common pybind_adaptors.hpp file which originally existed in the cal_python.hpp file. This commit also adds unit tests for the python bindings using a captured wireshark trace which is located in rfnoc_packets_*.py and some handwritten packets in hardcoded_packets.py Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
* utils: Expose CHDR Parsing APISamuel O'Brien2020-07-133-0/+179
| | | | | | | | | | | | This commit introduces a new public api in uhd::utils which allows serializing and deserializing chdr packets. As far as testing, this commit adds the chdr_parse_test test. It uses a wireshark trace located in rfnoc_packets_*.cpp as well as hand coded packets from hardcoded_packets.cpp to test the serialization and deserialization process Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
* utils: Fix prefix determination in get_lib_path()Ryan Volz2020-07-131-1/+3
| | | | | | | | | | | | | | | | | | | | get_lib_path() uses the libuhd location on disk to dynamically determine the installation prefix at runtime. This fix normalizes the libuhd path before any path operations are done to extract the library directory and then prefix directory. Previously, using a non-normalized library path, the returned prefix directory would be incorrect in some cases (e.g. when loaded through GNU Radio). In these error cases, the libuhd path would be $PREFIX/lib/./libuhd.so (with a no-op /. inserted) which would result in a technically correct library directory of `$PREFIX/lib/.` but an incorrect prefix directory of `$PREFIX/lib`. With the normalization fix, the libuhd path is corrected to $PREFIX/lib/libuhd.so and the subsequent path manipulation to get the library and prefix directories will work as intended.
* uhd: improved handling of empty serial number hintsMatthew Crymble2020-06-261-0/+2
| | | | | This allows device::find() calls to proceed even when encountering an empty/invalid serial number or serial number device argument hint.
* utils: log: fix logging race conditionmattprost2020-04-141-1/+3
| | | | | | | It was possible that output to cout would become interleaved inside of the uhd log messages. Signed-off-by: mattprost <matt.prost@ni.com>
* fixup! uhd: Add fuzzy serial number checkingmattprost2020-04-091-3/+2
|
* uhd: Add fuzzy serial number checkingLane Kolbly2020-04-082-0/+24
| | | | | | | | | We have integer 32-bit serial numbers for MPM devices, for example "1234abcd". For serial numbers which have less than eight digits, e.g. "123abcd", a user may feel inclined to prefix this number with a 0 when they are searching for devices, e.g. "0123abcd". This change makes it so that specifying "0123abcd" will match a device with serial number "123ABCD".
* uhd: paths: Harmonize around XDG Base Directory specificationMartin Braun2020-04-023-34/+115
| | | | | | | | | | | | | | | | | | | | | | Up until now, we completely ignore the XDG specification. This commit does the following to change that: - It uses XDG_DATA_HOME and XDG_CONFIG_HOME for cal and config data, respectively. - If config data is in ~/.uhd/uhd.conf, that is still accepted, but if it conflicts with $XDG_CONFIG_HOME/uhd.conf, it is ignored and a warning is displayed - The default location for cal data is thus ${HOME}/.local/share/uhd/cal on Unix, and %LOCALAPPDATA%\uhd\cal on Windows. This is a change in location! - The UHD_CONFIG_DIR environment variable was confusingly named and is now removed. It provided an alternative location than the home directory. The same purpose is now much better served by XDG_DATA_HOME and XDG_CONFIG_HOME. The specification can be found here: specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
* uhd: cal: Use usrp::cal::database instead of CSV filesMartin Braun2020-04-021-0/+26
| | | | | | | | | Now that we have cal::iq_cal and cal::database, there's no need to manually wrangle CSV files for calibration data. This commit replaces all CSV operations with cal::database calls and uses cal::iq_cal as a container. CSV files can still be read, but are considered deprecated.
* uhd: paths: Add get_cal_data_path() API callMartin Braun2020-03-261-0/+19
| | | | This points to the location where cal data is stored.
* utils: Add bool specialization to cast::from_str()Aaron Rossetto2020-03-181-0/+25
| | | | | | | This adds a specialization to `uhd::cast::from_str()` to handle `bool` as a target type and interpret strings like 'y', 'Y', 'n', 'No', 'True', 'False', etc. as Boolean values, as well as the traditional '0' and '1' (which also work).
* python: Export UHD paths utility functionsMartin Braun2020-03-121-0/+24
| | | | | | | | | All of the functions defined in uhd/utils/paths.hpp are now available in Python, with the exception of get_module_paths(). #!/usr/bin/env python3 import uhd print(uhd.get_lib_path()) # Prints location of libuhd
* lib: gain_group: Remove spurious logsMartin Braun2020-03-121-2/+0
| | | | | | Whenever gains where set through a gain_group, it would output spurious log messages that must stem from someone's debug code, since the log messages are not very useful by themselves.
* uhd: Apply clang-format against all .cpp and .hpp files in host/Martin Braun2020-03-0316-478/+479
| | | | | Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of files that clang-format gets applied against.
* thread: Fix formatting in thread utilitiesMartin Braun2020-02-101-132/+144
| | | | | - Apply clang-format - Remove unnecessary boost::format
* lib: utils: Don't use hard-coded path constantsRyan Volz2020-02-071-2/+24
| | | | | | | | | | | | | This replaces the package path constant with a runtime library path lookup. The package path is taken to be the parent directory of the library directory. When boost >= 1.61 is not available, this maintains the current behavior of using CMake to set path contants. Runtime path determination is preferable for making a relocatable library so that it is not necessary to do string substitution on relocated binaries (as with, for example, building a conda package).
* log: Remove LOG statement from _get_log_level()Martin Braun2020-01-291-2/+1
| | | | | | _get_log_level() is an internal function that only gets called during setup, so the logger isn't ready yet. It thus now logs to stderr instead of the logger.
* utils: log: Name all threadsMartin Braun2020-01-291-5/+16
| | | | | | Logging creates two threads, one for regular logging, and one for fastpath logging. Now these threads are named using uhd::set_thread_name()
* thread: Remove log messages for set_thread_name() when not supportedMartin Braun2020-01-291-10/+14
| | | | | | | | | | | On systems like Windows, set_thread_name() is not supported, and would previously log an error message telling the user that it can't set the thread name. However, that prevents set_thread_name() to be called before the logger is being set up, and the logger would like to use this function. Since it is obvious to the user if threads can be named or not, the log message is considered redundant and is removed.
* prefs: Output debug trace when config file cannot be located or loadedAaron Rossetto2019-12-172-8/+14
|
* prefs: Set init_done flag to true after loading config filesMartin Braun2019-12-051-0/+1
| | | | | | | The prefs API is supposed to load the config files once, and stash them away for the process to consume at will. Because the init_done is never set, it will read the config files every time it's asked for them. This is usually not a problem, but it causes the logging output to be messy.
* utils: tasks: Use uhd::set_thread_name()Martin Braun2019-11-261-3/+1
| | | | | This is a more portable option to set thread names. References to pthreads are now limited to thread.cpp, where they belong.
* docs: Change DPDK version to 18.11 and make args use underscoresAlex Williams2019-11-261-1/+1
| | | | | Swap out hyphens for underscores in the DPDK args. Also update list of distributions with the correct DPDK version in the repos.
* uhd: Replace all occurrences of boost::bind with std::bindMartin Braun2019-11-264-13/+15
| | | | | | | | | | | | | | | | | | | | | Note: Replacing everything with a lambda would be even better, but that can't be easily scripted so we'll do this as a first step to reduce the Boost footprint. This also removes occurences of #include <boost/bind.hpp>, and makes sure all usages of std::bind have an #include <functional>. clang-format wasn't always applied to minimize the changeset in this commit, however, it was applied to the blocks of #includes. Due to conflicts with other Boost libraries, the placeholders _1, _2, etc. could not be directly used, but had to be explicitly called out (as std::placeholders::_1, etc.). This makes the use of std::bind even uglier, which serves as another reminder that using std::bind (and even more so, boost::bind) should be avoided. nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It was not possible to remove it by simply doing a search and replace, so it will be removed in a separate commit.
* rfnoc: Adding rfnoc_graph utilitiesBrent Stapleton2019-11-262-0/+134
| | | | | | | Adding graph_utils to keep rfnoc_graph utilities to contain helper function and commonly used algorithms for the rfnoc_graph. These functions aren't core to the rfnoc_graph's functionality, so we'll keep them out of its API.
* uhd: Replace boost::regex with std::regexMartin Braun2019-11-261-5/+5
| | | | | | | | boost::regex was a requirement until the minimum version of gcc was increased. Since it is at version 5.3 now, using Boost.Regex is no longer necessary. This change is a pure search-and-replace; Boost and std versions of regex are compatible and use the same syntax.
* uhd: Replace usage of boost smart pointers with C++11 counterpartsMartin Braun2019-11-262-4/+4
| | | | | | | | | | | | | | | | | | | This removes the following Boost constructs: - boost::shared_ptr, boost::weak_ptr - boost::enable_shared_from_this - boost::static_pointer_cast, boost::dynamic_pointer_cast The appropriate includes were also removed. All C++11 versions of these require #include <memory>. Note that the stdlib and Boost versions have the exact same syntax, they only differ in the namespace (boost vs. std). The modifications were all done using sed, with the exception of boost::scoped_ptr, which was replaced by std::unique_ptr. References to boost::smart_ptr were also removed. boost::intrusive_ptr is not removed in this commit, since it does not have a 1:1 mapping to a C++11 construct.
* lib: Simplify implementation of uhd::get_system_time() to use <chrono>Martin Braun2019-11-262-108/+8
| | | | | | | uhd::get_system_time() is currently only used in USRP1 code, and it turns out that our "optimized", platform-dependent implementation still is a little slower than straight-up chrono. We therefore remove all the special cases, and replace them with a single, standard solution.
* gain groups: FormattingBrent Stapleton2019-11-261-64/+77
| | | | Applying formatting in anticipation of upcoming changes.
* gain_groups: Add zero-value gain groupsBrent Stapleton2019-11-261-0/+11
| | | | | | | | | | | | | | | Add convenience factory for making a gain group that has a single zero-valued element. This factory requires a name, which should probably be ALL_GAINS, or something similar (these constants are device-specific). Using this new make_zero factory in the X300 radio control when we don't find any gain elements so that our gain groups aren't empty. This simplifies our later setters/getters because we know that we'll always have _something_ cached. Note that we only register this zero value gain group for TX, as our ADC is registered as a gain element, so our RX gain groups are never empty.
* uhd: Add thread affinity utility functionsAaron Rossetto2019-11-262-11/+117
|