Skip to content

Instantly share code, notes, and snippets.

@xobs
Created September 10, 2019 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xobs/9bda0fb09b2cb3e5316592b96d4d4087 to your computer and use it in GitHub Desktop.
Save xobs/9bda0fb09b2cb3e5316592b96d4d4087 to your computer and use it in GitHub Desktop.
# Overall system interface
self.address = RegStorage(7, resettable=True, description="""Write to update the USB Address.
When you receive a `SET_ADDRESS` packet from the host, update the address by writing it into
this field. Otherwise, the USB controller will ignore all future packets.
This value will be reset to 0 when the host issues a USB reset.
""")
####
# SETUP endpoint Register Interface
self.data = data = RegStatus(8, description="This FIFO contains the contents of the most recent SETUP packet")
self.status = status = RegStatus(
Field("have", description="`1` if there is data in the FIFO."),
Field("is_in", description="`1` if an IN stage was detected."),
Field("epno", size=4, description="The destination endpoint for the most recent SETUP token."),
Field("pend", description="`1` if there is an IRQ pending."),
Field("data", description="1` if a DATA stage is expected."),
description="Status and diagnostic information about the SETUP handler",
)
self.ctrl = ctrl = RegStorage(
Field("advance", description="Write a `1` here to advance the `DATA` FIFO.", pulse=True),
Field("handled", description="Write a `1` here to indicate SETUP has been handled.", pulse=True),
Field("reset", description="Write a `1` here to reset the `SETUP` handler.", pulse=True),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment