Commit graph

233 commits

Author SHA1 Message Date
mattprost
d80d56114a twinrx: Bypass adf535x feedback divider
Bypass the LO1 feedback divider if it is not required. Some TwinRX units
have seen issues when tuning to frequencies between 3.5GHz and 5.1GHz
while following that data path.

Signed-off-by: mattprost <matt.prost@ni.com>
2020-09-03 15:02:05 -05:00
Aaron Rossetto
eada49e4d5 dpdk: Improve link status detection
This change improves the DPDK link status detection algorithm in the
following ways:

- The status of the links are checked at an interval of 250 ms. If all
  links report as being up, the driver proceeds.
- If any of the DPDK links has not reported as being up by the end of
  the link status detection timeout (1000 ms by default), the algorithm
  throws a runtime error rather than proceeds with one or more down
  links.
- Users may override the default link status detection timeout by
  passing dpdk_link_timeout=N, where N is the desired timeout in
  milliseconds, either via device arguments or in the UHD configuration
  file.
2020-09-03 15:01:12 -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
mattprost
fc3f91e0cf twinrx: update synthesizer register values for improved rf performance
Updated Register values for ADF5356:
R2) Expand Frac2 to a 28-bit value for ADF5356
R6) Use negative bleed current for improved spurious performance
R7) Set Fractional-N Lock Detect Precision to 12.0 ns because of bleed
currents
R8) Use magic number for reserved bits
R9) Fix VCO Band Division calculation for ADF5356
RD) Expand Frac2 to a 28-bit value for ADF5356

Signed-off-by: mattprost <matt.prost@ni.com>
2020-08-11 16:07:16 -05:00
Matthew Crymble
c13ba0d21f X300: fix for incorrect PCIe buffer size values
added extra args to get PCIe buffer sizes from factory method
2020-08-04 15:46:54 -05:00
michael-west
f659c1af8f RFNoC: Added support for destruction of streamers
- Added rfnoc_graph method to disconnect a connection.
- Added rfnoc_graph method to disconnect a streamer.
- Added rfnoc_graph method to disconnect a port on a streamer.
- Added disconnect callback to rfnoc_rx_streamer and rfnoc_tx_streamer.
- Registered disconnect callback functions to streamers returned by
get_rx_streamer and get_tx_streamer methods.

Signed-off-by: michael-west <michael.west@ettus.com>
2020-08-04 15:41:07 -05:00
michael-west
5a00f4d786 RFNoC: Add disconnect methods to graph
- Added method to disconnect an edge
- Added method to remove a node
- Fixed algorithm to check edges during connect.  Previous code was
checking some edges twice and allowing duplicate edges to be created
for existing edges.

Signed-off-by: michael-west <michael.west@ettus.com>
2020-08-04 15:41:07 -05:00
michael-west
d7c64eb4b1 RFNoC: Add xport disconnect callbacks
Transports were not disconnecting their links from the I/O service upon
destruction, leaving behind inaccessible send and recv links used by
nothing.  This led to I/O errors after creating several transports.

Added callbacks to transports to automatically disconnect their links
from the I/O service when the transport is destroyed.  Updated all
callers to supply a disconnect callback.

Signed-off-by: michael-west <michael.west@ettus.com>
2020-08-04 15:41:07 -05:00
RobertWalstab
1d3866bef4 uhd: remove liberio 2020-07-20 16:01:03 -05:00
robot-rover
22837edfe2 utils: Expose CHDR Types in Public API
This commit exposes uhdlib/rfnoc/chdr_types.hpp in the public includes.
Additionally, it takes some types from uhdlib/rfnoc/rfnoc_common.hpp and
exposes them publicly in uhd/rfnoc/rfnoc_types.hpp.
Finally, one constant is moved from uhdlib/rfnoc/rfnoc_common.hpp to
uhd/rfnoc/constants.hpp

