Rather than setting the correct blk_len, the code only wrote 1 and 0
into the three bytes due to the use of a logic and where a bitwise
and should be used.
Use symbol `USBDEV_SET_ADDR_AFTER_STATUS` to determine whether the device address has to be set directly after SETUP stage or after the associated STATUS stage.
This extends support for the GET STATUS requests to support endpoints
and interfaces as recipient. It also adds the SET and CLEAR FEATURE
requests for the endpoints with support to set and clear the halt
condition on an endpoint.
Instead of directly stalling an endpoint, handlers should enable the
halt condition on an usbus endpoint to signal error condition.
This can then be cleared via a CLEAR FEATURE request from the host.
This function should not be called by the driver as USBUS will handle it already. So remove this call to prevent duplication
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
If riotboot is built with NUM_SLOTS=1, there is no reason to advertise a second slot in the bootloader
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
If the number of endpoints is not sufficient for an application, it should not be silently ignored and cause a non-working application. Rather, should cause an assertion as it is a configuration issue.
17086: usbdev: Add dedicated stall functions r=benpicco a=bergzand
### Contribution description
This PR adds dedicated stall functions for usbdev peripherals. Two
functions are added. The first function (usbdev_ep_stall) to enable and
disable the stall condition on generic endpoints. The second function is
a dedicated function to set the stall condition on endpoint zero in both
directions. This status can only be set and should automatically be
cleared by the usbdev implementation (or hardware) after a new setup
request is received from the host.
### Testing procedure
- examples/usbus_minimal should still enumerate correctly on the host side.
- #17085 can be used to demonstrate the ep0_stall function with the `tests/usbus_cdc_acm_stdio/` test
### Issues/PRs references
None
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
This commit adds support for URBs (USB Request/Response Blocks). These
allow for submitting multi-transfer sized buffers with USBUS handling
the individual usbdev xmits. Multiple URBs can be queued at once for a
single endpoint and USBUS will handle them in the order of submission.
OUT endpoint URBs must always consist of a whole number of full-sized
transfers (N x MaxEndpointSize). They will automatically finish after
the endpoint received a transfer less than the endpoint size.
IN endpoints can be arbitrary-sized and do not have to consist of a
whole number of full-sized transmissions. They support a flag to
indicate that the last transfer in the sequence must be less than a full
sized transfer (USBUS_URB_FLAG_AUTO_ZLP) and this adds a zero length
transfer at the end of the transmissions if the last transfer was equal
to the maximum transfer size.
URBs can be cancelled, but if the URB is already being processed it will
be cancelled after the current transmission within the URB is finished.
If it is still in the queue it will immediately be removed from the
queue.
The board reset function `usb_board_reset_coding_cb` can be used on any CDC ACM interface. It is not necessary that the highlevel STDIO is used. Therefore, the call of the board reset function `usb_board_reset_coding_cb` has been moved from the USBUS STDIO CDC ACM implementation to USBUS CDC ACM implementation and is thus a feature of the USBUS CDC ACM interface that don't require any other functionality.
STM32F2/4/7 MCUs use sectors instead of pages, where the minimum sector size is defined by FLASHPAGE_MIN_SECTOR_SIZE, which is 16KB or 32KB (the first sector) depending on the CPU_MODEL. In this case SLOT0_OFFSET must be a multiple of the minimum sector size to cover a whole sector.