Skip to content

Commit f1ea281

Browse files
committed
STM32: USB: allow more endpoints for OTG_HS ports
1 parent db7954b commit f1ea281

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
@@ -34,7 +34,7 @@
3434

3535
#define NUM_ENDPOINTS 6
3636
#define MAX_PACKET_SIZE_NON_ISO 512
37-
#define MAX_PACKET_SIZE_ISO 1023 // Spec can go up to 1023, only ram for this though
37+
#define MAX_PACKET_SIZE_ISO 1023
3838

3939
#else
4040

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

@@ -438,11 +442,18 @@ void USBPhyHw::remote_wakeup()
438442
const usb_ep_table_t *USBPhyHw::endpoint_table()
439443
{
440444
static const usb_ep_table_t table = {
445+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
441446
1280, // 1.25K for endpoint buffers but space is allocated up front
447+
#else
448+
4096,
449+
#endif
442450
{
443451
{USB_EP_ATTR_ALLOW_CTRL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
444452
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
445453
{USB_EP_ATTR_ALLOW_BULK | USB_EP_ATTR_ALLOW_INT | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}, // NON ISO
454+
#if (MBED_CONF_TARGET_USB_SPEED == USE_USB_OTG_HS)
455+
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
456+
#endif
446457
{USB_EP_ATTR_ALLOW_ALL | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
447458
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
448459
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
@@ -455,7 +466,9 @@ const usb_ep_table_t *USBPhyHw::endpoint_table()
455466
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
456467
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
457468
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0},
469+
#if (MBED_CONF_TARGET_USB_SPEED != USE_USB_OTG_HS)
458470
{0 | USB_EP_ATTR_DIR_IN_AND_OUT, 0, 0}
471+
#endif
459472
}
460473
};
461474
return &table;

0 commit comments

Comments
 (0)