Commit graph

4400 commits

Author SHA1 Message Date
David Raeman
722ae69156 uhd: fix minor typo when querying tx sensors property tree 2022-06-08 13:44:08 -07:00
Lars Amsel
81711625be uhd: Align numeric data types in digital filter classes
Modified accessors and constructors in digital filter classes
to align with the type declared in the corresponding fields.
2022-06-03 13:15:19 -07:00
Martin Braun
90239cfee4 lib: Remove references to uhd::sid_t
This data structure was used in UHD 3, but is no longer relevant.
2022-06-03 06:12:41 -07:00
Martin Braun
8ac74ccb1e lib: Remove stray file async_msg.hpp 2022-06-03 06:12:41 -07:00
Martin Braun
6419405e7c transport: Remove zero_copy_flow_ctrl
In the current streaming model, this is never used. Another UHD-3
remnant.
2022-06-03 06:12:41 -07:00
Martin Braun
840335390c lib: Remove vrt::chdr namespace
This is another remnant of UHD 3. This chdr:: namespace is not used
anywhere in the current streaming model.
2022-06-03 06:12:41 -07:00
Martin Braun
fdced6984a zbx: Remove stray include 2022-06-03 06:12:41 -07:00
Martin Braun
76056c9781 rfnoc: Add atomic_item_size property to FFT block
The atomic item size for the FFT block is always equal to the length of
the FFT, multiplied by bytes-per-sample (4). For now, this is all the
FFT block supports.
2022-05-25 07:58:23 -07:00
Martin Braun
2e6cd12591 multi_usrp: Shorten GPIO bank names on single-db USRPs
In particular, the E3xx series have a single "daughterboard", and
a single radio block with two channels. Prior to this fix,
multi_usrp::get_gpio_banks() would return "INT0A", where the 'A' is to
distinguish the INT0 bank with other dboards. Since there are none, the
'A' is unnecessary.
2022-05-25 07:56:27 -07:00
Martin Braun
5bf02be2a8 x300: Change order of GPIO banks
FP0 is now listed first. This helps with determining a default GPIO
bank.
2022-05-25 07:56:27 -07:00
Aaron Rossetto
6a2c2effa2 rfnoc: Fix vector use in replay_block_control_impl
This commit fixes an issue in `replay_block_control_impl` with the
initialization of the `_cmd_fifo_spaces` vector member variable.
`std::vector<>::reserve()` only allocates memory for the vector items;
it does not resize the vector (i.e., instantiating an `std::vector<>`
and then calling `reserve()` leaves it with a size of 0). Attempting to
index a zero-sized vector causes some C++ debug mode runtimes to throw
an index out-of-range exception. The commit instantiates the vector
using the constructor variant that allocates memory sufficient for the
entries and default initializes them so that it can be indexed without
issue.
2022-05-24 07:55:11 -07:00
Martin Braun
3b2380430d rfnoc: Fix register_xport_hop_cfg_fns() usage
Note: This function is currently unused. However, it is not correctly
implemented. During init, it would call the routing configuration
function instead of the init configuration function.
2022-05-24 07:51:24 -07:00
Martin Braun
3f900ba3d6 rfnoc: Improve comments regarding streaming and mgmt. code
This commit *only* touches comments in the code for RFNoC streaming,
link management and management portal.
2022-05-18 08:23:53 -07:00
Martin Braun
0a02801bf8 n320: Fix reading DB serial in applying corrections
The frontend corrections for N320 (IQ imbalance, DC offset) require the
DB serial. However, there was an error in reading the DB serial in the
code that applies the corrections.
2022-05-16 12:51:20 -07:00
Lars Amsel
4698078d41 rfnoc: fix double conversions
result of get double was saved in an int value instead of double
replaced C cast by static_cast
2022-05-16 06:24:49 -07:00
Martin Braun
7749948c50 n320: Improve comments regarding low band
The N320 code include some constants that were either unused or
incorrect. This clarifies the lowband frequency.
2022-05-16 06:19:54 -07:00
Lars Amsel
2c213d492d uhd: change default into option flag in register definition
This adds support for read only registers in generated interfaces.