Signed-off-by: robot-rover <sam.obrien@ni.com>
2020-07-13 15:21:52 -05:00
Samuel O'Brien
b0cb065111 rfnoc: Rename chdr_packet to chdr_packet_writer
It would be confusing to have two classes named chdr_packet. As it makes
more sense to name the new public chdr parser class chdr_packet, the
internal uhd::rfnoc::chdr::chdr_packet class is being renamed to
chdr_packet_writer to better represent its functionality.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-07-13 15:21:52 -05:00
Martin Braun
f2f8ca056e cores: Remove shutdown function from spi_core_3000
This effectively reverts 0433e74. The set_shutdown() and get_shutdown()
API calls do not have a counterpart in simple_spi_core.v, which is
typically the HDL endpoint for this core driver, and thus could write to
a non-existent register. They are also never used in UHD, nor are they
part of the spi_iface interface.
2020-07-08 12:50:47 -07:00
Andrew Lynch
5c1771cc68 CHDR: support multiple CHDR widths
Support management payloads on busses over 64 bits
Automatically set CHDR width for mpmd_link_if_ctrl_udp
2020-06-26 14:34:13 -05:00
Lane Kolbly
d25782cf48 uhd: Implement discoverable_features for radio_control
radio_control doesn't implement any discoverable_features in
particular, but this gives it the API to do so.
2020-06-25 13:36:08 -05:00
Lane Kolbly
d6cb55ef08 uhd: Create discoverable feature registry implementation
Classes which want to implement discoverable_feature can simply inherit
from this registry and get access to an ergonomic map-backed registry of
features.
2020-06-25 13:36:08 -05:00
Martin Braun
0af68addaa radio_control: Provide default implementations for ref power APIs
The various implementations for the reference power APIs are always the
same, assuming the existence of a pwr_cal_mgr object. We therefore store
references to power cal managers in radio_control_impl, which radios can
choose to populate. The APIs then don't have to be reimplemented in the
various radio classes, unless they want to for whatever reason.
2020-06-10 12:44:10 -05:00
Martin Braun
e67871c7c8 rfnoc: radio: Add APIs to query cal keys
This allows asking the radio for the keys it uses to read/write its
calibration data.

By querying radio_control::get_{rx,tx}_power_ref_keys(), the return
values can be used to access uhd::usrp::cal::database::read_cal_data().
2020-05-20 15:19:55 -05:00
Martin Braun
2d7676e8cf lib: Add power cal manager
This is a utility class that can be used by USRP or daughterboard
drivers to tie power calibration into their respective drivers.
2020-05-19 13:24:59 -05:00
Michael West
d0c162bc7a TwinRX: Remove decimation from frontend
The decimation in the rx_frontend_gen3 was added to reduce the bandwidth
between the Radio and the DDC due to the limitation in bandwidth over
the crossbar for dynamically connected blocks.  The default FPGA image
for the X300 now has a static connection between the Radio and DDC, so
this is no longer necessary.

This change allows the TwinRX receive channels to be time aligned with
channels from other daughterboards so they can be used in the same
streamer.

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
760abdf703 lib: utils: interpolation: Add bilinear interpolation
This allows to treat a std::map<KeyType<std::map<KeyType, ValueType>> as
a set of x-y coordinates, and bilinearly interpolate a z-value given
four x/y pairs.
2020-04-17 07:58:19 -05:00
Lane Kolbly
a2ce2facc7 uhd: Add missing include guards 2020-04-08 15:16:06 -05:00
Lane Kolbly
5802a362f8 uhd: Replace include guards with pragma once
Pragma once is the more modern version of include guards, eliminating
any potential problems with mistyping include guards. Let's use those.
2020-04-08 15:16:06 -05:00
Lane Kolbly
abf025f0a5 uhd: Add fuzzy serial number checking
We have integer 32-bit serial numbers for MPM devices, for example
"1234abcd". For serial numbers which have less than eight digits,
e.g. "123abcd", a user may feel inclined to prefix this number with
a 0 when they are searching for devices, e.g. "0123abcd". This change
makes it so that specifying "0123abcd" will match a device with serial
number "123ABCD".
2020-04-08 15:13:53 -05:00
Martin Braun
d9f4d540ef uhd: math: Add interpolation.hpp
- Moves linear_interp from cal to utils
- Moves the interp_mode enum class to interpolation.hpp
- Adds three interpolation methods for maps: at_interpolate_1d(),
  at_nearest(), at_lin_interp()
- Adds unit tests
2020-04-07 07:24:19 -05:00
Martin Braun
1383fde345 uhd: paths: Harmonize around XDG Base Directory specification
Up until now, we completely ignore the XDG specification.

This commit does the following to change that:

- It uses XDG_DATA_HOME and XDG_CONFIG_HOME for cal and config data,
  respectively.
