aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/utils
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* uhd: utils: Add compat check for 32-bit compat numbersMartin Braun2019-11-261-0/+18
|
* utils: cast: Add from_str() typecastMartin Braun2019-11-262-0/+40
| | | | | This is the inverse to std::to_string(), and we can overload it with UHD-internal types.
* utils: Added set_thread_name for std::threadAshish Chaudhari2019-11-261-0/+12
|
* cmake: Add UHD_COMPONENT variablemichael-west2019-10-151-1/+1
| | | | | | | | Added cmake variable to set the component (currently UHD or MPM). so the banner printed by the log_resource would reference the correct component. Added accessor function and appropriate calls in log.cpp. Signed-off-by: michael-west <michael.west@ettus.com>
* log: Honour log levels on session initMartin Braun2019-10-101-0/+3
| | | | | | | | | | The first log message of UHD is always something like this: [INFO] [UHD] linux; GNU C++ version [...] However, it was being printed regardless of the requested log level. This will disable all initial log messages if the requested log level is greater than INFO.
* logging: On POSIX, don't use logging colors on non-ttyMarcus Müller2019-10-091-1/+6
|
* log: Change logging coloursMartin Braun2019-05-071-3/+3
| | | | | | TRACE: Remains purple, but that's now no longer bright ERROR: Is now bright red (was non-bold red before) FATAL: Is now red-on-yellow
* log: Fix ANSI colour codesMartin Braun2019-05-071-7/+9
| | | | | | The colour codes used for console logging were incorrectly defined. Some colours would simply not rendered this way (e.g., red), others had the boldness flag wrong.
* log: fix deadlock issue on Windows machinesAbdo-Gaber2019-04-111-3/+32
| | | | | | | In log.cpp, a deadlock can occur while popping elements from the log queue. If the queue is empty, the call does not timeout, and waits infinitely. Replacing pop_with_wait() with pop_with_timed_wait() solves this issue.
* log: formatting log.cppBrent Stapleton2019-04-111-168/+133
| | | | `clang-format -i --style=file host/lib/utils/log.cpp`
* uhd: mpm: update all license header w/ "-or-later"Brent Stapleton2019-03-081-1/+1
| | | | Updating all SPDX license identifiers to include "-or-later"
* python: Replace Boost.Python with PyBind11Martin Braun2019-02-221-31/+0
| | | | | | This does not change the Python API itself, but it is still a significant change. Most importantly, it removes the dependency on Boost.Python.
* mpmd,transport,prefs: Add xport_mgr for dpdk_zero_copyAlex Williams2019-01-251-11/+34
| | | | | | | | | | | | | | | | | | | | | | | Add configuration sections to the UHD config file for NIC entries. Keys are based on MAC addresses, and the entries beneath the section describe which CPU and I/O thread to use for the NIC and its IPv4 address. Make ring sizes configurable for uhd-dpdk. Ring size is now an argument for packet buffers. Note that the maximum number of available buffers is still determined at init! Add ability to receive broadcasts to uhd-dpdk. This is controllable by a boolean in the sockarg during socket creation. dpdk_zero_copy will filter broadcast packets out. Add dpdk_simple transport (to mirror udp_simple). This transport allows receiving from broadcast addresses, but it only permits one outstanding buffer at a time. Fix IP checksum handling in UHD-DPDK. TX checksums were not being calculated in the NIC, and in RX, the check for IP checksums allowed values of zero (reported as none). Now packets with bad IP checksums will be dropped.
* cmake: Update coding style to use lowercase commandsMartin Braun2018-11-141-77/+77
| | | | | | | | | | | | | | | | | Also updates our coding style file. Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code (with GNU compliant sed): cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done > convert.sed \ && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \ '*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed (Make sure the backslashes don't get mangled!)