Commit graph

302 commits

Author SHA1 Message Date
Martin Braun
cfcb97616a mpm: e3xx: Fix Pylint warnings in periph_mgr classes
- Whitespace
- Long lines
- Superfluous imports
2022-03-17 14:00:06 -05:00
Aaron Rossetto
910b797e18 images: Update manifest and compat number for X410 2022-03-10 13:53:58 -06:00
Martin Braun
f644c50114 e320: mpm: Remove monitor thread
This thread is a vestige from copy & pasting N310 code, it does
absolutely nothing but occupy resources.
2022-02-24 13:32:36 -06:00
Martin Braun
ba00ff0cf5 Remove FSRU-related files
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.
2022-02-22 14:41:19 -06:00
Martin Braun
3ad6dc8a69 mpm: eeprom: Improve E320 and N3x0 EEPROM code/comments
- Fix some Pylint warnings in eeprom.py
- Improve comments in n3xx.py and e320.py regarding rev_compat values in
  EEPROM
2022-02-16 14:53:37 -06:00
Lane Kolbly
6c8e9700d3 mpm: x4xx: Add function to map from gpio src list indices
set_gpio_src takes a list of twelve sources to apply to the pins. For
the DIO mapping, this is fine, because the twelve pins are zero through
eleven. However, for the HDMI mapping, the pin indices range from one
to nineteen. This commit adds a function to convert from the set_gpio_src
list indices into the pin number.
2022-02-11 07:57:37 -06:00
Aaron Rossetto
7956d0dbc3 images: Revert x4xx manifest and FPGA compat update 2022-02-08 15:23:57 -06:00
Aaron Rossetto
b229b0e796 mpm: x4xx: Update FPGA minor compat number 2022-02-07 07:20:39 -06:00
Lane Kolbly
3d045685ab mpm: x4xx: Align get/set_gpio_src mappings with HDMI pinouts 2022-01-24 14:24:53 -06:00
Lars Amsel
0e7553cd1a MPM: X410: Set correct tuning word
The comment behind the tuning word is correct but 0x200 does not
give a voltage of 1.65V but 2.5V, because the full range of the
DAC is 5V not 3.3V).
2022-01-10 14:55:44 -06:00
Martin Braun
57e8c028d8 mpm: x410: Fix docstrings related to GPS sensors
No code changes, only comment changes.
2022-01-10 08:02:51 -06:00
Martin Braun
4fd1cb317f mpm: x4xx: Add log message for older DIO boards
Older DIO boards don't support all the features of newer ones, but from
the log messages, it's not clear what revision the board has. We add
a log statement to clarify.
2021-12-09 13:09:28 -08:00
Martin Braun
db5ce31b0e mpm: x4xx: Move DioControl into its own module
No functional changes whatsoever, only:
- Move DioControl to its own module (x4xx_dio_control.py)
- Where PyLint was complaining about whitespace issues, fix those
- Fix import list in x4xx_periphs.py after removing DioControl
- Fix import list in x4xx.py to import DioControl from the correct
  location
2021-12-09 13:09:28 -08:00
Martin Braun
8ce91bc738 mpm: x4xx: Add checks before accessing self.dio_control
The X4x0 MPM code doesn't always load the object for the DIO control, it
only does that when certain checks pass (EEPROM readouts need to match
expected values). Therefore, `self.dio_control` may be NoneObject during
operations, and in other areas of the code, we already check if that's
the case.

The APIs added in c36fc5f don't have these checks, which means accessing
these new APIs may result in odd exceptions when trying to dereference
a NoneType object. By adding checks for the initialization state of
`self.dio_control`, we can avoid these and either substitute better
error messages / exception messages, or return safe values.

