rename bit_* helper to tu_bit_*, BIT_* to TU_BIT_* for consistency
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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) );
|
||||
|
||||
@@ -167,7 +167,7 @@ void test_hcd_init_usbcmd(void)
|
||||
TEST_ASSERT(regs->usb_cmd_bit.periodic_enable);
|
||||
|
||||
//------------- 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ void test_open_interrupt_hs_interval_1(void)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
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
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ void test_hcd_event_device_remove(void)
|
||||
_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].flag_supported_class = TU_BIT(TUSB_CLASS_HID);
|
||||
|
||||
hidh_close_Expect(dev_addr);
|
||||
hcd_pipe_control_close_ExpectAndReturn(dev_addr, TUSB_ERROR_NONE);
|
||||
@@ -181,7 +181,7 @@ void test_usbh_device_unplugged_multple_class(void)
|
||||
_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].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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -50,77 +50,60 @@ 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));
|
||||
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));
|
||||
}
|
||||
|
||||
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(0x0000ffff, tu_bit_mask(16));
|
||||
TEST_ASSERT_EQUAL_HEX32(0x00ffffff, tu_bit_mask(24));
|
||||
TEST_ASSERT_EQUAL_HEX32(0xffffffff, tu_bit_mask(32));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user