- If config data is in ~/.uhd/uhd.conf, that is still accepted, but if
  it conflicts with $XDG_CONFIG_HOME/uhd.conf, it is ignored and a
  warning is displayed
- The default location for cal data is thus ${HOME}/.local/share/uhd/cal
  on Unix, and %LOCALAPPDATA%\uhd\cal on Windows. This is a change in
  location!
- The UHD_CONFIG_DIR environment variable was confusingly named and is
  now removed. It provided an alternative location than the home
  directory. The same purpose is now much better served by XDG_DATA_HOME
  and XDG_CONFIG_HOME.

The specification can be found here:
specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2020-04-02 12:36:20 -05:00
mattprost
c65166562f rfnoc: Use multichannel register interface for RFNoC blocks
Allows RFNoC blocks to perform register peeks and pokes on blocks with
multiple channels without having to worry about handling register address
translation every time.

Signed-off-by: mattprost <matt.prost@ni.com>
2020-04-02 12:12:26 -05:00
Martin Braun
a1f9619469 uhd: cal: Use usrp::cal::database instead of CSV files
Now that we have cal::iq_cal and cal::database, there's no need to
manually wrangle CSV files for calibration data. This commit replaces
all CSV operations with cal::database calls and uses cal::iq_cal as
a container.

CSV files can still be read, but are considered deprecated.
2020-04-02 11:55:17 -05:00
Aaron Rossetto
3f1554f1a5 lib: Use from_str<bool> in constrained_device_args_t
This modifies `constrained_device_args_t::bool_arg::parse()` to use
`uhd::cast::from_str<bool>` to interpret strings as Boolean values,
deduplicating the string parsing code and single-sourcing it from
`uhd::cast`.
2020-03-18 07:43:20 -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
Michael Dickens
c42776f97b lib: move OSX specific code to where the values are initially set 2020-02-21 09:53:51 -06:00
Michael Dickens
84bc3a9912 lib: tweak prototypes to not be constexpr to allow building on OSX
Make all arguments const, in line with how other static methods are declared.
2020-02-21 09:53:51 -06:00
Martin Braun
883e658360 ad9361: Fix formatting
- Apply clang-format
- Remove unnecessary boost::format
2020-02-10 10:19:26 -06:00
Martin Braun
3075b98150 rfnoc_device: Remove spurious comment
This removes a comment that refers to Boost smart pointers, which were
removed in UHD.
2020-01-23 13:31:32 -08:00
Martin Braun
0cf54ce073 mpm/mpmd: Expose APIs to drive GPIO sources
The N310 has a feature that allows the front panel GPIOs to be driven by
various sources: The PS, or any of the radio channels. The MPM-based
APIs did not expose any way to change that.

Changes:
- Add MPM APIs to PeripheralManagerBase and n3xx classes
- Improve comments and explanations
- Add host-side hooks into these new APIs in mpmd_mb_controller
- Implement these APIs for N3xx

The N3xx devices will have the option to set the GPIO source to "PS", or
to one of "RF0", "RF1", "RF2", "RF3" (if there are four channels; the
N300 and N320 can only go up to RF1).

Note: The N310 radio does not have separate FP-GPIO banks for channels
0 and 1, which needs to be fixed in a separate commit.
2020-01-23 11:37:51 -08:00
Brent Stapleton
708840002e uhd: fixing MSVC warnings
Small changes to remove various compiler warnings found in MSVC
- Adding uhd::narrow_cast to verious spots
- wavetable.hpp: all floats literals in the wavetable.
- paths_test: unnecessary character escape
- replay example: remove unreferenced noc_id
- adfXXXX: Fixing qualifiers to match between parent and derived
  classes
