diff --git a/Class/BillBoard/Src/usbd_billboard.c b/Class/BillBoard/Src/usbd_billboard.c
index b9e6d19..35b45a1 100644
--- a/Class/BillBoard/Src/usbd_billboard.c
+++ b/Class/BillBoard/Src/usbd_billboard.c
@@ -391,10 +391,10 @@ static uint8_t *USBD_BB_GetDeviceQualifierDesc(uint16_t *length)
*/
USBD_BB_DescHeader_t *USBD_BB_GetNextDesc(uint8_t *pbuf, uint16_t *ptr)
{
- USBD_BB_DescHeader_t *pnext = (USBD_BB_DescHeader_t *)pbuf;
+ USBD_BB_DescHeader_t *pnext = (USBD_BB_DescHeader_t *)(void *)pbuf;
*ptr += pnext->bLength;
- pnext = (USBD_BB_DescHeader_t *)(pbuf + pnext->bLength);
+ pnext = (USBD_BB_DescHeader_t *)(void *)(pbuf + pnext->bLength);
return (pnext);
}
@@ -411,8 +411,8 @@ void *USBD_BB_GetCapDesc(USBD_HandleTypeDef *pdev, uint8_t *pBosDesc)
{
UNUSED(pdev);
- USBD_BB_DescHeader_t *pdesc = (USBD_BB_DescHeader_t *)pBosDesc;
- USBD_BosDescTypedef *desc = (USBD_BosDescTypedef *)pBosDesc;
+ USBD_BB_DescHeader_t *pdesc = (USBD_BB_DescHeader_t *)(void *)pBosDesc;
+ USBD_BosDescTypedef *desc = (USBD_BosDescTypedef *)(void *)pBosDesc;
USBD_BosBBCapDescTypedef *pCapDesc = NULL;
uint16_t ptr;
@@ -426,7 +426,7 @@ void *USBD_BB_GetCapDesc(USBD_HandleTypeDef *pdev, uint8_t *pBosDesc)
if (pdesc->bDevCapabilityType == USBD_BILLBOARD_CAPABILITY)
{
- pCapDesc = (USBD_BosBBCapDescTypedef *)pdesc;
+ pCapDesc = (USBD_BosBBCapDescTypedef *)(void *)pdesc;
break;
}
}
@@ -447,8 +447,8 @@ void *USBD_BB_GetAltModeDesc(USBD_HandleTypeDef *pdev, uint8_t *pBosDesc, uint8_
{
UNUSED(pdev);
- USBD_BB_DescHeader_t *pdesc = (USBD_BB_DescHeader_t *)pBosDesc;
- USBD_BosDescTypedef *desc = (USBD_BosDescTypedef *)pBosDesc;
+ USBD_BB_DescHeader_t *pdesc = (USBD_BB_DescHeader_t *)(void *)pBosDesc;
+ USBD_BosDescTypedef *desc = (USBD_BosDescTypedef *)(void *)pBosDesc;
USBD_BB_AltModeCapDescTypeDef *pAltModDesc = NULL;
uint8_t cnt = 0U;
uint16_t ptr;
@@ -465,7 +465,7 @@ void *USBD_BB_GetAltModeDesc(USBD_HandleTypeDef *pdev, uint8_t *pBosDesc, uint8_
{
if (cnt == idx)
{
- pAltModDesc = (USBD_BB_AltModeCapDescTypeDef *)pdesc;
+ pAltModDesc = (USBD_BB_AltModeCapDescTypeDef *)(void *)pdesc;
break;
}
else
diff --git a/Class/CDC/Src/usbd_cdc.c b/Class/CDC/Src/usbd_cdc.c
index 017e4cd..ae1f9a4 100644
--- a/Class/CDC/Src/usbd_cdc.c
+++ b/Class/CDC/Src/usbd_cdc.c
@@ -474,16 +474,16 @@ static uint8_t USBD_CDC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
(void)USBD_LL_OpenEP(pdev, CDC_IN_EP, USBD_EP_TYPE_BULK,
CDC_DATA_HS_IN_PACKET_SIZE);
- pdev->ep_in[CDC_IN_EP & 0xFU].is_used = 1U;
+ pdev->ep_in[CDC_IN_EP & 0xFU].is_used = 1U;
- /* Open EP OUT */
- (void)USBD_LL_OpenEP(pdev, CDC_OUT_EP, USBD_EP_TYPE_BULK,
- CDC_DATA_HS_OUT_PACKET_SIZE);
+ /* Open EP OUT */
+ (void)USBD_LL_OpenEP(pdev, CDC_OUT_EP, USBD_EP_TYPE_BULK,
+ CDC_DATA_HS_OUT_PACKET_SIZE);
- pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
+ pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
- /* Set bInterval for CDC CMD Endpoint */
- pdev->ep_in[CDC_CMD_EP & 0xFU].bInterval = CDC_HS_BINTERVAL;
+ /* Set bInterval for CDC CMD Endpoint */
+ pdev->ep_in[CDC_CMD_EP & 0xFU].bInterval = CDC_HS_BINTERVAL;
}
else
{
@@ -491,16 +491,16 @@ static uint8_t USBD_CDC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
(void)USBD_LL_OpenEP(pdev, CDC_IN_EP, USBD_EP_TYPE_BULK,
CDC_DATA_FS_IN_PACKET_SIZE);
- pdev->ep_in[CDC_IN_EP & 0xFU].is_used = 1U;
+ pdev->ep_in[CDC_IN_EP & 0xFU].is_used = 1U;
- /* Open EP OUT */
- (void)USBD_LL_OpenEP(pdev, CDC_OUT_EP, USBD_EP_TYPE_BULK,
- CDC_DATA_FS_OUT_PACKET_SIZE);
+ /* Open EP OUT */
+ (void)USBD_LL_OpenEP(pdev, CDC_OUT_EP, USBD_EP_TYPE_BULK,
+ CDC_DATA_FS_OUT_PACKET_SIZE);
- pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
+ pdev->ep_out[CDC_OUT_EP & 0xFU].is_used = 1U;
- /* Set bInterval for CMD Endpoint */
- pdev->ep_in[CDC_CMD_EP & 0xFU].bInterval = CDC_FS_BINTERVAL;
+ /* Set bInterval for CMD Endpoint */
+ pdev->ep_in[CDC_CMD_EP & 0xFU].bInterval = CDC_FS_BINTERVAL;
}
/* Open Command IN EP */
@@ -540,7 +540,6 @@ static uint8_t USBD_CDC_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
static uint8_t USBD_CDC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
{
UNUSED(cfgidx);
- uint8_t ret = 0U;
/* Close EP IN */
(void)USBD_LL_CloseEP(pdev, CDC_IN_EP);
@@ -563,7 +562,7 @@ static uint8_t USBD_CDC_DeInit(USBD_HandleTypeDef *pdev, uint8_t cfgidx)
pdev->pClassData = NULL;
}
- return ret;
+ return (uint8_t)USBD_OK;
}
/**
@@ -583,81 +582,81 @@ static uint8_t USBD_CDC_Setup(USBD_HandleTypeDef *pdev,
switch (req->bmRequest & USB_REQ_TYPE_MASK)
{
- case USB_REQ_TYPE_CLASS:
- if (req->wLength != 0U)
- {
- if ((req->bmRequest & 0x80U) != 0U)
+ case USB_REQ_TYPE_CLASS:
+ if (req->wLength != 0U)
{
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
- (uint8_t *)hcdc->data,
- req->wLength);
+ if ((req->bmRequest & 0x80U) != 0U)
+ {
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
+ (uint8_t *)hcdc->data,
+ req->wLength);
(void)USBD_CtlSendData(pdev, (uint8_t *)hcdc->data, req->wLength);
+ }
+ else
+ {
+ hcdc->CmdOpCode = req->bRequest;
+ hcdc->CmdLength = (uint8_t)req->wLength;
+
+ (void)USBD_CtlPrepareRx(pdev, (uint8_t *)hcdc->data, req->wLength);
+ }
}
else
{
- hcdc->CmdOpCode = req->bRequest;
- hcdc->CmdLength = (uint8_t)req->wLength;
-
- (void)USBD_CtlPrepareRx(pdev, (uint8_t *)hcdc->data, req->wLength);
- }
- }
- else
- {
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
- (uint8_t *)req, 0U);
- }
- break;
-
- case USB_REQ_TYPE_STANDARD:
- switch (req->bRequest)
- {
- case USB_REQ_GET_STATUS:
- if (pdev->dev_state == USBD_STATE_CONFIGURED)
- {
- (void)USBD_CtlSendData(pdev, (uint8_t *)&status_info, 2U);
- }
- else
- {
- USBD_CtlError(pdev, req);
- ret = USBD_FAIL;
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->Control(req->bRequest,
+ (uint8_t *)req, 0U);
}
break;
- case USB_REQ_GET_INTERFACE:
- if (pdev->dev_state == USBD_STATE_CONFIGURED)
+ case USB_REQ_TYPE_STANDARD:
+ switch (req->bRequest)
{
- (void)USBD_CtlSendData(pdev, &ifalt, 1U);
- }
- else
- {
- USBD_CtlError(pdev, req);
- ret = USBD_FAIL;
- }
- break;
+ case USB_REQ_GET_STATUS:
+ if (pdev->dev_state == USBD_STATE_CONFIGURED)
+ {
+ (void)USBD_CtlSendData(pdev, (uint8_t *)&status_info, 2U);
+ }
+ else
+ {
+ USBD_CtlError(pdev, req);
+ ret = USBD_FAIL;
+ }
+ break;
- case USB_REQ_SET_INTERFACE:
- if (pdev->dev_state != USBD_STATE_CONFIGURED)
- {
- USBD_CtlError(pdev, req);
- ret = USBD_FAIL;
- }
- break;
+ case USB_REQ_GET_INTERFACE:
+ if (pdev->dev_state == USBD_STATE_CONFIGURED)
+ {
+ (void)USBD_CtlSendData(pdev, &ifalt, 1U);
+ }
+ else
+ {
+ USBD_CtlError(pdev, req);
+ ret = USBD_FAIL;
+ }
+ break;
- case USB_REQ_CLEAR_FEATURE:
+ case USB_REQ_SET_INTERFACE:
+ if (pdev->dev_state != USBD_STATE_CONFIGURED)
+ {
+ USBD_CtlError(pdev, req);
+ ret = USBD_FAIL;
+ }
+ break;
+
+ case USB_REQ_CLEAR_FEATURE:
+ break;
+
+ default:
+ USBD_CtlError(pdev, req);
+ ret = USBD_FAIL;
+ break;
+ }
break;
default:
USBD_CtlError(pdev, req);
ret = USBD_FAIL;
break;
- }
- break;
-
- default:
- USBD_CtlError(pdev, req);
- ret = USBD_FAIL;
- break;
}
return (uint8_t)ret;
@@ -694,7 +693,11 @@ static uint8_t USBD_CDC_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
else
{
hcdc->TxState = 0U;
- ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+
+ if (((USBD_CDC_ItfTypeDef *)pdev->pUserData)->TransmitCplt != NULL)
+ {
+ ((USBD_CDC_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+ }
}
return (uint8_t)USBD_OK;
@@ -743,7 +746,6 @@ static uint8_t USBD_CDC_EP0_RxReady(USBD_HandleTypeDef *pdev)
(uint8_t *)hcdc->data,
(uint16_t)hcdc->CmdLength);
hcdc->CmdOpCode = 0xFFU;
-
}
return (uint8_t)USBD_OK;
@@ -778,7 +780,7 @@ static uint8_t *USBD_CDC_GetHSCfgDesc(uint16_t *length)
}
/**
- * @brief USBD_CDC_GetCfgDesc
+ * @brief USBD_CDC_GetOtherSpeedCfgDesc
* Return configuration descriptor
* @param speed : current device speed
* @param length : pointer data length
@@ -792,11 +794,11 @@ static uint8_t *USBD_CDC_GetOtherSpeedCfgDesc(uint16_t *length)
}
/**
-* @brief DeviceQualifierDescriptor
-* return Device Qualifier descriptor
-* @param length : pointer data length
-* @retval pointer to descriptor buffer
-*/
+ * @brief USBD_CDC_GetDeviceQualifierDescriptor
+ * return Device Qualifier descriptor
+ * @param length : pointer data length
+ * @retval pointer to descriptor buffer
+ */
uint8_t *USBD_CDC_GetDeviceQualifierDescriptor(uint16_t *length)
{
*length = (uint16_t)sizeof(USBD_CDC_DeviceQualifierDesc);
@@ -805,7 +807,7 @@ uint8_t *USBD_CDC_GetDeviceQualifierDescriptor(uint16_t *length)
}
/**
-* @brief USBD_CDC_RegisterInterface
+ * @brief USBD_CDC_RegisterInterface
* @param pdev: device instance
* @param fops: CD Interface callback
* @retval status
@@ -840,7 +842,6 @@ uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev,
return (uint8_t)USBD_OK;
}
-
/**
* @brief USBD_CDC_SetRxBuffer
* @param pdev: device instance
@@ -889,7 +890,6 @@ uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev)
return (uint8_t)ret;
}
-
/**
* @brief USBD_CDC_ReceivePacket
* prepare OUT Endpoint for reception
diff --git a/Class/CDC_ECM/Src/usbd_cdc_ecm.c b/Class/CDC_ECM/Src/usbd_cdc_ecm.c
index edc5d22..731c4a6 100644
--- a/Class/CDC_ECM/Src/usbd_cdc_ecm.c
+++ b/Class/CDC_ECM/Src/usbd_cdc_ecm.c
@@ -716,7 +716,10 @@ static uint8_t USBD_CDC_ECM_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
else
{
hcdc->TxState = 0U;
- ((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+ if (((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData)->TransmitCplt != NULL)
+ {
+ ((USBD_CDC_ECM_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+ }
}
}
else if (epnum == (CDC_ECM_CMD_EP & 0x7FU))
@@ -1020,7 +1023,7 @@ uint8_t USBD_CDC_ECM_SendNotification(USBD_HandleTypeDef *pdev,
(hcdc->Req).bmRequest = CDC_ECM_BMREQUEST_TYPE_ECM;
(hcdc->Req).bRequest = (uint8_t)Notif;
- switch (Notif)
+ switch ((hcdc->Req).bRequest)
{
case NETWORK_CONNECTION:
(hcdc->Req).wValue = bVal;
diff --git a/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c b/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c
index 946ed50..6109b63 100644
--- a/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c
+++ b/Class/CDC_RNDIS/Src/usbd_cdc_rndis.c
@@ -657,7 +657,7 @@ static uint8_t USBD_CDC_RNDIS_Setup(USBD_HandleTypeDef *pdev,
USBD_SetupReqTypedef *req)
{
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
- USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg = (USBD_CDC_RNDIS_CtrlMsgTypeDef *)hcdc->data;
+ USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg = (USBD_CDC_RNDIS_CtrlMsgTypeDef *)(void *)hcdc->data;
uint8_t ifalt = 0U;
uint16_t status_info = 0U;
USBD_StatusTypeDef ret = USBD_OK;
@@ -810,7 +810,11 @@ static uint8_t USBD_CDC_RNDIS_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
else
{
hcdc->TxState = 0U;
- ((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+
+ if (((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData)->TransmitCplt != NULL)
+ {
+ ((USBD_CDC_RNDIS_ItfTypeDef *)pdev->pUserData)->TransmitCplt(hcdc->TxBuffer, &hcdc->TxLength, epnum);
+ }
}
}
else if (epnum == (CDC_RNDIS_CMD_EP & 0x7FU))
@@ -866,7 +870,7 @@ static uint8_t USBD_CDC_RNDIS_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
NACKed till the end of the application Xfer */
/* Call data packet message parsing and processing function */
- (void)USBD_CDC_RNDIS_ProcessPacketMsg(pdev, (USBD_CDC_RNDIS_PacketMsgTypeDef *)hcdc->RxBuffer);
+ (void)USBD_CDC_RNDIS_ProcessPacketMsg(pdev, (USBD_CDC_RNDIS_PacketMsgTypeDef *)(void *)hcdc->RxBuffer);
}
else
{
@@ -1071,7 +1075,7 @@ uint8_t USBD_CDC_RNDIS_TransmitPacket(USBD_HandleTypeDef *pdev)
}
hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
- PacketMsg = (USBD_CDC_RNDIS_PacketMsgTypeDef *)hcdc->TxBuffer;
+ PacketMsg = (USBD_CDC_RNDIS_PacketMsgTypeDef *)(void *)hcdc->TxBuffer;
if (hcdc->TxState == 0U)
{
@@ -1192,7 +1196,7 @@ uint8_t USBD_CDC_RNDIS_SendNotification(USBD_HandleTypeDef *pdev,
*/
static uint8_t USBD_CDC_RNDIS_MsgParsing(USBD_HandleTypeDef *pdev, uint8_t *RxBuff)
{
- USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg = (USBD_CDC_RNDIS_CtrlMsgTypeDef *)RxBuff;
+ USBD_CDC_RNDIS_CtrlMsgTypeDef *Msg = (USBD_CDC_RNDIS_CtrlMsgTypeDef *)(void *)RxBuff;
static uint8_t ret = (uint8_t)USBD_OK;
/* Check message type */
@@ -1200,37 +1204,37 @@ static uint8_t USBD_CDC_RNDIS_MsgParsing(USBD_HandleTypeDef *pdev, uint8_t *RxBu
{
/* CDC_RNDIS Initialize message */
case CDC_RNDIS_INITIALIZE_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessInitMsg(pdev, (USBD_CDC_RNDIS_InitMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessInitMsg(pdev, (USBD_CDC_RNDIS_InitMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS Halt message */
case CDC_RNDIS_HALT_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessHaltMsg(pdev, (USBD_CDC_RNDIS_HaltMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessHaltMsg(pdev, (USBD_CDC_RNDIS_HaltMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS Query message */
case CDC_RNDIS_QUERY_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessQueryMsg(pdev, (USBD_CDC_RNDIS_QueryMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessQueryMsg(pdev, (USBD_CDC_RNDIS_QueryMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS Set message */
case CDC_RNDIS_SET_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessSetMsg(pdev, (USBD_CDC_RNDIS_SetMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessSetMsg(pdev, (USBD_CDC_RNDIS_SetMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS Reset message */
case CDC_RNDIS_RESET_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessResetMsg(pdev, (USBD_CDC_RNDIS_ResetMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessResetMsg(pdev, (USBD_CDC_RNDIS_ResetMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS Keep-Alive message */
case CDC_RNDIS_KEEPALIVE_MSG_ID:
- ret = USBD_CDC_RNDIS_ProcessKeepAliveMsg(pdev, (USBD_CDC_RNDIS_KpAliveMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessKeepAliveMsg(pdev, (USBD_CDC_RNDIS_KpAliveMsgTypeDef *)(void *)Msg);
break;
/* CDC_RNDIS unsupported message */
default:
- ret = USBD_CDC_RNDIS_ProcessUnsupportedMsg(pdev, (USBD_CDC_RNDIS_CtrlMsgTypeDef *)Msg);
+ ret = USBD_CDC_RNDIS_ProcessUnsupportedMsg(pdev, (USBD_CDC_RNDIS_CtrlMsgTypeDef *)(void *)Msg);
break;
}
@@ -1255,7 +1259,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessInitMsg(USBD_HandleTypeDef *pdev,
USBD_CDC_RNDIS_InitMsgTypeDef *InitMessage = (USBD_CDC_RNDIS_InitMsgTypeDef *)Msg;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_InitCpltMsgTypeDef *InitResponse = (USBD_CDC_RNDIS_InitCpltMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_InitCpltMsgTypeDef *InitResponse = (USBD_CDC_RNDIS_InitCpltMsgTypeDef *)(void *)Msg;
/* Store the Message Request ID */
uint32_t ReqId = InitMessage->ReqId;
@@ -1336,7 +1340,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessKeepAliveMsg(USBD_HandleTypeDef *pdev,
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef *InitResponse = (USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef *InitResponse = (USBD_CDC_RNDIS_KpAliveCpltMsgTypeDef *)(void *)Msg;
/* Store the Message Request ID */
uint32_t ReqId = Msg->ReqId;
@@ -1381,7 +1385,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessQueryMsg(USBD_HandleTypeDef *pdev,
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_QueryCpltMsgTypeDef *QueryResponse = (USBD_CDC_RNDIS_QueryCpltMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_QueryCpltMsgTypeDef *QueryResponse = (USBD_CDC_RNDIS_QueryCpltMsgTypeDef *)(void *)Msg;
/* Store the Message Request ID */
uint32_t ReqId = Msg->RequestId;
@@ -1524,7 +1528,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessSetMsg(USBD_HandleTypeDef *pdev,
USBD_CDC_RNDIS_SetMsgTypeDef *SetMessage = (USBD_CDC_RNDIS_SetMsgTypeDef *)Msg;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_SetCpltMsgTypeDef *SetResponse = (USBD_CDC_RNDIS_SetCpltMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_SetCpltMsgTypeDef *SetResponse = (USBD_CDC_RNDIS_SetCpltMsgTypeDef *)(void *)Msg;
/* Store the Message Request ID */
uint32_t ReqId = SetMessage->ReqId;
@@ -1578,7 +1582,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessResetMsg(USBD_HandleTypeDef *pdev,
/* Get the CDC_RNDIS handle pointer */
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_ResetCpltMsgTypeDef *ResetResponse = (USBD_CDC_RNDIS_ResetCpltMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_ResetCpltMsgTypeDef *ResetResponse = (USBD_CDC_RNDIS_ResetCpltMsgTypeDef *)(void *)Msg;
if ((ResetMessage->MsgLength != sizeof(USBD_CDC_RNDIS_ResetMsgTypeDef)) || \
(ResetMessage->Reserved != 0U))
@@ -1662,7 +1666,7 @@ static uint8_t USBD_CDC_RNDIS_ProcessUnsupportedMsg(USBD_HandleTypeDef *pdev,
USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData;
/* Use same Msg input buffer as response buffer */
- USBD_CDC_RNDIS_StsChangeMsgTypeDef *Response = (USBD_CDC_RNDIS_StsChangeMsgTypeDef *)Msg;
+ USBD_CDC_RNDIS_StsChangeMsgTypeDef *Response = (USBD_CDC_RNDIS_StsChangeMsgTypeDef *)(void *)Msg;
/* Setup the response buffer content */
Response->MsgType = CDC_RNDIS_INDICATE_STATUS_MSG_ID;
diff --git a/Core/Src/usbd_core.c b/Core/Src/usbd_core.c
index 3faed35..67b2a67 100644
--- a/Core/Src/usbd_core.c
+++ b/Core/Src/usbd_core.c
@@ -100,16 +100,10 @@ USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev,
return USBD_FAIL;
}
- /* Unlink previous class */
- if (pdev->pClass != NULL)
- {
- pdev->pClass = NULL;
- }
-
- if (pdev->pConfDesc != NULL)
- {
- pdev->pConfDesc = NULL;
- }
+ /* Unlink previous class resources */
+ pdev->pClass = NULL;
+ pdev->pUserData = NULL;
+ pdev->pConfDesc = NULL;
/* Assign USBD Descriptors */
if (pdesc != NULL)
@@ -137,6 +131,9 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
{
USBD_StatusTypeDef ret;
+ /* Disconnect the USB Device */
+ (void)USBD_LL_Stop(pdev);
+
/* Set Default State */
pdev->dev_state = USBD_STATE_DEFAULT;
@@ -144,22 +141,15 @@ USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev)
if (pdev->pClass != NULL)
{
pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config);
+ pdev->pClass = NULL;
+ pdev->pUserData = NULL;
}
- if (pdev->pConfDesc != NULL)
- {
- pdev->pConfDesc = NULL;
- }
+ /* Free Device descriptors resources */
+ pdev->pDesc = NULL;
+ pdev->pConfDesc = NULL;
- /* Stop the low level driver */
- ret = USBD_LL_Stop(pdev);
-
- if (ret != USBD_OK)
- {
- return ret;
- }
-
- /* Initialize low level driver */
+ /* DeInitialize low level driver */
ret = USBD_LL_DeInit(pdev);
return ret;
@@ -188,13 +178,18 @@ USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDe
pdev->pClass = pclass;
/* Get Device Configuration Descriptor */
-#ifdef USE_USB_FS
- pdev->pConfDesc = (void *)pdev->pClass->GetFSConfigDescriptor(&len);
-#else /* USE_USB_HS */
- pdev->pConfDesc = (void *)pdev->pClass->GetHSConfigDescriptor(&len);
+#ifdef USE_USB_HS
+ if (pdev->pClass->GetHSConfigDescriptor != NULL)
+ {
+ pdev->pConfDesc = (void *)pdev->pClass->GetHSConfigDescriptor(&len);
+ }
+#else /* Default USE_USB_FS */
+ if (pdev->pClass->GetFSConfigDescriptor != NULL)
+ {
+ pdev->pConfDesc = (void *)pdev->pClass->GetFSConfigDescriptor(&len);
+ }
#endif /* USE_USB_FS */
-
return USBD_OK;
}
@@ -218,23 +213,16 @@ USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev)
*/
USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev)
{
- USBD_StatusTypeDef ret;
+ /* Disconnect USB Device */
+ (void)USBD_LL_Stop(pdev);
/* Free Class Resources */
if (pdev->pClass != NULL)
{
- pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config);
+ (void)pdev->pClass->DeInit(pdev, (uint8_t)pdev->dev_config);
}
- if (pdev->pConfDesc != NULL)
- {
- pdev->pConfDesc = NULL;
- }
-
- /* Stop the low level driver */
- ret = USBD_LL_Stop(pdev);
-
- return ret;
+ return USBD_OK;
}
/**
diff --git a/Core/Src/usbd_ctlreq.c b/Core/Src/usbd_ctlreq.c
index c31d40e..cadaf12 100644
--- a/Core/Src/usbd_ctlreq.c
+++ b/Core/Src/usbd_ctlreq.c
@@ -285,7 +285,7 @@ USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef
(void)USBD_LL_ClearStallEP(pdev, ep_addr);
}
(void)USBD_CtlSendStatus(pdev);
- (USBD_StatusTypeDef)pdev->pClass->Setup(pdev, req);
+ ret = (USBD_StatusTypeDef)pdev->pClass->Setup(pdev, req);
}
break;
diff --git a/README.md b/README.md
index e279717..ba20ce7 100644
--- a/README.md
+++ b/README.md
@@ -29,21 +29,6 @@ This software component is licensed by ST under Ultimate Liberty license SLA004
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32_mw_usb_device/blob/master/Release_Notes.html).
-## Compatibility information
-
-This table shows the correspondence between the USB Device MW version and the corresponding HAL version of the targeted series. It is **crucial** that you use a consistent set of versions for the MW - HAL, as mentioned in this table.
-
-Note that:
-* in case a series does not support a particular tag, it is not mentioned in front of it.
-* in case a series supports a recent tag, it is not mentioned in front of older ones.
-
-USB Device | HAL |
----------- | ---------- |
-Tag v2.5.1 | Tag v1.10.2 ([stm32l0xx_hal_driver](https://github.com/STMicroelectronics/stm32l0xx_hal_driver))
-Tag v2.5.2 | Tag v1.4.0 ([stm32l1xx_hal_driver](https://github.com/STMicroelectronics/stm32l1xx_hal_driver))
-Tag v2.5.3 | Tag v1.7.3 ([stm32f0xx_hal_driver](https://github.com/STMicroelectronics/stm32f0xx_hal_driver))
Tag v1.1.4 ([stm32f1xx_hal_driver](https://github.com/STMicroelectronics/stm32f1xx_hal_driver))
Tag v1.2.4 ([stm32f2xx_hal_driver](https://github.com/STMicroelectronics/stm32f2xx_hal_driver))
Tag v1.5.3 ([stm32f3xx_hal_driver](https://github.com/STMicroelectronics/stm32f3xx_hal_driver))
-Tag v2.6.0 | Tag v1.7.8 ([stm32f4xx_hal_driver](https://github.com/STMicroelectronics/stm32f4xx_hal_driver))
Tag v1.2.8 ([stm32f7xx_hal_driver](https://github.com/STMicroelectronics/stm32f7xx_hal_driver))
Tag v1.9.0 ([stm32h7xx_hal_driver](https://github.com/STMicroelectronics/stm32h7xx_hal_driver))
Tag v1.12.0 ([stm32l4xx_hal_driver](https://github.com/STMicroelectronics/stm32l4xx_hal_driver))
Tag v1.6.0 ([stm32wbxx_hal_driver](https://github.com/STMicroelectronics/stm32wbxx_hal_driver))
-
## Troubleshooting
If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/stm32_mw_usb_device/issues/new/choose).
diff --git a/Release_Notes.html b/Release_Notes.html
index c1432a6..fa16ae7 100644
--- a/Release_Notes.html
+++ b/Release_Notes.html
@@ -14,6 +14,7 @@
+
-