For this the default is extended to an option string. The old format
is still supported for backward compability, so if options string is
just a number it will be handled as a writable number.

The option string is a comma separated list with key=value pairs. The
value is optional and treated as None if missing.

common.py now allows to pass in **kwargs to the generate method which
is used by gen_zbx_cpld_regs.py to pass a filter function for registers
used by mpm only.

get_all_addr now has an additional (optional, defaults to false) flag
to indicate whether read only addresses are to be returned or not.
It also supports type generic for the result to align with
get_changed_addr function.

The ZBX CPLD CTRL map is adapted accordingly to reflect read only
registers. The power registers are flagged as MPM scope only (and not
used in ZBX CPLD control of UHD).

Co-authored-by: Martin Braun <martin.braun@ettus.com>
2022-05-06 06:45:30 -07:00
mattprost
8fbff71f3b n310: Improve LO source control options for ALL and LO2 cases
If ALL option is specified, set lo source for both lo's. Do not report
an error if user sets LO2 to internal. Enforce single lo target for
queries about lo state.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-29 12:53:31 -07:00
Martin Braun
264db078dd dboard_iface: Change boost::chrono to std::chrono in sleep()
The underlying implementation was already using std::chrono. This
further removes boost::chrono from UHD.
2022-04-27 09:50:06 -07:00
Martin Braun
7d2b96c308 lib: Remove muxed_zero_copy_if
The usage of muxed_zero_copy_if was removed in 20baa41. We can thus
remove the muxed_zero_copy_if itself.
2022-04-27 09:49:04 -07:00
Martin Braun
d1c4132fc5 rfnoc: Improve documentation for chdr_ctrl_endpoint 2022-04-27 09:48:15 -07:00
Martin Braun
95b96bbddc lib: Add missing include to offload_io_service_client.hpp 2022-04-26 12:26:31 -07:00
Steven Koo
9a15dcb61d utils: Check install-prefix for images
On some installs, pkg-path and install-prefix aren't equivalent. Since
uhd_images_downloader defaults to installing into
$CMAKE_INSTALL_PREFIX/share/uhd/images, we should look there too.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-04-19 09:38:47 -07:00
Steven Koo
0a561c6c3f multi_usrp_rfnoc: Set assignment instead of equality
This resolves a typo intoduced by
multi_usrp_rfnoc: Add TX buffering using Replay

Signed-off-by: Steven Koo <steven.koo@ni.com>
2022-04-12 13:30:20 -07:00
Aaron Rossetto
640dd07ed3 uhd: Update MPM compat minor 2022-04-12 13:29:49 -07:00
mattprost
d2a7bce0d0 rfnoc: Add filter_node python bindings
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
b8acf58798 n310: Add Filter API to n310
Add the Filter API to n3xx specifically for the AD937x device.  The TX
filter is limited to 32 taps, and the RX filter is limited to 48 taps.

This feature requires MPM version 4.2 or later on the device.

Co-authored-by: bpadalino <bpadalino@gmail.com>
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
a8ad4917d3 n310: Add frontend bandwidth control
Allow users to control the Mykonos frontend bandwidth settings for
Rx and Tx. Note that this operation requires the daughterboard to
re-initialize, so it may take some time. Values for frontend filter
settings were derived using ADI's AD9371 Filter Wizard.

This feature requires MPM version 4.1 or later on the device.

Co-authored-by: bpadalino <bpadalino@gmail.com>
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
eacbf15e30 n310: cpld: Get and set TX ATR bits
This allows the user to get the current state of the tx atr bits and set
them back to a given state. This is useful for the n310 when resetting
the front end, in order to avoid any tx power out of the frontend when
the init_cals are run.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
14a4b969b6 ic_reg_maps: Generate save state read functions
Auto-generated IC Register Maps (e.g. magnesium_cpld_regs,
rhodium_cpld_regs, etc.) now provide getter methods for all attributes.
This gives access to the save state information for the device.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
mattprost
0cf8a60a4e types: filters: Add python support for digital filters
Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-07 13:28:02 -07:00
Martin Braun
3930a61547 rfnoc: Modify prop. propagation algorithm (back-edge resolution)
Previously, the property propagation algorithm would first forward and
resolve properties only along forward edges. Then, we would check that
properties also align across back-edges. The assumption is that graphs
are always structured in a way such that back-edges would align when the
resolution is done.

