Damian Gabino / picoGW_mcu
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usbd_conf.cpp Source File

usbd_conf.cpp

00001  /**
00002   ******************************************************************************
00003   * @file           : usbd_conf.c
00004   * @version        : v1.0_Cube
00005   * @brief          : This file implements the board support package for the USB device library
00006   ******************************************************************************
00007   *
00008   * COPYRIGHT(c) 2016 STMicroelectronics
00009   *
00010   * Redistribution and use in source and binary forms, with or without modification,
00011   * are permitted provided that the following conditions are met:
00012   * 1. Redistributions of source code must retain the above copyright notice,
00013   * this list of conditions and the following disclaimer.
00014   * 2. Redistributions in binary form must reproduce the above copyright notice,
00015   * this list of conditions and the following disclaimer in the documentation
00016   * and/or other materials provided with the distribution.
00017   * 3. Neither the name of STMicroelectronics nor the names of its contributors
00018   * may be used to endorse or promote products derived from this software
00019   * without specific prior written permission.
00020   *
00021   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00022   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00023   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00025   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00026   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00027   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00028   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00030   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031   *
00032   ******************************************************************************
00033 */
00034 /* Includes ------------------------------------------------------------------*/
00035 #include "stm32f4xx.h"
00036 #include "stm32f4xx_hal.h"
00037 #include "usbd_def.h"
00038 #include "usbd_core.h"
00039 #include "mbed.h"
00040 
00041 PCD_HandleTypeDef hpcd_USB_OTG_FS;
00042 void Error_Handler(void);
00043 
00044 /* External functions --------------------------------------------------------*/
00045 void SystemClock_Config(void);
00046 
00047 /* USER CODE BEGIN 0 */
00048 /* USER CODE END 0 */
00049 
00050 /* Private function prototypes -----------------------------------------------*/
00051 /* Private functions ---------------------------------------------------------*/
00052 /* USER CODE BEGIN 1 */
00053 /* USER CODE END 1 */
00054 
00055 /*******************************************************************************
00056                        LL Driver Callbacks (PCD -> USB Device Library)
00057 *******************************************************************************/
00058 /* MSP Init */
00059 
00060 #include "CmdUSB.h"
00061 
00062 void HAL_PCD_MspInit(PCD_HandleTypeDef* pcdHandle)
00063 {
00064   GPIO_InitTypeDef GPIO_InitStruct;
00065   if(pcdHandle->Instance==USB_OTG_FS)
00066   {
00067   /* USER CODE BEGIN USB_OTG_FS_MspInit 0 */
00068 
00069   /* USER CODE END USB_OTG_FS_MspInit 0 */
00070   
00071     /**USB_OTG_FS GPIO Configuration    
00072     PA11     ------> USB_OTG_FS_DM
00073     PA12     ------> USB_OTG_FS_DP 
00074     */
00075     GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
00076     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
00077     GPIO_InitStruct.Pull = GPIO_NOPULL;
00078     GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
00079     GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
00080     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
00081 
00082     /* Peripheral clock enable */
00083     __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
00084 
00085     /* Peripheral interrupt init */
00086     HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0);
00087     HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
00088   /* USER CODE BEGIN USB_OTG_FS_MspInit 1 */
00089 
00090   /* USER CODE END USB_OTG_FS_MspInit 1 */
00091   }
00092 }
00093 
00094 void HAL_PCD_MspDeInit(PCD_HandleTypeDef* pcdHandle)
00095 {
00096   if(pcdHandle->Instance==USB_OTG_FS)
00097   {
00098   /* USER CODE BEGIN USB_OTG_FS_MspDeInit 0 */
00099 
00100   /* USER CODE END USB_OTG_FS_MspDeInit 0 */
00101     /* Peripheral clock disable */
00102     __HAL_RCC_USB_OTG_FS_CLK_DISABLE();
00103   
00104     /**USB_OTG_FS GPIO Configuration    
00105     PA11     ------> USB_OTG_FS_DM
00106     PA12     ------> USB_OTG_FS_DP 
00107     */
00108     HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
00109 
00110     /* Peripheral interrupt Deinit*/
00111     HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
00112 
00113   /* USER CODE BEGIN USB_OTG_FS_MspDeInit 1 */
00114 
00115   /* USER CODE END USB_OTG_FS_MspDeInit 1 */
00116   }
00117 }
00118 
00119 /**
00120   * @brief  Setup stage callback
00121   * @param  hpcd: PCD handle
00122   * @retval None
00123   */
00124 void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
00125 {
00126   USBD_LL_SetupStage((USBD_HandleTypeDef *)hpcd->pData, (uint8_t *)hpcd->Setup);
00127 }
00128 
00129 /**
00130   * @brief  Data Out stage callback.
00131   * @param  hpcd: PCD handle
00132   * @param  epnum: Endpoint Number
00133   * @retval None
00134   */
00135 void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
00136 {
00137   int i;
00138   int size = 0;
00139   static int count = 0;
00140   static int firsttime = 1;
00141 
00142   __disable_irq(); // Disable Interrupts
00143   if (epnum == 1)
00144   {
00145     for (i = 0; i < 64; i++) //64 transfer length hardcode but faster in it
00146     {
00147       CmdManager.BufFromHost[i+64*count] = CmdManager.BufFromHostChunk[i];
00148     }
00149     size = (CmdManager.BufFromHost[1]<<8) + CmdManager.BufFromHost[2] + CMD_HEADER_RX_SIZE;
00150     if ((firsttime==1) && (CmdManager.CheckCmd(CmdManager.BufFromHost[0]) == true))
00151     {
00152       firsttime = 0;
00153       if (size > 64)
00154       {
00155         CmdManager.count = ((size-1)>>6) + 1;
00156       }
00157     }
00158     count++;
00159     CmdManager.count--;
00160     if (CmdManager.count == 0)
00161     {
00162       count = 0;
00163       firsttime=1;
00164     }
00165   }
00166   USBD_LL_DataOutStage((USBD_HandleTypeDef *)hpcd->pData, epnum, hpcd->OUT_ep[epnum].xfer_buff);
00167   __enable_irq();  // Disable Interrupts
00168 }
00169 
00170 /**
00171   * @brief  Data In stage callback..
00172   * @param  hpcd: PCD handle
00173   * @param  epnum: Endpoint Number
00174   * @retval None
00175   */
00176 void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
00177 {
00178   USBD_LL_DataInStage((USBD_HandleTypeDef *)hpcd->pData, epnum, hpcd->IN_ep[epnum].xfer_buff);
00179 }
00180 
00181 /**
00182   * @brief  SOF callback.
00183   * @param  hpcd: PCD handle
00184   * @retval None
00185   */
00186 void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
00187 {
00188   USBD_LL_SOF((USBD_HandleTypeDef *)hpcd->pData);
00189 }
00190 
00191 /**
00192   * @brief  Reset callback.
00193   * @param  hpcd: PCD handle
00194   * @retval None
00195   */
00196 void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
00197 { 
00198   USBD_SpeedTypeDef speed = USBD_SPEED_FULL;
00199 
00200   /*Set USB Current Speed*/
00201   switch (hpcd->Init.speed)
00202   {
00203   case PCD_SPEED_HIGH:
00204     speed = USBD_SPEED_HIGH;
00205     break;
00206   case PCD_SPEED_FULL:
00207     speed = USBD_SPEED_FULL;    
00208     break;
00209     
00210   default:
00211     speed = USBD_SPEED_FULL;    
00212     break;    
00213   }
00214   USBD_LL_SetSpeed((USBD_HandleTypeDef *)hpcd->pData, speed);  
00215   
00216   /*Reset Device*/
00217   USBD_LL_Reset((USBD_HandleTypeDef *)hpcd->pData);
00218 }
00219 
00220 /**
00221   * @brief  Suspend callback.
00222   * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
00223   * @param  hpcd: PCD handle
00224   * @retval None
00225   */
00226 void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
00227 {  
00228    /* Inform USB library that core enters in suspend Mode */
00229   USBD_LL_Suspend((USBD_HandleTypeDef *)hpcd->pData);
00230   __HAL_PCD_GATE_PHYCLOCK(hpcd);
00231   /*Enter in STOP mode */
00232   /* USER CODE BEGIN 2 */
00233   if (hpcd->Init.low_power_enable)
00234   {
00235     /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
00236     SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
00237   }
00238   /* USER CODE END 2 */
00239 }
00240 
00241 /**
00242   * @brief  Resume callback.
00243     When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
00244   * @param  hpcd: PCD handle
00245   * @retval None
00246   */
00247 void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
00248 {
00249   /* USER CODE BEGIN 3 */
00250   /* USER CODE END 3 */
00251   USBD_LL_Resume((USBD_HandleTypeDef *)hpcd->pData);
00252 }
00253 
00254 /**
00255   * @brief  ISOC Out Incomplete callback.
00256   * @param  hpcd: PCD handle
00257   * @param  epnum: Endpoint Number
00258   * @retval None
00259   */
00260 void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
00261 {
00262   USBD_LL_IsoOUTIncomplete((USBD_HandleTypeDef *)hpcd->pData, epnum);
00263 }
00264 
00265 /**
00266   * @brief  ISOC In Incomplete callback.
00267   * @param  hpcd: PCD handle
00268   * @param  epnum: Endpoint Number
00269   * @retval None
00270   */
00271 void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
00272 {
00273   USBD_LL_IsoINIncomplete((USBD_HandleTypeDef *)hpcd->pData, epnum);
00274 }
00275 
00276 /**
00277   * @brief  Connect callback.
00278   * @param  hpcd: PCD handle
00279   * @retval None
00280   */
00281 void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
00282 {
00283   USBD_LL_DevConnected((USBD_HandleTypeDef *)hpcd->pData);
00284 }
00285 
00286 /**
00287   * @brief  Disconnect callback.
00288   * @param  hpcd: PCD handle
00289   * @retval None
00290   */
00291 void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
00292 {
00293   USBD_LL_DevDisconnected((USBD_HandleTypeDef *)hpcd->pData);
00294 }
00295 
00296 /*******************************************************************************
00297                        LL Driver Interface (USB Device Library --> PCD)
00298 *******************************************************************************/
00299 /**
00300   * @brief  Initializes the Low Level portion of the Device driver.
00301   * @param  pdev: Device handle
00302   * @retval USBD Status
00303   */
00304 USBD_StatusTypeDef  USBD_LL_Init (USBD_HandleTypeDef *pdev)
00305 { 
00306   /* Init USB_IP */
00307   if (pdev->id == DEVICE_FS) {
00308   /* Link The driver to the stack */    
00309   hpcd_USB_OTG_FS.pData = pdev;
00310   pdev->pData = &hpcd_USB_OTG_FS; 
00311   
00312   hpcd_USB_OTG_FS.Instance = USB_OTG_FS;
00313   hpcd_USB_OTG_FS.Init.dev_endpoints = 4;
00314   hpcd_USB_OTG_FS.Init.speed = PCD_SPEED_FULL;
00315   hpcd_USB_OTG_FS.Init.dma_enable = DISABLE;
00316   hpcd_USB_OTG_FS.Init.ep0_mps = DEP0CTL_MPS_64;
00317   hpcd_USB_OTG_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
00318   hpcd_USB_OTG_FS.Init.Sof_enable = DISABLE;
00319   hpcd_USB_OTG_FS.Init.low_power_enable = DISABLE;
00320   hpcd_USB_OTG_FS.Init.lpm_enable = DISABLE;
00321   hpcd_USB_OTG_FS.Init.vbus_sensing_enable = DISABLE;
00322   hpcd_USB_OTG_FS.Init.use_dedicated_ep1 = DISABLE;
00323   if (HAL_PCD_Init(&hpcd_USB_OTG_FS) != HAL_OK)
00324   {
00325     Error_Handler();
00326   }
00327 
00328   HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
00329   HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
00330   HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);
00331   }
00332   return USBD_OK;
00333 }
00334 
00335 /**
00336   * @brief  De-Initializes the Low Level portion of the Device driver.
00337   * @param  pdev: Device handle
00338   * @retval USBD Status
00339   */
00340 USBD_StatusTypeDef  USBD_LL_DeInit (USBD_HandleTypeDef *pdev)
00341 {
00342   HAL_PCD_DeInit((PCD_HandleTypeDef *)pdev->pData);
00343   return USBD_OK; 
00344 }
00345 
00346 /**
00347   * @brief  Starts the Low Level portion of the Device driver. 
00348   * @param  pdev: Device handle
00349   * @retval USBD Status
00350   */
00351 USBD_StatusTypeDef  USBD_LL_Start(USBD_HandleTypeDef *pdev)
00352 {
00353   HAL_PCD_Start((PCD_HandleTypeDef *)pdev->pData);
00354   return USBD_OK; 
00355 }
00356 
00357 /**
00358   * @brief  Stops the Low Level portion of the Device driver.
00359   * @param  pdev: Device handle
00360   * @retval USBD Status
00361   */
00362 USBD_StatusTypeDef  USBD_LL_Stop (USBD_HandleTypeDef *pdev)
00363 {
00364   HAL_PCD_Stop((PCD_HandleTypeDef *)pdev->pData);
00365   return USBD_OK; 
00366 }
00367 
00368 /**
00369   * @brief  Opens an endpoint of the Low Level Driver.
00370   * @param  pdev: Device handle
00371   * @param  ep_addr: Endpoint Number
00372   * @param  ep_type: Endpoint Type
00373   * @param  ep_mps: Endpoint Max Packet Size                 
00374   * @retval USBD Status
00375   */
00376 USBD_StatusTypeDef  USBD_LL_OpenEP  (USBD_HandleTypeDef *pdev, 
00377                                       uint8_t  ep_addr,                                      
00378                                       uint8_t  ep_type,
00379                                       uint16_t ep_mps)
00380 {
00381 
00382   HAL_PCD_EP_Open((PCD_HandleTypeDef *)pdev->pData, 
00383                   ep_addr, 
00384                   ep_mps, 
00385                   ep_type);
00386   
00387   return USBD_OK; 
00388 }
00389 
00390 /**
00391   * @brief  Closes an endpoint of the Low Level Driver.
00392   * @param  pdev: Device handle
00393   * @param  ep_addr: Endpoint Number
00394   * @retval USBD Status
00395   */
00396 USBD_StatusTypeDef  USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)   
00397 {
00398   
00399   HAL_PCD_EP_Close((PCD_HandleTypeDef *)pdev->pData, ep_addr);
00400   return USBD_OK; 
00401 }
00402 
00403 /**
00404   * @brief  Flushes an endpoint of the Low Level Driver.
00405   * @param  pdev: Device handle
00406   * @param  ep_addr: Endpoint Number
00407   * @retval USBD Status
00408   */
00409 USBD_StatusTypeDef  USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)   
00410 {
00411   
00412   HAL_PCD_EP_Flush((PCD_HandleTypeDef *)pdev->pData, ep_addr);
00413   return USBD_OK; 
00414 }
00415 
00416 /**
00417   * @brief  Sets a Stall condition on an endpoint of the Low Level Driver.
00418   * @param  pdev: Device handle
00419   * @param  ep_addr: Endpoint Number
00420   * @retval USBD Status
00421   */
00422 USBD_StatusTypeDef  USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)   
00423 {
00424   
00425   HAL_PCD_EP_SetStall((PCD_HandleTypeDef *)pdev->pData, ep_addr);
00426   return USBD_OK; 
00427 }
00428 
00429 /**
00430   * @brief  Clears a Stall condition on an endpoint of the Low Level Driver.
00431   * @param  pdev: Device handle
00432   * @param  ep_addr: Endpoint Number
00433   * @retval USBD Status
00434   */
00435 USBD_StatusTypeDef  USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)   
00436 {
00437   
00438   HAL_PCD_EP_ClrStall((PCD_HandleTypeDef *)pdev->pData, ep_addr);  
00439   return USBD_OK; 
00440 }
00441 
00442 /**
00443   * @brief  Returns Stall condition.
00444   * @param  pdev: Device handle
00445   * @param  ep_addr: Endpoint Number
00446   * @retval Stall (1: Yes, 0: No)
00447   */
00448 uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)   
00449 {
00450   PCD_HandleTypeDef *hpcd = (PCD_HandleTypeDef *)pdev->pData; 
00451   
00452   if((ep_addr & 0x80) == 0x80)
00453   {
00454     return hpcd->IN_ep[ep_addr & 0x7F].is_stall; 
00455   }
00456   else
00457   {
00458     return hpcd->OUT_ep[ep_addr & 0x7F].is_stall; 
00459   }
00460 }
00461 /**
00462   * @brief  Assigns a USB address to the device.
00463   * @param  pdev: Device handle
00464   * @param  ep_addr: Endpoint Number
00465   * @retval USBD Status
00466   */
00467 USBD_StatusTypeDef  USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr)   
00468 {
00469   
00470   HAL_PCD_SetAddress((PCD_HandleTypeDef *)pdev->pData, dev_addr);
00471   return USBD_OK; 
00472 }
00473 
00474 /**
00475   * @brief  Transmits data over an endpoint.
00476   * @param  pdev: Device handle
00477   * @param  ep_addr: Endpoint Number
00478   * @param  pbuf: Pointer to data to be sent
00479   * @param  size: Data size    
00480   * @retval USBD Status
00481   */
00482 USBD_StatusTypeDef  USBD_LL_Transmit (USBD_HandleTypeDef *pdev, 
00483                                       uint8_t  ep_addr,                                      
00484                                       uint8_t  *pbuf,
00485                                       uint16_t  size)
00486 {
00487 
00488   HAL_PCD_EP_Transmit((PCD_HandleTypeDef *)pdev->pData, ep_addr, pbuf, size);
00489   return USBD_OK;   
00490 }
00491 
00492 /**
00493   * @brief  Prepares an endpoint for reception.
00494   * @param  pdev: Device handle
00495   * @param  ep_addr: Endpoint Number
00496   * @param  pbuf: Pointer to data to be received
00497   * @param  size: Data size
00498   * @retval USBD Status
00499   */
00500 USBD_StatusTypeDef  USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, 
00501                                            uint8_t  ep_addr,                                      
00502                                            uint8_t  *pbuf,
00503                                            uint16_t  size)
00504 {
00505 
00506   HAL_PCD_EP_Receive((PCD_HandleTypeDef *)pdev->pData, ep_addr, pbuf, size);
00507  
00508   return USBD_OK;   
00509 }
00510 
00511 /**
00512   * @brief  Returns the last transfered packet size.
00513   * @param  pdev: Device handle
00514   * @param  ep_addr: Endpoint Number
00515   * @retval Recived Data Size
00516   */
00517 uint32_t USBD_LL_GetRxDataSize  (USBD_HandleTypeDef *pdev, uint8_t  ep_addr)  
00518 {
00519   return HAL_PCD_EP_GetRxCount((PCD_HandleTypeDef *)pdev->pData, ep_addr);
00520   //return ((pdev.pData.OUT_ep[ep_addr & 0x7F].xfer_count));
00521 }
00522 
00523 #if (USBD_LPM_ENABLED == 1)
00524 /**
00525   * @brief  HAL_PCDEx_LPM_Callback : Send LPM message to user layer
00526   * @param  hpcd: PCD handle
00527   * @param  msg: LPM message
00528   * @retval HAL status
00529   */
00530 void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
00531 {
00532   switch ( msg)
00533   {
00534   case PCD_LPM_L0_ACTIVE:
00535     if (hpcd->Init.low_power_enable)
00536     {
00537       SystemClock_Config();
00538       
00539       /* Reset SLEEPDEEP bit of Cortex System Control Register */
00540       SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
00541     }
00542     __HAL_PCD_UNGATE_PHYCLOCK(hpcd);
00543     USBD_LL_Resume(hpcd->pData);    
00544     break;
00545     
00546   case PCD_LPM_L1_ACTIVE:
00547     __HAL_PCD_GATE_PHYCLOCK(hpcd);
00548     USBD_LL_Suspend(hpcd->pData);
00549     
00550     /*Enter in STOP mode */
00551     if (hpcd->Init.low_power_enable)
00552     {   
00553       /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
00554       SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
00555     }     
00556     break;   
00557   }
00558 }
00559 #endif
00560 /**
00561   * @brief  Delays routine for the USB Device Library.
00562   * @param  Delay: Delay in ms
00563   * @retval None
00564   */
00565 void  USBD_LL_Delay (uint32_t Delay)
00566 {
00567   HAL_Delay(Delay);  
00568 }
00569 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/