Commit graph

123 commits

Author SHA1 Message Date
Virendra Kakade
36f6c11ef3 mpmd: fix timekeeper misalignment
Change the syrnchronization order to be following:
- Run the MTS (multi-tile sync) procedure
- Run the timekeeper alignment to next_pps edge
- Run the post timekeeper alignment steps (none for now)

This ensures that any effects caused due to delay adjustments which are
part of the MTS procedure do not affect timekeeper alignment.
Without this change timekeepers on two X4xx devices would be mis-aligned
slightly in a multi-device scenario.

Note that setting all timekeepers to a common time_spec on the next_pps
as a part of post-initialization application code will still align them perfectly.

Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2023-10-09 11:01:28 -07:00
Grant Meyerhoff
78156eabfa mpm: move pop_host_tasks to PeriphManagerBase
Move pop_host_tasks function call from just x4xx to all MPM devices so it can be safely called from mpmd_mboard_impl
2023-09-06 10:09:36 -05:00
Martin Braun
b16631cf5e mpm: Add dboard_info to db_iface initialization 2023-04-02 22:24:31 -05:00
Martin Braun
87423d1d75 lib/mpm: Add MPM synchronization API
This adds a new synchronization step in the MPMD device initialization.

- Add API calls to PeriphManagerBase and rpc.py (synchronize() and
  aggregate_sync_data())
- Add sane default implementations to PeriphManagerBase

Note: This adds new APIs to MPM, but we won't change the compat number
in this commit, since the new API is not yet being used.
2023-03-24 16:08:30 -07:00
Martin Braun
3113054712 mpm: periph_manager: Remove vestigial Python-six 2023-03-06 11:00:52 -05:00
Martin Braun
4cad444604 mpm: Move get_dboard_class_from_pid()
Move get_dboard_class_from_pid() from periph_manager/base.py to
periph_manager/__init__.py. This allows usage of that class elsewhere.
2023-03-06 11:00:52 -05:00
Martin Braun
4d6b7263f5 Revert "uhd: Revert Raw UDP Host Changes"
This reverts commit 6cb1dcca83.

Raw UDP support is added back in on both MPM and UHD side.
2022-09-21 15:35:55 -07:00
Steven Koo
6cb1dcca83 uhd: Revert Raw UDP Host Changes
This reverts the Raw UDP host changes which is breaking
multiple interface streaming.

Commits addb81aa5d2d6adcd3a0c7a8d59fcd96af0c1ec4^..b1ca51f97aaa2226ed6ef339fb26fbea54ab7593
are reverted.

Reverts:
doc: Update manual on streaming
examples: Add remote RX streaming example
rfnoc: Enable remote UDP streaming
mpm: e320: Enable raw UDP streaming
mpm: n3xx: Enable raw UDP streaming
mpm: x4xx: Enable transport manager adapter
mpm: Enable opt-in transport adapter control
rfnoc: Transition stream managers and mgmt_portal to topo_graph_t
rfnoc: Add topology graph object
uhd/mpm: Add API to set remote routes
mpm: xports: Add XportAdapterMgr class
2022-09-12 17:00:19 -05:00
Martin Braun
40b66c9e56 uhd/mpm: Add API to set remote routes
This is an addition to both PeriphManagerBase (MPM) and mb_iface (UHD).
Main changes:

- Addition of mb_iface::add_remote_chdr_route() and
  mb_iface::get_chdr_xport_adapters()
- In X3x0, these APIs are stubbed out.
- In mpmd, these APIs are implemented and call the new MPM APIs (see
  below)
- Addition of PeriphManagerBase.add_remote_chdr_route() and
  PeriphManagerBase.get_chdr_xport_adapters()
- The PeriphManagerBase implements these APIs fully when the
  'remote_udp_streaming' FPGA feature is detected.
- The MPM compat number is bumped to 4.3. UHD will continue to work with
  lower compat numbers. It will query the compat number and act
  accordingly.
2022-08-30 13:43:36 -05:00
Martin Braun
216f1871f6 mpm: Factor out transport API into PeriphManagerBase
All MPM devices use identical implementations of the transport API.
Minor differences between the actual lines of code in the various
transport adapters are due to minor optimizations, such as hard-coding
'udp' as the only valid transport type for the N3xx series.

