Skip to content

Commit

Permalink
apollo_fpga.gateware: convert request handler to new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mndza committed Jan 16, 2024
1 parent b1e75fb commit f68195e
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions apollo_fpga/gateware/advertiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,18 @@ def elaborate(self, platform):
(setup.recipient == USBRequestRecipient.INTERFACE) & \
(setup.index == self.if_number)):

with m.Switch(setup.request):
with m.If(setup.request == self.REQUEST_APOLLO_ADV_STOP):

with m.Case(self.REQUEST_APOLLO_ADV_STOP):
# Notify that we want to manage this request
m.d.comb += interface.claim.eq(1)

# Once the receive is complete, respond with an ACK.
with m.If(interface.rx_ready_for_response):
m.d.comb += interface.handshakes_out.ack.eq(1)
# Once the receive is complete, respond with an ACK.
with m.If(interface.rx_ready_for_response):
m.d.comb += interface.handshakes_out.ack.eq(1)

# If we reach the status stage, send a ZLP.
with m.If(interface.status_requested):
m.d.comb += self.send_zlp()
m.d.usb += self.stop_pin.eq(1)
# If we reach the status stage, send a ZLP.
with m.If(interface.status_requested):
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

0 comments on commit f68195e

Please sign in to comment.