diff --git a/apollo_fpga/gateware/advertiser.py b/apollo_fpga/gateware/advertiser.py index 24fc190..2b2c11c 100644 --- a/apollo_fpga/gateware/advertiser.py +++ b/apollo_fpga/gateware/advertiser.py @@ -71,6 +71,11 @@ def __init__(self, if_number, stop_pin): self.if_number = if_number self.stop_pin = stop_pin + def handled(self, setup): + return (setup.type == USBRequestType.VENDOR) & \ + (setup.recipient == USBRequestRecipient.INTERFACE) & \ + (setup.index == self.if_number) + def elaborate(self, platform): m = Module() @@ -84,9 +89,7 @@ def elaborate(self, platform): (setup.recipient == USBRequestRecipient.INTERFACE) & \ (setup.index == self.if_number)): - with m.Switch(setup.request): - - with m.Case(self.REQUEST_APOLLO_ADV_STOP): + with m.If(setup.request == self.REQUEST_APOLLO_ADV_STOP): # Once the receive is complete, respond with an ACK. with m.If(interface.rx_ready_for_response): @@ -97,12 +100,4 @@ def elaborate(self, platform): m.d.comb += self.send_zlp() m.d.usb += self.stop_pin.eq(1) - with m.Case(): - - # - # Stall unhandled requests. - # - with m.If(interface.status_requested | interface.data_requested): - m.d.comb += interface.handshakes_out.stall.eq(1) - - return m + return m