Implements tuh_deinit() and tud_deinit() to uninitialize host/device mode.

This commit is contained in:
Felix "xq" Queißner
2023-01-02 17:09:45 +01:00
committed by hathach
parent bc10394e66
commit 47c12a07f2
4 changed files with 27 additions and 1 deletions

View File

@@ -407,6 +407,18 @@ void dcd_init(uint8_t rhport) {
dcd_connect(rhport);
}
void dcd_deinit(uint8_t rhport) {
assert(rhport == 0);
dcd_disconnect(rhport);
reset_non_control_endpoints();
irq_remove_handler(USBCTRL_IRQ, dcd_rp2040_irq);
// reset usb hardware into initial state
reset_block(RESETS_RESET_USBCTRL_BITS);
unreset_block_wait(RESETS_RESET_USBCTRL_BITS);
}
void dcd_int_enable(__unused uint8_t rhport) {
assert(rhport == 0);
irq_set_enabled(USBCTRL_IRQ, true);