Note that mpmd_mb_controller also accesses this object indirectly by
checking the length of the return value of get_gpio_banks(). This check
is not affected by this change, as we now are guaranteed to return an
empty list if there is no self.dio_control.
2021-12-06 07:09:14 -08:00
Martin Braun
e1e1aad5c5 mpm: x4xx: Remove superfluous import 2021-12-06 07:09:14 -08:00
Virendra Kakade
3bd6afb51e mpm: x4xx: update mboard_max_rev
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2021-12-02 06:42:09 -08:00
Virendra Kakade
6d6fc2a01d uhd: add support for max10 variants
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
2021-12-02 06:42:09 -08:00
Lane Kolbly
86190b4406 mpm: x4xx: Allow retrieving external power state
The external power can, broadly speaking, be in one of three possible
states:
- OFF (the default)
- ON (the user has enabled external power, and it's working normally)
- FAULT (the external power has encountered a fault condition)

This commit allows the client of MPM to distinguish between these
three conditions.
2021-11-05 12:02:19 -07:00
Lane Kolbly
ae12c802e7 mpm: x4xx: Allow GPIO0 and GPIO1 as port names 2021-11-04 11:32:21 -07:00
Lane Kolbly
e454fdbdee fixup! mpm: x4xx: add DIO GPIO API configuration methods 2021-11-03 06:04:50 -07:00
Dhiren Wijesinghe
c36fc5f6c0 mpm: x4xx: add DIO GPIO API configuration methods
These methods allow for reconfiguration of GPIO masters for x4xx.
The method names are get_gpio_banks, get_gpio_srcs, get_gpio_src,
and set_gpio_src.
2021-11-03 06:04:50 -07:00
Lane Kolbly
7ba25a638e mpm: rfdc: Tear down RFDC on teardown
So, the Python garbage collector is a bit pernicious, in that it happens
behind the scenes in a way which is difficult to predict. The rfdc_ctrl
class expects that its "lifetime" will be a single live/die cycle of the
FPGA (i.e. that when a new FPGA is loaded, it will be destructed).
However, by default the Python GC will keep the X4xxRfdcCtrl class alive
for an arbitrary amount of time, meaning that it's possible that
multiple (C++) rfdc_ctrl classes can be alive at a single time.

When the GC reaps all of these classes, libmetal segfaults when we call
metal_finish several times in a row. This change works around that
issue, if not the overall GC issue, by explicitly deleting the rfdc_ctrl
object.
2021-10-11 10:43:46 -07:00
Grant Meyerhoff
18de8c3271 mpmd: Add discoverable feature for trig i/o mode 2021-09-02 13:34:02 -05:00
Andrew Lynch
61d5cd5a0b mpm: x4xx: update mboard_max_rev 2021-08-25 15:28:22 -05:00
Michael Dickens
fc864f3675 MPM: add X410 support for 250e6 master clock rate 2021-08-24 15:27:35 -05:00
michael-west
d06eb0b44e n3xx: Add support for rev 10
No hardware interface change, so just bumping max revision.

Signed-off-by: michael-west <michael.west@ettus.com>
2021-08-16 15:42:13 -05:00
Sam O'Brien
3688056acd mpm: Expose motherboard regs for debugging
There currently isn't a way to access the motherboard register using MPM
(the ones defined in x4xx_global_regs). This commit adds a simple
interface to peek and poke them which is very similar to the current
interface for the daughter board registers.

Signed-off-by: Sam O'Brien <sam.obrien@ni.com>
2021-08-13 15:51:04 -05:00
Humberto Jimenez
d5c2750e3e mpm: update x410 fpga minor compat number 2021-06-24 13:52:25 -05:00
Lane Kolbly
8adbc72f0d mpm: Move cal freeze defaults to x4xx
This fixes an issue where the slot 0 ADC blocks would erroneously
report that they were unfrozen.

Additionally, adds logic to restore a saved cal freeze state on
sync source change.
2021-06-23 13:15:47 -05:00
Grant Meyerhoff
a8cb5d6359 mpm: restore rfdc nco frequency after setting sync source
After setting sync sources, the RFDCs get reset, we need to restore the previously set frequencies so that the device continues to transmit/receive at the requested frequency
2021-06-22 07:44:09 -05: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
Michael Dickens
ca076ab3ba MPM for N32x: Add 'XQ' image as valid when using sfp0 as time_source 2021-05-18 14:52:08 -05: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
Samuel O'Brien
5df8202c0c sim: Move Hardware Specific to Config File
This commit moves various magic numbers and hardware specific settings
into the configuration file. It also provides default presets for said
configuration files which can be inherited from.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-28 15:25:48 -05:00
Samuel O'Brien
bd278a4b93 sim: Support Configuration Files
This commit adds support for configuration files to the simulator. As of
now, these files only change the source and sink of data samples, but
they are easily extensible to add more configuration to the simulator.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-28 15:25:48 -05:00
Samuel O'Brien
d42ddc8041 sim: Support Streaming
This commit add support for both Tx and Rx streams to the simulator.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-28 15:25:48 -05:00
Samuel O'Brien
267365c945 sim: Clarify Naming of Streams
ChdrSniffer is renamed to ChdrEndpoint to clarify its function as the
actual destination of chdr packets, rather than just an observer.
TxWorker has been renamed to OutputStream and RxWorker has been renamed
to InputStream to avoid ambiguities regarding Tx and Rx terminology.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-08 07:44:12 -05:00
Samuel O'Brien
ee9085a494 sim: Simulator CHDR Parsing and RFNoC Graph
This commit adds a simulated RFNoC Graph to the simulator. It is also
able to process management and control packets which can traverse the
graph and read from simulated registers. Stub callbacks for creating
streams have been provided but are not implemented yet.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-08 07:44:12 -05:00
Samuel O'Brien
bfff8b79b9 sim: Add Daughterboard Methods
This commit adds daughterboard simulation to the simulator. There is a
sim_dboard class which registers it's methods with the rpc server. These
methods are visible over mpm as well as the mpm_shell.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-07 15:29:19 -05:00
Samuel O'Brien
6394a7c6ea sim: Lay Groundwork for Simulator
At this point, only about half of the mpm methods work on the simulator
    over the mpm shell, and it hasn't been tested with uhd at all.
    If you want to give it a try, first install all of the python
    dependencies of mpm (The simulator doesn't require libusrp or any of
    the C++ deps). In addition, running mpm on a desktop machine requires
    the python lib netifaces. Next, make an /mpm/build directory and open
    it. Run `cmake .. -DMPM_DEVICE=sim`, then `make`. Finally, run
    `python3 python/usrp_hwd.py`. You should be able to open another
    terminal and run `mpm/tools/mpm_shell.py localhost` to connect to the
    mpm server.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-07 15:29:19 -05: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