mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-24 18:02:40 +00:00
clean up max packet size endian
This commit is contained in:
parent
fa0936bf58
commit
b35ad6edcb
@ -141,11 +141,11 @@
|
|||||||
#define DCD_ATTR_ENDPOINT_MAX 7
|
#define DCD_ATTR_ENDPOINT_MAX 7
|
||||||
|
|
||||||
//------------- Renesas -------------//
|
//------------- Renesas -------------//
|
||||||
#elif TU_CHECK_MCU(RX63X) || TU_CHECK_MCU(RX65X)
|
#elif TU_CHECK_MCU(RX63X) || TU_CHECK_MCU(RX65X) || TU_CHECK_MCU(RX72N)
|
||||||
#define DCD_ATTR_ENDPOINT_MAX 10
|
#define DCD_ATTR_ENDPOINT_MAX 10
|
||||||
|
|
||||||
//#elif TU_CHECK_MCU(MM32F327X)
|
//#elif TU_CHECK_MCU(MM32F327X)
|
||||||
// #define DCD_ATTR_ENDPOINT_MAX not knwon yet
|
// #define DCD_ATTR_ENDPOINT_MAX not known yet
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#warning "DCD_ATTR_ENDPOINT_MAX is not defined for this MCU, default to 8"
|
#warning "DCD_ATTR_ENDPOINT_MAX is not defined for this MCU, default to 8"
|
||||||
|
@ -1150,15 +1150,17 @@ void usbd_defer_func(osal_task_func_t func, void* param, bool in_isr)
|
|||||||
|
|
||||||
bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)
|
bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)
|
||||||
{
|
{
|
||||||
TU_LOG2(" Open EP %02X with Size = %u\r\n", desc_ep->bEndpointAddress, tu_le16toh(desc_ep->wMaxPacketSize.size));
|
uint16_t const max_packet_size = tu_le16toh(desc_ep->wMaxPacketSize.size);
|
||||||
TU_ASSERT(tu_edpt_number(desc_ep->bEndpointAddress) < DCD_ATTR_ENDPOINT_MAX);
|
|
||||||
|
TU_LOG2(" Open EP %02X with Size = %u\r\n", desc_ep->bEndpointAddress, max_packet_size);
|
||||||
|
TU_ASSERT(tu_edpt_number(desc_ep->bEndpointAddress) < CFG_TUD_ENDPPOINT_MAX);
|
||||||
|
|
||||||
switch (desc_ep->bmAttributes.xfer)
|
switch (desc_ep->bmAttributes.xfer)
|
||||||
{
|
{
|
||||||
case TUSB_XFER_ISOCHRONOUS:
|
case TUSB_XFER_ISOCHRONOUS:
|
||||||
{
|
{
|
||||||
uint16_t const max_epsize = (_usbd_dev.speed == TUSB_SPEED_HIGH ? 1024 : 1023);
|
uint16_t const spec_size = (_usbd_dev.speed == TUSB_SPEED_HIGH ? 1024 : 1023);
|
||||||
TU_ASSERT(tu_le16toh(desc_ep->wMaxPacketSize.size) <= max_epsize);
|
TU_ASSERT(max_packet_size <= spec_size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1166,18 +1168,18 @@ bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)
|
|||||||
if (_usbd_dev.speed == TUSB_SPEED_HIGH)
|
if (_usbd_dev.speed == TUSB_SPEED_HIGH)
|
||||||
{
|
{
|
||||||
// Bulk highspeed must be EXACTLY 512
|
// Bulk highspeed must be EXACTLY 512
|
||||||
TU_ASSERT(tu_le16toh(desc_ep->wMaxPacketSize.size) == 512);
|
TU_ASSERT(max_packet_size == 512);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// TODO Bulk fullspeed can only be 8, 16, 32, 64
|
// TODO Bulk fullspeed can only be 8, 16, 32, 64
|
||||||
TU_ASSERT(tu_le16toh(desc_ep->wMaxPacketSize.size) <= 64);
|
TU_ASSERT(max_packet_size <= 64);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TUSB_XFER_INTERRUPT:
|
case TUSB_XFER_INTERRUPT:
|
||||||
{
|
{
|
||||||
uint16_t const max_epsize = (_usbd_dev.speed == TUSB_SPEED_HIGH ? 1024 : 64);
|
uint16_t const spec_size = (_usbd_dev.speed == TUSB_SPEED_HIGH ? 1024 : 64);
|
||||||
TU_ASSERT(tu_le16toh(desc_ep->wMaxPacketSize.size) <= max_epsize);
|
TU_ASSERT(max_packet_size <= spec_size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user