aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/libusb1_zero_copy.cpp
Commit message (Collapse)AuthorAgeFilesLines
* uhd: Replace Boost mutexes and locks with standard optionsMartin Braun2021-10-191-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* libusb: Remove unused context variableMartin Braun2021-09-301-2/+5
| | | | | | | | | | | The USB managed buffer implementation created a context every time one was generated. The additional load is not very high, because the global session is a singleton, and simply returns the same context again with only a few branches. Also, managed buffers persist for the entire session. However, the context is never used in the managed buffer. This code is thus confusing for the reader of this code, and we remove the extraneous, unused context variable.
* host: Update code base using clang-tidyMartin Braun2021-03-041-9/+9
| | | | | | | | | 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
* uhd: Apply clang-format against all .cpp and .hpp files in host/Martin Braun2020-03-031-1/+3
| | | | | Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of files that clang-format gets applied against.
* uhd: Replace all occurrences of boost::bind with std::bindMartin Braun2019-11-261-4/+3
| | | | | | | | | | | | | | | | | | | | | 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.
* uhd: Replace boost::function with std::functionMartin Braun2019-11-261-3/+3
| | | | | | | This is mostly a search-and-replace operation, with few exceptions: - boost::function has a clear() method. In C++11, this is achieved by assigning nullptr to the std::function object. - The empty() method is replaced by std::function's bool() operator
* uhd: Replace usage of boost smart pointers with C++11 counterpartsMartin Braun2019-11-261-6/+6
| | | | | | | | | | | | | | | | | | | 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.
* Remove proto-RFNoC filesMartin Braun2019-11-261-6/+0
| | | | | | | This commit removes all files and parts of files that are used by proto-RFNoC only. uhd: Fix include CMakeLists.txt, add missing files
* transport: usb: Allow to cancel USB requests without throwingBehnam Sabaghi2019-07-181-1/+3
|
* lib: transport: apply clang-formatBrent Stapleton2019-01-181-149/+189
| | | | | | | | | | This is a continuation of 967be2a4. $ find host/lib/transport -iname *.hpp -o -iname *.cpp |\ xargs clang-format -i -style=file Skipping host/lib/transport/nirio/ because of build errors. $ git checkout host/lib/transport/nirio
* uhd: Update license headersMartin Braun2018-02-191-1/+2
| | | | | | | All copyright is now attributed to "Ettus Research, a National Instruments company". SPDX headers were also updated to latest version 3.0.
* Move all license headers to SPDX format.Martin Braun2017-12-221-12/+1
|
* utils: introduce new logging API and remove msg APIAndrej Rode2017-02-201-1/+1
|
* uhd: replace BOOST_FOREACH with C++11 range-based for loopAndrej Rode2017-02-101-4/+3
| | | | | Note: This is the first commit that uses for-range, and range-based for-loops are now usable for UHD development.
* usb: tweak types for consistency between LIBUSB API calls and internal UHD ↵Michael Dickens2016-08-011-5/+5
| | | | usage of returned values.
* usb: add virtual destructors where needed; make virtual destructors ↵Michael Dickens2016-08-011-0/+19
| | | | out-of-line from class definition to reduce number of vtables emitted (according to clang).
* usb: fix interfaces to be type 'int' and endpoints to be type 'unsigned ↵Michael Dickens2016-08-011-9/+9
| | | | char' to match the libusb API.
* Corrected the UHD behavior in the event of a USB disconnectDaulPavid2016-02-121-2/+2
|
* C API cleanup, feature additionsNicholas Corgan2015-08-121-2/+2
| | | | | | * Cleaned up usage of handles vs. handle pointers * Store global string for last error thrown * Removed uhd::device_addr_t handle, added std::vector<std::string> handle
* UHD: Change libusb_error_name() to libusb_strerror() to improve error outputmichael-west2015-08-121-2/+2
|
* b200: fix libusb exceptions to work with that expected by b200 impl ↵Michael Dickens2015-08-111-3/+3
| | | | exception handling which uses uhd::usb_error (not uhd::runtime_error).
* UHD: libusb_strerror compatibility with older versions of libusbmichael-west2015-08-061-17/+0
|
* libusb: Fixed Windows build issueAshish Chaudhari2015-08-061-5/+5
| | | | | | - Introduced in b08352f267730ea417ec345cd90833a6746a1114. ERROR is a macro included through some windows specific header. Replaced with STATUS_ERROR.
* Fix for BUG 869: UHD: Unhandled exceptions during destruction of multi_usrp ↵michael-west2015-08-051-20/+40
| | | | | | | object cause application to terminate - Prevented libusb_zero_copy_single from submitting transfers after libusb reports an error - Made error messages in libusb_zero_copy and udp_zero_copy more descriptive
* b200: Change init sequence to catch bad USB statesBalint Seeber2015-08-031-2/+2
| | | | | - Fixes USB hang issues on OS X - Uses usb_errors
* Warning fixesNicholas Corgan2015-03-271-1/+1
| | | | | | | * CMake now not applying C++ flags to C files * GCC 4.4: anti-aliasing rules * MSVC: narrowing, differences in subclass function parameters * Clang: uninitialized variables
* Merging USRP X300 and X310 support!!Ben Hilburn2014-02-041-5/+40
|
* BUG #183: Addressed comments from code review.Michael West2013-11-191-14/+15
|
* BUG #183: Fixed typoMoritz Fischer2013-11-111-1/+1
| | | | Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
* BUG #183: B200 High CPU Usage: Created a single thread to handle libusb ↵Michael West2013-11-081-53/+45
| | | | events and expanded packet size to 16k
* usb: squashed thread related changesJosh Blum2013-07-191-125/+194
|
* usb: useful error messages on failed submitJosh Blum2013-07-161-2/+13
|
* usb: check for and use libusb_handle_events_timeout_completedJosh Blum2013-03-111-2/+8
|
* usb: use int for completed to match libusb example codeJosh Blum2013-03-111-8/+9
|
* usb: added recv buffer flushing to libusb zero copyJosh Blum2012-08-041-1/+18
|
* uhd: squashed transport workJosh Blum2012-04-231-26/+21
|
* dsp rework: work on usb wrapper for smaller packets, large lutsJosh Blum2012-02-021-7/+10
|
* usb: added interface args to usb abstractionsJosh Blum2011-09-191-7/+11
|
* usb: reimplement ~libusb_zero_copy_impl to avoid segfaults and indefinite ↵Josh Blum2011-09-021-13/+13
| | | | timeouts
* usb: removed handler thread, do work in get buffer callsJosh Blum2011-09-021-85/+75
|
* uhd: added tasks to simplify thread spawning use casesJosh Blum2011-07-131-21/+13
|
* uhd: replaced boolean for thread loop w/ ↵Josh Blum2011-06-161-4/+1
| | | | boost::this_thread::interruption_requested
* b100: added b100 host (squashed)Josh Blum2011-06-141-11/+22
|
* uhd: replace managed buffer shared pointer w/ intrusive pointer to reduce ↵Josh Blum2011-05-141-10/+2
| | | | overhead
* uhd: replaced many conditional prints with UHD_LOG usageJosh Blum2011-05-041-2/+2
|
* uhd: move thread loop condition flag to before barrier (prevents race condition)Josh Blum2011-04-221-1/+1
|
* usb: mark libusb callbacks with LIBUSB_CALL to ensure correct calling conventionJosh Blum2011-04-051-2/+12
|
* uhd: implemented boost barriers on all code that creates threadsJosh Blum2011-03-311-2/+6
| | | | | | | | | The barrier ensures that the thread must spawn before the caller exits. Some of the code already used a mutex to accomplish this, however cygwin chokes when a mutex is locked twice by the same thread. Mutex implementations were replaced with the barrier implementation. Also the barrier implementation is far cleaner.
* usb: fix callback cast in libusb zero copy under msvcJosh Blum2011-03-211-1/+1
|
* Merge branch 'usb-cancel' into nextJosh Blum2011-03-171-6/+14
|\ | | | | | | | | Conflicts: host/lib/transport/libusb1_zero_copy.cpp