- rpc, block_id: Removing unused name in try...catch
2020-01-09 09:18:25 -08:00
Brent Stapleton
97bc15a0de rpc: Applying clang formatting 2020-01-09 09:18:25 -08:00
Ciro Nishiguchi
0bf495f970 dpdk: Change client to wait on member variable
Waiting on queue status seems to not always work, the queue state seems
to not be updated immediately after pushing an item onto it when queried
from a different thread.
2019-12-20 16:32:22 -08:00
Alex Williams
691f191a1e transport,usrp: Make available packet-based flow control
DPDK provides a fixed number of fixed-size buffers for the receive
window, so it needs packet-based flow control to avoid dropping
packets. This change enables counting by packets.

Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-12-20 16:32:22 -08:00
Alex Williams
6d6d0f22eb rfnoc: Make chdr_ctrl_xport recv_io callbacks have symbols
This helps a little with debugging (for breakpoints).
2019-12-20 16:32:22 -08:00
Alex Williams
3a9d2b582d transport: Fix comment on recv_io_if::fc_callback_t
It referenced the wrong function for releasing recv buffers.
2019-12-20 16:32:22 -08:00
Ciro Nishiguchi
d7e5a630ed usrp: Add I/O service manager for DPDK 2019-12-20 16:32:22 -08:00
Martin Braun
378dc931ab lib: Remove dpdk_zero_copy files
These were left here as a reference.
2019-12-20 16:32:22 -08:00
Alex Williams
4e38eef817 dpdk: Add new DPDK stack to integrate with I/O services
docs: Update DPDK docs with new parameters:
Parameter names have had their hyphens changed to underscores, and
the I/O CPU argument is now named after the lcores and reflects
the naming used by DPDK.

transport: Add new udp_dpdk_link, based atop the new APIs:
This link is tightly coupled with the DPDK I/O service. The link class
carries all the address information to communicate with the other
host, and it can send packets directly through the DPDK NIC ports.

However, for receiving packets, the I/O service must pull the packets
from the DMA queue and attach them to the appropriate link object.
The link object merely formats the frame_buff object underneath, which
is embedded in the rte_mbuf container. For get_recv_buff, the link
will pull buffers only from its internal queue (the one filled by the
I/O service).

transport: Add DPDK-specific I/O service:
The I/O service is split into two parts, the user threads and the
I/O worker threads. The user threads submit requests through
various appropriate queues, and the I/O threads perform all the
I/O on their behalf. This includes routing UDP packets to the
correct receiver and getting the MAC address of a destination (by
performing the ARP request and handling the ARP replies).

The DPDK context stores I/O services. The context spawns all I/O
services on init(), and I/O services can be fetched from the dpdk_ctx
object by using a port ID.

I/O service clients:
The clients have two lockless ring buffers. One is to get a buffer
from the I/O service; the other is to release a buffer back to the
I/O service. Threads sleeping on buffer I/O are kept in a separate
list from the service queue and are processed in the course of doing
RX or TX.

The list nodes are embedded in the dpdk_io_if, and the head of the
list is on the dpdk_io_service. The I/O service will transfer the
embedded wait_req to the list if it cannot acquire the mutex to
complete the condition for waking.

Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Brent Stapleton <brent.stapleton@ettus.com>
2019-12-20 16:32:22 -08:00
Virendra Kakade
a98da1dfd4 rfnoc: fix incorrect long fifo wait timeouts
This fixes behavior where we would get long 100 sec timeouts
on fifo waits instead of 100 ms timeouts.

Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2019-11-26 12:21:35 -08:00
Alex Williams
911ca16adc lib: Add DPDK service queue
This is a data structure intended for use by the DPDK I/O service.
It uses DPDK's lockless ring in multi-producer, single-consumer mode
to allow clients to submit requests to the DPDK I/O service's worker
thread. Clients can specify a timeout for the requests to be fulfilled.
2019-11-26 12:21:34 -08:00
Ciro Nishiguchi
c730d7ba20 rfnoc: fix invalid access when sending packet with no samples 2019-11-26 12:21:34 -08:00
Martin Braun
920198556e mg/rh/rfnoc: Harmonize peripheral registers
- Move the SPI addresses out of radio_control_impl
- Fix the GPIO address spaces for N310/N300
2019-11-26 12:21:34 -08:00
Martin Braun
59fae330b0 detail::graph: Add shutdown capability
In the existing graph, when the shutdown was simply a release. However,
any outstanding actions would trigger warnings (because released graphs
aren't supposed to still have actions being passed around), which would
sometimes be visible at the end of an application.

This is a safer solution than simply releasing, because it explicitly
sets a shutdown flag that all graph-affecting functions (property
propagation and action handling) respect. Once the flag is set, the
graph can no longer be booted up again.
2019-11-26 12:21:33 -08:00
Ciro Nishiguchi
837b89e2ec rfnoc: Rename thread affinity args
Rename thread affinity args such that they do not end with an integer.
Arg names ending with an integer are interpreted as being targeted at a
specific motherboard index in device_addr methods.
2019-11-26 12:21:33 -08:00