From 09eb1f6fb402690af1292a2cbe4d7b9635383e71 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Fri, 5 Jul 2024 10:17:15 +0200 Subject: [PATCH] gateware.platform: add apollo_gateware_phy to LUNAApolloPlatform (#269) Adds the apollo_gateware_phy property to LUNAApolloPlatform to specify the preferred USB PHY for Apollo gateware. When the platform does not share a port with Apollo, it defaults to default_usb_connection. --- luna/gateware/platform/core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/luna/gateware/platform/core.py b/luna/gateware/platform/core.py index 86e3cb15..135f76d3 100644 --- a/luna/gateware/platform/core.py +++ b/luna/gateware/platform/core.py @@ -119,6 +119,17 @@ def port_sharing(self, phy_name): sharing = getattr(self, "apollo_port_sharing", {}) return sharing.get(phy_name, None) + + @property + def apollo_gateware_phy(self): + """ Returns the USB PHY for Apollo gateware. """ + + sharing = getattr(self, "apollo_port_sharing", {}) + if len(sharing) == 0: + return self.default_usb_connection + return list(sharing.keys())[0] + + def toolchain_program(self, products, name): """ Programs the relevant LUNA board via its sideband connection. """