feature(tusb): Added tusb_teardown()
Requirements
The USBD deinit were implemented here: https://github.com/hathach/tinyusb/pull/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
- General teardown + memory leakage after configurable amount of teardown rounds: https://github.com/espressif/esp-usb/pull/39
- CDC ACM Device Class teardown + each round data coherence verification for EP IN and OUT (sequence size equals MPS for FS and HS): https://github.com/espressif/esp-usb/pull/106
Limitations
- Using macros to handle the legacy support instead of function. Refer to Note2: https://github.com/hathach/tinyusb/blob/7c7b30f0ae66a856ada3526cb947bd3a255567f8/src/tusb.h#L140
Related issues
- Cherry-picked from https://github.com/espressif/tinyusb/pull/44
Can you merge/rebase on master to fix circleci build
@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?
issued with ceedling 1.0.0 is fixed #2949 , pleaes rebase/merge it should passed then