diff options
| author | HiFiPhile <[email protected]> | 2026-01-06 18:42:58 +0100 |
|---|---|---|
| committer | HiFiPhile <[email protected]> | 2026-01-06 18:42:58 +0100 |
| commit | 60154a128795bcd6ca36042cac1b8bebf1a2764e (patch) | |
| tree | 0557ab4b2a01c64de109c54662ba6f3a58147bc9 /src/device | |
| parent | c5f91ec6f54509d03529e276ffd42b0d9abab695 (diff) | |
| parent | 593dce28349cf5b1299c2cf1193312cb783574f3 (diff) | |
Merge remote-tracking branch 'tinyusb/master' into ep0_direct
Diffstat (limited to 'src/device')
| -rw-r--r-- | src/device/usbd.c | 11 | ||||
| -rw-r--r-- | src/device/usbd.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c index e337a5000..1e21c667a 100644 --- a/src/device/usbd.c +++ b/src/device/usbd.c @@ -580,6 +580,8 @@ bool tud_deinit(uint8_t rhport) { TU_LOG_USBD("USBD deinit on controller %u\r\n", rhport); + const uint8_t cfg_num = _usbd_dev.cfg_num; + // Deinit device controller driver dcd_int_disable(rhport); dcd_disconnect(rhport); @@ -594,6 +596,10 @@ bool tud_deinit(uint8_t rhport) { } } + // Clear device data + tu_varclr(&_usbd_dev); + usbd_control_reset(); + // Deinit device queue & task osal_queue_delete(_usbd_q); _usbd_q = NULL; @@ -605,6 +611,11 @@ bool tud_deinit(uint8_t rhport) { #endif _usbd_rhport = RHPORT_INVALID; + + if (cfg_num > 0) { + tud_umount_cb(); + } + return true; } diff --git a/src/device/usbd.h b/src/device/usbd.h index efde9377f..bd5a3c395 100644 --- a/src/device/usbd.h +++ b/src/device/usbd.h @@ -58,6 +58,7 @@ typedef union { bool tud_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param); // New API to replace tud_init() to init device stack on specific roothub port +// Must be called in the same task/context as tud_task() if RTOS is used bool tud_rhport_init(uint8_t rhport, const tusb_rhport_init_t* rh_init); // Init device stack on roothub port @@ -73,6 +74,7 @@ TU_ATTR_ALWAYS_INLINE static inline bool tud_init (uint8_t rhport) { } // Deinit device stack on roothub port +// Must be called in the same task/context as tud_task() if RTOS is used bool tud_deinit(uint8_t rhport); // Check if device stack is already initialized |
