Skip to content

Commit 38e7d11

Browse files
facchinmpennam
authored andcommitted
STM32: USB: allow more endpoints for OTG_HS ports
1 parent 21cec66 commit 38e7d11

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

targets/TARGET_STM/USBPhy_STM32.cpp

+14-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
#define NUM_ENDPOINTS 6
3535
#define MAX_PACKET_SIZE_NON_ISO 512
36-
#define MAX_PACKET_SIZE_ISO 1023 // Spec can go up to 1023, only ram for this though
36+
#define MAX_PACKET_SIZE_ISO 1023
3737

3838
#else
3939

@@ -47,6 +47,10 @@ static const uint32_t tx_ep_sizes[NUM_ENDPOINTS] = {
4747
MAX_PACKET_SIZE_NON_ISO,
4848
MAX_PACKET_SIZE_NON_ISO,
4949
MAX_PACKET_SIZE_NON_ISO,
50+
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
51+
MAX_PACKET_SIZE_NON_ISO,
52+
MAX_PACKET_SIZE_NON_ISO,
53+
#endif
5054
MAX_PACKET_SIZE_ISO
5155
};
5256

@@ -434,11 +438,18 @@ void USBPhyHw::remote_wakeup()
434438
const usb_ep_table_t *USBPhyHw::endpoint_table()
435439
{
436440
static const usb_ep_table_t table = {
441+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
437442
1280, // 1.25K for endpoint buffers but space is allocated up front
443+
#else
444+
4096,
445+
#endif
438446
{
439447
{USB_EP_ATTR_ALLOW_CTRL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
440448
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
441449
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
450+
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
451+
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
452+
#endif
442453
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
443454
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
444455
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
@@ -451,7 +462,9 @@ const usb_ep_table_t *USBPhyHw::endpoint_table()
451462
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
452463
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
453464
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
465+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
454466
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}
467+
#endif
455468
}
456469
};
457470
return &table;

0 commit comments

Comments
 (0)