usb: device_next: make HS support compliant with the USB2.0 specification

For specification-compliant high-speed support, we need to support
device quilifiers and other-speed-configuration descriptor requests. We
also need to store different configurations of the class/function
descriptors, which typically only affect the endpoint descriptors. With
this change, the stack expects class/function descriptors to be passed
as an array of struct usb_desc_header pointers to e.g. interface,
interface-specific, and endpoint descriptors, with the last element of
the array pointing to a nil descriptor. And also passed for a specific
speed, for now we support full and high speed configurations.

During instantiation, the class/function implementation must choose the
correct configuration in the full-speed and high-speed descriptor sets
for values such as maximum packet size and bInterval values of interrupt
and isochronous endpoints.

During initialization, the stack reads the highest speed supported by
the controller and uses it to get the appropriate descriptors set
from the instance. If the controller supports only full speed, the stack
configures the class/function descriptor for full speed only, if the
controller supports high speed, the stack configures the descriptors for
high speed only, and a class/function must update the full speed
descriptor during the init callback processing.

During device operation, the class/function implementation must check
the actual speed of the device and use the correct configuration, such
as the endpoint address or maximum packet size.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
12 files changed