Use the same scheme as for string descriptors. Descriptors can be added
or removed using the existend interface.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
It simplifies the macros to create the string descriptors. We also no
longer need placeholders for the SerialNumber descriptor when it is
generated from hwid. In the future, we can store other descriptor types
in the same list.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Do not use application-provided placeholder buffers. Generate
SerialNumber just before ASCII string is converted to UTF16LE. Make
dependency on HWINFO optional, but enabled by default.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Move and rework string descriptor data to a separate structure so we can
share memory with another type. Also add description to the
USBD_DESC_STRING_DEFINE macro.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This is slower but should have no real effect. In the future we can
support more than ASCII7 format and store it in other memory areas.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add function to get string descriptor index and function
to remove linked descriptor from a device. This abstracts
it a bit so that the user does not need to know how it is
handled internally.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
USB High-Speed devices must be able to operate at both High-Speed and
Full-Speed. The USB specification allows the device to have different
configurations depending on connection speed. Modify the API to reflect
USB Specification requirements on what can (e.g. configurations) and
what cannot (e.g. VID, PID) be speed dependent.
While the class configurations for different speeds are completely
independent, the actual class instances are shared between operating
speeds (because only one speed can be active at a time). Classes are
free to provide different number of interfaces and/or endpoints for
different speeds. The endpoints are assigned for all operating speeds
during initialization.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Support for multiple instances of a class implementation,
and the ability to register an instance to a configuration
at runtime, requires a mechanism to add a string descriptor
and update its index based on the total number of descriptors.
We also need to handle some special string descriptors like
Product or Serial Number provided by the application.
Marked as such by using specific macros, these descriptors
can be sorted out by the stack and the device descriptor
indexes are updated automatically.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
While this does not provide much of an advantage yet,
it will allow us to add descriptors and assign an index
more easily in the next commit.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If we try to reuse a string descriptor node, the content will
be corrupted because the device stack assumes it is still ASCII7
encoded. Add a flag to indicate that a descriptor node contains
UTF16LE encoded content.
And while we are at it, add a flag to indicate that the SN string
should not be obtained from the hwinfo API.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
At the shutdown of USB device stack we have to cleanup and
remove all registered class instances and string descriptors
from a configuration.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The device supprt brings support for multiple stack instances,
multiple configuration, asynchronous transfer model, ability to
change most of the properties of a device at runtime and
the composition of configuration and classes at runtime.
The stack requires new UDC driver API and is not compatible
with old driver API (usb_dc_). The classes (functions) of old
(current) USB device stack cannot be used with new ones and must
be ported.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>