However, for the following graph, this would fail:

Radio ---> Replay
  ^         |
  +---------+

The reason is that the radio block and the replay block both have an
"atomic_item_size" property, which needs to be resolved both ways. If
the default atomic_item_size is 4 for the radio, and 8 for the replay
block, then the input atomic_item_size on the radio will never be
aligned with the output atomic_item_size of the replay block, and there
is no other mechanism to align those.

The solution is to run the edge property propagation and resolution
twice, first for the forward edges, then for the back-edges. For graphs
that would previously work, this makes no difference: The additional
step of propagation properties across the back-edges will not dirty any
properties. However, for graphs like the one above, it will provide an
additional resolution path for properties that are otherwise not
connected.
2022-04-07 10:51:26 -07:00
Martin Braun
204c37faee rfnoc: graph: Allow property forwarding on back-edges
The internal helper function graph_t::_forward_edge_props() receives
another argument, which decides if properties are forwarded on forward-
or back-edges. Previously, only forward-edges were possible.
2022-04-07 10:51:26 -07:00
michael-west
b3a9c7849f multi_usrp_rfnoc: Add TX buffering using Replay
Enabled with the "tx_replay_buffer" device argument.  Buffers TX data in
DRAM using the Replay block (version 1.1 or higher required), allowing
more buffering of data on the device.  May reduce underruns for certain
applications.  The Replay block is currently limited to 32 play
commands, so fewer calls to send() with larger buffers will perform
better than more calls with smaller buffers.

Signed-off-by: michael-west <michael.west@ettus.com>
2022-04-07 06:24:52 -07:00
michael-west
8daa80c05f rfnoc: Fix test_timed_commands for RFNoC devices
- Added command time to readback of time from Radio block.
- Added wait for time to readback of shared registers in Radio block.

Signed-off-by: michael-west <michael.west@ettus.com>
2022-04-05 13:18:09 -07:00
Martin Anderseck
bc8713e7af host: SPI: Read number of supported SPI slaves from device
Add support for reading the number of supported SPI slaves from
the device. This has become necessary because we may have bitfiles
with different capabilities and we want to report this back correctly.
2022-04-04 12:27:18 -07:00
michael-west
ac5ddf9d0e uhd: Replay block version 1.1
- Add ability to get current record position.
- Add ability to get current play position.
- Track space in play command FIFO and throw uhd::op_failed error when
  command requested would overflow the command FIFO.

Signed-off-by: michael-west <michael.west@ettus.com>
2022-04-01 13:33:08 -07:00
David Raeman
7a303df8e4 n320: fix issue that occasionally prevents lo_locked upon first set_freq
For certain frequencies, the LMX2592 will sporadically fail to lock upon
the very first tune. When this happens, subsequent tunes (even to the same
frequency) do lock. This issue seems to be resolved by programming the FCAL
adjustment register fields (FCAL_LPFD_ADJ/FCAL_HPFD_ADJ) as described in
the LMX2592 datasheet. These fields adjust the FCAL calibration speed to
better accomodate PFD frequencies below 20MHz or above 100MHz.

This patch also fixes a few name typos in the register map that were
directly in the scope of this change.
2022-04-01 13:30:05 -07:00
mattprost
acc731eeb7 log: Add DPDK version to system info
Log installed DPDK version on boot.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-01 13:26:09 -07:00
mattprost
9cd80e13c5 dpdk: Add support for DPDK 18.11 API
Substituting old values to restore API breakage from DPDK 18.11 to DPDK 19.
It is recommended at this point that users upgrade to more recent DPDK LTS
versions, but the DPDK 18.11 API is functional with UHD.