This change moves the implementation of the transport API calls
(get_chdr_link_options() and get_chdr_link_types()) into
PeriphManagerBase. The class attributes _xport_adapter_mgrs is also
declared in that class, but defining them is left up to the individual
device implementations.
2022-07-12 13:10:39 -05:00
Martin Braun
780c921835 mpm: Introduce fpga_features set
This is a set of strings, each of which describe features the FPGA has.
The purpose of this is to provide a standard location to store knowledge
about available features. Typically, the code will read the compat
numbers to see if a feature is available, and then store a corresponding
string in this set.
2022-07-08 05:51:29 -07:00
Martin Braun
9573640db7 mpm: x4xx: Fix clock/time source API
In f73e327, we modified PeriphManagerBase to explicitly list all
required methods as per the MPM/UHD API. This had an unintended side
effect: Because the clocking methods on x4xx are imported from
X4xxClockMgr, and not defined on x4xx itself, the method used to import
methods from X4xxClockMgr onto x4xx would refuse to re-define API calls
such as set_clock_source(), get_clock_source(), and so on.

The solution is to allow _add_public_methods() to overwrite existing
methods, which means we can overwrite abstract methods from
PeriphManagerBase in this fashion.

Without this patch, UHD sessions could fail in the following manner:

>>> import uhd
>>> U = uhd.usrp.MultiUSRP("type=x4xx")
>>> U.get_clock_source(0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
U.get_clock_source(0)
RuntimeError: RuntimeError: Error during RPC call to `get_clock_source'.
Error message: get_clock_source() not available on this device!
2022-03-30 05:29:00 -07:00
Martin Braun
a705845c4c mpm: e3xx: Fix get_sync_sources() API
get_sync_sources() was not implemented for E31x and E320. Because UHD
assumes this exists, calling this would cause an error like this:

>>> import uhd
>>> U = uhd.usrp.MultiUSRP("type=e3xx")
>>> U.get_sync_sources(0)
Traceback (most recent call last):
File "<input>", line 1, in <module>
U.get_sync_sources(0)
RuntimeError: rpc::timeout: Timeout of 2000ms while calling RPC function
'get_sync_sources'
2022-03-28 12:54:07 -07:00
Martin Braun
f73e32729d mpm: PeriphManagerBase: List all sync-related methods
All PeriphManagerBase childs need to implement

- get_{clock,time,sync}_source()
- get_{clock,time,sync}_sources()
- set_{clock,time,sync}_source()

So we populate PeriphManagerBase with defaults for all of those.
2022-03-28 12:54:07 -07:00
Lars Amsel
2a575bf9b5 uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
Co-authored-by: Martin Braun <martin.braun@ettus.com>
Co-authored-by: Paul Butler <paul.butler@ni.com>
Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com>
Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com>
Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Co-authored-by: Lane Kolbly <lane.kolbly@ni.com>
Co-authored-by: Max Köhler <max.koehler@ni.com>
Co-authored-by: Andrew Lynch <andrew.lynch@ni.com>
Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com>
Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
2021-06-10 12:01:53 -05:00
Lars Amsel
60a147a6a1 mpm: Remove helper classes from RPC API
All public callables are exported as part of the RPC API. Because
classes are callable in Python they are now protected to prevent
export. Having theses inner helper classes marked as protected
also matches better their purpose as the are not meant to be used
outside the class.
2021-06-03 09:34:37 -05:00
Lars Amsel
0d55f572b7 mpm: Add symbol name based EEPROM read, cleanup EEPROM handling
Handling of EEPROM read was cleanup in PeriphManagerBase such that EEPROM
reading for mother and daugther board have similar names and signatures.

Base class supports symbol names for the nvmem files which make it easy
to find them by name such as db0_eeprom instead of addresses like
ff020000.i2c:cros-ec@3c:db0-i2c-tunnel.

Base class furthermore reads out all available auxiliary board EEPROM
files and stores them in a dictionary member.
2021-05-31 05:28:47 -07:00
Martin Braun
99e5230e4b mpm: PeriphManagerBase: Add _add_public_methods()
This allows conditionally adding public API methods.
2021-04-29 14:34:55 -05:00
Martin Braun
87b65cf7ab mpm: periph_mgr: Demote "no SPI nodes" warning
When there are SPI nodes declared for a daughterboard, MPM will emit
a warning: "No SPI nodes for dboard". The warning is misleading, because
this only occurs when no SPI nodes where *declared*, not when they were
declared but not found. This is entirely normal for USRPs where the
daughterboards do not have SPI nodes, and thus, not even worth a debug
statement.
2021-04-21 15:19:46 -05:00
Martin Braun
5d3a6d2044 mpm: periph manager: Fix get_mb_eeprom() return value formatting
The get_mb_eeprom() RPC call is supposed to return a string -> string
map and thus converts all EEPROM entries to strings. However, for raw
strings, the existing conversion (using str()) was not correct (we need
to decode raw strings first).

This would lead to things like the serial being returned as b'ABCD123'
instead of just ABCD123.
2021-03-25 07:56:30 -05:00
Toni Jones
1a9033b3e9 mpm: Add DboardIface for MB DB driver control
Add DboardIface class which will act as an interface to bridge the gap
between MB and DB drivers in MPM. The DboardIface will be implemented
by each Motherboard with MB specific information. Dboard objects
will then instantiate the class in order to utilize the implemented
control functions.
2021-03-04 12:09:39 -06:00
Michael Auchter
5ef29d9396 mpm: deduplicate dboard eeprom handling
The _get_dboard_eeprom_info implementations are the same with the
exception of how the dboard eeprom is actually read. Break that out into
a _read_dboard_eeprom method to reduce code duplication.

The base class now defines a lambda expression for the eeprom reader
which can be changed in subclasses.

Co-authored-by: Lars Amsel <lars.amsel@ni.com>
Co-authored-by: Michael Auchter <michael.auchter@ni.com>
2021-02-11 12:26:10 -06:00
Michael Auchter
fa6e7a7430 mpm: filesystem_status: tolerate absence of mender
If the mender utility is not installed or exits with a failure, return
NULL for the artifact rather than raising an exception (and disrupting
device initialization).
2021-02-09 07:36:08 -06:00
Lane Kolbly
5471a1f521 mpm: Implement get_sync_source and get_sync_sources. 2021-01-25 15:27:49 -06:00
Aaron Rossetto
7b43614846 sim: Ignore mender artifact file on sim devices 2021-01-21 12:47:54 -06:00
Joerg Hofrichter
a37413055e mpm: use filesystem_status from sys_utils
Use the utility functions for getting the filesystem version string
and for getting the Mender artifact which are now available in
usrp_mpm.sys_utils.
2020-10-06 15:21:27 -05:00
RobertWalstab
1d3866bef4 uhd: remove liberio 2020-07-20 16:01:03 -05:00
Lane Kolbly
6aa090b7fd mpm: Return filesystem info from get_device_info
This commit returns information on the filesystem and mender artifact
versions to clients of the MPM RPC connection.
2020-06-05 15:03:08 -05:00
Lane Kolbly
512fd1151f mpm: Return dboard_info in get_device_info
Though this information is also returned via usrp_probe, it can be
useful to provide this information to trackers which scrape the
get_device_info RPC call.

The dboard information is split up and cast to string just to
simplify parsing on the receiving end.
2020-06-05 15:03:08 -05:00
Lane Kolbly
655b32fc1c mpm: Return build info in mpm_sw_version
The mpm_version key was being overridden by the MPM_COMPAT field in
rpc_server::get_device_info.
2020-05-27 09:45:41 -05: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
Martin Braun
d60e4d87d8 mpm: Clean up code, improve Pylint score
Many small cleanups:
- Fix copyright headers
- Fix superfluous imports
- Pull some constants out of classes where appropriate
- Fix formatting
- Improve/fix some docstrings
- Disable specific Pylint warnings where appropriate
- Global catches use BaseException instead of Exception
- Don't use len() for empty checks
- Make sure to declare all self attributes in __init__ (note: this is
  particularly of interest for E310, becuase its regular init happens
  outside of __init__)
- Compacted some E310 code that had multi-DB checks
2019-11-26 12:21:33 -08:00
Martin Braun
ec488d49c0 mpm/mpmd: Remove token requirement for device info
This removes the token requirement for get_proto_ver() and
get_chdr_width().
2019-11-26 12:21:33 -08:00
Martin Braun
025ffdce34 mpm: Move common mboard regs code to common location
This assumes an existence of mboard_regs_control in PeriphManagerBase
and implements most TK controls there. All the *_periphs.py files can
now use a common class for registers, including the TK access, but also
git hash, build date, and device ID access.

This also fixes two issues:
- set_timekeeper_time() and set_tick_period() had a bug that would
  incorrectly calculate the upper 32 bits of their respective registers.
- N3xx had a bug that would swap around set time now and next PPS. This
  got auto-fixed because the common code never had this bug.
2019-11-26 12:21:33 -08:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
michael-west
c2f1f21d41 MPM: Add check for valid EEPROM address
Provides a more useful error message if the EEPROM cannot be found at
the specified address.  Without this change a generic index out of range
error is raised.

Signed-off-by: michael-west <michael.west@ettus.com>
2019-10-15 15:21:52 -07:00
Martin Braun
da6bf176aa mpm: periph manager: Fix typo in docstring (update default args) 2019-10-11 12:25:52 -07:00
Matthew Crymble
f47d805cc3 mpm: fixed mboard_max_revision value
This value should be 9 to correspond with the rev J motherboards.
This property was renamed to mboard_last_rev_compat in a previous commit.
But mboard_max_rev is actually a more accurate description,
since it specifies the latest hardware revision that the software
is aware of.  I renamed all references back to mboard_max_rev.
2019-09-24 17:23:44 -07:00
Trung Tran
75dc7a1d64 mpm: Change SW/HW compat check to use last_rev_compat
Newer revisions of the E320 and N3xx motherboards use EEPROM version 3,
and store a rev_compat field. The rev_compat is the last revision that
this hardware is compatible with. We now use that instead of simply the
revision.
2019-05-10 16:59:58 -07:00
Sugandha Gupta
178b35569b e310/e320: Move E310 to MPM architecture and refactor
- Turns the E310 into an MPM device (like N3xx, E320)
- Factor out common code between E320 and E310, maximize sharing between
  the two devices
- Remove all pre-MPM E310 code that is no longer needed
- Modify MPM to remove all existing overlays before applying new ones
  (this is necessary to enable idle image mode for E310)

Co-authored-by: Virendra Kakade <virendra.kakade@ni.com>
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2019-05-01 15:17:23 -07:00
Trung Tran
3fb8cfe96c n3xx: init peripherals before loading FPGA
Issue: Current code loads FPGA too early while many
essential peripherals such as net clocks are not brought up.

This change will make sure those are got init before FPGA loaded.

Signed-off-by: Trung Tran<trung.tran@ettus.com>
2019-02-01 15:28:35 -08:00
Brent Stapleton
90f2d1579a mpm: add Git hash, version to device info
Adding MPM Git hash and version to the MPM device info. This
information is currently only available through logs when MPM starts
(it is the first log message in usrp_hwd.py). Adding it to the device
info makes it accessible to any application which checks that, such as
uhd_usrp_probe.
2018-08-20 17:57:16 -07:00
Martin Braun
c8c4cf1b0c mpm: Remove unused _init_args from PeriphManagerBase 2018-07-17 10:49:21 -07:00
Brent Stapleton
05722dcc51 mpm: n3xx: Factor out component updating
- Refactoring component (FPGA, DTS) updating functions out of
n3xx.py into their own components.py. The ZynqComponent class now
defines the methods to update these two components.
- Adding super().__init__() to the PeriphManagerBase class. This is
needed to get the multiple inheritance used in N3XX now to work, and
(apparently) good Python practice.
2018-07-11 12:42:45 -07:00
Brent Stapleton
9c2e1907e9 mpm: n3xx: Overridable crossbar base port
Moving the RFNoC crossbar base port to the class overridables. MPM
devices may need to reserve different numbers of ports for non-blocks;
this can now be done by overriding the crossbar_base_port.
2018-07-06 14:53:40 -07:00
Martin Braun
22d684c3c8 mpm: Use device_info to determine overlay list 2018-06-08 13:27:13 -07:00
Martin Braun
cd716e264e mpm: n3xx: Derive product key programmatically
Since there is no simple mapping from an arbitrary tuple of mboard- and
dboard info dictionaries, we use generate_device_info() to figure out
the product key.
2018-06-08 13:27:13 -07:00
Martin Braun
30cc2e9982 mpm: Distinguish mboard_info and device_info
In the N3xx series, the motherboard ID and the device ID can differ. For
example, the N310 could share the same motherboard with a different
device that uses different daughterboards.
2018-06-08 13:27:13 -07:00
Martin Braun
aa0cc703fe mpm: Refactor periph manager init; split EEPROM read from rest
The readout of EEPROMs is moved to their own functions. This will allow
us to read out EEPROM values before starting the initialization.
2018-06-08 13:27:13 -07:00
Brent Stapleton
93617aa25c mpm: Adding offset to EEPROM reads
Adding address offset to all MBoard and DBoard EEPROM reads. This
matches what we're doing for the user portion of the EEPROM, and
allows us to share access to an EEPROM.
2018-03-20 16:47:24 -07:00