uint8_t g_UsbDeviceConfigurationDescriptor[] = {
..........................................................................................................................
..........................................................................................................................
/* The address of the endpoint on the USB device
described by this descriptor. */
USB_ENDPOINT_INTERRUPT, /* This field describes the endpoint's attributes */
USB_SHORT_GET_LOW(FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE),
USB_SHORT_GET_HIGH(FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE),
/* Maximum packet size this endpoint is capable of
sending or receiving when this configuration is
selected. */
FS_HID_GENERIC_INTERRUPT_IN_INTERVAL, /* Interval for polling endpoint for data transfers. */
USB_DESCRIPTOR_LENGTH_ENDPOINT, /* Size of this descriptor in bytes */
USB_DESCRIPTOR_TYPE_ENDPOINT, /* ENDPOINT Descriptor Type */
USB_HID_GENERIC_ENDPOINT_OUT | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
/* The address of the endpoint on the USB device
described by this descriptor. */
USB_ENDPOINT_INTERRUPT, /* This field describes the endpoint's attributes */
USB_SHORT_GET_LOW(FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE),
USB_SHORT_GET_HIGH(FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE),
/* Maximum packet size this endpoint is capable of
sending or receiving when this configuration is
selected. */
FS_HID_GENERIC_INTERRUPT_OUT_INTERVAL, /* Interval for polling endpoint for data transfers. */
};
but in hid_generic.c:
case kUSB_DeviceEventSetConfiguration:
..........................................................................................................................
..........................................................................................................................
if (USB_SPEED_HIGH == g_UsbDeviceHidGeneric.speed)
{
epInitStruct.maxPacketSize = HS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE;
epInitStruct.interval = HS_HID_GENERIC_INTERRUPT_IN_INTERVAL;
}
else
{
epInitStruct.maxPacketSize = FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE;
epInitStruct.interval = FS_HID_GENERIC_INTERRUPT_IN_INTERVAL;
}
USB_DeviceInitEndpoint(handle, &epInitStruct, &epCallback);
epCallback.callbackFn = USB_DeviceHidGenericInterruptOut;
epCallback.callbackParam = handle;
epInitStruct.zlt = 0U;
epInitStruct.transferType = USB_ENDPOINT_INTERRUPT;
epInitStruct.endpointAddress =
USB_HID_GENERIC_ENDPOINT_OUT | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT);
if (USB_SPEED_HIGH == g_UsbDeviceHidGeneric.speed)
{
epInitStruct.maxPacketSize = HS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE;
epInitStruct.interval = HS_HID_GENERIC_INTERRUPT_OUT_INTERVAL;
}
else
{
epInitStruct.maxPacketSize = FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE;
epInitStruct.interval = FS_HID_GENERIC_INTERRUPT_OUT_INTERVAL;
}
..........................................................................................................................
..........................................................................................................................
I have been confused by two code blocks above;
As my previous project from other MCU, they have been defined and fixed in related descriptors entity;
Please kindly advise,mainly i want to define a high speed interrupt in and out endpoint with the best polling interval as 125us.
Thank you very much!
Kind Regards,
uzslm