Skip to content

Commit ebe21e4

Browse files
committed
chore(usb): update to stm32-mw-usb_device v2.11.6
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 5ff5414 commit ebe21e4

49 files changed

Lines changed: 1814 additions & 954 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Inc/usbd_audio.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ extern "C" {
7171
#define USB_DEVICE_CLASS_AUDIO 0x01U
7272
#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01U
7373
#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02U
74+
#define AUDIO_SUBCLASS_MIDISTREAMING 0x03U
7475
#define AUDIO_PROTOCOL_UNDEFINED 0x00U
7576
#define AUDIO_STREAMING_GENERAL 0x01U
7677
#define AUDIO_STREAMING_FORMAT_TYPE 0x02U

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/AUDIO/Src/usbd_audio.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ USBD_ClassTypeDef USBD_AUDIO =
162162
USBD_AUDIO_GetCfgDesc,
163163
USBD_AUDIO_GetDeviceQualifierDesc,
164164
#endif /* USE_USBD_COMPOSITE */
165+
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
166+
NULL,
167+
#endif /* USBD_SUPPORT_USER_STRING_DESC */
165168
};
166169

167170
#ifndef USE_USBD_COMPOSITE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CCID/Inc/usbd_ccid.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ extern "C" {
6060
#define CCID_CMD_FS_BINTERVAL 0x10U
6161
#endif /* CCID_CMD_FS_BINTERVAL */
6262

63+
#ifndef CCID_CMD_PACKET_SIZE
64+
#define CCID_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */
65+
#endif /* CCID_CMD_PACKET_SIZE */
6366

6467
#define CCID_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */
6568
#define CCID_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */
66-
#define CCID_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */
6769

6870
#define USB_CCID_CONFIG_DESC_SIZ 93U
6971
#define CCID_DATA_HS_IN_PACKET_SIZE CCID_DATA_HS_MAX_PACKET_SIZE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CCID/Src/usbd_ccid.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ USBD_ClassTypeDef USBD_CCID =
129129
USBD_CCID_GetOtherSpeedCfgDesc,
130130
USBD_CCID_GetDeviceQualifierDescriptor,
131131
#endif /* USE_USBD_COMPOSITE */
132+
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
133+
NULL,
134+
#endif /* USBD_SUPPORT_USER_STRING_DESC */
132135
};
133136

