refractor move test enum to its own file
add assert with handler add task assert with error catcher
This commit is contained in:
@@ -71,9 +71,9 @@ tusb_error_t hcd_init(uint8_t hostid) ATTR_WARN_UNUSED_RESULT;
|
||||
//--------------------------------------------------------------------+
|
||||
// PIPE API
|
||||
//--------------------------------------------------------------------+
|
||||
pipe_handle_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size);
|
||||
tusb_error_t hcd_pipe_control_xfer(pipe_handle_t pipe_hdl, tusb_std_request_t const * p_request, uint8_t data[]);
|
||||
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc);
|
||||
pipe_handle_t hcd_pipe_control_open(uint8_t dev_addr, uint8_t max_packet_size) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t hcd_pipe_control_xfer(pipe_handle_t pipe_hdl, tusb_std_request_t const * p_request, uint8_t data[]) ATTR_WARN_UNUSED_RESULT;
|
||||
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#if 0
|
||||
//tusb_error_t hcd_pipe_open(
|
||||
|
||||
@@ -89,16 +89,14 @@ void usbh_enumeration_task(void)
|
||||
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
|
||||
osal_queue_receive(enum_queue_hdl, (uint32_t*)(&device_addr0.enum_entry), OSAL_TIMEOUT_NORMAL, &error);
|
||||
TASK_ASSERT_STATUS(error);
|
||||
osal_queue_receive(enum_queue_hdl, (uint32_t*)(&device_addr0.enum_entry), OSAL_TIMEOUT_WAIT_FOREVER, &error);
|
||||
|
||||
if (device_addr0.enum_entry.hub_addr == 0) // direct connection
|
||||
{
|
||||
TASK_ASSERT(device_addr0.enum_entry.connect_status == hcd_port_connect_status(device_addr0.enum_entry.core_id)); // there chances the event is out-dated
|
||||
|
||||
device_addr0.speed = hcd_port_speed(device_addr0.enum_entry.core_id);
|
||||
error = hcd_addr0_open(&device_addr0);
|
||||
TASK_ASSERT_STATUS(error);
|
||||
TASK_ASSERT_STATUS( hcd_addr0_open(&device_addr0) );
|
||||
|
||||
{ // Get first 8 bytes of device descriptor to get Control Endpoint Size
|
||||
tusb_std_request_t request_device_desc = {
|
||||
@@ -110,7 +108,7 @@ void usbh_enumeration_task(void)
|
||||
|
||||
hcd_pipe_control_xfer(device_addr0.pipe_hdl, &request_device_desc, enum_data_buffer);
|
||||
osal_semaphore_wait(device_addr0.sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // careful of local variable without static
|
||||
TASK_ASSERT_STATUS(error);
|
||||
TASK_ASSERT_STATUS_HANDLER(error, tusbh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_FAILED, NULL));
|
||||
}
|
||||
|
||||
new_addr = get_new_address();
|
||||
@@ -158,7 +156,7 @@ tusb_error_t usbh_init(void)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
memset(usbh_device_info_pool, 0, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
|
||||
memclr_(usbh_device_info_pool, sizeof(usbh_device_info_t)*TUSB_CFG_HOST_DEVICE_MAX);
|
||||
|
||||
for(i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++)
|
||||
{
|
||||
|
||||
@@ -127,9 +127,11 @@ typedef uint8_t tusbh_device_status_t;
|
||||
//--------------------------------------------------------------------+
|
||||
// APPLICATION API
|
||||
//--------------------------------------------------------------------+
|
||||
void tusbh_device_mounting_cb (tusb_error_t const error, tusb_handle_device_t const device_hdl);
|
||||
void tusbh_device_mounted_cb (tusb_error_t const error, tusb_handle_device_t const device_hdl);
|
||||
tusb_error_t tusbh_configuration_set (tusb_handle_device_t const device_hdl, uint8_t const configure_number) ATTR_WARN_UNUSED_RESULT;
|
||||
uint8_t tusbh_device_attached_cb (tusb_descriptor_device_t const *p_desc_device) ATTR_WEAK ATTR_WARN_UNUSED_RESULT;
|
||||
void tusbh_device_mounted_cb (tusb_handle_device_t device_hdl) ATTR_WEAK;
|
||||
void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_descriptor_device_t const *p_desc_device) ATTR_WEAK;
|
||||
|
||||
tusb_error_t tusbh_configuration_set (tusb_handle_device_t device_hdl, uint8_t configure_number) ATTR_WARN_UNUSED_RESULT;
|
||||
tusbh_device_status_t tusbh_device_status_get (tusb_handle_device_t const device_hdl) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
#if TUSB_CFG_OS == TUSB_OS_NONE // TODO move later
|
||||
@@ -147,7 +149,7 @@ static inline void tusb_tick_tock(void)
|
||||
|
||||
tusb_error_t usbh_init(void);
|
||||
pipe_status_t usbh_pipe_status_get(pipe_handle_t pipe_hdl) ATTR_WARN_UNUSED_RESULT;
|
||||
void usbh_enum_task(void);
|
||||
void usbh_enumeration_task(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user