mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-22 04:55:14 +00:00
_fb_state, the TMR0 interrupt mask and the timer registers are one logical state that was mutated independently at six sites, which produced four distinct defects. fallback_enter() now owns all three and is the only writer. Two of them become unreachable. fallback_timer_start() re-enables the vector its stop() masked, so a tud_disconnect()/tud_connect() cycle can no longer leave the ladder counting behind a masked interrupt whose latched expiry the shared ISR then consumes in place of a real USBSS/LINK event. And the partner-disappeared branch re-arms training, so a board that trained SuperSpeed once is no longer dead until a power cycle after a replug into a USB2-only host - FB_USB3_UP was terminal, and usbd calls neither dcd_init nor dcd_connect on link loss. The deferred re-init now re-checks the fallback state after its 30 ms settle rather than trusting a check made before it: the training-exhausted branch runs from the TMR0 ISR without consulting _hw_reinit_deferred and can land anywhere in that window. The warm-reset branch gains the ep_state_reset()/dcd_event_bus_reset() pair it omitted - a warm reset returns the device to Default state exactly as the hot reset the branch below has always reported. Its ~30 ms in-ISR settle is left alone and recorded as follow-up: usb30_bus_reset_from_isr() deinits synchronously and defers only settle+init, so simply deferring here would leave the address-0 write and the TX_WARM_RST handshake driving a torn-down controller.