From 44e09cc397df4e7fc47c37a4d967fe17a3d82e16 Mon Sep 17 00:00:00 2001 From: hathach Date: Sat, 23 Mar 2013 17:31:51 +0700 Subject: enhance some tests add test for usbh_isr error invoke fix bug if device unplugged before is set to new address - clean up & close control addr0 in usbh_device_unplugged_isr --- .../host/ehci/test_ehci_usbh_hcd_integration.c | 4 ++-- tests/test/host/ehci/test_pipe_bulk_open.c | 2 +- tests/test/host/ehci/test_pipe_bulk_xfer.c | 6 ++--- tests/test/host/ehci/test_pipe_control_open.c | 2 +- tests/test/host/ehci/test_pipe_control_xfer.c | 25 +++++++++---------- tests/test/host/ehci/test_pipe_interrupt_open.c | 2 +- tests/test/host/ehci/test_pipe_isochronous_open.c | 2 +- tests/test/host/test_enum_task.c | 7 ++++++ tests/test/support/ehci_controller.c | 28 ++++++++++++++++++++++ 9 files changed, 56 insertions(+), 22 deletions(-) (limited to 'tests') diff --git a/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c b/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c index 9ba36e4e6..3769844b6 100644 --- a/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c +++ b/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c @@ -72,13 +72,13 @@ void setUp(void) hcd_init(); - for (uint8_t i=0; ip_qtd_list_head; ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_tail; - ehci_controller_run(hostid); - usbh_isr_Expect(pipe_hdl_bulk, TUSB_CLASS_MSC, BUS_EVENT_XFER_COMPLETE); //------------- Code Under Test -------------// - hcd_isr(hostid); + ehci_controller_run(hostid); TEST_ASSERT_TRUE(p_qhd_bulk->qtd_overlay.next.terminate); TEST_ASSERT_FALSE(p_head->used); diff --git a/tests/test/host/ehci/test_pipe_control_open.c b/tests/test/host/ehci/test_pipe_control_open.c index 7064131df..76575915f 100644 --- a/tests/test/host/ehci/test_pipe_control_open.c +++ b/tests/test/host/ehci/test_pipe_control_open.c @@ -70,7 +70,7 @@ void setUp(void) dev_addr = 1; hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX; - for (uint8_t i=0; iasync_list_base); - TEST_ASSERT_EQUAL_HEX((uint32_t) p_control_qhd, align32(async_head->next.address)); usbh_isr_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, BUS_EVENT_XFER_COMPLETE); //------------- Code Under TEST -------------// - hcd_isr(hostid); + ehci_controller_run(hostid); TEST_ASSERT_NULL(p_control_qhd->p_qtd_list_head); TEST_ASSERT_NULL(p_control_qhd->p_qtd_list_tail); @@ -248,3 +240,12 @@ void test_control_xfer_complete_isr(void) TEST_ASSERT_FALSE(p_status->used); } + +void test_control_xfer_error_isr(void) +{ + hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data); + usbh_isr_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, BUS_EVENT_XFER_ERROR); + + //------------- Code Under TEST -------------// + ehci_controller_run_error(hostid); +} diff --git a/tests/test/host/ehci/test_pipe_interrupt_open.c b/tests/test/host/ehci/test_pipe_interrupt_open.c index b04e68192..ecd63d20d 100644 --- a/tests/test/host/ehci/test_pipe_interrupt_open.c +++ b/tests/test/host/ehci/test_pipe_interrupt_open.c @@ -68,7 +68,7 @@ void setUp(void) dev_addr = 1; hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX; - for (uint8_t i=0; iusb_sts = EHCI_INT_MASK_NXP_ASYNC; + hcd_isr(hostid); +} + +void ehci_controller_run_error(uint8_t hostid) +{ + //------------- Async List -------------// + ehci_registers_t* const regs = get_operational_register(hostid); + + ehci_qhd_t *p_qhd = (ehci_qhd_t*) regs->async_list_base; + do + { + if ( !p_qhd->qtd_overlay.halted ) + { + if(!p_qhd->qtd_overlay.next.terminate) + { + ehci_qtd_t* p_qtd = (ehci_qtd_t*) align32(p_qhd->qtd_overlay.next.address); + p_qtd->active = 0; + p_qtd->babble_err = p_qtd->buffer_err = p_qtd->xact_err = 1; + p_qhd->qtd_overlay = *p_qtd; + } + } + p_qhd = (ehci_qhd_t*) align32(p_qhd->next.address); + }while(p_qhd != get_async_head(hostid)); // stop if loop around + //------------- Period List -------------// + + regs->usb_sts = EHCI_INT_MASK_ERROR; + + hcd_isr(hostid); } void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed) -- cgit v1.3.1