usbh rename vars

This commit is contained in:
hathach
2018-12-07 00:47:16 +07:00
parent 2fe9abe71f
commit c93fb23693
17 changed files with 171 additions and 159 deletions
+21 -21
View File
@@ -68,7 +68,7 @@ void tearDown(void)
//--------------------------------------------------------------------+
void test_usbh_status_get_fail(void)
{
usbh_devices[dev_addr].state = 0;
_usbh_devices[dev_addr].state = 0;
TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_INVALID_PARAMETER, tusbh_device_get_state(CFG_TUSB_HOST_DEVICE_MAX+1) );
TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_UNPLUG, tusbh_device_get_state(dev_addr) );
@@ -76,7 +76,7 @@ void test_usbh_status_get_fail(void)
void test_usbh_status_get_succeed(void)
{
usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
_usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_CONFIGURED, tusbh_device_get_state(dev_addr) );
}
@@ -136,7 +136,7 @@ void test_usbh_init_ok(void)
for (uint8_t i=0; i<CFG_TUSB_HOST_DEVICE_MAX+1; i++)
{
TEST_ASSERT_NOT_NULL(usbh_devices[i].control.sem_hdl);
TEST_ASSERT_NOT_NULL(_usbh_devices[i].control.sem_hdl);
}
}
@@ -146,10 +146,10 @@ void test_usbh_hcd_rhport_unplugged_isr_device_not_previously_mounted(void)
{
uint8_t dev_addr = 1;
usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_UNPLUG;
usbh_devices[dev_addr].core_id = 0;
usbh_devices[dev_addr].hub_addr = 0;
usbh_devices[dev_addr].hub_port = 0;
_usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_UNPLUG;
_usbh_devices[dev_addr].core_id = 0;
_usbh_devices[dev_addr].hub_addr = 0;
_usbh_devices[dev_addr].hub_port = 0;
usbh_hcd_rhport_unplugged_isr(0);
}
@@ -158,11 +158,11 @@ void test_usbh_hcd_rhport_unplugged_isr(void)
{
uint8_t dev_addr = 1;
usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
usbh_devices[dev_addr].core_id = 0;
usbh_devices[dev_addr].hub_addr = 0;
usbh_devices[dev_addr].hub_port = 0;
usbh_devices[dev_addr].flag_supported_class = BIT_(TUSB_CLASS_HID);
_usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
_usbh_devices[dev_addr].core_id = 0;
_usbh_devices[dev_addr].hub_addr = 0;
_usbh_devices[dev_addr].hub_port = 0;
_usbh_devices[dev_addr].flag_supported_class = BIT_(TUSB_CLASS_HID);
hidh_close_Expect(dev_addr);
hcd_pipe_control_close_ExpectAndReturn(dev_addr, TUSB_ERROR_NONE);
@@ -170,18 +170,18 @@ void test_usbh_hcd_rhport_unplugged_isr(void)
//------------- Code Under Test -------------//
usbh_hcd_rhport_unplugged_isr(0);
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_REMOVING, usbh_devices[dev_addr].state);
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_REMOVING, _usbh_devices[dev_addr].state);
}
void test_usbh_device_unplugged_multple_class(void)
{
uint8_t dev_addr = 1;
usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
usbh_devices[dev_addr].core_id = 0;
usbh_devices[dev_addr].hub_addr = 0;
usbh_devices[dev_addr].hub_port = 0;
usbh_devices[dev_addr].flag_supported_class = BIT_(TUSB_CLASS_HID) | BIT_(TUSB_CLASS_MSC) | BIT_(TUSB_CLASS_CDC);
_usbh_devices[dev_addr].state = TUSB_DEVICE_STATE_CONFIGURED;
_usbh_devices[dev_addr].core_id = 0;
_usbh_devices[dev_addr].hub_addr = 0;
_usbh_devices[dev_addr].hub_port = 0;
_usbh_devices[dev_addr].flag_supported_class = BIT_(TUSB_CLASS_HID) | BIT_(TUSB_CLASS_MSC) | BIT_(TUSB_CLASS_CDC);
cdch_close_Expect(dev_addr);
hidh_close_Expect(dev_addr);
@@ -192,7 +192,7 @@ void test_usbh_device_unplugged_multple_class(void)
//------------- Code Under Test -------------//
usbh_hcd_rhport_unplugged_isr(0);
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_REMOVING, usbh_devices[dev_addr].state);
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_REMOVING, _usbh_devices[dev_addr].state);
}
#endif
@@ -219,7 +219,7 @@ void test_usbh_control_xfer_mutex_failed(void)
};
osal_mutex_wait_StubWithCallback(mutex_wait_failed_stub);
osal_mutex_release_ExpectAndReturn(usbh_devices[dev_addr].control.mutex_hdl, TUSB_ERROR_NONE);
osal_mutex_release_ExpectAndReturn(_usbh_devices[dev_addr].control.mutex_hdl, TUSB_ERROR_NONE);
//------------- Code Under Test -------------//
usbh_control_xfer_subtask(dev_addr, 1, 2, 3, 4, 0, NULL);
@@ -241,7 +241,7 @@ void test_usbh_control_xfer_ok(void)
hcd_pipe_control_xfer_ExpectAndReturn(dev_addr, &a_request, NULL, TUSB_ERROR_NONE);
osal_semaphore_wait_StubWithCallback(semaphore_wait_success_stub);
osal_mutex_release_ExpectAndReturn(usbh_devices[dev_addr].control.mutex_hdl, TUSB_ERROR_NONE);
osal_mutex_release_ExpectAndReturn(_usbh_devices[dev_addr].control.mutex_hdl, TUSB_ERROR_NONE);
//------------- Code Under Test -------------//
usbh_control_xfer_subtask(dev_addr, 1, 2, 3, 4, 0, NULL);