diff --git a/drivers/usb/device/usb_dc_stm32.c b/drivers/usb/device/usb_dc_stm32.c index ee85c51bfc3..ad33ba6f72f 100644 --- a/drivers/usb/device/usb_dc_stm32.c +++ b/drivers/usb/device/usb_dc_stm32.c @@ -747,8 +747,8 @@ int usb_dc_ep_write(const u8_t ep, const u8_t *const data, irq_disable(DT_USB_IRQ); } - if (ep == EP0_IN && len > MAX_PACKET_SIZE0) { - len = MAX_PACKET_SIZE0; + if (ep == EP0_IN && len > USB_MAX_CTRL_MPS) { + len = USB_MAX_CTRL_MPS; } status = HAL_PCD_EP_Transmit(&usb_dc_stm32_state.pcd, ep, diff --git a/include/usb/usb_device.h b/include/usb/usb_device.h index 6c4ff5988b6..f309804b4a3 100644 --- a/include/usb/usb_device.h +++ b/include/usb/usb_device.h @@ -72,7 +72,7 @@ extern "C" { * USB configuration **************************************************************************/ -#define MAX_PACKET_SIZE0 64 /**< maximum packet size for EP 0 */ +#define USB_MAX_CTRL_MPS 64 /**< maximum packet size (MPS) for EP 0 */ /************************************************************************* * USB application interface diff --git a/samples/net/wpanusb/src/wpanusb.c b/samples/net/wpanusb/src/wpanusb.c index fea537747de..58a9afe6442 100644 --- a/samples/net/wpanusb/src/wpanusb.c +++ b/samples/net/wpanusb/src/wpanusb.c @@ -64,7 +64,7 @@ static const struct dev_common_descriptor { .bDeviceClass = CUSTOM_CLASS, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .bMaxPacketSize0 = MAX_PACKET_SIZE0, + .bMaxPacketSize0 = USB_MAX_CTRL_MPS, .idVendor = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_VID), .idProduct = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_PID), .bcdDevice = sys_cpu_to_le16(BCDDEVICE_RELNUM), diff --git a/samples/subsys/usb/webusb/src/webusb_serial.c b/samples/subsys/usb/webusb/src/webusb_serial.c index 9597d4bf6fe..0213efa7950 100644 --- a/samples/subsys/usb/webusb/src/webusb_serial.c +++ b/samples/subsys/usb/webusb/src/webusb_serial.c @@ -109,7 +109,7 @@ static struct dev_common_descriptor webusb_serial_usb_description = { .bDeviceClass = 0, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .bMaxPacketSize0 = MAX_PACKET_SIZE0, + .bMaxPacketSize0 = USB_MAX_CTRL_MPS, .idVendor = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_VID), .idProduct = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_PID), .bcdDevice = sys_cpu_to_le16(BCDDEVICE_RELNUM), diff --git a/subsys/usb/class/usb_dfu.c b/subsys/usb/class/usb_dfu.c index eb924e24a69..77347b2c3c6 100644 --- a/subsys/usb/class/usb_dfu.c +++ b/subsys/usb/class/usb_dfu.c @@ -143,7 +143,7 @@ struct dev_dfu_mode_descriptor dfu_mode_desc = { .bDeviceClass = 0, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .bMaxPacketSize0 = MAX_PACKET_SIZE0, + .bMaxPacketSize0 = USB_MAX_CTRL_MPS, .idVendor = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_VID), .idProduct = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_PID), .bcdDevice = sys_cpu_to_le16(BCDDEVICE_RELNUM), diff --git a/subsys/usb/usb_descriptor.c b/subsys/usb/usb_descriptor.c index 5caf45843b8..3c4f6a88ea2 100644 --- a/subsys/usb/usb_descriptor.c +++ b/subsys/usb/usb_descriptor.c @@ -69,7 +69,7 @@ USBD_DEVICE_DESCR_DEFINE(primary) struct common_descriptor common_desc = { .bDeviceSubClass = 0, .bDeviceProtocol = 0, #endif - .bMaxPacketSize0 = MAX_PACKET_SIZE0, + .bMaxPacketSize0 = USB_MAX_CTRL_MPS, .idVendor = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_VID), .idProduct = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_PID), .bcdDevice = sys_cpu_to_le16(BCDDEVICE_RELNUM), diff --git a/subsys/usb/usb_device.c b/subsys/usb/usb_device.c index ce2c4ac3473..f94afcdace3 100644 --- a/subsys/usb/usb_device.c +++ b/subsys/usb/usb_device.c @@ -1059,7 +1059,7 @@ int usb_enable(struct usb_cfg_data *config) return ret; /* Configure control EP */ - ep0_cfg.ep_mps = MAX_PACKET_SIZE0; + ep0_cfg.ep_mps = USB_MAX_CTRL_MPS; ep0_cfg.ep_type = USB_DC_EP_CONTROL; ep0_cfg.ep_addr = USB_CONTROL_OUT_EP0; @@ -1587,7 +1587,7 @@ static int usb_composite_init(struct device *dev) } /* Configure control EP */ - ep0_cfg.ep_mps = MAX_PACKET_SIZE0; + ep0_cfg.ep_mps = USB_MAX_CTRL_MPS; ep0_cfg.ep_type = USB_DC_EP_CONTROL; ep0_cfg.ep_addr = USB_CONTROL_OUT_EP0; diff --git a/tests/subsys/usb/device/src/main.c b/tests/subsys/usb/device/src/main.c index fea3b2d034b..9d4b259c56a 100644 --- a/tests/subsys/usb/device/src/main.c +++ b/tests/subsys/usb/device/src/main.c @@ -36,7 +36,7 @@ static const struct dev_common_descriptor { .bDeviceClass = CUSTOM_CLASS, .bDeviceSubClass = 0, .bDeviceProtocol = 0, - .bMaxPacketSize0 = MAX_PACKET_SIZE0, + .bMaxPacketSize0 = USB_MAX_CTRL_MPS, .idVendor = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_VID), .idProduct = sys_cpu_to_le16((u16_t)CONFIG_USB_DEVICE_PID), .bcdDevice = sys_cpu_to_le16(BCDDEVICE_RELNUM),