Signed-off-by: mattprost <matt.prost@ni.com>
2022-04-01 13:26:09 -07:00
Martin Braun
e1d98d2bcd python: rfnoc: Add new replay block APIs to Python API
The new API calls get_{record,play}_async_metadata() calls are now
available in Python. To look more Pythonic, we change the call signature
and return value to either return `None` or the value (if available).
For comparison, this is the C++ code:

```cpp
uhd::rx_metadata_t md;
if (replay_ctrl->get_record_async_metadata(md, 0.1)) {
    cout << "Received metadata! Error code: " << md.strerror() << endl;
} else {
    cout << "No metadata received!" << endl;
}
```

In Python, this has the more Pythonic form:
```python
md = replay_ctrl.get_record_async_metadata(0.1);
if md is not None:
    print("Received metadata! Error code: ", md.strerror())
else:
    print("No metadata received!")
```
2022-03-30 10:28:07 -07:00
Martin Braun
1d2ec74317 rfnoc: replay: Add ability to capture and read async info
- Add action handlers to the replay block to store TX and RX events.
- Adds two new APIs: get_{record,play}_async_metadata() to read back
  async info.
- Add unit tests.
2022-03-30 10:28:07 -07:00
Jonathon Pendlum
5d20a5a401 rfnoc: fir filter: Add support for multiple channels to block controller 2022-03-23 16:21:24 -05:00
Lane Kolbly
48b76f49bc host: x410: Emulate GPIO classic ATR mode using new mode
This fixes an issue with setting the active channel source in MPM, and
additionally allows opening up the more flexible API in the future without
requiring a filesystem update.
2022-03-23 16:14:07 -05:00
Lane Kolbly
1ba8c2517d host: x410: Cache GPIO source in mb_controller 2022-03-23 16:14:07 -05:00
Lars Amsel
2e8f7484a4 Fix handling of discontinuities in power calibration data
The power that corresponds to a certain gain values depends on the
frequency band we are in. At the edges of these bands discontinuities
can occur (the gain necessary to achieve the same power value changes
non-continuously). The power calibration does a linear interpolation
between two neighbor points in the calibration data set to find at
best fitting value. We therefore have to make sure that this interpolation
does not cross discontinuities.

This is a minimal invasive approach. It adds values at discontinuities
for the lower and the upper band. The power calibration format uses
the frequency for a power to gain mapping as a map key. Therefore two
gain to power mappings cannot be stored for the same frequency as it
would be needed for the discontinuity. Instead the mapping for the
lower band is stored at the discontinuity frequency itself. The mapping
for the upper band is stored at the frequency + 1Hz. The calibration
will therefore still fail to yield proper results within this
sub-Hertz range. The frequency lookup in the power calibration manager
now uses round instead of truncation to find the best mapping frequency
in the calibration table.

With this, searching for neighbor data points now ensures that the data
points used belong to the same band (except for the range of
(f_discontinuity, f_discontinuity + 1Hz) ).

This commit does not solve the issue for calibration data generated
with usrp_power_cal.py because the Python interface has no means to
detect band edges for the USRP it is calibrating.
2022-03-23 16:12:03 -05:00
Lane Kolbly
74f371fcd3 host: Create meta_range_t::as_monotonic
In order to perform certain operations (start/stop/step), meta_range_t
objects must be "monotonic", meaning that the subranges composing it
are sorted and non-overlapping. This commit creates a method which
takes a non-monotonic meta_range_t containing no non-continuous
subranges and converts it into a monotonic meta_range_t.
2022-03-14 15:49:41 -05:00
Lane Kolbly
7484b4f095 host: test: Add UHD_UNITTEST_LOG_LEVEL override 2022-03-11 09:10:04 -06:00
Martin Braun
9457bda99c rfnoc: radio: Explicitly set MTU forwarding policy to DROP
This is a follow-up to 930fa39, where we set the MTU property explicitly
for several blocks. The radio block should also receive this treatment,
as the IQ data going into its inputs is not forwarded to its outputs.

