drivers: usb: udc: max32: Fix MAX32 udc event handling - #1
Open
Brandon-Hurst wants to merge 2 commits into
Open
Conversation
Issue was resolved where deferred transfers due to a busy
endpoint were not being resolved. This was causing some trasnfers
to never complete.
Add the following to the xfer_in_done and xfer_out_done
event functions:
```C
/* Start any transfer deferred while this endpoint was busy */
if (ep_cfg->addr != USB_CONTROL_EP_OUT && udc_buf_peek(ep_cfg) != NULL) {
udc_event_xfer_out(dev, ep_cfg);
}
```
Logging was also added to warn of any deferred ep transfers.
Signed-off-by: Brandon Hurst <brandon.hurst97@gmail.com>
MAX32 USB had some functions in ISR context allocating memory & acquiring mutexes. This commit fixes this by separating the transfer completion events into ISR-safe / non ISR-safe steps. Additionally, some apparent swapping of devicetree configuration for in/out endpoints is resolved. - Rename UDC_MAX32_EVT_XFER to UDC_MAX32_EVT_START_XFER - Add MAX32 UDC events for XFER_IN_DONE and XFER_OUT_DONE - Refactor xfer_in/out callbacks to only submit messages to a message queue. - Provide xfer_in_Done and xfer_out_done to handle transfer completions from UDC thread context. - Add XFER_IN_DONE and XFER_OUT_DONE events to thread handler - Fix swapping in devicetree macros of num_of_in_eps / num_of_out_eps and ep_cfg_in / ep_cfg_out Signed-off-by: Brandon Hurst <brandon.hurst97@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream PR
This PR is a duplicate of zephyrproject-rtos#104103 for Circuitpython's fork.
Description
MAX32 USB had some functions in ISR context allocating memory & acquiring mutexes. This PR fixes this by separating the transfer completion events into ISR-context and thread-context steps using the message queue. Additionally, some apparent swapping of devicetree configuration for in/out endpoints and configuration structs is resolved. Finally, handling of deferred endpoint transfers was added.
Commit 1:
Commit 2:
Functional Tests
Tested the
cdc_acmsample and themasssample with the FAT filesystem successfully.Twister Tests