Commit graph

51 commits

Author SHA1 Message Date
Martin Braun
b6119e581e uhd: Replace Boost mutexes and locks with standard options
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.
2021-10-19 12:21:33 -07:00
Martin Braun
107a49c0c2 host: Update code base using clang-tidy
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
2021-03-04 08:07:26 -06:00
Lane Kolbly
843527d303 uhd: mpm: Query prefs per-device for multi-device queries
If a user specifies a multi-device query, such as "serial0=1234,serial1=4321",
we have to look up the preferences for each device. To minimize the
impact to non-x400 devices, I simply push the get_usrp_args call down
into mpmd_impl and mpmd_find.
2020-04-08 15:32:50 -05:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Andrew Lynch
2362b3b3fb device: read in preferences file before discovery 2020-02-26 08:05:54 -06:00
Martin Braun
72b45bb8de uhd: Remove all usages of boost::tuple and friends
This replaces all of the following with standard C++ features:

- boost::tuple
- boost::make_tuple
- boost::tuple::get
- #include <boost/tuple/tuple.hpp>

All usages were replaced with search-and-replace scripts (the usages of
get could be automatically replaced with a vim macro, the rest was
straightforward search-and-replace).
2019-11-26 12:21:32 -08:00
Martin Braun
1fe98e8701 uhd: Replace usage of boost smart pointers with C++11 counterparts
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.
2019-11-26 12:21:32 -08:00
Martin Braun
ab1c74c7e4 lib: device: Parallelize device discovery 2018-07-31 10:05:03 -07:00
Martin Braun
cf644768c4 uhd: device: Auto-apply config file options to USRPs 2018-02-20 16:23:46 -08:00
Martin Braun
ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00
Martin Braun
db73d59969 uhd: Remove keys from device hashing 2017-12-22 15:05:05 -08:00
Martin Braun
4f948e2c8b Move all license headers to SPDX format. 2017-12-22 10:45:51 -08:00
trungnob
b431866a5e log: Remove logging out of any UHD_STATIC_BLOCK.
Window DLL loading is causing deadlock due to thread creation and
synchronization of logging system; therefore, we want to remove it for
now.
2017-05-20 21:21:59 -07:00
Martin Braun
282d57591b logging: Demoted more DEBUG to TRACE 2017-04-06 23:34:22 -07:00
Andrej Rode
21aad77c9c utils: introduce new logging API and remove msg API 2017-02-20 17:13:15 -08:00
Andrej Rode
26cc20847c uhd: replace BOOST_FOREACH with C++11 range-based for loop
Note: This is the first commit that uses for-range, and range-based
for-loops are now usable for UHD development.
2017-02-10 16:44:33 -08:00
meserve
ee4bb48868 device: change hashing test logic from try-throw-catch to if-else
Allows to trigger on catches during debugging.

Reviewed-By: Martin Braun <martin.braun@ettus.com>
2016-11-18 17:25:39 -08:00
Paul David
b28fcee599 transport optimize: Integrated the transport offloading into the X3XX codebase 2016-04-18 12:23:45 -07:00
Marcus Müller
499bcc0238 uhd: Fixed: Exception during detection kills device::make
On systems with libusb but not USB, device detection for USB
devices fails (lsusb itself dies with "error -99").
This crashes the device detection process itself.

Also made the documentation for ::make match what it actually does.
2015-03-03 14:12:43 -08:00
Ashish Chaudhari
cca1028717 x300,nirio: Added support for NI-RIO 14.0
- Split niriok_proxy interfaces to support NI-RIO <=13.0 and >=14.0 kernel interfaces
- Fixed multi-session race conditions by synchronizing niriok_proxy access
- Fixed bug switching from NI LV-FPGA access to UHD access by changing how devices are hashed into a reservation table
- Fixed calculation of FRAC values for CBX and SBX LO tuning by rounding instead of truncating
- Fixed bug that was not setting two MSBs for band select configuration of CBX LO
- Submitting on behalf of Patrick Sisterhen, Matthew Crymble
2014-10-10 17:24:40 -07:00
Nicholas Corgan
654c5b06c0 Added missing pure virtual destructors to base classes 2014-09-01 17:58:24 +02:00
Nicholas Corgan
a6e18604be OctoClock firmware upgrade, added host driver
* OctoClock can communicate with UHD over Ethernet
* Can read NMEA strings from GPSDO and send to host
* Added multi_usrp_clock class for clock devices
* uhd::device can now filter to return only USRP devices or clock devices
* New OctoClock bootloader can accept firmware download over Ethernet
* Added octoclock_burn_eeprom,octoclock_firmware_burner utilities
* Added test_clock_synch example to show clock API
2014-07-23 07:37:32 -07:00
Ben Hilburn
178ac3f1c9 Merging USRP X300 and X310 support!! 2014-02-04 11:04:07 -08:00
Josh Blum
9734a74366 uhd: various tweaks to log and msg, replaced a few remaining stdio 2011-05-04 20:40:36 -07:00
Josh Blum
805da3ef3d usrp-e100: removed stdio prints from implementation 2011-05-04 19:13:33 -07:00
Josh Blum
4335003e2e uhd: added scoped lock to device find and make (for thread safety) 2011-04-26 12:04:07 -07:00
Josh Blum
95b966a599 uhd: update copyright headers with automated script 2011-03-23 18:48:30 -07:00
Josh Blum
1526889803 uhd: switch algorithm namespace to uhd 2011-02-24 17:28:10 -08:00
Josh Blum
4357f5d3c0 uhd: replaced instanced of std::exception with the uhd exceptions 2011-02-24 16:35:29 -08:00
Josh Blum
16f08844d7 uhd: renamed the assert header to assert has
only the assert has implementation is in this header

