Commit graph

182 commits

Author SHA1 Message Date
Martin Anderseck
f2e5ab4472 multi_usrp: Fix setters for ALL_CHANS
Some setters in multi_usrp can take ALL_CHANS as channel parameter,
however there were differences between multi_usrp_rfnoc and multi_usrp.
This commit fixes this for set_trx_gain().
2024-02-20 14:40:55 -06:00
michael-west
aa161c5aad multi_usrp: Added module_serial to info
Added 'module_serial' field to retured value of
multi_usrp::get_usrp_rx_info() and multi_usrp::get_usrp_tx_info() API
calls that provides the module serial number.

Signed-off-by: michael-west <michael.west@ettus.com>
2023-11-01 20:45:06 -05:00
Martin Braun
ebd5dd03cf Apply clang-formatting to all C/C++ files
- Used clang-format version 14
- Ran ./tools/clang-formatter.sh apply
2023-08-07 15:35:56 -05:00
Martin Anderseck
4789c32f40 extension: Add extension framework
This change adds the extension framwork that enables external libraries
to extend the UHD functionality in MultiUSRP and RFNoC. Its main purpose
is to be able to use external frontend modules, signal conditioning
modules etc. and to control them together with the USRP device. To make
it easier to install into the correct directory the UHD_MODULE_PATH gets
exported in CMake.
2022-08-30 08:49:26 -05:00
Christopher Pearce
dfc7b31cfb uhd: multi_usrp.cpp remove commented out code
Reviewed-by: Steven Koo <steven.koo@ni.com>
2022-07-25 17:34:45 -05:00
David Raeman
722ae69156 uhd: fix minor typo when querying tx sensors property tree 2022-06-08 13:44:08 -07:00
Martin Braun
2d9a833747 uhd: Fix non-standard function name macros
Throughout UHD, we are using a random mix of __FUNCTION__, __func__,
__PRETTY_FUNCTION__, and BOOST_CURRENT_FUNCTION. Note that the first two
macros are non-standard (although many compilers understand them), and
the last requires Boost. __func__ is available since C++11, but is not
the best choice because the C++ standard doesn't require it to be of any
specific value.

We thus define UHD_FUNCTION and UHD_PRETTY_FUNCTION as portable macros.
The former simply contains the undecorated function name, the latter the
expanded function with full signature.

As it happens, our currently supported compilers didn't have any issues
using non-standard macros, so the main fix here is the removal of the
Boost macros and the harmonization of the other macros.
2022-01-12 15:07:54 -06:00
Lane Kolbly
f47df4d1a8 host: Add static_assert to prevent meta_range_t(0,0)
meta_range_t(0,0) actually calls the iterator-based constructor for
meta_range_t, which is almost certainly not the intended constructor
for that call syntax. Therefore, we add a static_assert to prevent
such usage, and fix all failing instances.
2021-07-14 16:19:20 -05:00
Martin Braun
7044fcdca5 uhd: Remove includes of list_of.hpp where appropriate
This Boost header is included in some places, despite not being used.
2021-06-24 12:00:49 -05:00
Martin Braun
4574063639 multi_usrp: Factor out make_overall_tune_range() and fix limits
This function had an issue where it might return negative frequency
values. A quick fix was to limit it to positive frequencies.

Since this function was duplicated between multi_usrp and
multi_usrp_rfnoc, this patch also moves it to a common location to not
have to fix it twice.
2021-06-09 16:58:57 -05:00
Aaron Rossetto
75738ff113 multi_usrp, x300: Relax LO set API strictness
This PR relaxes the set_{rx|tx}_lo_{source|sources|export_enabled}()
functions to allow them to be called with 'internal'/ALL_LOS or
false/ALL_LOS on devices which do not support changing their LO source
or exporting. This makes the get and set functions for those LOs
settings more symmetrical in that the values returned from the get
function can be successfully passed to the set function. Prior to this
change, calling the set functions would throw an error indicating that
the device does not support manual configuration of the LO.
2021-05-19 12:34:00 -05: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
Cristina Fuentes
2e64cb1b28 multi_usrp: Add get_mb_controller() API call 2020-09-24 15:16:45 -05:00
Martin Braun
b9f9ca2d0f uhd: Add APIs for getting the available power range
The previously added APIs for getting/setting power reference levels was
missing an option to read back the currently available power levels
(minimum and maximum power levels).
This adds getters for TX and RX power ranges to multi_usrp and
radio_control. The power API is thus now more similar to the gain API,
which always had getters for gain ranges.
2020-08-17 16:22:35 -05:00
Steven Koo
ecd8eec17e filter API: Fix multi_usrp tx calls
Adding the fix to use fs_path instead of tx_rf_fe_root. This was done
to the rx methods and should have been done for the tx ones as well.
2020-07-17 13:09:38 -05:00
Martin Braun
e4291f1ddc multi_usrp: Add get_radio_control() API call
This is an advanced API call that allows direct underlying
access to the radio_control object for RFNoC devices.
2020-07-16 15:17:26 -05:00
Martin Braun
470e11a1f8 filter API: Fix Python bindings and multi_usrp calls
This fixes the following issues:
- The Python bindings did not declare parents for the various filter
  object classes properly. This meant that set_?x_filter wouldn't work,
  because the user would pass a specific type (e.g., analog_filter_lp),
  but the class would not recognize it as a filter_info_base.
