stm32/usb: Add support for 2xVCP on L0, L432 and WB MCUs.

There are a maximum of 8 USB endpoints and each has 2 buffer slots
(in/out).  This commit add support for up to 8 endpoints and adds FIFO
configuration for USB profiles with 2xVCP on MCUs that have device-only USB
peripherals.

Tested on NUCLEO_WB55 in 2xVCP, 2xVCP+MSC and 2xVCP+MSC+HID mode.

Signed-off-by: Damien George <damien@micropython.org>
pull/6155/head
Damien George 2020-06-16 12:25:41 +10:00
rodzic da99e0f979
commit 289be6b352
2 zmienionych plików z 24 dodań i 3 usunięć

Wyświetl plik

@ -93,8 +93,29 @@ pyb_usb_storage_medium_t pyb_usb_storage_medium = PYB_USB_STORAGE_MEDIUM_NONE;
// Units of FIFO size arrays below are 4x 16-bit words = 8 bytes
// There are 512x 16-bit words it total to use here (when using PCD_SNG_BUF)
// EP0(out), EP0(in), MSC/HID(out), MSC/HID(in), unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
STATIC const uint8_t usbd_fifo_size_cdc1[] = {16, 16, 16, 16, 0, 16, 16, 16};
STATIC const uint8_t usbd_fifo_size_cdc1[USBD_PMA_NUM_FIFO] = {
16, 16, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 16, 16, 16, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 0, 0, 0, 0, 0, 0, 0, // 8x unused
};
#if MICROPY_HW_USB_CDC_NUM >= 2
STATIC const uint8_t usbd_fifo_size_cdc2[USBD_PMA_NUM_FIFO] = {
8, 8, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 8, 12, 12, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 8, 12, 12, // unused, CDC2_CMD(in), CDC2_DATA(out), CDC2_DATA(in)
0, 0, 0, 0, // 4x unused
};
// RX; EP0(in), MSC/HID, CDC_CMD, CDC_DATA, CDC2_CMD/HID, CDC2_DATA, HID
STATIC const uint8_t usbd_fifo_size_cdc2_msc_hid[USBD_PMA_NUM_FIFO] = {
8, 8, 16, 16, // EP0(out), EP0(in), MSC/HID(out), MSC/HID(in)
0, 8, 8, 8, // unused, CDC_CMD(in), CDC_DATA(out), CDC_DATA(in)
0, 8, 8, 8, // unused, CDC2_CMD(in), CDC2_DATA(out), CDC2_DATA(in)
8, 8, // HID(out), HID(in)
0, 0, // 2x unused
};
#endif
#else

Wyświetl plik

@ -51,7 +51,7 @@
// For MCUs with a device-only USB peripheral
#define USBD_PMA_RESERVE (64)
#define USBD_PMA_NUM_FIFO (8)
#define USBD_PMA_NUM_FIFO (16) // Maximum 8 endpoints, 2 FIFOs each
// For MCUs with multiple OTG USB peripherals
#define USBD_FS_NUM_TX_FIFO (6)