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() #44

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

roma-jam
Copy link
Collaborator

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

Requirements

To change the USB device function or re-initialize the tinyusb stack there should be an option to teardown the lower layer (disable the phy and flush the registers).

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

Teardown feature should be implemented as a public API for Device and Host roles and provide the possibility to use the teardown call in both (legacy and new API way)

Description

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

Limitations

Breaking change

No breaking changes

Testing:

Implemented in espressif/esp-usb#39

Checklist

  • Pull Request name has appropriate format (for example: "fix(dcd_dwc2): Resolved address selection when several phy are present")
  • Optional: README.md updated
  • CI passing

Related issues

@roma-jam roma-jam self-assigned this Dec 11, 2024
@roma-jam roma-jam marked this pull request as ready for review December 11, 2024 11:36
@roma-jam roma-jam changed the title feature(tusb): Added tusb_teardown API feature(tusb): Added tusb_teardown() Dec 11, 2024
@roma-jam roma-jam added this to the v0.17.1 milestone Dec 11, 2024
@roma-jam roma-jam force-pushed the feature/tusb_teardown branch from ba5a917 to c46d292 Compare December 11, 2024 14:59
@roma-jam roma-jam mentioned this pull request Dec 11, 2024
3 tasks
@roma-jam roma-jam force-pushed the feature/tusb_teardown branch from c46d292 to 3288a79 Compare December 11, 2024 18:23
src/tusb.c Outdated Show resolved Hide resolved
src/tusb.c Outdated Show resolved Hide resolved
src/tusb.c Outdated Show resolved Hide resolved
src/tusb.c Show resolved Hide resolved
Copy link
Collaborator

@peter-marcisovsky peter-marcisovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried the changes on HW with the test app, works fine. Once this is merged, we can enable the rest of the device tests in CI which depend on the teardown.

@roma-jam roma-jam force-pushed the feature/tusb_teardown branch from 098a223 to 8366c63 Compare December 12, 2024 14:31
@roma-jam roma-jam merged commit 98aea07 into release/v0.17 Dec 16, 2024
88 checks passed
@roma-jam roma-jam deleted the feature/tusb_teardown branch December 16, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants