Commit graph

1139 commits

Author SHA1 Message Date
mattprost
0507cc2d79 rfnoc: Add Moving Average block controller
Signed-off-by: mattprost <matt.prost@ni.com>
2020-07-16 12:14:49 -05:00
Samuel O'Brien
919a147afc python: Add bindings for C++ CHDR Parser
This commit adds pybind11 glue code for the userland chdr parsing code
introduced in the uhd::utils::chdr namespace. Additionally, it moves
some pybind11 adapter code to a common pybind_adaptors.hpp file which
originally existed in the cal_python.hpp file.

This commit also adds unit tests for the python bindings using a
captured wireshark trace which is located in rfnoc_packets_*.py and some
handwritten packets in hardcoded_packets.py

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-07-16 09:59:25 -05:00
Samuel O'Brien
297d5855ca utils: Expose CHDR Parsing API
This commit introduces a new public api in uhd::utils which allows serializing
and deserializing chdr packets.

As far as testing, this commit adds the chdr_parse_test test. It uses a
wireshark trace located in rfnoc_packets_*.cpp as well as hand coded
packets from hardcoded_packets.cpp to test the serialization and
deserialization process

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-07-13 15:21:52 -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
Steven Koo
feb05cba75 meta-ettus: remove io_type.hpp
io_type's implementation was removed when host/lib/depricated.cpp was
removed. This commit also removes the hpp and installation.

Signed-off-by: Steven Koo <steven.koo@ni.com>
2020-07-08 12:46:20 -07:00
Aaron Rossetto
1ce6f961a7 rfnoc: Add Log Power RFNoC block support 2020-06-29 14:03:17 -05:00
Wade Fife
cf82b36388 fpga: rfnoc: Add Log-Power block 2020-06-29 14:03:17 -05:00
Aaron Rossetto
619f9d6372 rfnoc: Add window RFNoC block controller 2020-06-29 13:41:15 -05:00
Wade Fife
38caced694 fpga: rfnoc: Add RFNoC Window block 2020-06-29 13:41:15 -05:00
Lane Kolbly
1b502694e1 fixup! uhd: Add discoverable_features API 2020-06-25 13:36:08 -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
Lane Kolbly
e9ae5fb949 uhd: Add discoverable_features API
The "discoverable features" API handles how clients access the myriad
features we offer, without simply adding a million has_FOO and do_FOO
methods to radio_control and multi_usrp. discoverable_features allows
clients to query the existance of, enumerate, and ultimately they get
(by enum or by type) an object which implements their wanted feature.
2020-06-25 13:36:08 -05:00
Lars Amsel
b772b5b2cb cal: change default extension of calibration files
Flatbuffers offers an option to set the default extension for
binary files. Our calibration files have the extension .cal. Set
the extension in all schema files to ease conversion between
binary and text representation of calibration files.

Updated documentation accordingly.
2020-06-23 12:25:05 -05:00
Wade Fife
a0a5b6d6a6 rfnoc: Update port format in block YAML 2020-06-18 10:23:04 -05:00
Wade Fife
ade82b6ae4 rfnoc: Add makefile_srcs to block YAML 2020-06-18 10:23:04 -05:00
Andrew Moch
3af8dcaacf fpga: rfnoc: Add support for 512-bit CHDR widths
This fixes the rfnoc_null_src_sink, chdr_crossbar_nxn, and
chdr_stream_endpoint blocks so that wider CHDR widths are properly
supported. It also updates PkgChdrBfm to able to properly test these
blocks. The testbenches have been updated to test both 64 and 512-bit
widths.
2020-06-18 09:09:34 -05:00
Aaron Rossetto
bf9594641d rfnoc: Augment FFT RFNoC block controller
This commit augments the existing FFT RFNoC block controller with
C++ functions through which the block can be configured, as well as
adding range checking to the various properties that sit atop the FFT
RFNoC block registers.
2020-06-18 07:48:25 -05:00
Aaron Rossetto
18460e3478 python: Add radio RFNoC block controller bindings 2020-06-09 07:10:57 -05:00
Aaron Rossetto
eba658881b rfnoc: Add Add/Sub RFNoC block support 2020-05-28 15:04:05 -05:00
Wade Fife
5134b6caea fpga: rfnoc: Add RFNoC Add/Sub block 2020-05-28 15:04:05 -05:00
Aaron Rossetto
9c67396ec1 rfnoc: Add support for Split Stream RFNoC block
The split stream RFNoC block is an RFNoC block that takes in a single
CHDR stream and duplicates it, creating a number of output streams for
each input stream. Consult the split_stream_block_control class header
file for more details on block configuration and behavior, including how
property and action forwarding is handled by the block.
2020-05-28 14:49:32 -05:00
Aaron Rossetto
cb99b720ee rfnoc: Add USE_MAP prop/action forwarding policy
This commit adds a new forwarding policy for properties and actions,
USE_MAP. This forwarding policy causes the node to consult a
user-provided map to determine how to forward the property or action.
The map's key is the source edge of the incoming property or action,
while the value is a list of destination edges to which the property
should be propagated or action should be forwarded. It allows clients to
construct sophisticated forwarding behaviors for specialized blocks,
such as a split stream block that needs to forward properties and
actions only to specific output edges based on the incoming edge.
2020-05-28 14:49:32 -05:00
Wade Fife
c27c8db011 rfnoc: Add Split Stream RFNoC block 2020-05-28 14:49:32 -05:00
Martin Braun
dbff8eaf05 cal: Minor fixes in power container, add unit test
- min_power and max_power arguments were swapped. They were always
  called correctly, so this is more of a documentation fix.