This patch will remove spurious log messages like these:

[INFO] [0/Radio#0] Setting default MTU forward policy.
[INFO] [0/Radio#1] Setting default MTU forward policy.
2022-03-08 15:36:48 -06:00
Aaron Rossetto
8601d225d5 rfnoc: Refactor ctrlport_endpoint; fix MT issues
This commit refactors ctrlport_endpoint and fixes several issues related
to multiple threads sending and receiving control transfers.

First, it refactors the change that Martin Braun implemented in
0caed5529 by adding a tracking mechanism for control requests where
clients have explicitly asked to receive an ACK when the corresponding
control response is received.

When a client wants to wait for an ACK associated with a control
request, a combination of that request's opcode, address, and sequence
number is added to a set when the request is sent. When a control
response is received, the set is consulted to see if the corresponding
request is there by matching the packet field data listed above. If so,
the control response is added to the response queue, thus notifying all
threads waiting in `wait_for_ack()` that there is a response that the
thread may be waiting on. If the request is not in the set, the request
is never added to the response queue. This prevents the initial problem
that 0caed5529 was addressing of the response queue growing infinitely
large with control responses that would never be popped from the queue.

Secondly, it addresses issues when multiple threads have sent a request
packet and are waiting in `wait_for_ack()` on the corresponding
response.

Originally, the function contained a loop which would sleep the calling
thread until the control response queue had at least one element in it.
When awakened, the thread would pop the frontmost control response off
the queue to see if it matches the corresponding control request (i.e.,
has the same sequence number, opcode, and address elements). If so, the
response would be handled appropriately, which may include signalling an
error if the response indicates an exceptional status, and the function
would return. If the response is not a matching one, the function would
return to the top of the loop. If the corresponding response is not
found within a specified period, the function would throw an op_timeout
exception.

However, there is a subtle issue with this algorithm when two different
calling threads submit control requests and end up calling
`wait_for_ack()` nearly simultaneously. Consider two threads issuing a
control request. Thread T1 issues a request with sequence number 1 and
thread T2 issues a request with sequence number 2. The two threads then
call `wait_for_ack()`. Let's assume that neither of the control reponses
have arrived yet. Both threads sleep, waiting to be notified of a
response. Now the response for sequence number 1 arrives and is pushed
to the front the response queue. This generates a signal that awakes one
of the waiting threads, but which one is awakened is completely at the
mercy of the scheduler. If T1 is awakened first, it pops the response
from the queue, finds that it matches the request, and handles it as
expected. Later, when the reponse for sequence number 2 is pushed onto
the queue, the still-sleeping T2 will be awakened. It pops the response,
finds it to be matching, and all is well.

But if the scheduler decides to wake T2 first, T2 ends up popping the
response with sequence number 1 off the front of the queue, but it
doesn't match the request that T2 sent with sequence number 2, so T2
goes back to the top of the loop. At this point, it doesn't matter if T2
or T1 is awakened next; because the control response for sequence number
1 was already popped off the queue, T1 never sees the control response
it expects, and will throw uhd::op_timeout back up the stack.

This commit modifies the `wait_for_ack()` algorithm to search the queue
for a matching response rather than indiscriminately popping the
frontmost element from the queue and throwing it away if it doesn't
match. That way, the order in which threads are awakened no longer
matters as they will be able to find the corresponding response
regardless. Furthermore, when a response is pushed onto the response
queue, all waiting threads are notified of the condition via
`notify_all()`, rather than just waking one thread at random
(`notify_one()`). This gives all waiting threads the opportunity to
check the queue for a response.

Finally, the `wait_for_ack()` loop has been modified such that the
thread waits to be signalled regardless of whether the queue has
elements in it or not. (Prior to this change, the thread would only wait
to be signalled if the queue was empty.) This effectively implements the
behavior that all threads are awakened when a new control response is
pushed into the queue, and combined with the changes above, ensures that
all threads get a chance to react and check the queue when the queue is
modified.
2022-03-03 14:09:27 -06:00