Skip to content

Commit

Permalink
apollo_fpga.gateware: do not trigger reconfiguration using flash --fast
Browse files Browse the repository at this point in the history
Return control to Apollo instead to match `flash` behavior.
  • Loading branch information
mndza committed Jun 25, 2024
1 parent 2523d9a commit b871346
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion apollo_fpga/gateware/flash_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from usb_protocol.emitters import DeviceDescriptorCollection
from usb_protocol.emitters.descriptors.standard import get_string_descriptor

from apollo_fpga import ApolloDebugger
from .advertiser import ApolloAdvertiser, ApolloAdvertiserRequestHandler

VENDOR_ID = 0x1209
Expand Down Expand Up @@ -363,7 +364,7 @@ def __init__(self):
self.interface, self.endpoint = self._find_cfg_flash_bridge(device, get_ep=True)

def __del__(self):
self.trigger_reconfiguration()
self.request_handoff()

@staticmethod
def _find_cfg_flash_bridge(dev, get_ep=False):
Expand All @@ -379,6 +380,13 @@ def trigger_reconfiguration(self):
request_type = usb.ENDPOINT_OUT | usb.RECIP_INTERFACE | usb.TYPE_VENDOR
return self.device.ctrl_transfer(request_type, 0, wValue=0, wIndex=self.interface)

def request_handoff(self):
""" Requests the gateware to liberate the USB port. """
try:
ApolloDebugger._request_handoff(self.device)
except Exception:
pass

def transfer(self, data):
""" Performs a SPI transfer, targeting the configuration flash."""
tx_sent = self.device.write(self.endpoint, data)
Expand Down

0 comments on commit b871346

Please sign in to comment.