Skip to content

Commit

Permalink
Release v1.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RJMSTM committed Jul 2, 2024
1 parent ea5475b commit 529e571
Show file tree
Hide file tree
Showing 2,427 changed files with 132,098 additions and 130,100 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
| STM32_Audio_PDM | STMicroelectronics | SLA0047 |
| STM32_WPAN | STMicroelectronics | SLA0044 |
| Azure RTOS ThreadX | Microsoft Corporation | Microsoft Software License for Azure RTOS |
| STM32 Projects | STMicroelectronics | SLA0044 (BSD-3-Clause for basic Examples) |
| STM32 Projects | STMicroelectronics | SLA0044 |
| STM32 Utilities | STMicroelectronics | BSD-3-Clause |
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,15 @@ static uint8_t USBD_CUSTOM_HID_Setup(USBD_HandleTypeDef *pdev,
}
}

(void)USBD_CtlSendData(pdev, pbuf, len);
if (pbuf != NULL)
{
(void)USBD_CtlSendData(pdev, pbuf, len);
}
else
{
USBD_CtlError(pdev, req);
ret = USBD_FAIL;
}
break;

case USB_REQ_GET_INTERFACE:
Expand Down
52 changes: 48 additions & 4 deletions Middlewares/ST/STM32_USB_Device_Library/Class/DFU/Src/usbd_dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ static uint8_t USBD_DFU_EP0_RxReady(USBD_HandleTypeDef *pdev)

return (uint8_t)USBD_OK;
}

/**
* @brief USBD_DFU_EP0_TxReady
* handle EP0 TRx Ready event
Expand All @@ -525,7 +526,7 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
uint32_t addr;
USBD_DFU_HandleTypeDef *hdfu = (USBD_DFU_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U) || (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
uint32_t VendorStatus = 0U;
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */

Expand Down Expand Up @@ -619,7 +620,6 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
hdfu->dev_status[4] = hdfu->dev_state;
return (uint8_t)USBD_FAIL;
}

}
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
else
Expand Down Expand Up @@ -647,13 +647,57 @@ static uint8_t USBD_DFU_EP0_TxReady(USBD_HandleTypeDef *pdev)
}
else
{
#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
if (hdfu->wlength > 0U)
{
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_DOWNLOAD, &VendorStatus) != USBD_OK)
{
/* Update the state machine */
hdfu->dev_state = DFU_STATE_ERROR;
hdfu->dev_status[0] = (uint8_t)VendorStatus;
hdfu->dev_status[1] = 0U;
hdfu->dev_status[2] = 0U;
hdfu->dev_status[3] = 0U;
hdfu->dev_status[4] = hdfu->dev_state;
return (uint8_t)USBD_FAIL;
}
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */

/* Vendor specific DFU CMD */
if (DfuInterface->VendorDownloadCMD(hdfu->buffer.d8, hdfu->wblock_num,
hdfu->wlength, &VendorStatus) != USBD_OK)
{
/* Update the state machine */
hdfu->dev_state = DFU_STATE_ERROR;
hdfu->dev_status[0] = (uint8_t)VendorStatus;
hdfu->dev_status[1] = 0U;
hdfu->dev_status[2] = 0U;
hdfu->dev_status[3] = 0U;
hdfu->dev_status[4] = hdfu->dev_state;
return (uint8_t)USBD_FAIL;
}
}
else
{
/* Reset the block number */
hdfu->wblock_num = 0U;

/* Call the error management function (command will be NAKed) */
req.bmRequest = 0U;
req.wLength = 1U;
USBD_CtlError(pdev, &req);
}
#else
/* Reset the global length and block number */
hdfu->wlength = 0U;
hdfu->wblock_num = 0U;

