What is the purpose of the following two fields in the USBEndpointConfig of the STM32 USB LLD?
Code: Select all
/* End of the mandatory fields.*/
/**
* @brief Reserved field, not currently used.
* @note Initialize this field to 1 in order to be forward compatible.
*/
uint16_t ep_buffers;
/**
* @brief Pointer to a buffer for setup packets.
* @details Setup packets require a dedicated 8-bytes buffer, set this
* field to @p NULL for non-control endpoints.
*/
uint8_t *setup_buf;
I couldn't find any use for them. ep_buffers seems to be set to either 1 or 2, depending on whether
it is only an IN/OUT endpoint or both. A buffer for the setup packet is included in the USBDriver structure anyway.
The STM32 USB LLD isn't the only one with those fields: the USB LLD of Kinetis has them as well.
I assume that it was done to make it easier for applications to create USBEndpointConfig structures that are valid
for both ChibiOS ports? The AVR USB LLD doesn't have those fields, so the application developer who wants
to run on those three ports will have to use #ifdefs when initializing his endpoint configs or provide
different modules depending on the port.
Now i'm asking myself whether i should add those two fields to my NUC122 port, because it might make the life
of the application developer easier who wants to support STM32/Kinetis/NUC122?
But since i don't see the purpose currently, i'm leaning towards the #ifdef for the application developer.
Maybe i'm just missing something here?