mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-16 06:40:11 +00:00
Implements tuh_deinit() and tud_deinit() to uninitialize host/device mode.
This commit is contained in:
parent
bc10394e66
commit
47c12a07f2
@ -122,6 +122,9 @@ void dcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
|
||||
// Initialize controller to device mode
|
||||
void dcd_init(uint8_t rhport);
|
||||
|
||||
// Deinitialize controller, unset device mode.
|
||||
void dcd_deinit(uint8_t rhport);
|
||||
|
||||
// Interrupt Handler
|
||||
void dcd_int_handler(uint8_t rhport);
|
||||
|
||||
|
@ -37,9 +37,12 @@ extern "C" {
|
||||
// Application API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Init device stack
|
||||
// Init device stack on roothub port
|
||||
bool tud_init (uint8_t rhport);
|
||||
|
||||
// Deinit device stack on roothub port
|
||||
void tud_deinit(uint8_t rhport);
|
||||
|
||||
// Check if device stack is already initialized
|
||||
bool tud_inited(void);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -409,6 +409,14 @@ bool hcd_init(uint8_t rhport)
|
||||
return true;
|
||||
}
|
||||
|
||||
void hcd_deinit(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
|
||||
irq_remove_handler(USBCTRL_IRQ, hcd_rp2040_irq);
|
||||
reset_block(RESETS_RESET_USBCTRL_BITS);
|
||||
unreset_block_wait(RESETS_RESET_USBCTRL_BITS);
|
||||
}
|
||||
|
||||
void hcd_port_reset(uint8_t rhport)
|
||||
{
|
||||
(void) rhport;
|
||||
|
Loading…
x
Reference in New Issue
Block a user