/* Call the error management function (command will be NAKed) */
req.bmRequest = 0U;
req.wLength = 1U;
USBD_CtlError(pdev, &req);
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
}
}
/* Regular Download Command */
Expand Down Expand Up @@ -856,10 +900,10 @@ static void DFU_Download(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
USBD_DFU_HandleTypeDef *hdfu = (USBD_DFU_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];

#if (USBD_DFU_VENDOR_CMD_ENABLED == 1U)
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
USBD_DFU_MediaTypeDef *DfuInterface = (USBD_DFU_MediaTypeDef *)pdev->pUserData[pdev->classId];
uint32_t VendorStatus = 0U;
#endif /* USBD_DFU_VENDOR_CMD_ENABLED */
#endif /* USBD_DFU_VENDOR_CHECK_ENABLED */

if (hdfu == NULL)
{
Expand Down
31 changes: 16 additions & 15 deletions Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@

/**
* @brief USBD_Init
* Initializes the device stack and load the class driver
* Initialize the device stack and load the class driver
* @param pdev: device instance
* @param pdesc: Descriptor structure address
* @param id: Low level core index
* @retval None
* @retval status: USBD Status
*/
USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,
USBD_DescriptorsTypeDef *pdesc, uint8_t id)
Expand Down Expand Up @@ -142,9 +142,9 @@ USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,

/**
* @brief USBD_DeInit
* Re-Initialize the device library
* De-Initialize the device library
* @param pdev: device instance
* @retval status: status
* @retval status: USBD Status
*/
USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
{
Expand Down Expand Up @@ -195,7 +195,7 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
/**
* @brief USBD_RegisterClass
* Link class driver to Device Core.
* @param pDevice : Device Handle
* @param pdev: Device Handle
* @param pclass: Class handle
* @retval USBD Status
*/
Expand Down Expand Up @@ -228,7 +228,7 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDe
#endif /* USE_USB_FS */

/* Increment the NumClasses */
pdev->NumClasses ++;
pdev->NumClasses++;

return USBD_OK;
}
Expand All @@ -243,10 +243,10 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDe
* @param EpAddr: Endpoint Address handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass,
USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr)
USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass,
USBD_CompositeClassTypeDef classtype, uint8_t *EpAddr)
{
USBD_StatusTypeDef ret = USBD_OK;
USBD_StatusTypeDef ret = USBD_OK;
uint16_t len = 0U;

if ((pdev->classId < USBD_MAX_SUPPORTED_CLASS) && (pdev->NumClasses < USBD_MAX_SUPPORTED_CLASS))
Expand Down Expand Up @@ -291,7 +291,7 @@ USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_C
/**
* @brief USBD_UnRegisterClassComposite
* UnLink all composite class drivers from Device Core.
* @param pDevice : Device Handle
* @param pdev: Device Handle
* @retval USBD Status
*/
USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev)
Expand Down Expand Up @@ -374,6 +374,7 @@ USBD_StatusTypeDef USBD_RegisterDevStateCallback(USBD_HandleTypeDef *pdev, USBD_
return USBD_OK;
}
#endif /* USBD_USER_REGISTER_CALLBACK */