- In multi_usrp.cpp, filter names are also property tree paths to make
  them unique. However, the setters and getters for filters would then
  prepend the FE path again, thus breaking those calls.
2020-06-10 12:46:33 -05:00
Martin Braun
4cd86bbf2a multi_usrp: Amend get_usrp_{rx,tx}_info() to include cal keys
This adds two more keys to the dictionary return from
get_usrp_{rx,tx}_info() which can be used to query the calibration key
and serial.
2020-05-20 15:19:55 -05:00
Martin Braun
b78e06df03 multi_usrp: Remove rfnoc-specific code from multi_usrp.cpp
This implementation of multi_usrp is only for non-RFNoC devices; the
section was thus dead code.
2020-04-28 13:04:00 -05:00
Martin Braun
a63682f981 uhd: Add reference power level API to multi_usrp and radio_control
This adds the following API calls:

- multi_usrp::has_{rx,tx}_power_reference()
- multi_usrp::set_{rx,tx}_power_reference()
- multi_usrp::get_{rx,tx}_power_reference()
- radio_control::has_{rx,tx}_power_reference()
- radio_control::set_{rx,tx}_power_reference()
- radio_control::get_{rx,tx}_power_reference()

It also adds a manual page explaining the philosophy of the API.

Note that this does not actually add this feature to any device
implementation. Calling the new API calls will thus result in
`uhd::not_implemented_error` exceptions being thrown. This commit is to
lock down the API and ABI.
2020-04-17 07:59: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
Martin Braun
defcb174eb multi_usrp: Add get_tree() API call
This allows access to the underlying property tree without having to
refer to the device object. Useful for RFNoC objects, where the device
object is not accessible.
2020-02-04 08:11:16 -06:00
Martin Braun
90a72e8cd4 multi_usrp: Amend APIs for GPIO source control
This adds a new API call to multi_usrp: get_gpio_src_banks(). This
returns a list of GPIO banks who's source can be controlled through the
motherboard controller.

The remaining GPIO source methods' docstrings are improved, to explain
the difference between GPIO banks for set_gpio_attr() and
set_gpio_src(). The former controls the actual value on a GPIO bank, and
the latter who drives it. These can be different banks.
2020-01-23 11:37:51 -08:00
Brent Stapleton
84e203d5a9 multi_usrp: unify GPIO access type
GPIOs in the property tree are registered as uint32_t's, so the
get_gpio_attr function should use that type as well.

This resolves a property tree runtime_error when running the `gpio`
example with a B2xx device.
2019-12-30 17:51:55 -08:00
Martin Braun
d5580fcec8 multi_usrp: Add set_rx_spp() call
This API call is a more explicit way of setting the spp than passing in
an spp value in the args of the stream args when creating streamers. For
pre-RFNoC devices, this is done by injecting the spp arg back into the
stream args. For RFNoC devices, the set_property() call on the radio is
called.
2019-11-26 12:21:33 -08: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
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
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Brent Stapleton
23f4f8cf4e rfnoc: Add multi_usrp_rfnoc, modify multi_usrp
This adds a separate version of multi_usrp for RFNoC devices. It is
compatible with RFNoC devices only, and prefers C++ APIs over property
tree usage. The factory of multi_usrp is modified such that it picks the
correct version, users of multi_usrp don't care about this change.

This also introduces some API changes:
- Removing redundant GPIO functions. Now all GPIO control, setting, and
  readback is done with uint32_t's.
- Adding getter/setter for GPIO source. This was done to simplify the
  other GPIO settings, as the source for each pin is not always a
  binary. The CTRL mode, for example, can either be ATR or GPIO.
  However, the source can be controlled by various radios or "PS" or
  some other source.
- Removing the mask from the RFNoC radio controllers' set_gpio_attr().
- Adding state caching to gpio_atr_3000, and a getter for it. Whenever
  an attribute is set, that value is cached, and can now be retreieved.
- Remove low-level register API. Since UHD 3.10, there is no USRP that
  implements that API.
Modifying the filter API in the following ways:
- Splitting filter API getter/setter/list into separate RX and TX
  functions
- Adding channel numbers as an argument
- The filter name will no longer be a property tree path, but rather a
  filter name. For RFNoC devices, this will take the form
  `BLOCK_ID:FILTER_NAME`. For non-RFNoC devices, this will just be the
  filter name (e.g. `HB_1`)
