add hard fault handler to bsp.c
rename class_install_subtask to class_open_subtask add class_close for unmount adding code for usbh_device_unplugged_isr & invoke it in hcd_isr
This commit is contained in:
@@ -97,3 +97,13 @@ void test_isr_device_connect_slowspeed(void)
|
||||
//------------- Code Under Test -------------//
|
||||
hcd_isr(hostid);
|
||||
}
|
||||
|
||||
void test_isr_device_disconnect(void)
|
||||
{
|
||||
ehci_controller_device_unplug(hostid);
|
||||
usbh_device_unplugged_isr_Expect(hostid);
|
||||
|
||||
//------------- Code Under Test -------------//
|
||||
hcd_isr(hostid);
|
||||
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void test_enum_failed_get_full_config_desc(void)
|
||||
|
||||
void class_install_expect(void)
|
||||
{
|
||||
hidh_install_subtask_StubWithCallback(hidh_install_stub);
|
||||
hidh_open_subtask_StubWithCallback(hidh_install_stub);
|
||||
}
|
||||
|
||||
void test_enum_parse_config_desc(void)
|
||||
|
||||
@@ -156,3 +156,22 @@ void test_usbh_init_ok(void)
|
||||
TEST_ASSERT_EQUAL_MEMORY(device_info_zero, usbh_device_info_pool, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1));
|
||||
|
||||
}
|
||||
|
||||
void class_close_expect(void)
|
||||
{
|
||||
hidh_close_Expect(1);
|
||||
}
|
||||
|
||||
void test_usbh_device_unplugged_isr(void)
|
||||
{
|
||||
usbh_device_info_pool[1].status = TUSB_DEVICE_STATUS_READY;
|
||||
usbh_device_info_pool[1].core_id = 0;
|
||||
usbh_device_info_pool[1].hub_addr = 0;
|
||||
usbh_device_info_pool[1].hub_port = 0;
|
||||
|
||||
class_close_expect();
|
||||
|
||||
usbh_device_unplugged_isr(0);
|
||||
|
||||
TEST_ASSERT_EQUAL(TUSB_DEVICE_STATUS_REMOVING, usbh_device_info_pool[1].status);
|
||||
}
|
||||
|
||||
@@ -86,3 +86,12 @@ void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed)
|
||||
regs->portsc_bit.current_connect_status = 1;
|
||||
regs->portsc_bit.nxp_port_speed = speed;
|
||||
}
|
||||
|
||||
void ehci_controller_device_unplug(uint8_t hostid)
|
||||
{
|
||||
ehci_registers_t* const regs = get_operational_register(hostid);
|
||||
|
||||
regs->usb_sts_bit.port_change_detect = 1;
|
||||
regs->portsc_bit.connect_status_change = 1;
|
||||
regs->portsc_bit.current_connect_status = 0;
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
void ehci_controller_run(uint8_t hostid);
|
||||
void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed);
|
||||
void ehci_controller_device_unplug(uint8_t hostid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user