Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(tusb): Added tusb_teardown() #2904

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

roma-jam
Copy link
Contributor

@roma-jam roma-jam commented Dec 11, 2024

Requirements

The USBD deinit were implemented here: #1835

To provide the possibility to re-initialize the tinyusb stack, tusb_teardown() call should be present in tusb.h

The public API to init tinyusb stack for device role is tusb_init(void) for versions < v0.17, and tusb_rhport_init(rhport, *rh_init) for verisons >= 0.17.

Teardown mechanism should be implemented as a public API for Device and Host roles and provide the possibility to use the deinit call in both (legacy and new API way) for the underlying layers.

Description

The same mechanism for legacy call support is used as for tusb_init(void) (providing the rhport as TUD_OPT_RHPORT or TUH_OPT_RHPORT but not the function argument)

Limitations

  • Using macros to handle the legacy support instead of function. Refer to Note2:
    // Note2: defined as macro for backward compatible with tusb_init(void), can be changed to function in the future.

Related issues

@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from 600c379 to d8ba6c0 Compare December 11, 2024 15:00
@roma-jam roma-jam marked this pull request as ready for review December 11, 2024 16:15
@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from d8ba6c0 to 5beffd1 Compare December 12, 2024 09:46
@hathach
Copy link
Owner

hathach commented Dec 12, 2024

Can you merge/rebase on master to fix circleci build

@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from 5beffd1 to 07538bf Compare December 12, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants