aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
Commit message (Collapse)AuthorAgeFilesLines
* x300: Fix invalid GPIO source bank error messageAaron Rossetto2022-07-201-2/+2
| | | | | | | | | | | | | | | When calling `get_gpio_srcs()` or `get_gpio_src()` with an invalid bank parameter, the error text associated with the `uhd::runtime_error` that is thrown prints the expected bank, not the erroneous bank, e.g.: >>> my_x310.get_gpio_srcs('BAD_BANK', 0) [ERROR] [X300::MB_CTRL] Invalid GPIO source bank: BAD_BANK. Only supported bank is FP0 Traceback (most recent call last): File "<stdin>", line 2, in <module> RuntimeError: RuntimeError: Invalid GPIO source bank: FP0 The invalid source bank on the last line should read BAD_BANK, not FP0.
* uhd: fix minor typo when querying tx sensors property treeDavid Raeman2022-07-201-1/+1
|
* lib: Remove stray file async_msg.hppMartin Braun2022-06-101-85/+0
|
* zbx: Remove stray includeMartin Braun2022-06-101-1/+0
|
* rfnoc: Add atomic_item_size property to FFT blockMartin Braun2022-06-101-1/+30
| | | | | | 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.
* x300: Change order of GPIO banksMartin Braun2022-06-101-1/+1
| | | | | FP0 is now listed first. This helps with determining a default GPIO bank.
* rfnoc: Fix vector use in replay_block_control_implAaron Rossetto2022-06-101-2/+2
| | | | | | | | | | | | | 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.
* rfnoc: Fix register_xport_hop_cfg_fns() usageMartin Braun2022-06-102-4/+11
| | | | | | 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.
* rfnoc: Improve comments regarding streaming and mgmt. codeMartin Braun2022-06-105-10/+59
| | | | | This commit *only* touches comments in the code for RFNoC streaming, link management and management portal.
* n320: Fix reading DB serial in applying correctionsMartin Braun2022-06-101-2/+2
| | | | | | 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.
* rfnoc: fix double conversionsLars Amsel2022-06-101-4/+3
| | | | | result of get double was saved in an int value instead of double replaced C cast by static_cast
* n320: Improve comments regarding low bandMartin Braun2022-06-102-4/+6
| | | | | The N320 code include some constants that were either unused or incorrect. This clarifies the lowband frequency.
* uhd: change default into option flag in register definitionLars Amsel2022-06-103-35/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* n310: Improve LO source control options for ALL and LO2 casesmattprost2022-06-101-19/+40
| | | | | | | | 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>
* rfnoc: Improve documentation for chdr_ctrl_endpointMartin Braun2022-06-101-3/+23
|
* lib: Add missing include to offload_io_service_client.hppMartin Braun2022-06-101-0/+1
|
* utils: Check install-prefix for imagesSteven Koo2022-04-191-8/+11
| | | | | | | | 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>
* multi_usrp_rfnoc: Set assignment instead of equalitySteven Koo2022-04-121-1/+1
| | | | | | | This resolves a typo intoduced by multi_usrp_rfnoc: Add TX buffering using Replay Signed-off-by: Steven Koo <steven.koo@ni.com>
* uhd: Update MPM compat minorAaron Rossetto2022-04-121-1/+1
|
* rfnoc: Add filter_node python bindingsmattprost2022-04-071-0/+9
| | | | Signed-off-by: mattprost <matt.prost@ni.com>
* n310: Add Filter API to n310mattprost2022-04-077-18/+202
| | | | | | | | | | 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>
* n310: Add frontend bandwidth controlmattprost2022-04-073-25/+107
| | | | | | | | | | | | 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>
* n310: cpld: Get and set TX ATR bitsmattprost2022-04-072-0/+66
| | | | | | | | | 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>
* ic_reg_maps: Generate save state read functionsmattprost2022-04-071-0/+24
| | | | | | | | 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>
* types: filters: Add python support for digital filtersmattprost2022-04-071-5/+44
| | | | Signed-off-by: mattprost <matt.prost@ni.com>
* rfnoc: Modify prop. propagation algorithm (back-edge resolution)Martin Braun2022-04-072-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* rfnoc: graph: Allow property forwarding on back-edgesMartin Braun2022-04-072-5/+8
| | | | | | 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.
* multi_usrp_rfnoc: Add TX buffering using Replaymichael-west2022-04-074-86/+466
| | | | | | | | | | | 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>
* rfnoc: Fix test_timed_commands for RFNoC devicesmichael-west2022-04-051-1/+3
| | | | | | | - 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>
* host: SPI: Read number of supported SPI slaves from deviceMartin Anderseck2022-04-044-20/+44
| | | | | | 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.
* uhd: Replay block version 1.1michael-west2022-04-011-2/+59
| | | | | | | | | - 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>
* n320: fix issue that occasionally prevents lo_locked upon first set_freqDavid Raeman2022-04-012-8/+45
| | | | | | | | | | | | 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.
* log: Add DPDK version to system infomattprost2022-04-011-2/+8
| | | | | | Log installed DPDK version on boot. Signed-off-by: mattprost <matt.prost@ni.com>
* dpdk: Add support for DPDK 18.11 APImattprost2022-04-013-1/+41
| | | | | | | | 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>
* python: rfnoc: Add new replay block APIs to Python APIMartin Braun2022-03-301-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | 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!") ```
* rfnoc: replay: Add ability to capture and read async infoMartin Braun2022-03-301-0/+72
| | | | | | | - 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.
* rfnoc: fir filter: Add support for multiple channels to block controllerJonathon Pendlum2022-03-231-54/+117
|
* host: x410: Emulate GPIO classic ATR mode using new modeLane Kolbly2022-03-233-13/+83
| | | | | | 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.
* host: x410: Cache GPIO source in mb_controllerLane Kolbly2022-03-233-1/+12
|
* Fix handling of discontinuities in power calibration dataLars Amsel2022-03-237-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* host: Create meta_range_t::as_monotonicLane Kolbly2022-03-141-0/+29
| | | | | | | | 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.
* host: test: Add UHD_UNITTEST_LOG_LEVEL overrideLane Kolbly2022-03-111-19/+35
|
* rfnoc: radio: Explicitly set MTU forwarding policy to DROPMartin Braun2022-03-081-0/+1
| | | | | | | | | | | 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.
* rfnoc: Refactor ctrlport_endpoint; fix MT issuesAaron Rossetto2022-03-031-121/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* N310: Deactivate frontend components on radio shutdownmattprost2022-03-033-0/+35
| | | | | | | | Make sure no active components are connected to the TX frontend during next boot. This avoids configurations that could generate unwanted tones during operations such as the Mykonos init cals. Signed-off-by: mattprost <matt.prost@ni.com>
* rfnoc: window: Set window size register after loading coefficientsJonathon Pendlum2022-03-021-0/+4
|
* rfnoc: replay: Add atomic item size propertyMartin Braun2022-03-021-0/+37
| | | | | | | This adds the atomic item size property to the replay block, which was originally introduced in 3e5e4eb. The effect is that it enforces streaming data to and from the block that is an integer multiple of the word size.
* uhd: fix negligible copy/paste typos in rhodium radio controlDavid Raeman2022-02-282-4/+4
|
* convert: Make narrowing conversions saturateAaron Rossetto2022-02-282-14/+24
| | | | | This commit modifies the explicitly written narrowing conversions to clamp the results to the limits of the signed integer type.
* convert: Minor cleanupAaron Rossetto2022-02-281-2/+2
| | | | | | | | | | | | | | | | | | | This commit implements some minor cleanup of various converter- and convert test-related code: * Improves the log messages regarding which converter was returned for a request. * Modifies the result checking code in the converter tests to only report an out-of-range sample error once, rather than reporting every out-of-range sample encountered during the test. This vastly cuts down on the output when a conversion has failed. * Adds a function `reverse_converter()` which, given a `convert::id_type` describing a conversion from C1 to C2, returns a `convert::id_type` describing the reverse conversion (C2 to C1). * Removes two redundant test cases from the converter test.