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)

Testing

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 2 times, most recently from 07538bf to 93a4649 Compare December 13, 2024 12:46
@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch 2 times, most recently from 952dc91 to 25a832a Compare December 24, 2024 20:44
@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from 25a832a to 4db87ac Compare January 2, 2025 10:20
@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from 4db87ac to bad9f23 Compare January 2, 2025 10:43
@roma-jam roma-jam force-pushed the feature/add_tusb_teardown branch from bad9f23 to 79417f2 Compare January 3, 2025 12:06
@roma-jam
Copy link
Contributor Author

roma-jam commented Jan 3, 2025

@hathach May I ask you to check why pre-commit is failing please?

unit-test................................................................Failed
- hook id: unit-test
- exit code: 1

🚧 Loaded project configuration from working directory.
 > Using: /home/runner/work/tinyusb/tinyusb/test/unit-test/project.yml
 > Working directory: /home/runner/work/tinyusb/tinyusb/test/unit-test
/home/runner/work/tinyusb/tinyusb/test/unit-test/vendor/ceedling/vendor/diy/lib/diy.rb:6: warning: already initialized constant DIY::VERSION
/opt/hostedtoolcache/Ruby/3.0.7/x64/lib/ruby/gems/3.0.0/gems/ceedling-1.0.0/vendor/diy/lib/diy.rb:14: warning: previous definition of VERSION was here
🧨 EXCEPTION: Failed to construct 'file_path_utils'
  ...caused by:
  >>> Failed to construct 'configurator'
  ...caused by:
  >>> uninitialized constant BackgroundExec

Is there anything I can/need to fix?

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