- Add a unit test for the case where power values are not regular, which
  is the normal case with real data.
2020-05-26 12:58: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
d728767835 cal: database: Add option to register flash cal callbacks
This adds the possibility to read cal data from flash/EEPROM by adding
callbacks to the database. Unlike the RC and FILESYSTEM data, this is
very device-specific, but we can let devices register callbacks in the
database so that reading cal data from flash can use the same APIs as
from RC or filesystem.

Note that this also gives a convenient way to inject call data during
unit tests, if desired.
2020-05-20 07:30:15 -05:00
Aaron Rossetto
c1549b9f6a rfnoc: Add Vector IIR RFNoC block support 2020-05-19 14:22:55 -05:00
Wade Fife
a40f2a4a5d fpga: rfnoc: Add Vector IIR RFNoC block 2020-05-19 14:22:55 -05:00
Michael West
12dfb97c8e DUC/DDC: Add variable time increment
Sets time increment based on tick rate and sample rate instead of
assuming one tick per sample.  Defaults to legacy behavior.

Minor compat number bumped on DUC and DDC blocks.

Signed-off-by: Michael West <michael.west@ettus.com>
2020-05-12 12:03:31 -05:00
Ciro Nishiguchi
cdd4b782d1 uhd: Remove default channel input from power ref methods
The radio_control methods shouldn't have a default value for the channel
input, to keep them consistent with other methods in this class.
2020-05-11 15:57:00 -05:00
Wade Fife
8db85296df utils: Add sideband_at_end support to Mako template
This adds a new option to the "AXI-Stream Data" (axis_data) FPGA
interface type. The new option, "sideband_at_end", can be added to the
output port of a block's YAML description to control whether the
sideband information should be sampled at the end (sideband_at_end: 1)
or the beginning (sideband_at_end: 0) of the AXI-Stream packet.
2020-04-21 10:31:07 -05:00
Martin Braun
18e41b32ff math: Add dB_to_lin() and lin_to_dB()
These are simply shorthands, but make the code a little more readable
with respect to intent. It allows to replace

    const double power_db = 10 * std::log10(power_lin);

with

    const double power_db = lin_to_dB(power_lin);

which expresses the intent a little more clearly and concisely.
2020-04-17 10:27:49 -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
1a19bc653e cal: Add pwr_cal container
This is a cal container for all types of power cal (RX or TX) that rely
on a single, overall gain value.

Includes Python API.
2020-04-17 07:58:19 -05:00
Wade Fife
d386c75007 rfnoc: Add RFNoC fosphor block 2020-04-14 16:37:43 -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
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
Aaron Rossetto
11d70898d1 rfnoc: Add FIR filter RFNoC block controller 2020-04-07 14:20:14 -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
6aed4b5a45 rfnoc: Add multichannel register interface
This utility class implements the register access methods of reg_iface
but adds built-in address translation features for consecutive instances of
an RFNoC block. The register peek and poke methods accept an extra 'instance'
parameter which is used to calculate the absolute address for the register
access. This can be used for accessing registers for the different channels
of a multi-channel block (i.e. Radio, DDC, DUC, etc).

Signed-off-by: mattprost <matt.prost@ni.com>
2020-04-02 12:12:26 -05:00
Martin Braun
3fe5ccf700 uhd: cal: Add iq_cal calibration data container class
This class can be used to store calibration coefficients for the X300
DC offset and IQ imbalance calibration.

Note: This also modifies Doxyfile.in to not document files generated by
flatc.
2020-04-02 11:55:17 -05:00
Martin Braun
1e016e49e8 uhd: Add calibration container class
This adds uhd::usrp::cal::container, which serves as a base class for
calibration data.
It also provides the interp_mode enum class which can be useful for
future calibration classes.
2020-04-02 11:55:17 -05:00
Martin Braun
f13615ec14 uhd: cal: Add database class
This class contains methods to store and retrieve data from the local
calibration database. Note that in this case, the "database" is just a
bunch of files on the local filesystem.
2020-03-26 07:46:03 -05:00
Martin Braun
8055879242 uhd: paths: Add get_cal_data_path() API call
This points to the location where cal data is stored.
2020-03-26 07:46:03 -05:00
Martin Braun
07b85b6dcc uhd: math: Add linear_interp()
This lets you linearly interpolate between two points.
2020-03-18 12:53:50 -05:00
Aaron Rossetto
b12c3b2037 utils: Add bool specialization to cast::from_str()
This adds a specialization to `uhd::cast::from_str()` to handle `bool`
as a target type and interpret strings like 'y', 'Y', 'n', 'No', 'True',
'False', etc. as Boolean values, as well as the traditional '0' and '1'
(which also work).
2020-03-18 07:43:20 -05:00
Aaron Rossetto
39158d18bd tests: Allow custom mock_reg_iface_t in mock block
Allow clients to pass a custom instance of a mock_reg_iface_t for use
with mock_block_container. This is especially useful when a block test
subclasses mock_reg_iface_t to implement specialized behaviors.
2020-03-13 14:17:30 -05:00