uhd assert throw moved to the exception header

updated code base includes to match
2011-02-24 14:54:24 -08:00
Josh Blum
4066b1f8fd uhd: added a bunch of custom exceptions, not used yet 2011-02-24 14:07:11 -08:00
Josh Blum
348b5b12ad usb: catch open errors and print message, device: catch exceptions at discovery time 2010-10-01 11:54:22 -07:00
Josh Blum
bbe7dd1c8f uhd: fix find-replace accident asize_t 2010-07-26 22:47:06 -07:00
Josh Blum
0c6fbdfe37 work on algorithms and documentation 2010-06-14 10:44:50 -07:00
Josh Blum
4d5df2376b Expanded the dboard id API to create dboard id types from strings and ints.
And created utility functions to go between representations.
Created to_pp_string for pretty print strings for dboard ids and device addrs.
Minor changes to the various classes that call these utilities.
2010-05-03 01:20:11 -07:00
Josh Blum
04dae4bf6b setting size of buffers from device args 2010-04-27 15:20:53 -07:00
Josh Blum
90ed2e3a80 prefixed the ASSERT_THROW macro with UHD for the sake of namespace 2010-04-26 14:42:32 -07:00
Josh Blum
ed5cb33eb4 renamed dict get key and value methods 2010-04-05 18:11:32 -07:00
Josh Blum
281307833c use find to discover devices 2010-03-30 15:11:23 -07:00
Josh Blum
1295df8cbb Added utility methods to device addr and mac addr to make them more usable. 2010-03-29 12:58:06 -07:00
Josh Blum
b71d0cbea9 refactored types.hpp into types directory 2010-03-27 14:27:55 -07:00
Josh Blum
52df9afd67 Split utils.hpp into subdir with multiple files.
static for static block and static instance (singleton)
assert for assertion and throwing related stuff
algorithm for my addons to std::algorithm (has)
and a new one, safe main, for having a main catch-all
2010-03-27 01:02:58 -07:00
Josh Blum
69aaffa6d8 got uhd almost compiling in windowze. figured out special flags. also had to use boost stdint because its missing in visual c++, added a bunch of numeric casts to reduce warnings 2010-03-17 17:55:20 -08:00
Josh Blum
6458eca954 Added recovery app to use raw socket to burn known ip addr.
Fixed up fw so the device can reply after new addrs are set.
2010-03-16 17:54:54 -07:00
Josh Blum
7590f187d0 Device sub classes can register themselves. Simplifies device.cpp internals.
Added static instance macro for lazy instantiation of static variables.
2010-03-15 12:15:33 -07:00
Josh Blum
daed43a8a8 Cleaned up the gain handler (thing that gets and sets wildcard gains)
and made use of it in the dboard manager so it intercepts the sets and gets.
While doing this, fixed something with nested links in wax obj.
Added some useful macros and templates to the utils.
2010-03-11 18:37:34 -08:00
Josh Blum
5715b2c493 Created empty usrp1e cpp file for the case when headers are not found.
Worked on the device make and discovery to fix certain problems.
Added node param to discover usrps for usrp1e, made addr optional.
2010-02-25 18:32:32 -08:00
Josh Blum
3571f65a11 use a single addr param for the usrp2 2010-02-25 12:48:51 -08:00
Josh Blum
3e5898fa11 Made the usrp2 impl into a device.
Removed the usrp device wrapper and usrp2 cpp file outside of the usrp2 lib dir.
Also removed the mboard base files since we wont be needing them.
2010-02-21 22:15:30 -08:00
Josh Blum
add5d32f9b Moved lib and include contents of dboard and mboard one directory up and prefixed them with dboard_ and mboard_.
And yes, the code is compiling.
2010-02-21 12:59:41 -08:00