/**
* @brief USBD_Start
* Start the USB Device Core.
Expand Down Expand Up @@ -499,7 +500,7 @@ USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
* Clear current configuration
* @param pdev: device instance
* @param cfgidx: configuration index
* @retval status: USBD_StatusTypeDef
* @retval status
*/
USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
{
Expand Down Expand Up @@ -539,6 +540,7 @@ USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
* @brief USBD_LL_SetupStage
* Handle the setup stage
* @param pdev: device instance
* @param psetup: setup packet buffer pointer
* @retval status
*/
USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
Expand Down Expand Up @@ -673,6 +675,7 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
* Handle data in stage
* @param pdev: device instance
* @param epnum: endpoint index
* @param pdata: data pointer
* @retval status
*/
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
Expand Down Expand Up @@ -765,7 +768,6 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
* @param pdev: device instance
* @retval status
*/

USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
{
USBD_StatusTypeDef ret = USBD_OK;
Expand Down Expand Up @@ -848,7 +850,6 @@ USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev,
* @param pdev: device instance
* @retval status
*/

USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
{
if (pdev->dev_state != USBD_STATE_SUSPENDED)
Expand All @@ -867,7 +868,6 @@ USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
* @param pdev: device instance
* @retval status
*/

USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
{
if (pdev->dev_state == USBD_STATE_SUSPENDED)
Expand All @@ -884,7 +884,6 @@ USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
* @param pdev: device instance
* @retval status
*/

USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
{
/* The SOF event can be distributed for all classes that support it */
Expand Down Expand Up @@ -925,6 +924,7 @@ USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
* @brief USBD_LL_IsoINIncomplete
* Handle iso in incomplete event
* @param pdev: device instance
* @param epnum: Endpoint number
* @retval status
*/
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev,
Expand All @@ -950,6 +950,7 @@ USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev,
* @brief USBD_LL_IsoOUTIncomplete
* Handle iso out incomplete event
* @param pdev: device instance
* @param epnum: Endpoint number
* @retval status
*/
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev,
Expand Down
20 changes: 11 additions & 9 deletions Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
/** @defgroup USBD_REQ_Private_Defines
* @{
*/

#ifndef USBD_MAX_STR_DESC_SIZ
#define USBD_MAX_STR_DESC_SIZ 64U
#endif /* USBD_MAX_STR_DESC_SIZ */
/**
* @}
*/
Expand Down Expand Up @@ -421,7 +423,7 @@ USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
* Handle Get Descriptor requests
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand Down Expand Up @@ -675,7 +677,7 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *r
* Set device address
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_SetAddress(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand Down Expand Up @@ -814,7 +816,7 @@ static USBD_StatusTypeDef USBD_SetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReq
* Handle Get device configuration request
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand Down Expand Up @@ -848,7 +850,7 @@ static void USBD_GetConfig(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
* Handle Get Status request
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand Down Expand Up @@ -889,7 +891,7 @@ static void USBD_GetStatus(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
* Handle Set device feature request
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand All @@ -915,7 +917,7 @@ static void USBD_SetFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
* Handle clear device feature request
* @param pdev: device instance
* @param req: usb request
* @retval status
* @retval None
*/
static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
{
Expand All @@ -941,8 +943,8 @@ static void USBD_ClrFeature(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
/**
* @brief USBD_ParseSetupRequest
* Copy buffer into setup structure
* @param pdev: device instance
* @param req: usb request
* @param pdata: setup data pointer
* @retval None
*/
void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
Expand Down Expand Up @@ -1002,7 +1004,7 @@ void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
}

pdesc = desc;
*len = ((uint16_t)USBD_GetLen(pdesc) * 2U) + 2U;
*len = MIN(USBD_MAX_STR_DESC_SIZ, ((uint16_t)USBD_GetLen(pdesc) * 2U) + 2U);

unicode[idx] = *(uint8_t *)len;
idx++;
Expand Down
29 changes: 29 additions & 0 deletions Middlewares/ST/STM32_USB_Device_Library/Release_Notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,35 @@ <h1 id="purpose">Purpose</h1>
<h1>Update History</h1>
<div class="collapse">
<input type="checkbox" id="collapse-section23" checked aria-hidden="true">
<label for="collapse-section23" aria-hidden="true">V2.11.3 /
20-December-2023</label>
<div>
<h2 id="main-changes">Main Changes</h2>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">Headline</th>
</tr>
</thead>
<tbody>
<tr class="even">
<td style="text-align: left;"><strong>USB Core:</strong></td>
</tr>
<tr class="odd">
<td style="text-align: left;">Minor enhancement; add a check on device string descriptor length</td>
</tr>
<tr class="even">
<td style="text-align: left;"><strong>USB DFU Class:</strong></td>
</tr>
<tr class="odd">
<td style="text-align: left;">Improve DFU Vendor Commands support</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="collapse">
<input type="checkbox" id="collapse-section23" aria-hidden="true">
<label for="collapse-section23" aria-hidden="true">V2.11.2 /
17-April-2023</label>
<div>
Expand Down
Loading

0 comments on commit 529e571

Please sign in to comment.