|
|
@@ -50,7 +50,6 @@
|
|
|
|
|
|
extern usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1];
|
|
|
extern uint8_t enum_data_buffer[TUSB_CFG_HOST_ENUM_BUFFER_SIZE];
|
|
|
-uint8_t dev_addr;
|
|
|
|
|
|
usbh_enumerate_t const enum_connect = {
|
|
|
.core_id = 0,
|
|
|
@@ -70,12 +69,15 @@ void setUp(void)
|
|
|
|
|
|
osal_queue_receive_StubWithCallback(queue_recv_stub);
|
|
|
osal_semaphore_wait_StubWithCallback(semaphore_wait_success_stub);
|
|
|
+ osal_mutex_wait_StubWithCallback(semaphore_wait_success_stub);
|
|
|
+ osal_mutex_release_IgnoreAndReturn(TUSB_ERROR_NONE);
|
|
|
hcd_pipe_control_xfer_StubWithCallback(control_xfer_stub);
|
|
|
|
|
|
hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
|
|
|
hcd_port_reset_Expect(enum_connect.core_id);
|
|
|
hcd_port_speed_get_ExpectAndReturn(enum_connect.core_id, device_speed);
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
hcd_pipe_control_open_ExpectAndReturn(0, 8, TUSB_ERROR_NONE);
|
|
|
}
|
|
|
|
|
|
@@ -172,6 +174,7 @@ tusb_error_t hidh_install_stub(uint8_t dev_addr, tusb_descriptor_interface_t con
|
|
|
void test_addr0_failed_dev_desc(void)
|
|
|
{
|
|
|
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(0));
|
|
|
+
|
|
|
tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
|
|
|
|
|
|
usbh_enumeration_task(NULL);
|
|
|
@@ -199,6 +202,7 @@ void test_enum_failed_get_full_dev_desc(void)
|
|
|
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
|
|
|
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
|
|
|
tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
|
|
|
|
|
|
@@ -218,6 +222,8 @@ void test_enum_failed_get_9byte_config_desc(void)
|
|
|
hcd_port_reset_Expect( usbh_devices[0].core_id );
|
|
|
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
+
|
|
|
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
|
|
|
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
|
|
|
tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
|
|
|
@@ -235,6 +241,7 @@ void test_enum_failed_get_full_config_desc(void)
|
|
|
hcd_port_reset_Expect( usbh_devices[0].core_id );
|
|
|
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
|
|
|
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
|
|
|
tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
|
|
|
@@ -253,6 +260,7 @@ void test_enum_parse_config_desc(void)
|
|
|
hcd_port_reset_Expect( usbh_devices[0].core_id );
|
|
|
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
|
|
|
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
|
|
|
|
|
|
@@ -269,6 +277,7 @@ void test_enum_set_configure(void)
|
|
|
hcd_port_reset_Expect( usbh_devices[0].core_id );
|
|
|
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
|
|
|
osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
|
|
|
+ osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
|
|
|
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
|
|
|
tusbh_device_attached_cb_ExpectAndReturn((tusb_descriptor_device_t*) enum_data_buffer, 1);
|
|
|
class_install_expect();
|