summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriabdalkader <i.abdalkader@gmail.com>2023-04-18 14:21:11 +0200
committerDamien George <damien@micropython.org>2023-09-14 23:34:30 +1000
commit0a3264ba9636f0414078fa0c498178eae2994118 (patch)
treedbea5bf538eef333298875f47da3059f24646d9a
parent09a2ee8e7f45756470f9ca51edd4402fcb0fc39c (diff)
shared/tinyusb: Support HS endpoint sizes.
Set buffer and endpoint sizes to 512 if the device is configured as a High Speed device. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
-rw-r--r--shared/tinyusb/mp_usbd_descriptor.c2
-rw-r--r--shared/tinyusb/tusb_config.h6
2 files changed, 5 insertions, 3 deletions
diff --git a/shared/tinyusb/mp_usbd_descriptor.c b/shared/tinyusb/mp_usbd_descriptor.c
index 8fab599b6..72a265217 100644
--- a/shared/tinyusb/mp_usbd_descriptor.c
+++ b/shared/tinyusb/mp_usbd_descriptor.c
@@ -34,7 +34,7 @@
#include "mp_usbd_internal.h"
#define USBD_CDC_CMD_MAX_SIZE (8)
-#define USBD_CDC_IN_OUT_MAX_SIZE (64)
+#define USBD_CDC_IN_OUT_MAX_SIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 64)
const tusb_desc_device_t mp_usbd_desc_device_static = {
.bLength = sizeof(tusb_desc_device_t),
diff --git a/shared/tinyusb/tusb_config.h b/shared/tinyusb/tusb_config.h
index 28bee09a5..96e883fc8 100644
--- a/shared/tinyusb/tusb_config.h
+++ b/shared/tinyusb/tusb_config.h
@@ -43,7 +43,9 @@
#define MICROPY_HW_USB_CDC_INTERFACE_STRING "Board CDC"
#endif
+#ifndef CFG_TUSB_RHPORT0_MODE
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE)
+#endif
#if MICROPY_HW_USB_CDC
#define CFG_TUD_CDC (1)
@@ -59,8 +61,8 @@
// CDC Configuration
#if CFG_TUD_CDC
-#define CFG_TUD_CDC_RX_BUFSIZE (256)
-#define CFG_TUD_CDC_TX_BUFSIZE (256)
+#define CFG_TUD_CDC_RX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256)
+#define CFG_TUD_CDC_TX_BUFSIZE ((CFG_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED) ? 512 : 256)
#endif
// MSC Configuration