summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-03-22 18:55:45 +0700
committerhathach <[email protected]>2013-03-22 18:55:45 +0700
commitf6acca666421cddb4e25842ad1215e951f898ecb (patch)
treefb37775bb1c09d397adff42b8b274cd0c11bcc8c /tinyusb/host
parent6b276d09bffb8f544a54aab717eac904bd34c5b2 (diff)
add callback for hcd when it cleaned up all cache data for a device (previously mark as removing).
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/ehci/ehci.c3
-rw-r--r--tinyusb/host/usbh.c8
-rw-r--r--tinyusb/host/usbh_hcd.h2
3 files changed, 10 insertions, 3 deletions
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 92c439ff8..e94793254 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -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
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index a70ba28bd..f871d8979 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -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
diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h
index bbcad3611..47f1b32d4 100644
--- a/tinyusb/host/usbh_hcd.h
+++ b/tinyusb/host/usbh_hcd.h
@@ -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
}