summaryrefslogtreecommitdiff
path: root/stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c')
-rw-r--r--stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c446
1 files changed, 223 insertions, 223 deletions
diff --git a/stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c b/stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
index 49330c6..fce6a5b 100644
--- a/stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
+++ b/stm32cubemx/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
@@ -3,7 +3,7 @@
* @file usbd_req.c
* @author MCD Application Team
* @version V2.4.2
- * @date 11-December-2015
+ * @date 11-December-2015
* @brief This file provides the standard USB requests following chapter 9.
******************************************************************************
* @attention
@@ -16,14 +16,14 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
- */
+ */
/* Includes ------------------------------------------------------------------*/
#include "usbd_ctlreq.h"
@@ -35,78 +35,78 @@
*/
-/** @defgroup USBD_REQ
+/** @defgroup USBD_REQ
* @brief USB standard requests module
* @{
- */
+ */
/** @defgroup USBD_REQ_Private_TypesDefinitions
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Private_Defines
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Private_Macros
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Private_Variables
* @{
- */
+ */
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Private_FunctionPrototypes
* @{
- */
-static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
+ */
+static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_SetAddress(USBD_HandleTypeDef *pdev ,
+static void USBD_SetAddress(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
+static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_GetConfig(USBD_HandleTypeDef *pdev ,
+static void USBD_GetConfig(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_GetStatus(USBD_HandleTypeDef *pdev ,
+static void USBD_GetStatus(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_SetFeature(USBD_HandleTypeDef *pdev ,
+static void USBD_SetFeature(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
-static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
+static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req);
static uint8_t USBD_GetLen(uint8_t *buf);
/**
* @}
- */
+ */
/** @defgroup USBD_REQ_Private_Functions
* @{
- */
+ */
/**
@@ -118,45 +118,45 @@ static uint8_t USBD_GetLen(uint8_t *buf);
*/
USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
{
- USBD_StatusTypeDef ret = USBD_OK;
-
- switch (req->bRequest)
+ USBD_StatusTypeDef ret = USBD_OK;
+
+ switch (req->bRequest)
{
- case USB_REQ_GET_DESCRIPTOR:
-
+ case USB_REQ_GET_DESCRIPTOR:
+
USBD_GetDescriptor (pdev, req) ;
break;
-
- case USB_REQ_SET_ADDRESS:
+
+ case USB_REQ_SET_ADDRESS:
USBD_SetAddress(pdev, req);
break;
-
- case USB_REQ_SET_CONFIGURATION:
+
+ case USB_REQ_SET_CONFIGURATION:
USBD_SetConfig (pdev , req);
break;
-
- case USB_REQ_GET_CONFIGURATION:
+
+ case USB_REQ_GET_CONFIGURATION:
USBD_GetConfig (pdev , req);
break;
-
- case USB_REQ_GET_STATUS:
+
+ case USB_REQ_GET_STATUS:
USBD_GetStatus (pdev , req);
break;
-
-
- case USB_REQ_SET_FEATURE:
- USBD_SetFeature (pdev , req);
+
+
+ case USB_REQ_SET_FEATURE:
+ USBD_SetFeature (pdev , req);
break;
-
- case USB_REQ_CLEAR_FEATURE:
+
+ case USB_REQ_CLEAR_FEATURE:
USBD_ClrFeature (pdev , req);
break;
-
- default:
+
+ default:
USBD_CtlError(pdev , req);
break;
}
-
+
return ret;
}
@@ -169,27 +169,27 @@ USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
*/
USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
{
- USBD_StatusTypeDef ret = USBD_OK;
-
- switch (pdev->dev_state)
+ USBD_StatusTypeDef ret = USBD_OK;
+
+ switch (pdev->dev_state)
{
case USBD_STATE_CONFIGURED:
-
- if (LOBYTE(req->wIndex) <= USBD_MAX_NUM_INTERFACES)
+
+ if (LOBYTE(req->wIndex) <= USBD_MAX_NUM_INTERFACES)
{
- pdev->pClass->Setup (pdev, req);
-
+ pdev->pClass->Setup (pdev, req);
+
if((req->wLength == 0)&& (ret == USBD_OK))
{
USBD_CtlSendStatus(pdev);
}
- }
- else
- {
+ }
+ else
+ {
USBD_CtlError(pdev , req);
}
break;
-
+
default:
USBD_CtlError(pdev , req);
break;
@@ -206,116 +206,116 @@ USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev , USBD_SetupReqType
*/
USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTypedef *req)
{
-
+
uint8_t ep_addr;
- USBD_StatusTypeDef ret = USBD_OK;
+ USBD_StatusTypeDef ret = USBD_OK;
USBD_EndpointTypeDef *pep;
- ep_addr = LOBYTE(req->wIndex);
-
+ ep_addr = LOBYTE(req->wIndex);
+
/* Check if it is a class request */
if ((req->bmRequest & 0x60) == 0x20)
{
pdev->pClass->Setup (pdev, req);
-
+
return USBD_OK;
}
-
- switch (req->bRequest)
+
+ switch (req->bRequest)
{
-
+
case USB_REQ_SET_FEATURE :
-
- switch (pdev->dev_state)
+
+ switch (pdev->dev_state)
{
- case USBD_STATE_ADDRESSED:
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
+ case USBD_STATE_ADDRESSED:
+ if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
USBD_LL_StallEP(pdev , ep_addr);
}
break;
-
- case USBD_STATE_CONFIGURED:
+
+ case USBD_STATE_CONFIGURED:
if (req->wValue == USB_FEATURE_EP_HALT)
{
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
- {
+ if ((ep_addr != 0x00) && (ep_addr != 0x80))
+ {
USBD_LL_StallEP(pdev , ep_addr);
-
+
}
}
- pdev->pClass->Setup (pdev, req);
+ pdev->pClass->Setup (pdev, req);
USBD_CtlSendStatus(pdev);
-
+
break;
-
- default:
+
+ default:
USBD_CtlError(pdev , req);
- break;
+ break;
}
break;
-
+
case USB_REQ_CLEAR_FEATURE :
-
- switch (pdev->dev_state)
+
+ switch (pdev->dev_state)
{
- case USBD_STATE_ADDRESSED:
- if ((ep_addr != 0x00) && (ep_addr != 0x80))
+ case USBD_STATE_ADDRESSED:
+ if ((ep_addr != 0x00) && (ep_addr != 0x80))
{
USBD_LL_StallEP(pdev , ep_addr);
}
break;
-
- case USBD_STATE_CONFIGURED:
+
+ case USBD_STATE_CONFIGURED:
if (req->wValue == USB_FEATURE_EP_HALT)
{
- if ((ep_addr & 0x7F) != 0x00)
- {
+ if ((ep_addr & 0x7F) != 0x00)
+ {
USBD_LL_ClearStallEP(pdev , ep_addr);
pdev->pClass->Setup (pdev, req);
}
USBD_CtlSendStatus(pdev);
}
break;
-
- default:
+
+ default:
USBD_CtlError(pdev , req);
- break;
+ break;
}
break;
-
- case USB_REQ_GET_STATUS:
- switch (pdev->dev_state)
+
+ case USB_REQ_GET_STATUS:
+ switch (pdev->dev_state)
{
- case USBD_STATE_ADDRESSED:
- if ((ep_addr & 0x7F) != 0x00)
+ case USBD_STATE_ADDRESSED:
+ if ((ep_addr & 0x7F) != 0x00)
{
USBD_LL_StallEP(pdev , ep_addr);
}
break;
-
+
case USBD_STATE_CONFIGURED:
pep = ((ep_addr & 0x80) == 0x80) ? &pdev->ep_in[ep_addr & 0x7F]:\
&pdev->ep_out[ep_addr & 0x7F];
if(USBD_LL_IsStallEP(pdev, ep_addr))
{
- pep->status = 0x0001;
+ pep->status = 0x0001;
}
else
{
- pep->status = 0x0000;
+ pep->status = 0x0000;
}
-
+
USBD_CtlSendData (pdev,
(uint8_t *)&pep->status,
2);
break;
-
- default:
+
+ default:
USBD_CtlError(pdev , req);
break;
}
break;
-
+
default:
break;
}
@@ -328,26 +328,26 @@ USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev , USBD_SetupReqTyped
* @param req: usb request
* @retval status
*/
-static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
+static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
uint16_t len;
uint8_t *pbuf;
-
-
+
+
switch (req->wValue >> 8)
- {
+ {
#if (USBD_LPM_ENABLED == 1)
case USB_DESC_TYPE_BOS:
pbuf = pdev->pDesc->GetBOSDescriptor(pdev->dev_speed, &len);
break;
-#endif
+#endif
case USB_DESC_TYPE_DEVICE:
pbuf = pdev->pDesc->GetDeviceDescriptor(pdev->dev_speed, &len);
break;
-
- case USB_DESC_TYPE_CONFIGURATION:
- if(pdev->dev_speed == USBD_SPEED_HIGH )
+
+ case USB_DESC_TYPE_CONFIGURATION:
+ if(pdev->dev_speed == USBD_SPEED_HIGH )
{
pbuf = (uint8_t *)pdev->pClass->GetHSConfigDescriptor(&len);
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
@@ -358,47 +358,47 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
pbuf[1] = USB_DESC_TYPE_CONFIGURATION;
}
break;
-
+
case USB_DESC_TYPE_STRING:
switch ((uint8_t)(req->wValue))
{
case USBD_IDX_LANGID_STR:
- pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len);
+ pbuf = pdev->pDesc->GetLangIDStrDescriptor(pdev->dev_speed, &len);
break;
-
+
case USBD_IDX_MFC_STR:
pbuf = pdev->pDesc->GetManufacturerStrDescriptor(pdev->dev_speed, &len);
break;
-
+
case USBD_IDX_PRODUCT_STR:
pbuf = pdev->pDesc->GetProductStrDescriptor(pdev->dev_speed, &len);
break;
-
+
case USBD_IDX_SERIAL_STR:
pbuf = pdev->pDesc->GetSerialStrDescriptor(pdev->dev_speed, &len);
break;
-
+
case USBD_IDX_CONFIG_STR:
pbuf = pdev->pDesc->GetConfigurationStrDescriptor(pdev->dev_speed, &len);
break;
-
+
case USBD_IDX_INTERFACE_STR:
pbuf = pdev->pDesc->GetInterfaceStrDescriptor(pdev->dev_speed, &len);
break;
-
+
default:
#if (USBD_SUPPORT_USER_STRING == 1)
pbuf = pdev->pClass->GetUsrStrDescriptor(pdev, (req->wValue) , &len);
break;
-#else
+#else
USBD_CtlError(pdev , req);
return;
-#endif
+#endif
}
break;
- case USB_DESC_TYPE_DEVICE_QUALIFIER:
+ case USB_DESC_TYPE_DEVICE_QUALIFIER:
- if(pdev->dev_speed == USBD_SPEED_HIGH )
+ if(pdev->dev_speed == USBD_SPEED_HIGH )
{
pbuf = (uint8_t *)pdev->pClass->GetDeviceQualifierDescriptor(&len);
break;
@@ -407,14 +407,14 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
{
USBD_CtlError(pdev , req);
return;
- }
+ }
case USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION:
- if(pdev->dev_speed == USBD_SPEED_HIGH )
+ if(pdev->dev_speed == USBD_SPEED_HIGH )
{
pbuf = (uint8_t *)pdev->pClass->GetOtherSpeedConfigDescriptor(&len);
pbuf[1] = USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION;
- break;
+ break;
}
else
{
@@ -422,21 +422,21 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
return;
}
- default:
+ default:
USBD_CtlError(pdev , req);
return;
}
-
+
if((len != 0)&& (req->wLength != 0))
{
-
+
len = MIN(len , req->wLength);
-
- USBD_CtlSendData (pdev,
+
+ USBD_CtlSendData (pdev,
pbuf,
len);
}
-
+
}
/**
@@ -446,39 +446,39 @@ static void USBD_GetDescriptor(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_SetAddress(USBD_HandleTypeDef *pdev ,
+static void USBD_SetAddress(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
- uint8_t dev_addr;
-
- if ((req->wIndex == 0) && (req->wLength == 0))
+ uint8_t dev_addr;
+
+ if ((req->wIndex == 0) && (req->wLength == 0))
{
- dev_addr = (uint8_t)(req->wValue) & 0x7F;
-
- if (pdev->dev_state == USBD_STATE_CONFIGURED)
+ dev_addr = (uint8_t)(req->wValue) & 0x7F;
+
+ if (pdev->dev_state == USBD_STATE_CONFIGURED)
{
USBD_CtlError(pdev , req);
- }
- else
+ }
+ else
{
pdev->dev_address = dev_addr;
- USBD_LL_SetUSBAddress(pdev, dev_addr);
- USBD_CtlSendStatus(pdev);
-
- if (dev_addr != 0)
+ USBD_LL_SetUSBAddress(pdev, dev_addr);
+ USBD_CtlSendStatus(pdev);
+
+ if (dev_addr != 0)
{
pdev->dev_state = USBD_STATE_ADDRESSED;
- }
- else
+ }
+ else
{
- pdev->dev_state = USBD_STATE_DEFAULT;
+ pdev->dev_state = USBD_STATE_DEFAULT;
}
}
- }
- else
+ }
+ else
{
- USBD_CtlError(pdev , req);
- }
+ USBD_CtlError(pdev , req);
+ }
}
/**
@@ -488,59 +488,59 @@ static void USBD_SetAddress(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
+static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
-
+
static uint8_t cfgidx;
-
- cfgidx = (uint8_t)(req->wValue);
-
- if (cfgidx > USBD_MAX_NUM_CONFIGURATION )
- {
- USBD_CtlError(pdev , req);
- }
- else
+
+ cfgidx = (uint8_t)(req->wValue);
+
+ if (cfgidx > USBD_MAX_NUM_CONFIGURATION )
+ {
+ USBD_CtlError(pdev , req);
+ }
+ else
{
- switch (pdev->dev_state)
+ switch (pdev->dev_state)
{
case USBD_STATE_ADDRESSED:
- if (cfgidx)
+ if (cfgidx)
{
pdev->dev_config = cfgidx;
pdev->dev_state = USBD_STATE_CONFIGURED;
if(USBD_SetClassConfig(pdev , cfgidx) == USBD_FAIL)
{
- USBD_CtlError(pdev , req);
+ USBD_CtlError(pdev , req);
return;
}
USBD_CtlSendStatus(pdev);
}
- else
+ else
{
USBD_CtlSendStatus(pdev);
}
break;
-
+
case USBD_STATE_CONFIGURED:
- if (cfgidx == 0)
- {
+ if (cfgidx == 0)
+ {
pdev->dev_state = USBD_STATE_ADDRESSED;
- pdev->dev_config = cfgidx;
+ pdev->dev_config = cfgidx;
USBD_ClrClassConfig(pdev , cfgidx);
USBD_CtlSendStatus(pdev);
-
- }
- else if (cfgidx != pdev->dev_config)
+
+ }
+ else if (cfgidx != pdev->dev_config)
{
/* Clear old configuration */
USBD_ClrClassConfig(pdev , pdev->dev_config);
-
+
/* set new configuration */
pdev->dev_config = cfgidx;
if(USBD_SetClassConfig(pdev , cfgidx) == USBD_FAIL)
{
- USBD_CtlError(pdev , req);
+ USBD_CtlError(pdev , req);
return;
}
USBD_CtlSendStatus(pdev);
@@ -550,9 +550,9 @@ static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
USBD_CtlSendStatus(pdev);
}
break;
-
+
default:
- USBD_CtlError(pdev , req);
+ USBD_CtlError(pdev , req);
break;
}
}
@@ -565,32 +565,32 @@ static void USBD_SetConfig(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_GetConfig(USBD_HandleTypeDef *pdev ,
+static void USBD_GetConfig(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
- if (req->wLength != 1)
- {
+ if (req->wLength != 1)
+ {
USBD_CtlError(pdev , req);
}
- else
+ else
{
- switch (pdev->dev_state )
+ switch (pdev->dev_state )
{
- case USBD_STATE_ADDRESSED:
+ case USBD_STATE_ADDRESSED:
pdev->dev_default_config = 0;
- USBD_CtlSendData (pdev,
+ USBD_CtlSendData (pdev,
(uint8_t *)&pdev->dev_default_config,
1);
break;
-
- case USBD_STATE_CONFIGURED:
-
- USBD_CtlSendData (pdev,
+
+ case USBD_STATE_CONFIGURED:
+
+ USBD_CtlSendData (pdev,
(uint8_t *)&pdev->dev_config,
1);
break;
-
+
default:
USBD_CtlError(pdev , req);
break;
@@ -605,34 +605,34 @@ static void USBD_GetConfig(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_GetStatus(USBD_HandleTypeDef *pdev ,
+static void USBD_GetStatus(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
-
-
- switch (pdev->dev_state)
+
+
+ switch (pdev->dev_state)
{
case USBD_STATE_ADDRESSED:
case USBD_STATE_CONFIGURED:
-
+
#if ( USBD_SELF_POWERED == 1)
- pdev->dev_config_status = USB_CONFIG_SELF_POWERED;
+ pdev->dev_config_status = USB_CONFIG_SELF_POWERED;
#else
- pdev->dev_config_status = 0;
+ pdev->dev_config_status = 0;
#endif
-
- if (pdev->dev_remote_wakeup)
+
+ if (pdev->dev_remote_wakeup)
{
- pdev->dev_config_status |= USB_CONFIG_REMOTE_WAKEUP;
+ pdev->dev_config_status |= USB_CONFIG_REMOTE_WAKEUP;
}
-
- USBD_CtlSendData (pdev,
+
+ USBD_CtlSendData (pdev,
(uint8_t *)& pdev->dev_config_status,
2);
break;
-
+
default :
- USBD_CtlError(pdev , req);
+ USBD_CtlError(pdev , req);
break;
}
}
@@ -645,14 +645,14 @@ static void USBD_GetStatus(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_SetFeature(USBD_HandleTypeDef *pdev ,
+static void USBD_SetFeature(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
{
- pdev->dev_remote_wakeup = 1;
- pdev->pClass->Setup (pdev, req);
+ pdev->dev_remote_wakeup = 1;
+ pdev->pClass->Setup (pdev, req);
USBD_CtlSendStatus(pdev);
}
@@ -666,21 +666,21 @@ static void USBD_SetFeature(USBD_HandleTypeDef *pdev ,
* @param req: usb request
* @retval status
*/
-static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
+static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
USBD_SetupReqTypedef *req)
{
switch (pdev->dev_state)
{
case USBD_STATE_ADDRESSED:
case USBD_STATE_CONFIGURED:
- if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
+ if (req->wValue == USB_FEATURE_REMOTE_WAKEUP)
{
- pdev->dev_remote_wakeup = 0;
- pdev->pClass->Setup (pdev, req);
+ pdev->dev_remote_wakeup = 0;
+ pdev->pClass->Setup (pdev, req);
USBD_CtlSendStatus(pdev);
}
break;
-
+
default :
USBD_CtlError(pdev , req);
break;
@@ -688,7 +688,7 @@ static void USBD_ClrFeature(USBD_HandleTypeDef *pdev ,
}
/**
-* @brief USBD_ParseSetupRequest
+* @brief USBD_ParseSetupRequest
* Copy buffer into setup structure
* @param pdev: device instance
* @param req: usb request
@@ -706,7 +706,7 @@ void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata)
}
/**
-* @brief USBD_CtlError
+* @brief USBD_CtlError
* Handle USB low level Error
* @param pdev: device instance
* @param req: usb request
@@ -732,19 +732,19 @@ void USBD_CtlError( USBD_HandleTypeDef *pdev ,
void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len)
{
uint8_t idx = 0;
-
- if (desc != NULL)
+
+ if (desc != NULL)
{
- *len = USBD_GetLen(desc) * 2 + 2;
+ *len = USBD_GetLen(desc) * 2 + 2;
unicode[idx++] = *len;
unicode[idx++] = USB_DESC_TYPE_STRING;
-
- while (*desc != '\0')
+
+ while (*desc != '\0')
{
unicode[idx++] = *desc++;
unicode[idx++] = 0x00;
}
- }
+ }
}
/**
@@ -757,7 +757,7 @@ static uint8_t USBD_GetLen(uint8_t *buf)
{
uint8_t len = 0;
- while (*buf != '\0')
+ while (*buf != '\0')
{
len++;
buf++;
@@ -767,16 +767,16 @@ static uint8_t USBD_GetLen(uint8_t *buf)
}
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/**
* @}
- */
+ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/