Commit graph

24 commits

Author SHA1 Message Date
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
Aaron Rossetto
5333d0d932 multi_usrp: Use multi_usrp::sptrs in graph disconnect lambdas 2020-08-17 15:07:14 -05:00
michael-west
57c39779f1 multi_usrp: Fix connect/disconnect of RFNoC chains
- Added helper methods to connect and disconnect TX and RX chains.
- Directly create streamer objects and register local disconnect
methods to make sure chains are disconnected and the streamer is
removed from the graph when streamers are destroyed.

Signed-off-by: michael-west <michael.west@ettus.com>
2020-08-04 15:41:07 -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
Steve Czabaniuk
1d71d453de multi_usrp: Assert that edge_lists are non-empty before accessing
The edge_list for a given rx/tx chain should never be empty so this
explicitly performs that check, which prevents a potential bad access.
2020-06-22 14:32:42 -05:00
michael-west
985e691092 multi_usrp: Various multi_usrp_rfnoc fixes
- Fix serial and PID info in get_usrp_xx_info methods
- Make defaults match multi_usrp base class
- Make support of ALL_MBOARDS and ALL_CHANS consistent across all set
methods
- Make set/clear_time_commands honor the mboard argument
- Fix get_rx_lo_sources() to use rx_chain.block_chan
- Fix typos in get_tx_freq_range that were calling rx functions instead
of tx

Signed-off-by: michael-west <michael.west@ettus.com>
2020-06-10 12:45:50 -05:00
Martin Braun
d4e62f0d9d multi_usrp: Fix get_tx_freq() for RFNoC devices
get_tx_freq(), unlike get_rx_freq(), would not factor in the DSP
frequency. Before, this would happen:

    >>> U = uhd.usrp.MultiUSRP("type=x300")
    >>> tr = uhd.types.TuneRequest(1e9, 10e6)
    >>> res = U.set_tx_freq(tr)
    >>> res.clipped_rf_freq
    1000000000.0
    >>> U.get_tx_freq()
    1010000000.0

In other words, the TuneResult object was correct, but the return value
of get_tx_freq() was not. This fixes the issue.
2020-05-29 07:15:17 -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
Michael West
1cdfe30725 multi_usrp_rfnoc: Misc fixes
- Change get_master_clock_rate() to return tick rate instead of sample
rate
- Make warning of incompatible rates conditional so it does not display
for first channel

Signed-off-by: Michael West <michael.west@ettus.com>
2020-05-12 12:03:31 -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
3b59529e71 multi_usrp: Approximate legacy behaviour for recv_async_msg()
When using multi_usrp with an RFNoC device, the previous behaviour was
to throw an exception when calling recv_async_msg() so users would know
they're not supposed to call it (calling tx_stream::recv_async_msg is
preferred). However, this breaks too many existing applications.
Instead, we keep a weak pointer to the streamer, the same way that older
devices do, and query the async message from that. This means that
calling recv_async_msg() when there are multiple streamers can lead to
unexpected behaviour, but that's a general issue with
multi_usrp::recv_async_msg() and this way, the RFNoC devices now behave
like older devices do.
2020-04-13 07:19:42 -05:00
steviez
b6ff5fd283 multi_usrp_rfnoc: Manually pass sample rate to ddc/duc
This adds (and calls) methods to manually pass radio block sample rate
to the input/output properties of the ddc/duc during creation of the
multi_usrp_rfnoc object. The ddc/duc require this information in order
to return valid, possible output/input sample rates in
get_rx_rates()/get_tx_rates().

Before, the ddc/duc wouldn't have this rate until the rfnoc_graph had
been connected and committed, which happens in
get_rx_stream()/get_tx_stream(). Thus, this fixes an issue where a user
was unable to query possible sample rates prior to specifying a sample
rate and creating a stream.
2020-04-13 07:19:12 -05:00
steviez
26ff293489 multi_usrp_rfnoc: Fix get_rx/tx_rates()
This replaces incorrect code with the proper function calls to retrieve
the range of possible sample rates.
2020-04-13 07:19:12 -05:00
Martin Braun
52f1c15cfc multi_usrp: Fix ALL_CHAN and ALL_MBOARDS API calls for Gen-3 devices
Most of the API calls that default an arg to ALL_CHANS or ALL_MBOARDS
were in fact broken. This adds a macro to efficiently mux out API calls
that take such wildcard arguments so we don't have to repeat the same
loop all over the place, even for those API calls that already correctly
implemented wildcards (for consistency).
2020-03-31 15:08:30 -05:00
Martin Braun
910d95af2f multi_usrp: Provide valid return value for multi_usrp::get_device()
For RFNoC devices, multi_usrp::get_device() no longer returns a device
pointer, rather, it returns a nullptr.
This is intentional because access to the underlying device is no longer
allowed. However, legacy code can segfault (e.g. portions ofr gr-uhd).

This patch returns a faux uhd::device class, which almost mimicks the
original behaviour perfectly, by redirecting its class methods back to
multi_usrp_rfnoc. The only exception is recv_async_msg(), which requires
a TX streamer. This function will always return false now.
2020-03-12 07:35:15 -05: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
Martin Braun
2d110b1ded rfnoc_graph: Modify find_blocks() to sort return value
With this patch, the elements of of the return value of find_blocks()
are sorted lexicographically (specifically, using
uhd::rfnoc::block_id_it::operator<()).

The underlying block_container class stores the blocks in an unordered
set, so the return value for find_blocks() was always sorted randomly.
multi_usrp_rfnoc had to sort the return values every time find_blocks()
was used to get a useful return value.

Because find_blocks() had no contract for the order of returned blocks,
this change simply sorts the return value before returning it.
multi_usrp_rfnoc is modified to remove all the sorts that are now
superfluous.

A good way to see the change is to run uhd_usrp_probe, which will now
contain content like this:

|     _____________________________________________________
|    /
|   |       RFNoC blocks on this device:
|   |
|   |   * 0/DDC#0
|   |   * 0/DDC#1
|   |   * 0/DUC#0
|   |   * 0/DUC#1
|   |   * 0/DmaFIFO#0
|   |   * 0/Radio#0
|   |   * 0/Radio#1

Assuming the blocks don't change, the order of this list will always be
the same following this patch. Note that the order is unrelated to the
order on the control crossbar, which it never was.
2019-11-26 12:21:33 -08:00
Martin Braun
b7488af14e multi_usrp: Fix GPIO bank selection
When calling a multi_usrp object like this:

    usrp->set_gpio_attr("TXB", "CTRL", 0xFFFF);

Previously, it would only be able to address daughterboard A. Now, there
is a full backward-compatible solution (compatible with 3.15), that will
address either daughterboard's GPIOs.
2019-11-26 12:21:33 -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
Brent Stapleton
03dcda01e0 rfnoc: Use graph_utils in multi_usrp chan generation 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
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