Commit graph

177 commits

Author SHA1 Message Date
Martin Braun
adfe953d96 uhd: Update ASIO usage to modern style, compatible with Boost 1.87
Starting with Boost 1.66 and the corresponding ASIO version, there were
some changes introduced based on the C++ Networking TS. This includes
changes like replacing io_service with io_context, deprecating some
functions, etc. Starting with Boost 1.87, the old style is no longer
supported.

This commit updates all usage of ASIO in a way that makes UHD compatible
with future versions of ASIO. However, this makes UHD no longer
compatible with Boost 1.65 and below.

Summary of changes:
- Replace asio::io_service with asio::io_context
- Replace asio::io_service::strand with
  asio::strand<asio::io_context::executor_type>
  - This implies using asio::post() instead of asio::strand::post()
- Replace asio::buffer_cast<T>(buf) with static_cast<T>(buf.data())
- Update resolve(query) with new API
- Replace references to endpoint_iterator with resolver::results_type
- Replace ip::address::from_string() with ip::make_address()

Co-authored-by: Jörg Hofrichter <joerg.hofrichter@emerson.com>
2024-12-11 14:37:26 +01:00
Martin Braun
c4eaf7ba5a usrp2: Remove unused code segments
This fixes compiler warnings under Clang12.
2022-06-17 06:45:04 -07:00
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
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
Martin Braun
d3a16b7022 uhd: Replace all occurrences of boost::bind with std::bind
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.
2019-11-26 12:21:32 -08:00
Martin Braun
fcc2e9c602 uhd: Replace boost::function with std::function
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
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
0303f1ed55 lib: Purge all references to boost::this_thread::sleep()
Replace with std::this_thread::sleep_for().
2018-04-30 17:10:26 -07:00
Martin Braun
6652eb4a03 uhd: Move internal headers to uhdlib/
To avoid the proliferation of additional include directories and
multiple ways of including project-local headers, we now default to
moving all headers that are used across UHD into the uhdlib/
subdirectory.

Some #include statements were also reordered as they were modified for
closer compliance with the coding guidelines.

Internal cpp source files should now include files like this:

    #include <uhdlib/rfnoc/ctrl_iface.hpp>

Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2018-03-14 15:17:44 -07: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
4f948e2c8b Move all license headers to SPDX format. 2017-12-22 10:45:51 -08:00
Andrej Rode
c33928d2bb utils: add set_thread_name API call, move thread_priority to thread 2017-06-29 13:43:05 -07:00
Martin Braun
cb1649d201 uhd: tasks now use std::threads under the hood, and can't be interrupted
USRP1 and USRP2 used tasks that relied on Boost thread interruption
mechanisms. These were replaced with explicit atomics.
2017-06-28 15:54:39 -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
Andrej Rode
6d7692f393 usrp2: fixes according to coverity reports 2017-01-12 15:15:37 -08:00
Martin Braun
26d047f821 usrp2: Removed superfluous helper function 2016-11-28 12:17:12 -08:00
Martin Braun
99c2730bc9 Remove all boost:: namespace prefix for uint32_t, int32_t etc. (fixed-width types)
- Also removes all references to boost/cstdint.hpp and replaces it with
  stdint.h (The 'correct' replacement would be <cstdint>, but not all of our
  compilers support that).
