Commit Graph

16 Commits

Author SHA1 Message Date
Max Becker
b1e4016c2b mpm: Update X4xx GPIO SPI support
Update MPM GPIO handling for the updated X4xx GPIO SPI register
interface.

Require the FPGA compatibility number bump introduced with the new
SPI support so MPM does not operate against an incompatible FPGA image.

Bump MPM compat number.
2026-09-29 13:12:32 +02:00
Abhishek Verma
e24b1cb8bb host/mpm: replace mpRPC with gRPC transport
host:
Replace the msgpack-RPC (rpclib) client with a gRPC-based
implementation. Add auto-generated C++ client and Python bindings
from protobuf definitions. Remove rpclib dependency and integrate
FindgRPC into CMake.

mpm:
Replace the msgpack-RPC server with a gRPC server generated from
protobuf definitions. Add pb_utils.py for type conversion between
Python and protobuf. Update rpc_server.py to dispatch calls via
gRPC stubs. Update mpm_shell to use gRPC. Replace pyudev with sysfs
scan in uio device discovery.

Bump MPM compatibility number to 7.0 and RPC version to 2.

This change requires new depedencies. E.g. for Ubuntu 24.04 or 25.10:
libgrpc++-dev, libprotobuf-dev, protobuf-compiler-grpc, python3-grpcio
2026-07-09 12:12:04 +02:00
Andre Zoch
908236e28f mpm: Fixed reference leaks by clearing references to bound methods
Upon reset, MPM Server tries to destroy the current instance of
Periperal Manager and re-create a new one.
Due to external references to bound methods, Peripheral Manager
and its member DioControl could not get destroyed which resulted
in reference leaks and file desciptor leaks.

This PR clears all external references to bound methods such that
PeripheralManager and its members are cleanly destroyed before
re-creation.

This fixes the "Too Many Open Files" when running 'uhd_image_loader'
repeatedly.
2026-03-05 07:57:18 +01:00
Jörg Hofrichter
ec60c2a3b6 mpm: guard sections from re-formatting using "# fmt: off" 2026-02-04 14:02:15 +01:00
Jörg Hofrichter
2a8f79a6e8 mpm: DioControl: Add support for linear pin mapping 2025-12-17 13:45:14 +01:00
Lars Amsel
342e031a9f mpm: Make setproctitle optional
setproctitle is not available by default on our embedded systems. We therefore use it only if the module is installed and leave the title as is otherwise.
To get the process title one has to install setproctitle via pip and then restart MPM.
2025-02-12 11:31:01 +01:00
Lars Amsel
948c31387d mpm: Set names for all MPM processes
During debug, it is often helpful to distinguish the processes by
name. By default, Python processes inherit the name of the parent,
which is the name of the script executed. This change sets explicit
names for all our MPM processes.
2025-02-10 18:47:57 +01:00
Lars Amsel
4bc97f51ee mpm: Add helper method to register chained signals
When registering a signal, the current registered signal is removed.
This is often an unwanted behavior. Instead, one typically wants to
add code to the existing handler. This helper remembers the current
handler and calls it after the newly registered handler is executed.

Co-authored-by: Martin Anderseck <martin.anderseck@ni.com>
2025-02-10 18:47:57 +01:00
Lars Amsel
cdeb0a4b4c mpm: Fix linter issue
This fixes linter issues for the upcoming changes to MPM.
2025-02-10 18:47:57 +01:00
Martin Anderseck
b9a3ae9bcc mpm: x4xx: Add back SPI as source for GPIO
In commit bc8713e7af the SPI functionality was made available
conditionally depending on the FPGA version number. For this,
all SPI entries were removed from the X4XX_GPIO_SRC_RADIO variable
and put into an own variable. But therefore SPI was not available
anymore as valid source for GPIO. This change reintroduces SPI and
thus enables the SPI functionality again.

Co-authored-by: Javier Valenzuela <javier.valenzuela@ni.com>
2022-04-29 06:08:18 -07:00
Martin Anderseck
bc8713e7af host: SPI: Read number of supported SPI slaves from device
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.
2022-04-04 12:27:18 -07:00
Lane Kolbly
37987a87f4 mpm: x4xx: Remove GPIO classic mode register 2022-03-23 16:14:07 -05: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
Lane Kolbly
3d045685ab mpm: x4xx: Align get/set_gpio_src mappings with HDMI pinouts 2022-01-24 14:24:53 -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