refractor
- rename TUSB_DEVICE_STATE_READY to TUSB_DEVICE_STATE_CONFIGURED - move device_state to core/tusb_types.h - remove usbh_device_hcd_data_cleaned_up_cb, hcd now set the state directly
This commit is contained in:
@@ -166,8 +166,8 @@ void async_advance_isr(ehci_qhd_t * const async_head)
|
||||
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);
|
||||
// Host Controller has cleaned up its cached data for this device, set state to unplug
|
||||
usbh_device_info_pool[relative_dev_addr+1].state = TUSB_DEVICE_STATE_UNPLUG;
|
||||
}
|
||||
|
||||
// check if any other endpoints in pool is removing
|
||||
|
||||
@@ -226,16 +226,11 @@ void usbh_device_unplugged_isr(uint8_t hostid)
|
||||
|
||||
usbh_pipe_control_close(dev_addr);
|
||||
|
||||
// set to REMOVING to end wait for HCD to clean up its cached data for this device
|
||||
// set to REMOVING to allow HCD to clean up its cached data for this device
|
||||
// HCD must set this device's state to TUSB_DEVICE_STATE_UNPLUG when done
|
||||
usbh_device_info_pool[dev_addr].state = TUSB_DEVICE_STATE_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].state = TUSB_DEVICE_STATE_UNPLUG;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// ENUMERATION TASK
|
||||
//--------------------------------------------------------------------+
|
||||
@@ -409,7 +404,7 @@ OSAL_TASK_DECLARE(usbh_enumeration_task)
|
||||
)
|
||||
);
|
||||
|
||||
usbh_device_info_pool[new_addr].state = TUSB_DEVICE_STATE_READY;
|
||||
usbh_device_info_pool[new_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
|
||||
tusbh_device_mount_succeed_cb(new_addr);
|
||||
|
||||
// TODO invoke mounted callback
|
||||
|
||||
@@ -93,17 +93,6 @@
|
||||
// TUSB_CLASS_APPLICATION_SPECIFIC = 0xEF ,
|
||||
// TUSB_CLASS_VENDOR_SPECIFIC = 0xFF
|
||||
|
||||
/// Device Status
|
||||
enum tusbh_device_status_{
|
||||
TUSB_DEVICE_STATE_UNPLUG = 0,
|
||||
TUSB_DEVICE_STATE_ADDRESSED,
|
||||
|
||||
TUSB_DEVICE_STATE_READY, /* Configured */
|
||||
|
||||
TUSB_DEVICE_STATE_REMOVING,
|
||||
TUSB_DEVICE_STATE_SAFE_REMOVE,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
PIPE_STATUS_AVAILABLE = 0,
|
||||
PIPE_STATUS_BUSY,
|
||||
|
||||
@@ -92,6 +92,7 @@ typedef struct { // TODO internal structure, re-order members
|
||||
|
||||
uint8_t state; // value from enum tusbh_device_status_
|
||||
|
||||
//------------- control pipe -------------//
|
||||
tusb_std_request_t control_request;
|
||||
OSAL_SEM_DEF(semaphore);
|
||||
osal_semaphore_handle_t sem_hdl;
|
||||
@@ -103,7 +104,6 @@ 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user