summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c4
-rw-r--r--tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c50
-rw-r--r--tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c6
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c11
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c10
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c4
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c6
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c12
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c12
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c10
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c22
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c38
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c14
-rw-r--r--tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c6
-rw-r--r--tests/lpc18xx_43xx/test/host/hid/test_hid_host.c2
-rw-r--r--tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c8
-rw-r--r--tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c8
-rw-r--r--tests/lpc18xx_43xx/test/host/host_helper.h14
-rw-r--r--tests/lpc18xx_43xx/test/host/msc/test_msc_host.c22
-rw-r--r--tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c80
-rw-r--r--tests/lpc18xx_43xx/test/host/usbh/test_usbh.c58
-rw-r--r--tests/lpc18xx_43xx/test/test_assertion.c14
-rw-r--r--tests/lpc18xx_43xx/test/test_binary.c88
-rw-r--r--tests/support/ehci_controller_fake.c6
-rw-r--r--tests/support/tusb_callback.h2
-rw-r--r--tests/support/tusb_config.h12
m---------tests/vendor/unity0
27 files changed, 244 insertions, 275 deletions
diff --git a/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c b/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
index 31baa5f5c..f61556c22 100644
--- a/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
+++ b/tests/lpc175x_6x/test/test_dcd_lpc175x_6x.c
@@ -99,7 +99,7 @@ void test_dcd_init(void)
dcd_init();
//------------- slave check -------------//
- TEST_ASSERT_EQUAL_HEX( BIN8(11), LPC_USB->USBEpIntEn );
+ TEST_ASSERT_EQUAL_HEX( TU_BIN8(11), LPC_USB->USBEpIntEn );
TEST_ASSERT_EQUAL_HEX( DEV_INT_DEVICE_STATUS_MASK | DEV_INT_ENDPOINT_SLOW_MASK | DEV_INT_ERROR_MASK,
LPC_USB->USBDevIntEn );
TEST_ASSERT_EQUAL_HEX( 0, LPC_USB->USBEpIntPri);
@@ -135,7 +135,7 @@ void test_dcd_configure_endpoint_in(void)
dcd_pipe_open(0, &desc_endpoint);
uint8_t const phy_ep = 2*3 + 1;
- TEST_ASSERT_EQUAL_HEX( BIT_(phy_ep), LPC_USB->USBReEp);
+ TEST_ASSERT_EQUAL_HEX( TU_BIT(phy_ep), LPC_USB->USBReEp);
TEST_ASSERT_EQUAL_HEX( phy_ep, LPC_USB->USBEpInd);
TEST_ASSERT_EQUAL( desc_endpoint.wMaxPacketSize.size, LPC_USB->USBMaxPSize);
diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
index 12dce0528..25d74d860 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
+++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_host.c
@@ -51,7 +51,7 @@
#include "descriptor_cdc.h"
#include "cdc_host.h"
-#if CFG_TUSB_HOST_CDC_RNDIS // TODO enable
+#if CFG_TUH_CDC_RNDIS // TODO enable
#include "cdc_rndis_host.h"
#endif
@@ -86,10 +86,10 @@ void test_cdch_open_failed_to_open_notification_endpoint(void)
{
pipe_handle_t null_hdl = {0};
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, null_hdl);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, null_hdl);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open_subtask(dev_addr, p_comm_interface, &length));
+ TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open(dev_addr, p_comm_interface, &length));
}
@@ -98,11 +98,11 @@ void test_cdch_open_failed_to_open_data_endpoint_out(void)
pipe_handle_t dummy_hld = { .dev_addr = 1 };
pipe_handle_t null_hdl = {0};
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, dummy_hld);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, null_hdl);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, dummy_hld);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, null_hdl);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open_subtask(dev_addr, p_comm_interface, &length));
+ TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open(dev_addr, p_comm_interface, &length));
}
@@ -111,12 +111,12 @@ void test_cdch_open_failed_to_open_data_endpoint_in(void)
pipe_handle_t dummy_hld = { .dev_addr = 1 };
pipe_handle_t null_hdl = {0};
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, dummy_hld);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, dummy_hld);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, null_hdl);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, dummy_hld);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, dummy_hld);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, null_hdl);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open_subtask(dev_addr, p_comm_interface, &length));
+ TEST_ASSERT_EQUAL(TUSB_ERROR_HCD_OPEN_PIPE_FAILED, cdch_open(dev_addr, p_comm_interface, &length));
}
@@ -131,11 +131,11 @@ void test_cdch_open_length_check(void)
sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t);
pipe_handle_t dummy_hld = { .dev_addr = 1 };
- hcd_pipe_open_IgnoreAndReturn(dummy_hld);
+ hcd_edpt_open_IgnoreAndReturn(dummy_hld);
tusbh_cdc_mounted_cb_Expect(dev_addr);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
+ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open(dev_addr, p_comm_interface, &length) );
TEST_ASSERT_EQUAL(expected_length, length);
}
@@ -143,11 +143,11 @@ void test_cdch_open_length_check(void)
void test_cdch_open_interface_number_check(void)
{
pipe_handle_t dummy_hld = { .dev_addr = 1 };
- hcd_pipe_open_IgnoreAndReturn(dummy_hld);
+ hcd_edpt_open_IgnoreAndReturn(dummy_hld);
tusbh_cdc_mounted_cb_Expect(dev_addr);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
+ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open(dev_addr, p_comm_interface, &length) );
TEST_ASSERT_EQUAL(1, p_cdc->interface_number);
@@ -156,11 +156,11 @@ void test_cdch_open_interface_number_check(void)
void test_cdch_open_protocol_check(void)
{
pipe_handle_t dummy_hld = { .dev_addr = 1 };
- hcd_pipe_open_IgnoreAndReturn(dummy_hld);
+ hcd_edpt_open_IgnoreAndReturn(dummy_hld);
tusbh_cdc_mounted_cb_Expect(dev_addr);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
+ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open(dev_addr, p_comm_interface, &length) );
TEST_ASSERT_EQUAL(p_comm_interface->bInterfaceProtocol, p_cdc->interface_protocol);
@@ -169,11 +169,11 @@ void test_cdch_open_protocol_check(void)
void test_cdch_open_acm_capacity_check(void)
{
pipe_handle_t dummy_hld = { .dev_addr = 1 };
- hcd_pipe_open_IgnoreAndReturn(dummy_hld);
+ hcd_edpt_open_IgnoreAndReturn(dummy_hld);
tusbh_cdc_mounted_cb_Expect(dev_addr);
//------------- CUT -------------//
- TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
+ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open(dev_addr, p_comm_interface, &length) );
TEST_ASSERT_EQUAL_MEMORY(&cdc_config_descriptor.cdc_acm.bmCapabilities, &p_cdc->acm_capability, 1);
}
@@ -187,12 +187,12 @@ void test_cdch_close_device(void)
pipe_handle_t pipe_out = { .dev_addr = 1, .xfer_type = TUSB_XFER_BULK, .index = 0 };
pipe_handle_t pipe_int = { .dev_addr = 1, .xfer_type = TUSB_XFER_BULK, .index = 1 };
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, pipe_out);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_int);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, pipe_out);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_int);
tusbh_cdc_mounted_cb_Expect(dev_addr);
- TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open_subtask(dev_addr, p_comm_interface, &length) );
+ TEST_ASSERT_EQUAL( TUSB_ERROR_NONE, cdch_open(dev_addr, p_comm_interface, &length) );
hcd_pipe_close_ExpectAndReturn(pipe_notification , TUSB_ERROR_NONE);
hcd_pipe_close_ExpectAndReturn(pipe_int , TUSB_ERROR_NONE);
@@ -216,7 +216,7 @@ void test_cdc_serial_is_mounted_not_configured(void)
void test_cdc_serial_is_mounted_protocol_zero(void)
{
- tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) );
+ tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, TU_BIT(TUSB_CLASS_CDC) );
cdch_data[0].interface_protocol = 0;
TEST_ASSERT_FALSE( tusbh_cdc_serial_is_mounted(dev_addr) );
@@ -224,7 +224,7 @@ void test_cdc_serial_is_mounted_protocol_zero(void)
void test_cdc_serial_is_mounted_protocol_is_vendor(void)
{
- tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) );
+ tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, TU_BIT(TUSB_CLASS_CDC) );
cdch_data[0].interface_protocol = 0xff;
TEST_ASSERT_FALSE( tusbh_cdc_serial_is_mounted(dev_addr) );
@@ -232,7 +232,7 @@ void test_cdc_serial_is_mounted_protocol_is_vendor(void)
void test_cdc_serial_is_mounted_protocol_is_at_command(void)
{
- tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, BIT_(TUSB_CLASS_CDC) );
+ tusbh_device_get_mounted_class_flag_ExpectAndReturn(dev_addr, TU_BIT(TUSB_CLASS_CDC) );
cdch_data[0].interface_protocol = CDC_COMM_PROTOCOL_ATCOMMAND;
TEST_ASSERT( tusbh_cdc_serial_is_mounted(dev_addr) );
diff --git a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
index 86d6c2890..ca478b129 100644
--- a/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
+++ b/tests/lpc18xx_43xx/test/host/cdc/test_cdc_rndis_host.c
@@ -103,9 +103,9 @@ void setUp(void)
osal_mutex_wait_StubWithCallback(stub_mutex_wait);
osal_mutex_release_IgnoreAndReturn(TUSB_ERROR_NONE);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, pipe_out);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_in);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_notification, TUSB_CLASS_CDC, pipe_notification);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_out, TUSB_CLASS_CDC, pipe_out);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_endpoint_in, TUSB_CLASS_CDC, pipe_in);
}
void tearDown(void)
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
index 69b7c1dd9..5047e98c4 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_init.c
@@ -51,7 +51,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hostid;
@@ -125,7 +125,6 @@ void check_qhd_endpoint_link(ehci_link_t *p_prev, ehci_qhd_t *p_qhd)
void test_hcd_init_period_list(void)
{
-#if EHCI_PERIODIC_LIST
ehci_registers_t* const regs = get_operational_register(hostid);
ehci_qhd_t * const period_head_arr = get_period_head(hostid, 1);
ehci_link_t * const framelist = get_period_frame_list(hostid);
@@ -153,7 +152,6 @@ void test_hcd_init_period_list(void)
}
TEST_ASSERT_TRUE(period_head_arr[0].next.terminate);
-#endif
}
void test_hcd_init_tt_control(void)
@@ -166,15 +164,10 @@ void test_hcd_init_usbcmd(void)
ehci_registers_t* const regs = get_operational_register(hostid);
TEST_ASSERT(regs->usb_cmd_bit.async_enable);
-
-#if EHCI_PERIODIC_LIST
TEST_ASSERT(regs->usb_cmd_bit.periodic_enable);
-#else
- TEST_ASSERT_FALSE(regs->usb_cmd_bit.periodic_enable);
-#endif
//------------- Framelist size (NXP specific) -------------//
- TEST_ASSERT_BITS(BIN8(11), EHCI_CFG_FRAMELIST_SIZE_BITS, regs->usb_cmd_bit.framelist_size);
+ TEST_ASSERT_BITS(TU_BIN8(11), EHCI_CFG_FRAMELIST_SIZE_BITS, regs->usb_cmd_bit.framelist_size);
TEST_ASSERT_EQUAL(EHCI_CFG_FRAMELIST_SIZE_BITS >> 2, regs->usb_cmd_bit.nxp_framelist_size_msb);
}
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
index 6a6beec3d..df830512e 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_isr.c
@@ -50,7 +50,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hostid;
static ehci_registers_t * regs;
@@ -70,7 +70,7 @@ void tearDown(void)
void test_isr_device_connect_highspeed(void)
{
- usbh_hcd_rhport_plugged_isr_Expect(hostid);
+ hcd_event_device_attach_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_HIGH);
@@ -78,7 +78,7 @@ void test_isr_device_connect_highspeed(void)
void test_isr_device_connect_fullspeed(void)
{
- usbh_hcd_rhport_plugged_isr_Expect(hostid);
+ hcd_event_device_attach_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_FULL);
@@ -86,7 +86,7 @@ void test_isr_device_connect_fullspeed(void)
void test_isr_device_connect_slowspeed(void)
{
- usbh_hcd_rhport_plugged_isr_Expect(hostid);
+ hcd_event_device_attach_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_plug(hostid, TUSB_SPEED_LOW);
@@ -94,7 +94,7 @@ void test_isr_device_connect_slowspeed(void)
void test_isr_device_disconnect(void)
{
- usbh_hcd_rhport_unplugged_isr_Expect(hostid);
+ hcd_event_device_remove_Expect(hostid);
//------------- Code Under Test -------------//
ehci_controller_device_unplug(hostid);
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
index f35c90509..39e15b227 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_structure.c
@@ -51,7 +51,7 @@
#include "mock_osal.h"
#include "mock_usbh_hcd.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
//--------------------------------------------------------------------+
// Setup/Teardown + helper declare
@@ -225,7 +225,7 @@ void test_register_usbcmd(void)
TEST_ASSERT_EQUAL( 2 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, framelist_size) );
TEST_ASSERT_EQUAL( 4 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, periodic_enable) );
TEST_ASSERT_EQUAL( 5 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, async_enable) );
- TEST_ASSERT_EQUAL( 6 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, advacne_async) );
+ TEST_ASSERT_EQUAL( 6 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, advance_async) );
TEST_ASSERT_EQUAL( 7 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, light_reset) );
TEST_ASSERT_EQUAL( 8 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, async_park) );
TEST_ASSERT_EQUAL( 11 , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_cmd_bit, async_park_enable) );
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
index f39f25022..8fa5af5d5 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_ehci_usbh_hcd_integration.c
@@ -100,7 +100,7 @@ void test_addr0_control_close(void)
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr,
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr,
&(tusb_control_request_t) {
.bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE },
.bRequest = TUSB_REQ_SET_ADDRESS,
@@ -126,7 +126,7 @@ void test_isr_disconnect_then_async_advance_control_pipe(void)
{
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr,
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr,
&(tusb_control_request_t) {
.bmRequestType_bit = { .direction = TUSB_DIR_HOST_TO_DEV, .type = TUSB_REQ_TYPE_STANDARD, .recipient = TUSB_REQ_RECIPIENT_DEVICE },
.bRequest = TUSB_REQ_SET_ADDRESS,
@@ -168,7 +168,7 @@ void test_bulk_pipe_close(void)
};
uint8_t xfer_data[100];
- pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_bulk_in, TUSB_CLASS_MSC);
+ pipe_handle_t pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_bulk_in, TUSB_CLASS_MSC);
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl, xfer_data, sizeof(xfer_data), 100) );
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl, xfer_data, sizeof(xfer_data), 50) );
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
index 581488d7d..5b86750ef 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_open.c
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -70,7 +70,7 @@ void setUp(void)
dev_addr = 1;
hostid = RANDOM(CONTROLLER_HOST_NUMBER) + TEST_CONTROLLER_HOST_START_INDEX;
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
helper_usbh_device_emulate(dev_addr, hub_addr, hub_port, hostid, TUSB_SPEED_HIGH);
async_head = get_async_head( hostid );
@@ -85,7 +85,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
- TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
+ TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -155,7 +155,7 @@ void test_open_bulk_qhd_data(void)
tusb_desc_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
+ pipe_hdl = hcd_edpt_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
TEST_ASSERT_EQUAL(dev_addr, pipe_hdl.dev_addr);
TEST_ASSERT_EQUAL(TUSB_XFER_BULK, pipe_hdl.xfer_type);
@@ -175,7 +175,7 @@ void test_open_bulk_hs_out_pingstate(void)
pipe_handle_t pipe_hdl;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_bulk_out, TUSB_CLASS_MSC);
+ pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_bulk_out, TUSB_CLASS_MSC);
p_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1 ].qhd[ pipe_hdl.index ];
TEST_ASSERT(p_qhd->qtd_overlay.pingstate_err);
@@ -187,7 +187,7 @@ void test_open_bulk_hs_out_pingstate(void)
void test_bulk_close(void)
{
tusb_desc_endpoint_t const * desc_endpoint = &desc_ept_bulk_in;
- pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
+ pipe_handle_t pipe_hdl = hcd_edpt_open(dev_addr, desc_endpoint, TUSB_CLASS_MSC);
ehci_qhd_t *p_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
//------------- Code Under TEST -------------//
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
index c4037c596..47e8177a3 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_bulk_xfer.c
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t hub_addr = 2;
static uint8_t hub_port = 2;
@@ -91,7 +91,7 @@ void setUp(void)
{
ehci_controller_init();
tu_memclr(xfer_data, sizeof(xfer_data));
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
TEST_ASSERT_STATUS( hcd_init() );
@@ -102,7 +102,7 @@ void setUp(void)
async_head = get_async_head( hostid );
//------------- pipe open -------------//
- pipe_hdl_bulk = hcd_pipe_open(dev_addr, &desc_ept_bulk_in, TUSB_CLASS_MSC);
+ pipe_hdl_bulk = hcd_edpt_open(dev_addr, &desc_ept_bulk_in, TUSB_CLASS_MSC);
TEST_ASSERT_EQUAL(dev_addr, pipe_hdl_bulk.dev_addr);
TEST_ASSERT_EQUAL(TUSB_XFER_BULK, pipe_hdl_bulk.xfer_type);
@@ -146,9 +146,9 @@ void verify_qtd(ehci_qtd_t *p_qtd, uint8_t p_data[], uint16_t length)
void test_bulk_xfer_hs_ping_out(void)
{
- usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
+ _usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
- pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_bulk_out, TUSB_CLASS_MSC);
+ pipe_handle_t pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_bulk_out, TUSB_CLASS_MSC);
ehci_qhd_t *p_qhd = qhd_get_from_pipe_handle(pipe_hdl);
//------------- Code Under Test -------------//
@@ -208,7 +208,7 @@ void test_bulk_xfer_complete_isr(void)
ehci_qtd_t* p_head = p_qhd_bulk->p_qtd_list_head;
ehci_qtd_t* p_tail = p_qhd_bulk->p_qtd_list_tail;
- usbh_xfer_isr_Expect(pipe_hdl_bulk, TUSB_CLASS_MSC, XFER_RESULT_SUCCESS, sizeof(data2)+sizeof(xfer_data));
+ hcd_event_xfer_complete_Expect(pipe_hdl_bulk, TUSB_CLASS_MSC, XFER_RESULT_SUCCESS, sizeof(data2)+sizeof(xfer_data));
//------------- Code Under Test -------------//
ehci_controller_run(hostid);
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
index 426fed9f2..0faae0fe5 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_open.c
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const control_max_packet_size = 64;
static uint8_t const hub_addr = 2;
@@ -67,7 +67,7 @@ static ehci_qhd_t *p_control_qhd;
//--------------------------------------------------------------------+
void setUp(void)
{
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
TEST_ASSERT_STATUS( hcd_init() );
@@ -90,7 +90,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
- TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
+ TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -149,7 +149,7 @@ void test_control_open_qhd_data(void)
void test_control_open_highspeed(void)
{
- usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
+ _usbh_devices[dev_addr].speed = TUSB_SPEED_HIGH;
//------------- Code Under TEST -------------//
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
@@ -158,7 +158,7 @@ void test_control_open_highspeed(void)
void test_control_open_non_highspeed(void)
{
- usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
+ _usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
index 4f8cdb4c8..9db8b999e 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_control_xfer.c
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const control_max_packet_size = 64;
static uint8_t const hub_addr = 2;
@@ -74,7 +74,7 @@ void setUp(void)
{
ehci_controller_init();
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(xfer_data, sizeof(xfer_data));
TEST_ASSERT_STATUS( hcd_init() );
@@ -149,7 +149,7 @@ void test_control_addr0_xfer_get_check_qhd_qtd_mapping(void)
TEST_ASSERT_STATUS( hcd_pipe_control_open(dev_addr, control_max_packet_size) );
//------------- Code Under TEST -------------//
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
p_setup = &ehci_data.addr0_qtd[0];
p_data = &ehci_data.addr0_qtd[1];
@@ -171,7 +171,7 @@ void test_control_addr0_xfer_get_check_qhd_qtd_mapping(void)
void test_control_xfer_get(void)
{
//------------- Code Under TEST -------------//
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
TEST_ASSERT_EQUAL_HEX( p_setup, p_control_qhd->qtd_overlay.next.address );
TEST_ASSERT_EQUAL_HEX( p_setup , p_control_qhd->p_qtd_list_head);
@@ -206,7 +206,7 @@ void test_control_xfer_get(void)
void test_control_xfer_set(void)
{
//------------- Code Under TEST -------------//
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_set_dev_addr, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_set_dev_addr, xfer_data) );
TEST_ASSERT_EQUAL_HEX( p_setup, p_control_qhd->qtd_overlay.next.address );
TEST_ASSERT_EQUAL_HEX( p_setup , p_control_qhd->p_qtd_list_head);
@@ -226,9 +226,9 @@ void test_control_xfer_set(void)
void test_control_xfer_complete_isr(void)
{
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
- usbh_xfer_isr_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_SUCCESS, 18);
+ hcd_event_xfer_complete_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_SUCCESS, 18);
//------------- Code Under TEST -------------//
ehci_controller_run(hostid);
@@ -245,9 +245,9 @@ void test_control_xfer_complete_isr(void)
void test_control_xfer_error_isr(void)
{
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
- usbh_xfer_isr_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_FAILED, 0);
+ hcd_event_xfer_complete_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_FAILED, 0);
//------------- Code Under TEST -------------//
ehci_controller_run_error(hostid);
@@ -264,9 +264,9 @@ void test_control_xfer_error_isr(void)
void test_control_xfer_error_stall(void)
{
- TEST_ASSERT_STATUS( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
+ TEST_ASSERT( hcd_pipe_control_xfer(dev_addr, &request_get_dev_desc, xfer_data) );
- usbh_xfer_isr_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_STALLED, 0);
+ hcd_event_xfer_complete_Expect(((pipe_handle_t){.dev_addr = dev_addr}), 0, XFER_RESULT_STALLED, 0);
//------------- Code Under TEST -------------//
ehci_controller_run_stall(hostid);
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
index b243a468e..24fddf65e 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_open.c
@@ -50,7 +50,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -67,7 +67,7 @@ static pipe_handle_t pipe_hdl;
//--------------------------------------------------------------------+
void setUp(void)
{
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
hcd_init();
@@ -90,7 +90,7 @@ void verify_open_qhd(ehci_qhd_t *p_qhd, uint8_t endpoint_addr, uint16_t max_pack
TEST_ASSERT_EQUAL(dev_addr, p_qhd->device_address);
TEST_ASSERT_FALSE(p_qhd->non_hs_period_inactive_next_xact);
TEST_ASSERT_EQUAL(endpoint_addr & 0x0F, p_qhd->endpoint_number);
- TEST_ASSERT_EQUAL(usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
+ TEST_ASSERT_EQUAL(_usbh_devices[dev_addr].speed, p_qhd->endpoint_speed);
TEST_ASSERT_EQUAL(max_packet_size, p_qhd->max_package_size);
TEST_ASSERT_EQUAL(0, p_qhd->nak_count_reload); // TDD NAK Reload disable
@@ -144,7 +144,7 @@ void check_int_endpoint_link(ehci_qhd_t *p_prev, ehci_qhd_t *p_qhd)
void test_open_interrupt_qhd_hs(void)
{
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
TEST_ASSERT_EQUAL(dev_addr, pipe_hdl.dev_addr);
TEST_ASSERT_EQUAL(TUSB_XFER_INTERRUPT, pipe_hdl.xfer_type);
@@ -162,11 +162,11 @@ void test_open_interrupt_hs_interval_1(void)
int_edp_interval.bInterval = 1;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(0 , p_int_qhd->interval_ms);
- TEST_ASSERT_EQUAL(BIN8(11111111) , p_int_qhd->interrupt_smask);
+ TEST_ASSERT_EQUAL(TU_BIN8(11111111) , p_int_qhd->interrupt_smask);
check_int_endpoint_link(period_head_arr, p_int_qhd);
}
@@ -177,7 +177,7 @@ void test_open_interrupt_hs_interval_2(void)
int_edp_interval.bInterval = 2;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(0 , p_int_qhd->interval_ms);
@@ -191,7 +191,7 @@ void test_open_interrupt_hs_interval_3(void)
int_edp_interval.bInterval = 3;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(0, p_int_qhd->interval_ms);
@@ -205,7 +205,7 @@ void test_open_interrupt_hs_interval_4(void)
int_edp_interval.bInterval = 4;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(1, p_int_qhd->interval_ms);
@@ -219,7 +219,7 @@ void test_open_interrupt_hs_interval_5(void)
int_edp_interval.bInterval = 5;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(2, p_int_qhd->interval_ms);
@@ -233,7 +233,7 @@ void test_open_interrupt_hs_interval_6(void)
int_edp_interval.bInterval = 6;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(4, p_int_qhd->interval_ms);
@@ -247,7 +247,7 @@ void test_open_interrupt_hs_interval_7(void)
int_edp_interval.bInterval = 7;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(8, p_int_qhd->interval_ms);
@@ -261,7 +261,7 @@ void test_open_interrupt_hs_interval_8(void)
int_edp_interval.bInterval = 16;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(255, p_int_qhd->interval_ms);
@@ -272,10 +272,10 @@ void test_open_interrupt_hs_interval_8(void)
void test_open_interrupt_qhd_non_hs(void)
{
- usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
+ _usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
TEST_ASSERT_EQUAL(dev_addr, pipe_hdl.dev_addr);
TEST_ASSERT_EQUAL(TUSB_XFER_INTERRUPT, pipe_hdl.xfer_type);
@@ -294,10 +294,10 @@ void test_open_interrupt_qhd_non_hs_9(void)
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 32;
- usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
+ _usbh_devices[dev_addr].speed = TUSB_SPEED_FULL;
//------------- Code Under TEST -------------//
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = &ehci_data.device[ pipe_hdl.dev_addr-1].qhd[ pipe_hdl.index ];
TEST_ASSERT_EQUAL(int_edp_interval.bInterval, p_int_qhd->interval_ms);
@@ -310,7 +310,7 @@ void test_open_interrupt_qhd_non_hs_9(void)
//--------------------------------------------------------------------+
void test_interrupt_close(void)
{
- pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_interrupt_out, TUSB_CLASS_HID);
p_int_qhd = qhd_get_from_pipe_handle(pipe_hdl);
//------------- Code Under TEST -------------//
@@ -328,7 +328,7 @@ void test_interrupt_256ms_close(void)
tusb_desc_endpoint_t int_edp_interval = desc_ept_interrupt_out;
int_edp_interval.bInterval = 9;
- pipe_hdl = hcd_pipe_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
+ pipe_hdl = hcd_edpt_open(dev_addr, &int_edp_interval, TUSB_CLASS_HID);
p_int_qhd = qhd_get_from_pipe_handle(pipe_hdl);
//------------- Code Under TEST -------------//
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
index bf7ad352a..d6a5e396c 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_interrupt_xfer.c
@@ -51,7 +51,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -91,7 +91,7 @@ void setUp(void)
{
ehci_controller_init();
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
tu_memclr(xfer_data, sizeof(xfer_data));
TEST_ASSERT_STATUS( hcd_init() );
@@ -104,7 +104,7 @@ void setUp(void)
period_head_arr = (ehci_qhd_t*) get_period_head( hostid, 1 );
//------------- pipe open -------------//
- pipe_hdl_interrupt = hcd_pipe_open(dev_addr, &desc_ept_interrupt_in, TUSB_CLASS_HID);
+ pipe_hdl_interrupt = hcd_edpt_open(dev_addr, &desc_ept_interrupt_in, TUSB_CLASS_HID);
TEST_ASSERT_EQUAL(dev_addr, pipe_hdl_interrupt.dev_addr);
TEST_ASSERT_EQUAL(TUSB_XFER_INTERRUPT, pipe_hdl_interrupt.xfer_type);
@@ -201,7 +201,7 @@ void test_interrupt_xfer_complete_isr_interval_less_than_1ms(void)
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, data2, sizeof(data2), true) );
- usbh_xfer_isr_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_SUCCESS, sizeof(xfer_data)+sizeof(data2));
+ hcd_event_xfer_complete_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_SUCCESS, sizeof(xfer_data)+sizeof(data2));
ehci_qtd_t* p_head = p_qhd_interrupt->p_qtd_list_head;
ehci_qtd_t* p_tail = p_qhd_interrupt->p_qtd_list_tail;
@@ -220,7 +220,7 @@ void test_interrupt_xfer_complete_isr_interval_2ms(void)
tusb_desc_endpoint_t desc_endpoint_2ms = desc_ept_interrupt_in;
desc_endpoint_2ms.bInterval = 5;
- pipe_handle_t pipe_hdl_2ms = hcd_pipe_open(dev_addr, &desc_endpoint_2ms, TUSB_CLASS_HID);
+ pipe_handle_t pipe_hdl_2ms = hcd_edpt_open(dev_addr, &desc_endpoint_2ms, TUSB_CLASS_HID);
ehci_qhd_t * p_qhd_2ms = &ehci_data.device[ dev_addr -1].qhd[ pipe_hdl_2ms.index ];
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_2ms, xfer_data, sizeof(xfer_data), false) );
@@ -242,7 +242,7 @@ void test_interrupt_xfer_error_isr(void)
{
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), true) );
- usbh_xfer_isr_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_FAILED, 0);
+ hcd_event_xfer_complete_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_FAILED, 0);
//------------- Code Under TEST -------------//
ehci_controller_run_error(hostid);
@@ -254,7 +254,7 @@ void test_interrupt_xfer_error_stall(void)
{
TEST_ASSERT_STATUS( hcd_pipe_xfer(pipe_hdl_interrupt, xfer_data, sizeof(xfer_data), true) );
- usbh_xfer_isr_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_STALLED, 0);
+ hcd_event_xfer_complete_Expect(pipe_hdl_interrupt, TUSB_CLASS_HID, XFER_RESULT_STALLED, 0);
//------------- Code Under TEST -------------//
ehci_controller_run_stall(hostid);
diff --git a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
index 1feff94e5..92dd2b474 100644
--- a/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
+++ b/tests/lpc18xx_43xx/test/host/ehci/test_pipe_isochronous_open.c
@@ -50,7 +50,7 @@
#include "ehci_controller_fake.h"
#include "host_helper.h"
-usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
static uint8_t const hub_addr = 2;
static uint8_t const hub_port = 2;
@@ -63,7 +63,7 @@ static ehci_qhd_t *period_head_arr;
//--------------------------------------------------------------------+
void setUp(void)
{
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
hcd_init();
@@ -94,6 +94,6 @@ tusb_desc_endpoint_t const desc_ept_iso_in =
void test_open_isochronous(void)
{
- pipe_handle_t pipe_hdl = hcd_pipe_open(dev_addr, &desc_ept_iso_in, TUSB_CLASS_AUDIO);
+ pipe_handle_t pipe_hdl = hcd_edpt_open(dev_addr, &desc_ept_iso_in, TUSB_CLASS_AUDIO);
TEST_ASSERT_EQUAL(0, pipe_hdl.dev_addr);
}
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c b/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
index 59ad54c88..963c344ab 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hid_host.c
@@ -75,7 +75,7 @@ void tearDown(void)
// uint16_t length=0;
//
// // TODO expect get HID report descriptor
-// hcd_pipe_open_IgnoreAndReturn( pipe_hdl );
+// hcd_edpt_open_IgnoreAndReturn( pipe_hdl );
//
// //------------- Code Under TEST -------------//
// TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, hidh_open_subtask(dev_addr, p_kbd_interface_desc, &length) );
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
index de3581423..e5f33574a 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_keyboard.c
@@ -146,7 +146,7 @@ void test_keyboard_open_ok(void)
usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQ_TYPE_CLASS, TUSB_REQ_RECIPIENT_INTERFACE),
HID_REQ_CONTROL_SET_IDLE, 0, p_kbd_interface_desc->bInterfaceNumber, 0, NULL,
TUSB_ERROR_NONE);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_kdb_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_kdb_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
tusbh_hid_keyboard_mounted_cb_Expect(dev_addr);
//------------- Code Under TEST -------------//
@@ -187,7 +187,7 @@ void test_keyboard_get_device_not_ready(void)
void test_keyboard_get_report_xfer_failed()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, false);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, false);
hcd_pipe_xfer_ExpectAndReturn(p_hidh_kbd->pipe_hdl, (uint8_t*) &report, p_hidh_kbd->report_size, true, TUSB_ERROR_INVALID_PARA);
//------------- Code Under TEST -------------//
@@ -197,7 +197,7 @@ void test_keyboard_get_report_xfer_failed()
void test_keyboard_get_report_xfer_failed_busy()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, true);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, true);
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_keyboard_get_report(dev_addr, &report));
}
@@ -206,7 +206,7 @@ void test_keyboard_get_ok()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
// TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, tusbh_hid_keyboard_status(dev_addr));
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, false);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_kbd->pipe_hdl, false);
hcd_pipe_xfer_ExpectAndReturn(p_hidh_kbd->pipe_hdl, (uint8_t*) &report, p_hidh_kbd->report_size, true, TUSB_ERROR_NONE);
//------------- Code Under TEST -------------//
diff --git a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
index 541c2caef..9aca982b8 100644
--- a/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
+++ b/tests/lpc18xx_43xx/test/host/hid/test_hidh_mouse.c
@@ -117,7 +117,7 @@ void test_mouse_open_ok(void)
usbh_control_xfer_subtask_ExpectAndReturn(dev_addr, bm_request_type(TUSB_DIR_HOST_TO_DEV, TUSB_REQ_TYPE_CLASS, TUSB_REQ_RECIPIENT_INTERFACE),
HID_REQ_CONTROL_SET_IDLE, 0, p_mouse_interface_desc->bInterfaceNumber, 0, NULL,
TUSB_ERROR_NONE);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_mouse_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_mouse_endpoint_desc, TUSB_CLASS_HID, pipe_hdl);
tusbh_hid_mouse_mounted_cb_Expect(dev_addr);
//------------- Code Under TEST -------------//
@@ -159,7 +159,7 @@ void test_mouse_get_device_not_ready(void)
void test_mouse_get_report_xfer_failed()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, false);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, false);
hcd_pipe_xfer_ExpectAndReturn(p_hidh_mouse->pipe_hdl, (uint8_t*) &report, p_hidh_mouse->report_size, true, TUSB_ERROR_INVALID_PARA);
//------------- Code Under TEST -------------//
@@ -169,7 +169,7 @@ void test_mouse_get_report_xfer_failed()
void test_mouse_get_report_xfer_failed_busy()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, true);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, true);
TEST_ASSERT_EQUAL(TUSB_ERROR_INTERFACE_IS_BUSY, tusbh_hid_mouse_get_report(dev_addr, &report));
}
@@ -178,7 +178,7 @@ void test_mouse_get_ok()
{
tusbh_device_get_state_IgnoreAndReturn(TUSB_DEVICE_STATE_CONFIGURED);
// TEST_ASSERT_EQUAL(TUSB_INTERFACE_STATUS_READY, tusbh_hid_mouse_status(dev_addr));
- hcd_pipe_is_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, false);
+ hcd_edpt_busy_ExpectAndReturn(p_hidh_mouse->pipe_hdl, false);
hcd_pipe_xfer_ExpectAndReturn(p_hidh_mouse->pipe_hdl, (uint8_t*) &report, p_hidh_mouse->report_size, true, TUSB_ERROR_NONE);
//------------- Code Under TEST -------------//
diff --git a/tests/lpc18xx_43xx/test/host/host_helper.h b/tests/lpc18xx_43xx/test/host/host_helper.h
index c293ec748..183254e7e 100644
--- a/tests/lpc18xx_43xx/test/host/host_helper.h
+++ b/tests/lpc18xx_43xx/test/host/host_helper.h
@@ -42,7 +42,7 @@
static inline void helper_class_init_expect(void)
{ // class code number order
-#if CFG_TUSB_HOST_CDC
+#if CFG_TUH_CDC
cdch_init_Expect();
#endif
@@ -50,7 +50,7 @@ static inline void helper_class_init_expect(void)
hidh_init_Expect();
#endif
-#if CFG_TUSB_HOST_MSC
+#if CFG_TUH_MSC
msch_init_Expect();
#endif
@@ -69,11 +69,11 @@ static inline void helper_usbh_init_expect(void)
static inline void helper_usbh_device_emulate(uint8_t dev_addr, uint8_t hub_addr, uint8_t hub_port, uint8_t hostid, tusb_speed_t speed)
{
- usbh_devices[dev_addr].core_id = hostid;
- usbh_devices[dev_addr].hub_addr = hub_addr;
- usbh_devices[dev_addr].hub_port = hub_port;
- usbh_devices[dev_addr].speed = speed;
- usbh_devices[dev_addr].state = dev_addr ? TUSB_DEVICE_STATE_CONFIGURED : TUSB_DEVICE_STATE_UNPLUG;
+ _usbh_devices[dev_addr].rhport = hostid;
+ _usbh_devices[dev_addr].hub_addr = hub_addr;
+ _usbh_devices[dev_addr].hub_port = hub_port;
+ _usbh_devices[dev_addr].speed = speed;
+ _usbh_devices[dev_addr].state = dev_addr ? TUSB_DEVICE_STATE_CONFIGURED : TUSB_DEVICE_STATE_UNPLUG;
}
diff --git a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
index 3f4f9102b..abdcbaf1f 100644
--- a/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
+++ b/tests/lpc18xx_43xx/test/host/msc/test_msc_host.c
@@ -84,17 +84,17 @@ void tearDown(void)
void test_open_pipe_in_failed(void)
{
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_null);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_null);
- TEST_ASSERT(TUSB_ERROR_NONE != msch_open_subtask(dev_addr, p_msc_interface_desc, &length));
+ TEST_ASSERT(TUSB_ERROR_NONE != msch_open(dev_addr, p_msc_interface_desc, &length));
}
void test_open_pipe_out_failed(void)
{
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, (pipe_handle_t) {1} );
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_null);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, (pipe_handle_t) {1} );
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_null);
- TEST_ASSERT(TUSB_ERROR_NONE != msch_open_subtask(dev_addr, p_msc_interface_desc, &length));
+ TEST_ASSERT(TUSB_ERROR_NONE != msch_open(dev_addr, p_msc_interface_desc, &length));
}
tusb_error_t stub_control_xfer(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
@@ -121,15 +121,15 @@ tusb_error_t stub_control_xfer(uint8_t dev_addr, uint8_t bmRequestType, uint8_t
#if 0 // TODO TEST enable this
void test_open_desc_length(void)
{
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_in);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_out);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_in);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_out);
usbh_control_xfer_subtask_IgnoreAndReturn(TUSB_ERROR_NONE);
hcd_pipe_xfer_IgnoreAndReturn(TUSB_ERROR_NONE);
hcd_pipe_queue_xfer_IgnoreAndReturn(TUSB_ERROR_NONE);
//------------- Code Under Test -------------//
- TEST_ASSERT_STATUS( msch_open_subtask(dev_addr, p_msc_interface_desc, &length) );
+ TEST_ASSERT_STATUS( msch_open(dev_addr, p_msc_interface_desc, &length) );
TEST_ASSERT_EQUAL(sizeof(tusb_desc_interface_t) + 2*sizeof(tusb_desc_endpoint_t),
length);
@@ -137,14 +137,14 @@ void test_open_desc_length(void)
void test_open_ok(void)
{
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_in);
- hcd_pipe_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_out);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_in, TUSB_CLASS_MSC, pipe_in);
+ hcd_edpt_open_ExpectAndReturn(dev_addr, p_edp_out, TUSB_CLASS_MSC, pipe_out);
//------------- get max lun -------------//
usbh_control_xfer_subtask_StubWithCallback(stub_control_xfer);
//------------- Code Under Test -------------//
- TEST_ASSERT_STATUS( msch_open_subtask(dev_addr, p_msc_interface_desc, &length) );
+ TEST_ASSERT_STATUS( msch_open(dev_addr, p_msc_interface_desc, &length) );
TEST_ASSERT_EQUAL(p_msc_interface_desc->bInterfaceNumber, p_msc->interface_number);
}
diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
index eba3fbcc3..262dbe9ef 100644
--- a/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
+++ b/tests/lpc18xx_43xx/test/host/usbh/test_enum_task.c
@@ -51,11 +51,11 @@
#include "mock_cdc_host.h"
#include "mock_msc_host.h"
-extern usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
extern uint8_t enum_data_buffer[CFG_TUSB_HOST_ENUM_BUFFER_SIZE];
usbh_enumerate_t const enum_connect = {
- .core_id = 0,
+ .rhport = 0,
.hub_addr = 0,
.hub_port = 0,
};
@@ -73,7 +73,7 @@ enum {
void setUp(void)
{
- tu_memclr(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
+ tu_memclr(_usbh_devices, sizeof(usbh_device_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
osal_queue_receive_StubWithCallback(queue_recv_stub);
osal_semaphore_wait_StubWithCallback(semaphore_wait_success_stub);
@@ -82,15 +82,15 @@ void setUp(void)
osal_mutex_release_IgnoreAndReturn(TUSB_ERROR_NONE);
hcd_pipe_control_xfer_StubWithCallback(control_xfer_stub);
- hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
+ hcd_port_connect_status_ExpectAndReturn(enum_connect.rhport, true);
osal_task_delay_Expect(POWER_STABLE_DELAY);
- hcd_port_connect_status_ExpectAndReturn(enum_connect.core_id, true);
- hcd_port_reset_Expect(enum_connect.core_id);
+ hcd_port_connect_status_ExpectAndReturn(enum_connect.rhport, true);
+ hcd_port_reset_Expect(enum_connect.rhport);
osal_task_delay_Expect(RESET_DELAY);
- hcd_port_speed_get_ExpectAndReturn(enum_connect.core_id, device_speed);
+ hcd_port_speed_get_ExpectAndReturn(enum_connect.rhport, device_speed);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(0, 8, TUSB_ERROR_NONE);
}
@@ -179,7 +179,7 @@ tusb_error_t control_xfer_stub(uint8_t dev_addr, const tusb_control_request_t *
return TUSB_ERROR_OSAL_TIMEOUT;
}
- usbh_xfer_isr(
+ hcd_event_xfer_complete(
(pipe_handle_t) { .dev_addr = (num_call > 1 ? 1 : 0), .xfer_type = TUSB_XFER_CONTROL },
0, XFER_RESULT_SUCCESS, 0);
@@ -222,53 +222,53 @@ void test_addr0_failed_dev_desc(void)
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, usbh_devices[0].state);
+ TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, _usbh_devices[0].state);
}
void test_addr0_failed_set_address(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(1));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, usbh_devices[0].state);
+ TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, _usbh_devices[0].state);
TEST_ASSERT_EQUAL_MEMORY(&desc_device, enum_data_buffer, 8);
}
void test_enum_failed_get_full_dev_desc(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(2));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_UNPLUG, usbh_devices[0].state);
- TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, usbh_devices[1].state);
- TEST_ASSERT_EQUAL(TUSB_SPEED_FULL, usbh_devices[1].speed);
- TEST_ASSERT_EQUAL(enum_connect.core_id, usbh_devices[1].core_id);
- TEST_ASSERT_EQUAL(enum_connect.hub_addr, usbh_devices[1].hub_addr);
- TEST_ASSERT_EQUAL(enum_connect.hub_port, usbh_devices[1].hub_port);
+ TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_UNPLUG, _usbh_devices[0].state);
+ TEST_ASSERT_EQUAL(TUSB_DEVICE_STATE_ADDRESSED, _usbh_devices[1].state);
+ TEST_ASSERT_EQUAL(TUSB_SPEED_FULL, _usbh_devices[1].speed);
+ TEST_ASSERT_EQUAL(enum_connect.rhport, _usbh_devices[1].rhport);
+ TEST_ASSERT_EQUAL(enum_connect.hub_addr, _usbh_devices[1].hub_addr);
+ TEST_ASSERT_EQUAL(enum_connect.hub_port, _usbh_devices[1].hub_port);
}
void test_enum_failed_get_9byte_config_desc(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(3));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
@@ -276,19 +276,19 @@ void test_enum_failed_get_9byte_config_desc(void)
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL(desc_device.idVendor, usbh_devices[1].vendor_id);
- TEST_ASSERT_EQUAL(desc_device.idProduct, usbh_devices[1].product_id);
- TEST_ASSERT_EQUAL(desc_device.bNumConfigurations, usbh_devices[1].configure_count);
+ TEST_ASSERT_EQUAL(desc_device.idVendor, _usbh_devices[1].vendor_id);
+ TEST_ASSERT_EQUAL(desc_device.idProduct, _usbh_devices[1].product_id);
+ TEST_ASSERT_EQUAL(desc_device.bNumConfigurations, _usbh_devices[1].configure_count);
}
void test_enum_failed_get_full_config_desc(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(4));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
// tusbh_device_mount_failed_cb_Expect(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL);
@@ -299,11 +299,11 @@ void test_enum_failed_get_full_config_desc(void)
void test_enum_parse_config_desc(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(5));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
@@ -311,17 +311,17 @@ void test_enum_parse_config_desc(void)
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL(desc_configuration.configuration.bNumInterfaces, usbh_devices[1].interface_count);
+ TEST_ASSERT_EQUAL(desc_configuration.configuration.bNumInterfaces, _usbh_devices[1].interface_count);
}
void test_enum_set_configure(void)
{
osal_semaphore_wait_StubWithCallback(semaphore_wait_timeout_stub(6));
- hcd_port_reset_Expect( usbh_devices[0].core_id );
+ hcd_port_reset_Expect( _usbh_devices[0].rhport );
osal_task_delay_Expect(RESET_DELAY);
hcd_pipe_control_close_ExpectAndReturn(0, TUSB_ERROR_NONE);
- osal_semaphore_reset_Expect( usbh_devices[0].control.sem_hdl );
- osal_mutex_reset_Expect( usbh_devices[0].control.mutex_hdl );
+ osal_semaphore_reset_Expect( _usbh_devices[0].control.sem_hdl );
+ osal_mutex_reset_Expect( _usbh_devices[0].control.mutex_hdl );
hcd_pipe_control_open_ExpectAndReturn(1, desc_device.bMaxPacketSize0, TUSB_ERROR_NONE);
tusbh_device_attached_cb_ExpectAndReturn((tusb_desc_device_t*) enum_data_buffer, 1);
@@ -334,6 +334,6 @@ void test_enum_set_configure(void)
usbh_enumeration_task(NULL);
- TEST_ASSERT_EQUAL( BIT_(TUSB_CLASS_HID) | BIT_(TUSB_CLASS_MSC) | BIT_(TUSB_CLASS_CDC),
- usbh_devices[1].flag_supported_class); // TODO change later
+ TEST_ASSERT_EQUAL( TU_BIT(TUSB_CLASS_HID) | TU_BIT(TUSB_CLASS_MSC) | TU_BIT(TUSB_CLASS_CDC),
+ _usbh_devices[1].flag_supported_class); // TODO change later
}
diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
index 7b99b013a..7b5d06c31 100644
--- a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
+++ b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
@@ -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,52 +136,52 @@ 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);
}
}
#if 0 // TODO TEST enable this
// device is not mounted before, even the control pipe is not open, do nothing
-void test_usbh_hcd_rhport_unplugged_isr_device_not_previously_mounted(void)
+void test_hcd_event_device_remove_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);
+ hcd_event_device_remove(0);
}
-void test_usbh_hcd_rhport_unplugged_isr(void)
+void test_hcd_event_device_remove(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 = TU_BIT(TUSB_CLASS_HID);
hidh_close_Expect(dev_addr);
hcd_pipe_control_close_ExpectAndReturn(dev_addr, TUSB_ERROR_NONE);
//------------- Code Under Test -------------//
- usbh_hcd_rhport_unplugged_isr(0);
+ hcd_event_device_remove(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 = TU_BIT(TUSB_CLASS_HID) | TU_BIT(TUSB_CLASS_MSC) | TU_BIT(TUSB_CLASS_CDC);
cdch_close_Expect(dev_addr);
hidh_close_Expect(dev_addr);
@@ -190,9 +190,9 @@ void test_usbh_device_unplugged_multple_class(void)
hcd_pipe_control_close_ExpectAndReturn(dev_addr, TUSB_ERROR_NONE);
//------------- Code Under Test -------------//
- usbh_hcd_rhport_unplugged_isr(0);
+ hcd_event_device_remove(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,10 +219,10 @@ 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);
+ usbh_control_xfer(dev_addr, 1, 2, 3, 4, 0, NULL);
}
void test_usbh_control_xfer_ok(void)
@@ -241,13 +241,13 @@ 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);
+ usbh_control_xfer(dev_addr, 1, 2, 3, 4, 0, NULL);
}
-//void test_usbh_xfer_isr_non_control_stalled(void) // do nothing for stall on control
+//void test_hcd_event_xfer_complete_non_control_stalled(void) // do nothing for stall on control
//{
//
//}
diff --git a/tests/lpc18xx_43xx/test/test_assertion.c b/tests/lpc18xx_43xx/test/test_assertion.c
index 2b465d07d..a01c41d13 100644
--- a/tests/lpc18xx_43xx/test/test_assertion.c
+++ b/tests/lpc18xx_43xx/test/test_assertion.c
@@ -274,17 +274,17 @@ void test_assert_bin_equal(void)
{
Try
{
- ASSERT_BIN8 (BIN8(11110000), BIN8(11110000), __LINE__);
- ASSERT_BIN8_EQUAL (BIN8(00001111), BIN8(00001111), __LINE__);
+ ASSERT_BIN8 (TU_BIN8(11110000), TU_BIN8(11110000), __LINE__);
+ ASSERT_BIN8_EQUAL (TU_BIN8(00001111), TU_BIN8(00001111), __LINE__);
// test side effect
- uint32_t x = BIN8(11001100);
- uint32_t y = BIN8(11001100);
+ uint32_t x = TU_BIN8(11001100);
+ uint32_t y = TU_BIN8(11001100);
ASSERT_BIN8 (x++, y++, __LINE__);
- TEST_ASSERT_EQUAL(BIN8(11001101), x);
- TEST_ASSERT_EQUAL(BIN8(11001101), y);
+ TEST_ASSERT_EQUAL(TU_BIN8(11001101), x);
+ TEST_ASSERT_EQUAL(TU_BIN8(11001101), y);
- ASSERT_BIN8(BIN8(11001111), BIN8(11111100), 0);
+ ASSERT_BIN8(TU_BIN8(11001111), TU_BIN8(11111100), 0);
}
Catch(e)
{
diff --git a/tests/lpc18xx_43xx/test/test_binary.c b/tests/lpc18xx_43xx/test/test_binary.c
index fb61df0fa..cd9bd1e54 100644
--- a/tests/lpc18xx_43xx/test/test_binary.c
+++ b/tests/lpc18xx_43xx/test/test_binary.c
@@ -50,77 +50,53 @@ void tearDown(void)
void test_binary_8(void)
{
- TEST_ASSERT_EQUAL_HEX8(0x00, BIN8(00000000));
- TEST_ASSERT_EQUAL_HEX8(0x01, BIN8(00000001));
- TEST_ASSERT_EQUAL_HEX8(0x02, BIN8(00000010));
- TEST_ASSERT_EQUAL_HEX8(0x04, BIN8(00000100));
- TEST_ASSERT_EQUAL_HEX8(0x08, BIN8(00001000));
- TEST_ASSERT_EQUAL_HEX8(0x10, BIN8(00010000));
- TEST_ASSERT_EQUAL_HEX8(0x20, BIN8(00100000));
- TEST_ASSERT_EQUAL_HEX8(0x40, BIN8(01000000));
- TEST_ASSERT_EQUAL_HEX8(0x80, BIN8(10000000));
+ TEST_ASSERT_EQUAL_HEX8(0x00, TU_BIN8(00000000));
+ TEST_ASSERT_EQUAL_HEX8(0x01, TU_BIN8(00000001));
+ TEST_ASSERT_EQUAL_HEX8(0x02, TU_BIN8(00000010));
+ TEST_ASSERT_EQUAL_HEX8(0x04, TU_BIN8(00000100));
+ TEST_ASSERT_EQUAL_HEX8(0x08, TU_BIN8(00001000));
+ TEST_ASSERT_EQUAL_HEX8(0x10, TU_BIN8(00010000));
+ TEST_ASSERT_EQUAL_HEX8(0x20, TU_BIN8(00100000));
+ TEST_ASSERT_EQUAL_HEX8(0x40, TU_BIN8(01000000));
+ TEST_ASSERT_EQUAL_HEX8(0x80, TU_BIN8(10000000));
- TEST_ASSERT_EQUAL_HEX8(0x0f, BIN8(00001111));
- TEST_ASSERT_EQUAL_HEX8(0xf0, BIN8(11110000));
- TEST_ASSERT_EQUAL_HEX8(0xff, BIN8(11111111));
+ TEST_ASSERT_EQUAL_HEX8(0x0f, TU_BIN8(00001111));
+ TEST_ASSERT_EQUAL_HEX8(0xf0, TU_BIN8(11110000));
+ TEST_ASSERT_EQUAL_HEX8(0xff, TU_BIN8(11111111));
}
void test_binary_16(void)
{
- TEST_ASSERT_EQUAL_HEX16(0x0000, BIN16(00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX16(0x000f, BIN16(00000000, 00001111));
- TEST_ASSERT_EQUAL_HEX16(0x00f0, BIN16(00000000, 11110000));
- TEST_ASSERT_EQUAL_HEX16(0x0f00, BIN16(00001111, 00000000));
- TEST_ASSERT_EQUAL_HEX16(0xf000, BIN16(11110000, 00000000));
- TEST_ASSERT_EQUAL_HEX16(0xffff, BIN16(11111111, 11111111));
+ TEST_ASSERT_EQUAL_HEX16(0x0000, TU_BIN16(00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX16(0x000f, TU_BIN16(00000000, 00001111));
+ TEST_ASSERT_EQUAL_HEX16(0x00f0, TU_BIN16(00000000, 11110000));
+ TEST_ASSERT_EQUAL_HEX16(0x0f00, TU_BIN16(00001111, 00000000));
+ TEST_ASSERT_EQUAL_HEX16(0xf000, TU_BIN16(11110000, 00000000));
+ TEST_ASSERT_EQUAL_HEX16(0xffff, TU_BIN16(11111111, 11111111));
}
void test_binary_32(void)
{
- TEST_ASSERT_EQUAL_HEX32(0x00000000, BIN32(00000000, 00000000, 00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0x0000000f, BIN32(00000000, 00000000, 00000000, 00001111));
- TEST_ASSERT_EQUAL_HEX32(0x000000f0, BIN32(00000000, 00000000, 00000000, 11110000));
- TEST_ASSERT_EQUAL_HEX32(0x00000f00, BIN32(00000000, 00000000, 00001111, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0x0000f000, BIN32(00000000, 00000000, 11110000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0x000f0000, BIN32(00000000, 00001111, 00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0x00f00000, BIN32(00000000, 11110000, 00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0x0f000000, BIN32(00001111, 00000000, 00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0xf0000000, BIN32(11110000, 00000000, 00000000, 00000000));
- TEST_ASSERT_EQUAL_HEX32(0xffffffff, BIN32(11111111, 11111111, 11111111, 11111111));
+ TEST_ASSERT_EQUAL_HEX32(0x00000000, TU_BIN32(00000000, 00000000, 00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0x0000000f, TU_BIN32(00000000, 00000000, 00000000, 00001111));
+ TEST_ASSERT_EQUAL_HEX32(0x000000f0, TU_BIN32(00000000, 00000000, 00000000, 11110000));
+ TEST_ASSERT_EQUAL_HEX32(0x00000f00, TU_BIN32(00000000, 00000000, 00001111, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0x0000f000, TU_BIN32(00000000, 00000000, 11110000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0x000f0000, TU_BIN32(00000000, 00001111, 00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0x00f00000, TU_BIN32(00000000, 11110000, 00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0x0f000000, TU_BIN32(00001111, 00000000, 00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0xf0000000, TU_BIN32(11110000, 00000000, 00000000, 00000000));
+ TEST_ASSERT_EQUAL_HEX32(0xffffffff, TU_BIN32(11111111, 11111111, 11111111, 11111111));
}
void test_bit_set(void)
{
- TEST_ASSERT_EQUAL_HEX32( BIN8(00001101), bit_set( BIN8(00001001), 2));
- TEST_ASSERT_EQUAL_HEX32( BIN8(10001101), bit_set( BIN8(00001101), 7));
+ TEST_ASSERT_EQUAL_HEX32( TU_BIN8(00001101), tu_bit_set( TU_BIN8(00001001), 2));
+ TEST_ASSERT_EQUAL_HEX32( TU_BIN8(10001101), tu_bit_set( TU_BIN8(00001101), 7));
}
void test_bit_clear(void)
{
- TEST_ASSERT_EQUAL_HEX32( BIN8(00001001), bit_clear( BIN8(00001101), 2));
- TEST_ASSERT_EQUAL_HEX32( BIN8(00001101), bit_clear( BIN8(10001101), 7));
-}
-
-void test_bit_mask(void)
-{
- TEST_ASSERT_EQUAL_HEX32(0x0000ffff, bit_mask(16));
- TEST_ASSERT_EQUAL_HEX32(0x00ffffff, bit_mask(24));
- TEST_ASSERT_EQUAL_HEX32(0xffffffff, bit_mask(32));
-}
-
-void test_bit_range(void)
-{
- TEST_ASSERT_EQUAL_HEX32(BIN8(00001111), bit_mask_range(0, 3));
- TEST_ASSERT_EQUAL_HEX32(BIN8(01100000), bit_mask_range(5, 6));
-
- TEST_ASSERT_EQUAL_HEX32(BIN16(00001111, 00000000), bit_mask_range(8, 11));
- TEST_ASSERT_EQUAL_HEX32(0xf0000000, bit_mask_range(28, 31));
-}
-
-void test_bit_set_range(void)
-{
- TEST_ASSERT_EQUAL_HEX32(BIN8(01011001), bit_set_range(BIN8(00001001), 4, 6, BIN8(101)));
-
- TEST_ASSERT_EQUAL_HEX32(BIN32(11001011, 10100000, 00000000, 00001001),
- bit_set_range(BIN8(00001001), 21, 31, BIN16(110, 01011101)));
+ TEST_ASSERT_EQUAL_HEX32( TU_BIN8(00001001), tu_bit_clear( TU_BIN8(00001101), 2));
+ TEST_ASSERT_EQUAL_HEX32( TU_BIN8(00001101), tu_bit_clear( TU_BIN8(10001101), 7));
}
diff --git a/tests/support/ehci_controller_fake.c b/tests/support/ehci_controller_fake.c
index acd40cc0b..eed72e20c 100644
--- a/tests/support/ehci_controller_fake.c
+++ b/tests/support/ehci_controller_fake.c
@@ -54,7 +54,7 @@
LPC_USB0_Type lpc_usb0;
LPC_USB1_Type lpc_usb1;
-extern usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
+extern usbh_device_t _usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1];
//--------------------------------------------------------------------+
// IMPLEMENTATION
@@ -67,7 +67,7 @@ void ehci_controller_init(void)
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 );
+ ehci_registers_t* const regs = get_operational_register( _usbh_devices[dev_addr].rhport );
ehci_qhd_t * p_qhd = get_control_qhd(dev_addr);
ehci_qtd_t * p_qtd_setup = get_control_qtds(dev_addr);
ehci_qtd_t * p_qtd_data = p_qtd_setup + 1;
@@ -86,7 +86,7 @@ void ehci_controller_control_xfer_proceed(uint8_t dev_addr, uint8_t p_data[])
regs->usb_sts = EHCI_INT_MASK_NXP_ASYNC | EHCI_INT_MASK_NXP_PERIODIC;
- hcd_isr( usbh_devices[dev_addr].core_id );
+ hcd_isr( _usbh_devices[dev_addr].rhport );
}
void complete_qtd_in_qhd(ehci_qhd_t *p_qhd)
diff --git a/tests/support/tusb_callback.h b/tests/support/tusb_callback.h
index 03fa60b5d..bd5a2dacf 100644
--- a/tests/support/tusb_callback.h
+++ b/tests/support/tusb_callback.h
@@ -60,7 +60,7 @@
#include "usbh.h"
//------------- core -------------//
-uint8_t tusbh_device_attached_cb (tusb_desc_device_t const *p_desc_device) ATTR_WEAK ATTR_WARN_UNUSED_RESULT;
+uint8_t tusbh_device_attached_cb (tusb_desc_device_t const *p_desc_device) ATTR_WEAK;
void tusbh_device_mount_succeed_cb (uint8_t dev_addr) ATTR_WEAK;
void tusbh_device_mount_failed_cb(tusb_error_t error, tusb_desc_device_t const *p_desc_device) ATTR_WEAK;
diff --git a/tests/support/tusb_config.h b/tests/support/tusb_config.h
index bf6277849..fe3d59ef1 100644
--- a/tests/support/tusb_config.h
+++ b/tests/support/tusb_config.h
@@ -55,13 +55,13 @@
#define CFG_TUSB_HOST_DEVICE_MAX 5 // TODO be a part of HUB config
//------------- CLASS -------------//
-#define CFG_TUSB_HOST_HUB 0
-#define CFG_TUSB_HOST_HID_KEYBOARD 1
-#define CFG_TUSB_HOST_HID_MOUSE 1
-#define CFG_TUSB_HOST_MSC 1
+#define CFG_TUH_HUB 1
+#define CFG_TUH_HID_KEYBOARD 1
+#define CFG_TUH_HID_MOUSE 1
+#define CFG_TUH_MSC 1
#define CFG_TUSB_HOST_HID_GENERIC 0
-#define CFG_TUSB_HOST_CDC 1
-#define CFG_TUSB_HOST_CDC_RNDIS 0
+#define CFG_TUH_CDC 1
+#define CFG_TUH_CDC_RNDIS 0
// Test support
#define TEST_CONTROLLER_HOST_START_INDEX \
diff --git a/tests/vendor/unity b/tests/vendor/unity
new file mode 160000
+Subproject a2849843654524194b72567b198c25d1c1dfead