134137
#ifndef USE_USBD_COMPOSITE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CCID/Src/usbd_ccid_cmd.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ static void CCID_UpdateCommandStatus(USBD_HandleTypeDef *pdev, uint8_t cmd_stat
4242
uint8_t PC_to_RDR_IccPowerOn(USBD_HandleTypeDef *pdev)
4343
{
4444
/* Apply the ICC VCC
45-
Fills the Response buffer with ICC ATR
46-
This Command is returned with RDR_to_PC_DataBlock();
47-
*/
48-
USBD_CCID_HandleTypeDef *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
45+
* Fills the Response buffer with ICC ATR
46+
* This Command is returned with RDR_to_PC_DataBlock();
47+
*/
48+
USBD_CCID_HandleTypeDef *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
4949
uint8_t voltage;
5050
uint8_t sc_voltage = 0U;
5151
uint8_t index;

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ extern "C" {
5858
#define CDC_FS_BINTERVAL 0x10U
5959
#endif /* CDC_FS_BINTERVAL */
6060

61+
#ifndef CDC_CMD_PACKET_SIZE
62+
#define CDC_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */
63+
#endif /* CDC_CMD_PACKET_SIZE */
64+
6165
/* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
6266
#define CDC_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */
6367
#define CDC_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */
64-
#define CDC_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */
6568

6669
#define USB_CDC_CONFIG_DESC_SIZ 67U
6770
#define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Src/usbd_cdc.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ USBD_ClassTypeDef USBD_CDC =
161161
USBD_CDC_GetOtherSpeedCfgDesc,
162162
USBD_CDC_GetDeviceQualifierDescriptor,
163163
#endif /* USE_USBD_COMPOSITE */
164+
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
165+
NULL,
166+
#endif /* USBD_SUPPORT_USER_STRING_DESC */
164167
};
165168

166169
#ifndef USE_USBD_COMPOSITE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_ECM/Inc/usbd_cdc_ecm.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ extern "C" {
6868
#define CDC_ECM_FS_BINTERVAL 0x10U
6969
#endif /* CDC_ECM_FS_BINTERVAL */
7070

71+
#ifndef CDC_ECM_CMD_PACKET_SIZE
72+
#define CDC_ECM_CMD_PACKET_SIZE 16U /* Control Endpoint Packet size */
73+
#endif /* CDC_ECM_CMD_PACKET_SIZE */
74+
7175
#ifndef USBD_SUPPORT_USER_STRING_DESC
7276
#define USBD_SUPPORT_USER_STRING_DESC 1U
7377
#endif /* USBD_SUPPORT_USER_STRING_DESC */
7478

7579
/* CDC_ECM Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */
7680
#define CDC_ECM_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */
7781
#define CDC_ECM_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */
78-
#define CDC_ECM_CMD_PACKET_SIZE 16U /* Control Endpoint Packet size */
7982

8083
#define CDC_ECM_CONFIG_DESC_SIZ 79U
8184

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_RNDIS/Inc/usbd_cdc_rndis.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ extern "C" {
6666
#define CDC_RNDIS_FS_BINTERVAL 0x10U
6767
#endif /* CDC_RNDIS_FS_BINTERVAL */
6868

69+
#ifndef CDC_RNDIS_CMD_PACKET_SIZE
70+
#define CDC_RNDIS_CMD_PACKET_SIZE 16U /* Control Endpoint Packet size */
71+
#endif /* CDC_RNDIS_CMD_PACKET_SIZE */
6972

7073
/* CDC_RNDIS Endpoints parameters: you can fine tune these values
7174
depending on the needed baudrates and performance. */
7275
#define CDC_RNDIS_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */
7376
#define CDC_RNDIS_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */
74-
#define CDC_RNDIS_CMD_PACKET_SIZE 16U /* Control Endpoint Packet size */
7577

7678
#define CDC_RNDIS_CONFIG_DESC_SIZ 75U
7779
#define CDC_RNDIS_DATA_HS_IN_PACKET_SIZE CDC_RNDIS_DATA_HS_MAX_PACKET_SIZE

‎system/Middlewares/ST/STM32_USB_Device_Library/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessQueryMsg(USBD_HandleTypeDef *pdev,
14141414
case OID_GEN_VENDOR_DESCRIPTION:
14151415
QueryResponse->InfoBufLength = (strlen(USBD_CDC_RNDIS_VENDOR_DESC) + 1U);
14161416
(void)USBD_memcpy(QueryResponse->InfoBuf, USBD_CDC_RNDIS_VENDOR_DESC,
1417-
strlen(USBD_CDC_RNDIS_VENDOR_DESC));
1417+
strlen(USBD_CDC_RNDIS_VENDOR_DESC) + 1U);
14181418

14191419
QueryResponse->Status = CDC_RNDIS_STATUS_SUCCESS;
14201420
break;
@@ -1452,7 +1452,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessQueryMsg(USBD_HandleTypeDef *pdev,
14521452

14531453
case OID_GEN_CURRENT_PACKET_FILTER:
14541454
QueryResponse->InfoBufLength = sizeof(uint32_t);
1455-
QueryResponse->InfoBuf[0] = 0xFFFFFFU; /* USBD_CDC_RNDIS_DEVICE.packetFilter; */
1455+
QueryResponse->InfoBuf[0] = 0xFFFFFFU; /* USBD_CDC_RNDIS_DEVICE.packetFilter */
14561456
QueryResponse->Status = CDC_RNDIS_STATUS_SUCCESS;
14571457
break;
14581458

@@ -1641,6 +1641,13 @@ static uint8_t USBD_CDC_RNDIS_ProcessPacketMsg(USBD_HandleTypeDef *pdev,
16411641
/* Use temporary storage variables to comply with MISRA-C 2012 rule of (+) operand allowed types */
16421642
tmp1 = (uint32_t)PacketMsg;
16431643
tmp2 = (uint32_t)(PacketMsg->DataOffset);
1644+
1645+
/* Validate DataOffset and DataLength against the received MsgLength */
1646+
if ((tmp2 + CDC_RNDIS_PCKTMSG_DATAOFFSET_OFFSET + PacketMsg->DataLength) > PacketMsg->MsgLength)
1647+
{
1648+
return (uint8_t)USBD_FAIL;
1649+
}
1650+
16441651
hcdc->RxBuffer = (uint8_t *)(tmp1 + tmp2 + CDC_RNDIS_PCKTMSG_DATAOFFSET_OFFSET);
16451652
hcdc->RxLength = PacketMsg->DataLength;
16461653

0 commit comments

Comments
 (0)