2016-11-08 08:02:22 -08:00
Martin Braun
bcd364df0f N2x0: Fixed missing usage of send_buff_size 2015-03-03 14:25:56 -08:00
Josh Blum
c464a63e87 uhd: added new calls to streamer object + support work
* The transmit streamer gives access to the async msg queue.
* The receive streamer gives access to the issue stream cmd.
* Supporting usrp implementation files updated.
* Example applications updated to use this API.
2013-07-15 15:44:42 -07:00
Josh Blum
584b7ae26c usrp2: fix program_stream_dest (arp for dest)
The send buffer should be reset ASAP so it gets flushed out.
2012-08-14 13:47:48 -07:00
Josh Blum
e4d3f63ce0 usrp2: work on alternative stream destination 2012-03-23 14:36:21 -07:00
Josh Blum
3060006b35 uhd: added async md user payload and common utils 2012-02-14 18:26:03 -08:00
Josh Blum
1151000340 uhd: various tweaks for compiler warns and valgrind 2012-02-09 17:59:48 -08:00
Josh Blum
5eec31fab4 dsp rework: implement 64 bit ticks, no seconds 2012-02-06 16:40:42 -08:00
Josh Blum
b7ff81c9a8 dsp rework: work on usb wrapper for smaller packets, large luts 2012-02-02 15:15:54 -08:00
Josh Blum
d27125b9ab dsp rework: account for no sid used in tx vita pkt 2012-02-01 09:48:28 -08:00
Josh Blum
d46c176af3 dsp rework: tx trailer, scaling work (peak) 2012-01-31 14:56:31 -08:00
Josh Blum
aa95e53a91 dsp rework: work on scaling and args parsing on RX and TX dsp
This simplified some copy pasta in the io_impl.cpp files,
and adds a place for sc8 tx mode in the tx dsp core code.
2012-01-31 14:56:31 -08:00
Josh Blum
8f25550d1a dsp rework: implemented new scalefactor in rx dsp core 2012-01-31 14:56:31 -08:00
Josh Blum
9f2aa9235f uhd: add samples per pkt option to rx streamer 2012-01-26 13:03:09 -08:00
Josh Blum
b8e41cbbc9 uhd: flush transport for new rx streamers 2012-01-23 13:03:09 -08:00
Josh Blum
81289ab051 usrp: added underflow_policy to tx streamer args 2011-12-20 17:38:00 -08:00
Ben Hilburn
f3654090d9 UHD will now print 'L' whenever a late packet is transmitted.
This is similiar to printing 'U' and 'S'. This functionality is not yet
supported on the USRP1.
2011-12-12 10:29:11 -08:00
Josh Blum
40c637bfb7 uhd: work with stream clearing
dont clear when using the compat device API

tx clear also resets expected seqnum

tx clear on usrp2 resets flow control monitor
2011-12-05 13:04:23 -08:00
Josh Blum
dac9a5001a usrp: clear dsp when making new streamer 2011-11-21 09:55:55 -08:00
Josh Blum
f1434d7c52 usrp2: fix channel mapping calculation 2011-11-07 15:10:19 -08:00
Josh Blum
8bb81824ea usrp: parse rx stream args scalar 2011-11-05 12:14:14 -07:00
Josh Blum
c885da1138 uhd: renamed convert markup to format
removed convert args

added simd level

got orc and neon updated
2011-11-03 20:37:12 -07:00
Josh Blum
0946176f51 usrp1: got the 16Msps working (needed non hb-filter image) 2011-11-03 20:37:11 -07:00
Josh Blum
861e66848f usrp2: work on alternative OTW formats 2011-11-03 20:37:11 -07:00
Josh Blum
fac15db5d7 uhd: renamed some of the stream types and functions 2011-11-03 20:37:11 -07:00
Josh Blum
e4561a18cd usrp1: did work for stream interface on usrp1 2011-11-03 20:37:11 -07:00
Josh Blum
fbe2aefe29 usrp2: additional corrections for streaming to work 2011-11-03 20:37:10 -07:00
Josh Blum
66c95c12a1 uhd: lots of work releated to streamer work and usrp2 implementation 2011-11-03 20:37:10 -07:00
Josh Blum
997fff3bb8 usrp2: manually deconstruct tasks, fixes cleanup bug 2011-08-25 15:26:57 -07:00
Josh Blum
da40a1aebc uhd: replaced boost filesystem path with fs_path in property tree 2011-07-22 13:59:47 -07:00
Josh Blum
22319dfc30 uhd: tweaks for windows boost 1.47 compile 2011-07-18 12:57:00 -07:00
Josh Blum
6d47818032 usrp2: use the err transport for tx/err, and rx xports are recv only 2011-07-17 23:54:19 -07:00
Josh Blum
7e1b2a0e3c uhd: added tasks to simplify thread spawning use cases 2011-07-13 17:25:40 -07:00