diff options
| author | hathach <[email protected]> | 2013-03-13 10:57:30 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-03-13 10:57:30 +0700 |
| commit | 97c9001d401b217b383046b6af3b8fd957e835f4 (patch) | |
| tree | 565b4ff5ad55cebd0dea9425bc533848b17a825e /tests | |
| parent | 63765b37c7ebab2a7586122924cfb8b134db17f8 (diff) | |
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test/host/ehci/test_ehci_isr.c | 10 | ||||
| -rw-r--r-- | tests/test/host/test_enum_task.c | 2 | ||||
| -rw-r--r-- | tests/test/host/test_usbh.c | 19 | ||||
| -rw-r--r-- | tests/test/support/ehci_controller.c | 9 | ||||
| -rw-r--r-- | tests/test/support/ehci_controller.h | 1 |
5 files changed, 40 insertions, 1 deletions
diff --git a/tests/test/host/ehci/test_ehci_isr.c b/tests/test/host/ehci/test_ehci_isr.c index 44eb503cf..95cbbcb5b 100644 --- a/tests/test/host/ehci/test_ehci_isr.c +++ b/tests/test/host/ehci/test_ehci_isr.c @@ -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); + +} diff --git a/tests/test/host/test_enum_task.c b/tests/test/host/test_enum_task.c index 30d99692f..00df47833 100644 --- a/tests/test/host/test_enum_task.c +++ b/tests/test/host/test_enum_task.c @@ -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) diff --git a/tests/test/host/test_usbh.c b/tests/test/host/test_usbh.c index 27bceb697..f69e32a5f 100644 --- a/tests/test/host/test_usbh.c +++ b/tests/test/host/test_usbh.c @@ -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); +} diff --git a/tests/test/support/ehci_controller.c b/tests/test/support/ehci_controller.c index 0bc09f53a..484348566 100644 --- a/tests/test/support/ehci_controller.c +++ b/tests/test/support/ehci_controller.c @@ -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; +} diff --git a/tests/test/support/ehci_controller.h b/tests/test/support/ehci_controller.h index aee3f0116..cb5c69313 100644 --- a/tests/test/support/ehci_controller.h +++ b/tests/test/support/ehci_controller.h @@ -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 } |