- Removing search mask from listing function. Users can do their own
  searching

Co-Authored-By: Martin Braun <martin.braun@ettus.com>
2019-11-26 11:49:42 -08:00
Martin Braun
8aaf42a280 utils: soft_register: Remove 16-bit mode
This mode is never used, and makes it more cumbersome to maintain this
code.
2019-11-26 11:49:09 -08:00
Martin Braun
2ed94af772 uhd: Remove deprecated objects and methods
This removes the following symbols:
- otw_type_t
- clock_config_t
- Any functions that use those symbols
- Non-standard args from examples (e.g., --total-time is deprecated in
  favour of --duration)
2019-11-26 11:49:08 -08:00
Brent Stapleton
6b26ddcfc3 multi_usrp: Fix typo in get_user_settings_iface() 2019-08-19 18:25:06 -07:00
Michael West
1256821f3e X300: Add recovery for duplicate IP addresses in EEPROM
- Limit initialization to ZPU communication if recover_mb_eeprom=1 is
set in device args.
2018-10-25 09:57:16 -07:00
Martin Braun
b66f3701a7 multi_usrp: Add sync_source API
The sync_source API is an atomic setter for all sync-related settings.
If supported by the underlying USRP, it can be faster to call
set_sync_source() rather than sequentially calling set_clock_source()
and set_time_source().
If the underlying device does not support the sync_source API, it will
fall back to the set_clock_source() and set_time_source() APIs, making
this change backward-compatiple.
2018-10-11 17:54:23 -07:00
Andrew Lynch
72a21ba84c multi_usrp: move definition of constants
ALL_MBOARDS and ALL_CHANS will be exported on GCC and MSVC
2018-10-04 06:15:04 +02:00
Martin Braun
d0e8f4effa multi_usrp: Add get_user_settings_iface() API call
For USRPs that support user settings (e.g., B2xx, N230), this will
return an object that will allow peeking and poking user-defined
settings registers.
Mock code example:

    auto usrp = multi_usrp::make(...);
    auto user_settings_iface = usrp->get_user_settings_iface();
    user_settings_iface->poke32(0, 23);
2018-08-16 11:40:48 -07:00
Brent Stapleton
34f99a7734 fixup! uhd: Warn when tuning with auto DSP frequency and an external LO
Check for ALL_LOS in the property tree before checking if its set to
external. This warning is only applicable to the TwinRX, so its fine to
only look for the ALL_LOS property.
2018-07-18 16:21:08 -07:00
Martin Braun
de4545ed4f multi_usrp: Fix get_usrp_tx_info() for MPMD devices 2018-07-17 10:44:18 -07:00
Derek Kozel
b39358f490 uhd: Expose DC Offset range via multi_usrp interface 2018-07-11 10:12:03 -07:00
Derek Kozel
8262797545 uhd: Warn when tuning with auto DSP frequency and an external LO
In LO sharing cases this can result in frequency errors between
channels.
2018-07-10 11:35:19 -07:00
Martin Braun
3964021e97 multi_usrp: Check for existence of mboard sensor names
get_mboard_sensor_names() would crash if a USRP didn't actually have at
least one sensors defined.
2018-05-17 17:25:43 -07:00
Michael West
02638afb18 UHD: Fix get_usrp_?x_info 2018-05-15 11:44:16 -07:00
Martin Braun
38a7fa64f4 lib: Remove some unnecessary use of boost::posix_time
Replace by std::chrono.
2018-05-14 17:24:19 -07:00
Trung N Tran
bcad3f377c multi_usrp: Update get_usrp_?x_info()
In MPM devices, daughterboard EEPROMs now use eeprom_map_t instead of
dboard_eeprom_t.  The eeprom also is under rfnoc path.
This change will allow ?x_info() to reach that rfnoc path and pull
information from the new eeprom_map_t.
2018-05-01 08:55:08 -07: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
1d0c25ef7d multi_usrp: Add API call to query the clock rate range 2018-04-03 17:03:14 -07:00
Martin Braun
a29f7da507 multi_usrp: Refactor gpio_attr methods
- Fix indentation issues
- Fix inconsistent formatting
- Fix typos in user-facing messages
- Fix inconsistent exception messages
- Apply coding guideline formatting rules
- Remove some code duplication
2018-03-30 12:44:25 -07:00
Trung N Tran
4844f66dcc fixup! usrp: Add set_gpio_attr overload that use string
set_gpio_attr did not return after completion. This leads to wrong error
reporting.
2018-03-14 16:42:44 -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
594030c1af uhd: Move some gpio_defs constants definitions out of headers
Reviewed-by: Trung Tran <trung.tran@ettus.com>
2018-02-27 09:52:19 -08:00