Transfer

This module contains gateware designed to assist with endpoint/transfer state management. Its components facilitate data transfer longer than a single packet.

class sol_usb.gateware.usb.usb2.transfer.USBInTransferManager(*args, src_loc_at: int = 0, **kwargs)

Sequencer that converts a long data stream (a USB transfer) into a burst of USB packets.

This module is designed so it can serve as the core of a IN endpoint.

Variables:
  • active (Signal(), input) – Held high to enable this module to send packets to the host, and interpret tokens from the host. This is typically equivalent to the relevant endpoint being addressed by the host.

  • transfer_stream (StreamInterface, input stream) –

    Input stream; accepts transfer data to be sent on the endpoint. This stream represents a USB transfer, and can be as long as is desired; and will be sent in max-packet-size chunks.

    For this stream: first is ignored; and thus entirely optional. last is optional; if it is not provided; this module will send only max-length-packets, sending a new packet every time a full packet size is reached.

  • packet_stream (USBInStreamInterface, output stream) – Output stream; broken into packets to be sent.

  • flush (Signal(), input) – If high, data that is currently buffered will be sent out as soon as possible. The module will not wait further for the input stream to end, or to have a max-length packet; it will send a packet as soon as possible.

  • discard (Signal(), input) – If high, data that is currently buffered will be discarded. The module will not buffer further data, or send any further packets, until this signal is low again.

  • data_pid (Signal(2), output) – The LSBs of the data PID to be issued with the current packet. Used with packet_stream to indicate the PID of the transmitted packet.

  • tokenizer (TokenDetectorInterface, input) – Connection to a detector that detects incoming tokens packets.

  • handshakes_in (HandshakeExchangeInterface, input) – Indicates when handshakes are received from the host.

  • handshakes_out (HandshakeExchangeInterface, output) – Output that carries handshake packet requests.

  • generate_zlps (Signal(), input) – If high, zero-length packets will automatically be generated if the end of a transfer would not result in a short packet. (This should be set for control endpoints; and for any interface where transfer boundaries are significant.)

  • start_with_data1 (Signal(), input) – If high, the transmitter will start our PID with DATA1

  • reset_sequence (Signal(), input) – If true, our PID generated will reset to the value indicated by start_with_data1. If desired, this can be held permanently high to control our PID expectation manually.

Parameters:

max_packet_size (int) – The maximum packet size for our associated endpoint, in bytes.