diff --git a/tests/test/host/ehci/test_ehci_init.c b/tests/test/host/ehci/test_ehci_init.c index e83827be5..4876edbdd 100644 --- a/tests/test/host/ehci/test_ehci_init.c +++ b/tests/test/host/ehci/test_ehci_init.c @@ -54,8 +54,7 @@ usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; //--------------------------------------------------------------------+ void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); } void tearDown(void) diff --git a/tests/test/host/ehci/test_ehci_isr.c b/tests/test/host/ehci/test_ehci_isr.c index 40613b53a..7539500a5 100644 --- a/tests/test/host/ehci/test_ehci_isr.c +++ b/tests/test/host/ehci/test_ehci_isr.c @@ -53,8 +53,7 @@ uint8_t hostid; ehci_registers_t * regs; void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX; regs = get_operational_register(hostid); 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 ee640fff2..0e059df88 100644 --- a/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c +++ b/tests/test/host/ehci/test_ehci_usbh_hcd_integration.c @@ -63,8 +63,7 @@ ehci_qhd_t *period_head; void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1)); hub_addr = hub_port = 0; diff --git a/tests/test/host/ehci/test_pipe_bulk_xfer.c b/tests/test/host/ehci/test_pipe_bulk_xfer.c index a4a23cda7..15e33d639 100644 --- a/tests/test/host/ehci/test_pipe_bulk_xfer.c +++ b/tests/test/host/ehci/test_pipe_bulk_xfer.c @@ -85,8 +85,7 @@ tusb_descriptor_endpoint_t const desc_ept_bulk_out = //--------------------------------------------------------------------+ void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1)); memclr_(xfer_data, sizeof(xfer_data)); diff --git a/tests/test/host/ehci/test_pipe_control_xfer.c b/tests/test/host/ehci/test_pipe_control_xfer.c index 4494d225a..3c062dae8 100644 --- a/tests/test/host/ehci/test_pipe_control_xfer.c +++ b/tests/test/host/ehci/test_pipe_control_xfer.c @@ -68,8 +68,7 @@ ehci_qtd_t *p_status; //--------------------------------------------------------------------+ void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1)); memclr_(xfer_data, sizeof(xfer_data)); diff --git a/tests/test/host/ehci/test_pipe_interrupt_xfer.c b/tests/test/host/ehci/test_pipe_interrupt_xfer.c index 81a0f990f..d1ef66fb0 100644 --- a/tests/test/host/ehci/test_pipe_interrupt_xfer.c +++ b/tests/test/host/ehci/test_pipe_interrupt_xfer.c @@ -85,8 +85,7 @@ tusb_descriptor_endpoint_t const desc_ept_interupt_out = //--------------------------------------------------------------------+ void setUp(void) { - memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); - memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); + ehci_controller_init(); memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1)); memclr_(xfer_data, sizeof(xfer_data)); diff --git a/tests/test/support/ehci_controller.c b/tests/test/support/ehci_controller.c index d1a7bbdde..762691c3a 100644 --- a/tests/test/support/ehci_controller.c +++ b/tests/test/support/ehci_controller.c @@ -53,12 +53,17 @@ LPC_USB0_Type lpc_usb0; LPC_USB1_Type lpc_usb1; -extern ehci_data_t ehci_data; extern usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; //--------------------------------------------------------------------+ // IMPLEMENTATION //--------------------------------------------------------------------+ +void ehci_controller_init(void) +{ + memclr_(&lpc_usb0, sizeof(LPC_USB0_Type)); + memclr_(&lpc_usb1, sizeof(LPC_USB1_Type)); +} + void ehci_controller_control_xfer_proceed(uint8_t dev_addr, uint8_t p_data[]) { ehci_registers_t* const regs = get_operational_register( usbh_devices[dev_addr].core_id ); diff --git a/tests/test/support/ehci_controller.h b/tests/test/support/ehci_controller.h index c6fea6902..e87fb95d0 100644 --- a/tests/test/support/ehci_controller.h +++ b/tests/test/support/ehci_controller.h @@ -57,7 +57,9 @@ extern ehci_data_t ehci_data; +void ehci_controller_init(void); void ehci_controller_run(uint8_t hostid); +void ehci_controller_control_xfer_proceed(uint8_t dev_addr, uint8_t p_data[]); void ehci_controller_device_plug(uint8_t hostid, tusb_speed_t speed); void ehci_controller_device_unplug(uint8_t hostid);