Descriptor
Utilities for building USB descriptors into gateware.
- class sol_usb.gateware.usb.usb2.descriptor.USBDescriptorStreamGenerator(*args, src_loc_at: int = 0, **kwargs)
Specialized stream generator for generating USB descriptor constants.
- class sol_usb.gateware.usb.usb2.descriptor.GetDescriptorHandlerDistributed(*args, src_loc_at: int = 0, **kwargs)
Gateware that handles responding to GetDescriptor requests.
Currently does not support descriptors in multiple languages.
- I/O port:
- I: value[16] - The value field associated with the Get Descriptor request.
Contains the descriptor type and index.
- I: length[16] - The length field associated with the Get Descriptor request.
Determines the maximum amount allowed in a response.
I: start - Strobe that indicates when a descriptor should be transmitted.
*: tx - The USBInStreamInterface that streams our descriptor data. O: stall - Pulsed if a STALL handshake should be generated, instead of a response.
- class sol_usb.gateware.usb.usb2.descriptor.GetDescriptorHandlerBlock(*args, src_loc_at: int = 0, **kwargs)
Gateware that handles responding to GetDescriptor requests.
Currently does not support descriptors in multiple languages.
- I/O port:
- I: value[16] - The value field associated with the Get Descriptor request.
Contains the descriptor type and index.
- I: length[16] - The length field associated with the Get Descriptor request.
Determines the maximum amount allowed in a response.
I: start - Strobe that indicates when a descriptor should be transmitted. I: start_position - Specifies the starting position of the descriptor data to be transmitted.
*: tx - The USBInStreamInterface that streams our descriptor data. O: stall - Pulsed if a STALL handshake should be generated, instead of a response.
- generate_rom_content()
Generates the contents of the ROM used to hold descriptors.
Memory layout
All data is aligned on 4 bytes
Type offsets and number of entries
Each descriptor type starting from 0 until maximum used type number has an entry consisting of number of indexes for this type number (2 bytes) and address of first index (2 bytes).
Invalid entries have a value of 0x0000xxxx (0 entries).
Example: 0000 0xFFFF 0002 0xFFFF 0004 Number of device indexes 0006 Address of first device index 0008 Number of configuration indexes 000A Address of first configuration index 000C Number of string indexes 000E Address of first string index …
Index offsets and length of descriptor
Each index of a descriptor type has an entry consistent of the length of the descriptor (2 bytes) and the address of first data byte (2 bytes).
0010 Length of first device descriptor 0012 Address of first device descriptor …
Data
Descriptor data for each descriptor. Padded by 0 to next 4-byte address.
… Descriptor data