Commit graph

109 commits

Author SHA1 Message Date
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
Martin Braun
86b95486ed mpm: Add INFO log statements on MPM reset and component update 2018-03-13 16:19:03 -07:00
Martin Braun
f9a8098cae mpm: Fix some Pylint warnings
No functional changes.
2018-03-06 15:45:15 -08:00
Martin Braun
ed2d1ac3e4 mpm: Demote some log messages
The log output at level 'INFO' was pretty cluttered. This cleans up the
log messages at the higher levels. In some cases, log message typos or
capitalizations were also fixed.
2018-03-06 15:28:33 -08:00
Martin Braun
9d55c58858 mpm: n300/n310: Select correct overlay based on product ID 2018-03-05 15:56:41 -08:00
Martin Braun
d150449822 n310: Make MPM report FPGA version and description, UHD read it
The FPGA and MPM version as well as the description of the device
("N300-Series Device") and its name (its the hostname) are now properly
reported coming from MPM, properly saved in the prop tree, and
uhd_usrp_probe can nicely display them this way.
2018-03-02 13:48:14 -08:00
Martin Braun
c73a013d01 mpm: periph_manager: Guarantee self.dboards exists
Other components assume the existence of mgr.dboards, and so it needs to
be default-initialized before doing any code that can go wrong.
2018-02-28 15:20:12 -08:00
Brent Stapleton
94aedfd2d9 mpm: adding get_component_info
Add getter function for updateable component information. This is a
minor compat number bump.
2018-02-19 16:58:52 -08:00
Martin Braun
e9288a439c mpm: Update all license headers
- Fix typo in company name (missing 'a')
- Updated SPDX license identifier to version 3.0
2018-02-19 16:55:08 -08:00
Martin Braun
832cbe095a mpm: Use prefs API for periph manager
- Allow to set default args via config file
- Read them from prefs API
- override-db-pids uses the same APIs now ([overrides] section in
  config file, prefs API, and same dictionary as --default-args when
  used on the command line
2018-02-08 22:18:14 +01:00
Martin Braun
852bf3aa10 mpm: n310: Return CHDR addresses as part of device_info
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2018-02-07 14:04:30 -08:00
Martin Braun
4c81ed0a5d fixup! mpm: Log timeouts during API calls, reset timer on claimed calls 2018-01-23 15:21:28 -08:00
Martin Braun
0da3eefcc3 mpm/mpmd: Report device state using get_init_status() and verify
When trying to run init(), mpmd will first query the initialization
status of the MPM device. If it is found to be in a bad state, it will
not go forward with initialization, but instead print the error message.
2018-01-16 13:10:37 -08:00
Martin Braun
2d424a54fc mpm: Refactor PeriphManager classes
- Sort methods by functional groups
- Removed some cruft
2018-01-16 12:10:37 -08:00
Martin Braun
4e873a4cb1 mpm: n310: Check all periphs for initialization status 2018-01-12 18:17:54 -08:00