aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
Commit message (Collapse)AuthorAgeFilesLines
* rfnoc: replay: Add action handler for stream commandsMartin Braun2022-02-241-0/+26
| | | | | | | | When connecting an Rx streamer to a replay block, this now allows requesting data from the replay block using a stream command. This will automatically request data from all ports the streamer is connected to, and even if there are blocks in between (depending on their action forwarding policies).
* python: rfnoc: Add connect_through_blocks() and get_block_chain()Martin Braun2022-02-241-2/+13
| | | | These RFNoC C++ API calls were previously not exported into Python.
* rfnoc: graph_utils: Add ability to declare back-edgesMartin Braun2022-02-241-3/+7
| | | | | | | rfnoc::connect_through_blocks(), unlike rfnoc_graph::connect(), did not have an argument to declare a back-edge. This patch remedies this situation by adding a skip_property_propagation argument that works exactly as with rfnoc_graph::connect().
* Remove FSRU-related filesMartin Braun2022-02-221-3/+0
| | | | | | | The FSRU (aka EISCAT) was never supported in UHD 4.0. The FPGA repository never had the relevant files, and the block controller also never existed. This removes all the corresponding files from MPM, as well as some references from makefiles.
* rfnoc: Fix spelling in property resolution error messageMartin Braun2022-02-111-1/+1
|
* host: Throw exception when accessing properties with incorrect typeLane Kolbly2022-02-071-4/+4
|
* host: Minor cleanups in property_tree codeLane Kolbly2022-02-071-15/+28
|
* uhd: Harmonize fuzzy frequency comparisonsMartin Braun2022-02-047-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throughout UHD, we often do floating-point comparisons for frequency ranges that require resilience to floating point rounding errors. Most of the time the checks look like this: ```cpp if (fp_compare_epsilon<double>(freq) > boundary) { // ... } ``` The exception is the N320 daughterboard control, which uses a custom epsilon: ```cpp if (fp_compare_epsilon<double>(freq, RHODIUM_FREQ_COMPARE_EPSILON) > boundary) { // ... } ``` This was, for the most part, not by design, but because authors simply didn't think about which epsilon value was appropriate for the frequency comparison. This was complicated by the fact that fp_compare_epsilon previously had some issues. This patch introduces FREQ_COMPARE_EPSILON, which is a sensible default value for fp_compare_epsilon when doing frequency comparisons (note that fp_compare_delta already had such a value). Also, it introduces freq_compare_epsilon(x), which is a shorthand for fp_compare_epsilon<double>(x, FREQ_COMPARE_EPSILON). We then replace all occurrences of fp_compare_epsilon<double> which are specific to frequency checks with freq_compare_epsilon.
* uhd: rfnoc: Let connect_through_blocks() return edge listMartin Braun2022-02-041-1/+2
| | | | | | This changes the return value of connect_through_blocks() from void to a list of edges. If the connection can be made, then it will now return the list of connections between the source block and port.
* host: x4xx: Fix some warnings on mac OSLane Kolbly2022-02-042-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following warnings: ``` /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2335:5: warning: \ delete called on non-final 'uhd::rfnoc::x400::x400_gpio_port_mapping' that has \ virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor] delete __ptr; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2648:7: note: in \ instantiation of member function 'std::__1::default_delete<uhd::rfnoc::x400::x4\ 00_gpio_port_mapping>::operator()' requested here __ptr_.second()(__tmp); ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:2602:19: note: in\ instantiation of member function 'std::__1::unique_ptr<uhd::rfnoc::x400::x400_g\ pio_port_mapping, std::__1::default_delete<uhd::rfnoc::x400::x400_gpio_port_map\ ping> >::reset' requested here ~unique_ptr() { reset(); } ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/memory:4063:21: note: in\ instantiation of member function 'std::__1::unique_ptr<uhd::rfnoc::x400::x400_g\ pio_port_mapping, std::__1::default_delete<uhd::rfnoc::x400::x400_gpio_port_map\ ping> >::~unique_ptr' requested here unique_ptr<_Yp> __hold(__p); ^ /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_radio_control.cpp:1\ 92:33: note: in instantiation of function template specialization 'std::__1::sh\ ared_ptr<uhd::mapper::gpio_port_mapper>::shared_ptr<uhd::rfnoc::x400::x400_gpio\ _port_mapping>' requested here auto gpio_port_mapper = std::shared_ptr<uhd::mapper::gpio_port_mapper>( ``` and: ``` /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_gpio_control.cpp:15\ 4:75: warning: adding 'const uint32_t' (aka 'const unsigned int') to a string d\ oes not append to the string [-Wstring-plus-int] "Could not find corresponding GPIO pin number for given SPI pin " + value); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ /Users/rfmibuild/myagent/_work/76/s/host/lib/usrp/x400/x400_gpio_control.cpp:15\ 4:75: note: use array indexing to silence this warning "Could not find corresponding GPIO pin number for given SPI pin " + value); ^ & [ ] ```
* host: zbx: Expose tuning table on property treeLane Kolbly2022-02-034-5/+28
| | | | | This allows viewing or, conceivably, customizing the tuning table that ZBX uses, depending on the particular needs of the end user.
* python: rfnoc: Add get_property bindingsWade Fife2022-02-011-0/+60
|
* rfnoc: Update the MTU forwarding property for some blocksMartin Braun2022-02-018-0/+25
| | | | | | | | | | | | | | | | Note that the default MTU forwarding policy is ONE_TO_ONE, therefore, it is only strictly necessary to modify the MTU forwarding policy for blocks that route data in a different manner. However, it may be nice to explicitly state the forwarding policy for the benefit of the reader. The following blocks had their policies updated: - addsub: ONE_TO_FAN - duc: ONE_TO_ONE - dmafifo: ONE_TO_ONE - null block: DROP - replay block: DROP - split stream: ONE_TO_FAN - switchboard: ONE_TO_FAN
* rfnoc: Set the default MTU forwarding policy to ONE_TO_ONE.Martin Braun2022-02-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the default was DROP. For almost all RFNoC blocks, this is not a good default. It is very easy to crash USRPs by not properly propagating the MTU. For example, the following flow graph: Radio -> DDC -> FIR -> Streamer would crash an X310 when not manually setting an spp value. The reason is: The Radio block has an output buffer of 8192 bytes, capable of handling 2044 samples per packet. However, that's too big for the Ethernet portion of the X310, which would cause the X310 to lose connection between UHD and firmware. If the FIR were configured to propagate MTU, the Host->USRP connection (which has an MTU of <= 8000) would limit the MTU on all links, and the spp value would automatically be reduced to 1996 (or less). This commit uses the post_init() feature to check the user set an MTU in the constructor, and sets it to the default if that didn't happen. This doesn't solve all problems (the new default of ONE_TO_ONE) could also be incorrect, but is a much more suitable default. As a consequence, this has a minor change in how set_mtu_forwarding_policy() can be used: It now must be called during the constructor. Before, the rule was that it may only be called once, but that could also have happened, e.g., during the first property resolution. Now, the constructor is the last time block authors can choose an MTU forwarding policy.
* rfnoc: Add post_init() method to noc_block_baseMartin Braun2022-02-012-0/+23
| | | | | | | | This method allows running a fixed set of rules to check the internal consistency of a block. This may be necessary, because blocks authors may incorrectly implement a certain design rule, and we want the ability to not start an RFNoC graph with blocks that have rule violations which we can write checks for.
* rfnoc: Fix _set_subdev_spec() helper functionAaron Rossetto2022-02-011-3/+8
| | | | | | | | | | | | | | | | | | | | | | | In 716ed77, refactoring was performed to merge `set_tx_subdev_spec()` and `set_rx_subdev_spec()` via the use of a shared helper function, `_set_subdev_spec()`, which factors out differences in the two directions by accepting lambda functions from the caller. However, there were two bugs introduced in the refactoring: - The channel map parameter, which is either `_rx_chans` or `_tx_chans` based on direction, was passed by value and not reference, so changes made by the function were not persisted in the member variables maintained in the `multi_usrp_rfnoc` class. - The connection removal loop checks for the presence of an SEP block on an edge as its termination condition. In the pre-refactored code, the direction determined whether the source or destination of the edge was checked for the SEP. However, in the refactoring, the source of the edge is checked for both TX and RX. While this works for the `set_tx_subdev_spec()` call, it breaks the `set_rx_subdev_spec()` call. This commit fixes the issue by adding another lambda parameter to the `set_subdev_spec()` function, which puts the onus of the edge check on the direction-specific code to ensure it is looking at the correct side of the edge.
* RFNoC: Cache and re-use host endpointsmichael-west2022-01-271-7/+30
| | | | | | | | | | Constatntly incrementing endpoints was causing the entries in the routing table on the device to be exhausted, eventually resulting in a timeout error on control packets. Since a connection between the host and a stream endpoint on a device in a given direction is unique, the host endpoints can be cached and re-used. This change does that. Signed-off-by: michael-west <michael.west@ettus.com>
* uhd: Demote WARNING on minor compat mismatch to DEBUGMartin Braun2022-01-251-2/+2
| | | | | | | | | | | | When the minor FPGA compat number on the device is ahead of what MPM expects, we no longer print a warning. That's because by definition, the FPGA is still compatible with the software in this case. If UHD requires a certain minor compat number to enable a feature, the appropriate behaviour would be to print a warning only for that case. This is the equivalent change to the MPM-only change in 88d28481.
* host: x4xx: gpio: Properly unmap FPGA GPIO valuesLane Kolbly2022-01-242-39/+44
| | | | | | The FPGA GPIO registers don't exactly match the pin numbering on the front panel and in the docs. This commit changes the algorithm so that the API presented to the user matches the front panel.
* rfnoc: Ignore errors in ctrlport response packets if ACKs not wantedAaron Rossetto2022-01-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 0caed5529, a change was made to ctrlpoint_endpoint's behavior such that if a client does not care about checking for ACKs on poke or poll operations, the code calls `wait_for_ack()` with a flag indicating that it should not wait for the ACK, but find and remove the corresponding response from the response queue. This prevents the queue from potentially growing endlessly with response packets that the client doesn't even care about. However, this introduced a subtle, undesired behavioral change. When `wait_for_ack()` finds the corresponding response for a request, it also checks the status field of the response to report any errors flagged by the hardware such as invalid command, routing error, etc. Prior to the change mentioned above, since `wait_for_ack()` was never called when the client doesn't want ACKs, the client would never be never notified of any errors associated with the request. However, with the aforementioned change in placd, when `wait_for_ack()` is called to find and remove the unwanted response packet corresponding to the request, errors **are** checked and reported up the user. The behavior change was unearthed by the X410 ZBX CPLD initialization code, which writes an initial value of 0 to all ZBX CPLD registers--even read-only registers. A control request to write a read-only register results in a response with CMDERR in its status field, as it should. However, since the ZBX CPLD register initialization is performed with a `poke32()` operation which by default doesn't wait for ACKs, this was never a problem until the change to drain the response queue inadvertently caused the error to surface. The result is that creating a USRP session or RFNoC graph session to an X410 device is seen to occasionally fail with a 'RuntimeError: RuntimeError: Failure to create rfnoc_graph' message printed to the console. This commit preserves the desired queue-draining behavior, but ignores any error status on the response when it is found and removed from the queue, thus restoring the behavior pre-0caed5529.
* host: fix build with DPDK v21.11 LTSLuca Boccassi2022-01-205-43/+94
| | | | | | | | | | | | | Some APIs were changed with the latest DPDK LTS release, add some ifdefs to fix the build. Fixes https://github.com/EttusResearch/uhd/issues/547 Updated CMake file to reflect updated DPDK version. Fixed mbuf size to take ethernet headers into account. Updated documentation. Co-authored-by: Martin Anderseck <martin.anderseck@ni.com>
* host: Implement nameless_gain_mixinLane Kolbly2022-01-206-83/+150
|
* lib: set dynamic_lookup and flat_namespaceSteven Koo2022-01-191-3/+4
| | | | | | This resolves some linking issues across binaries. Signed-off-by: Steven Koo <steven.koo@ni.com>
* tests: disable x4xx_radio_block_test on macOSSteven Koo2022-01-191-0/+1
| | | | | | | | This commit disables x4xx_radio_block_test on macOS because the platform has stricter casting and symbol export rules, which causes this test to fail. Signed-off-by: Steven Koo <steven.koo@ni.com>
* lib: Make simple_claimer atomicMartin Braun2022-01-141-38/+19
| | | | | | | | | | | | | | | This fixes multiple issues: - The simple_claimer was not truly atomic, it tested and set the locked-flag on separate lines - It used a Boost yield statement, although we're not running Boost threads - It used the deprecated UHD_INLINE macro We also remove spin_wait_with_timeout(), which was only used in claim_with_wait() because it's not worth putting into its own function. This is no API change on simple_claimer, but it may result in different performance of this spinlock.
* deps: rpclib: Replace distutils.dir_util with shutilAaron Rossetto2022-01-141-2/+1
| | | | | This commit replaces the use of distutils.dir_util.copy_tree() with the equivalent function shutil.copytree().
* SPI: Implement SPI engine for x410Martin Anderseck2022-01-138-15/+366
| | | | | Add SPI Core host implementation for x410 and a discoverable feature to make it accessible.
* rfnoc: Always clear response queue in ctrlport_endpointMartin Braun2022-01-131-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behaviour of ctrlport_endpoint (the register interface for block controllers) to always check for an ACK after doing a poke or poll of any kind. Previously, the behaviour was to only check for an ACK if the policy was set that way, or if the user requested the ACK to be received. The problem with the former approach was that if many pokes were performed without ever requesting an ACK or a poll, the response queue would fill up without ever getting emptied, eventually draining the available heap space. Note that this is not a memory leak in the usual sense, as the response queue was correctly holding on to the response packets. With this change, ctrlport_endpoint::wait_for_ack() now receives a require_ack parameter. If it is false, the behaviour of wait_for_ack() is changed as follows: - If the response queue is empty, immediately return with an empty response payload object. - Otherwise, continue reading elements out of the response queue until it is either depleted (in which case the previous rule kicks in), or we find the ACK corresponding to the command previously sent out. Note that this replicates the corresponding behaviour in UHD 3 (see ctrl_iface_impl::wait_for_ack()).
* uhd: Fix non-standard function name macrosMartin Braun2022-01-124-7/+9
| | | | | | | | | | | | | | | | | 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.
* x300: Fix LED configuration for TwinRXMartin Braun2022-01-111-13/+53
| | | | | | | | | | | | | | The problem was that TwinRX has a special LED configuration (unlike most other daughterboards): Since it has two channels, it is possible to stream RX from both SMA ports. In that case, we would light up both LEDs in green (which was not happening, only one LED would light up, depending on which antenna was set last). This fixes the problem and turns on both LEDs when both channels are used, and both SMA ports are selected. Note that the reason for this issue was an incorrect porting of this code from UHD 3. There, we had separate LED ATR objects per channel.
* x300: clang-formatMartin Braun2022-01-1110-61/+65
|
* e3xx: Fix frequency queryingMartin Braun2022-01-101-2/+11
| | | | | | | The E3xx devices have one LO per TX/RX, respectively. That means when changing the frequency on channel 0, the frequency on channel 1 also gets changed. The code didn't track this change properly: When setting channel 1, channel 0's frequency didn't match.
* RFNoC: Fix DSP frequency accuracymichael-west2022-01-104-12/+26
| | | | | | | | | | The host code was calculating and programming a 32-bit value for the DSP frequency, but the DDS modules in the FPGA only use the upper 24-bits. This led to inaccurate frequency values being returned. This change corrects the resolution of the value on the host side so an accurate value is returned. Signed-off-by: michael-west <michael.west@ettus.com>
* rfnoc: Add atomic item size property for RFNoC blocksLars Amsel2022-01-108-10/+115
| | | | | | | | | | | | | | | An RFNoC block (like the radio) might require a minimal number of items in each clock cycle, e.g. the radio has to process SPC (samples per cycle). Because data in RFNoC is transmitted and processed in packets, we have to make sure the items inside these packets are a multiple of the items processed in each cycle. This commit adds an atomic item size properties which is set by the radio and adapted by the streamers. The streamers adapt the SPP property of the radio block controller depending on the MTU value. This might lead to an SPP value which does not align with the SPC value of the radio block, hence we add a property resolver for the atomic item size.
* rfnoc: transport: Check if streamers are connected in send() and recv()Martin Braun2022-01-102-2/+40
| | | | | | | | | | | | | | | | This adds a check in send() and recv() whether or not the streamer is actually connected. If not, an exception is thrown with the message: [rx_stream] Attempting to call recv() before all channels are connected! or [tx_stream] Attempting to call send() before all channels are connected! The check is a single boolean flag check, but it does add a branch in our hot code. Since this event is unlikely, and only happens in badly configured apps, we will get some help from the CPUs branch prediction to reduce the additional cost of this check.
* host: multi_usrp: Merge set_tx_subdev_spec and set_rx_subdev_specLane Kolbly2022-01-101-99/+67
| | | | | This change simply refactors these methods so that the core of the algorithm is no longer duplicated between them.
* rfnoc: ddc/duc: Improve variable name for _set_freq()Martin Braun2022-01-072-4/+4
| | | | | | | | As Github user johnwstanford points out, the DUC calls the argument 'input_rate', which is wrong (and was copy/pasted from the DDC code). By calling it dds_rate in both cases, we avoid such confusion. This commit only renames a variable. No changes whatsoever.
* lib: SSPH: Fix comment for convert_to_in_buff()Martin Braun2022-01-071-2/+1
| | | | | | | As Github user dylan-baros points out, the comment is copy/pasted from the SRPH. Only comment changes here.
* rfnoc: radio: Fix comment in radio_control_implMartin Braun2022-01-071-1/+1
| | | | | As Github user johnwstanford kindly points out, the comment was incorrect.
* host: Add divider constructor to spi_config_tLane Kolbly2022-01-061-0/+9
|
* host: rf_control: Add internal antenna API abstraction.Lane Kolbly2022-01-055-49/+202
|
* host: Make core_iface inheritence virtualLane Kolbly2022-01-051-1/+1
|
* host: Implement operator<< for data_reader_tLane Kolbly2022-01-051-0/+7
|
* lib: Remove superfluous includes of udp_zero_copy.hppMartin Braun2022-01-052-2/+0
|
* uhd: Remove tcp_zero_copyMartin Braun2022-01-052-250/+0
| | | | | This removes the tcp_zero_copy interface, which is not supported by any USRP.
* host: Add char* overload for device_addr_tLane Kolbly2022-01-052-6/+6
| | | | | | | This allows constructing a multi_usrp using a string constant: ``` auto usrp = uhd::usrp::multi_usrp::make("type=x4xx"); ```
* dpdk: correct MTU warning messageAndrew Lynch2021-12-171-1/+1
|
* rfnoc: graph: make topology failure more descriptivemattprost2021-12-171-4/+41
| | | | | | | | Clarify that invalid RFNoC graph topology failures are due to an attempt to access input or output ports that are not connected to anything in the FPGA. Signed-off-by: mattprost <matt.prost@ni.com>
* dpdk: support new MTU discoveryAndrew Lynch2021-12-171-4/+4
|
* rfnoc: Fix block_id::get_tree_root()Martin Braun2021-12-161-1/+1
| | | | | The path it returned was only valid in UHD 3. Added unit test to confirm.