mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-15 21:40:18 +00:00
add callback for hcd when it cleaned up all cache data for a device (previously mark as removing).
This commit is contained in:
parent
6b276d09bf
commit
f6acca6664
@ -184,12 +184,10 @@ void test_device_unplugged_status(void)
|
||||
{
|
||||
ehci_controller_device_unplug(hostid);
|
||||
hcd_isr(hostid);
|
||||
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATUS_REMOVING, usbh_device_info_pool[dev_addr].status);
|
||||
|
||||
regs->usb_sts_bit.async_advance = 1;
|
||||
hcd_isr(hostid); // async advance
|
||||
|
||||
//------------- Code Under Test -------------//
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATUS_REMOVING, usbh_device_info_pool[dev_addr].status);
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATUS_UNPLUG, usbh_device_info_pool[dev_addr].status);
|
||||
}
|
||||
|
@ -183,6 +183,9 @@ void async_advance_isr(ehci_qhd_t * const async_head)
|
||||
p_control_qhd->is_removing = 0;
|
||||
p_control_qhd->used = 0;
|
||||
p_control_qhd->p_qtd_list_head = p_control_qhd->p_qtd_list_tail = NULL;
|
||||
|
||||
// TODO abstract: Host Controller has cleaned up its data for this device, notify usbh
|
||||
usbh_device_hcd_data_cleaned_up_cb(relative_dev_addr+1);
|
||||
}
|
||||
|
||||
// check if any other endpoints in pool is removing
|
||||
|
@ -225,11 +225,15 @@ void usbh_device_unplugged_isr(uint8_t hostid)
|
||||
|
||||
usbh_pipe_control_close(dev_addr);
|
||||
|
||||
// set to REMOVING to prevent allocate to other new device
|
||||
// need to set to UNPLUGGED by HCD after freeing all resources
|
||||
// set to REMOVING to end wait for HCD to clean up its cached data for this device
|
||||
usbh_device_info_pool[dev_addr].status = TUSB_DEVICE_STATUS_REMOVING;
|
||||
}
|
||||
|
||||
// HCD cleaned up cached data for this device
|
||||
void usbh_device_hcd_data_cleaned_up_cb(uint8_t dev_addr)
|
||||
{
|
||||
usbh_device_info_pool[dev_addr].status = TUSB_DEVICE_STATUS_UNPLUG;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// ENUMERATION TASK
|
||||
|
@ -103,7 +103,7 @@ extern usbh_device_info_t usbh_device_info_pool[TUSB_CFG_HOST_DEVICE_MAX+1]; //
|
||||
void usbh_isr(pipe_handle_t pipe_hdl, uint8_t class_code);
|
||||
void usbh_device_plugged_isr(uint8_t hostid, tusb_speed_t speed);
|
||||
void usbh_device_unplugged_isr(uint8_t hostid);
|
||||
|
||||
void usbh_device_hcd_data_cleaned_up_cb(uint8_t dev_addr); // hcd called this function when it cleaned all its cached data for this device
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user