]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube/ST_Code/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c
Add MPU projects for STM32L475 Discovery Kit IoT Node
[freertos] / FreeRTOS / Demo / CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube / ST_Code / Drivers / STM32L4xx_HAL_Driver / Src / stm32l4xx_hal_pcd_ex.c
diff --git a/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube/ST_Code/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c b/FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube/ST_Code/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c
new file mode 100644 (file)
index 0000000..b4a4842
--- /dev/null
@@ -0,0 +1,566 @@
+/**\r
+  ******************************************************************************\r
+  * @file    stm32l4xx_hal_pcd_ex.c\r
+  * @author  MCD Application Team\r
+  * @brief   PCD Extended HAL module driver.\r
+  *          This file provides firmware functions to manage the following\r
+  *          functionalities of the USB Peripheral Controller:\r
+  *           + Extended features functions\r
+  *\r
+  ******************************************************************************\r
+  * @attention\r
+  *\r
+  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.\r
+  * All rights reserved.</center></h2>\r
+  *\r
+  * This software component is licensed by ST under BSD 3-Clause license,\r
+  * the "License"; You may not use this file except in compliance with the\r
+  * License. You may obtain a copy of the License at:\r
+  *                        opensource.org/licenses/BSD-3-Clause\r
+  *\r
+  ******************************************************************************\r
+  */\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32l4xx_hal.h"\r
+\r
+/** @addtogroup STM32L4xx_HAL_Driver\r
+  * @{\r
+  */\r
+\r
+/** @defgroup PCDEx PCDEx\r
+  * @brief PCD Extended HAL module driver\r
+  * @{\r
+  */\r
+\r
+#ifdef HAL_PCD_MODULE_ENABLED\r
+\r
+#if defined (USB) || defined (USB_OTG_FS)\r
+/* Private types -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private constants ---------------------------------------------------------*/\r
+/* Private macros ------------------------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+/* Exported functions --------------------------------------------------------*/\r
+\r
+/** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions\r
+  * @{\r
+  */\r
+\r
+/** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions\r
+  * @brief    PCDEx control functions\r
+ *\r
+@verbatim\r
+ ===============================================================================\r
+                 ##### Extended features functions #####\r
+ ===============================================================================\r
+    [..]  This section provides functions allowing to:\r
+      (+) Update FIFO configuration\r
+\r
+@endverbatim\r
+  * @{\r
+  */\r
+#if defined (USB_OTG_FS)\r
+/**\r
+  * @brief  Set Tx FIFO\r
+  * @param  hpcd PCD handle\r
+  * @param  fifo The number of Tx fifo\r
+  * @param  size Fifo size\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)\r
+{\r
+  uint8_t i;\r
+  uint32_t Tx_Offset;\r
+\r
+  /*  TXn min size = 16 words. (n  : Transmit FIFO index)\r
+      When a TxFIFO is not used, the Configuration should be as follows:\r
+          case 1 :  n > m    and Txn is not used    (n,m  : Transmit FIFO indexes)\r
+         --> Txm can use the space allocated for Txn.\r
+         case2  :  n < m    and Txn is not used    (n,m  : Transmit FIFO indexes)\r
+         --> Txn should be configured with the minimum space of 16 words\r
+     The FIFO is used optimally when used TxFIFOs are allocated in the top\r
+         of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.\r
+     When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */\r
+\r
+  Tx_Offset = hpcd->Instance->GRXFSIZ;\r
+\r
+  if (fifo == 0U)\r
+  {\r
+    hpcd->Instance->DIEPTXF0_HNPTXFSIZ = ((uint32_t)size << 16) | Tx_Offset;\r
+  }\r
+  else\r
+  {\r
+    Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;\r
+    for (i = 0U; i < (fifo - 1U); i++)\r
+    {\r
+      Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);\r
+    }\r
+\r
+    /* Multiply Tx_Size by 2 to get higher performance */\r
+    hpcd->Instance->DIEPTXF[fifo - 1U] = ((uint32_t)size << 16) | Tx_Offset;\r
+  }\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Set Rx FIFO\r
+  * @param  hpcd PCD handle\r
+  * @param  size Size of Rx fifo\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)\r
+{\r
+  hpcd->Instance->GRXFSIZ = size;\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Activate LPM feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
+\r
+  hpcd->lpm_active = 1U;\r
+  hpcd->LPM_State = LPM_L0;\r
+  USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM;\r
+  USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Deactivate LPM feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
+\r
+  hpcd->lpm_active = 0U;\r
+  USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM;\r
+  USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+\r
+/**\r
+  * @brief  Handle BatteryCharging Process.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
+  uint32_t tickstart = HAL_GetTick();\r
+\r
+  /* Enable DCD : Data Contact Detect */\r
+  USBx->GCCFG |= USB_OTG_GCCFG_DCDEN;\r
+\r
+  /* Wait Detect flag or a timeout is happen*/\r
+  while ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == 0U)\r
+  {\r
+    /* Check for the Timeout */\r
+    if ((HAL_GetTick() - tickstart) > 1000U)\r
+    {\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+\r
+      return;\r
+    }\r
+  }\r
+\r
+  /* Right response got */\r
+  HAL_Delay(200U);\r
+\r
+  /* Check Detect flag*/\r
+  if ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == USB_OTG_GCCFG_DCDET)\r
+  {\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+    hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
+#else\r
+    HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+  }\r
+\r
+  /*Primary detection: checks if connected to Standard Downstream Port\r
+  (without charging capability) */\r
+  USBx->GCCFG &= ~ USB_OTG_GCCFG_DCDEN;\r
+  HAL_Delay(50U);\r
+  USBx->GCCFG |=  USB_OTG_GCCFG_PDEN;\r
+  HAL_Delay(50U);\r
+\r
+  if ((USBx->GCCFG & USB_OTG_GCCFG_PDET) == 0U)\r
+  {\r
+    /* Case of Standard Downstream Port */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+    hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
+#else\r
+    HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+  }\r
+  else\r
+  {\r
+    /* start secondary detection to check connection to Charging Downstream\r
+    Port or Dedicated Charging Port */\r
+    USBx->GCCFG &= ~ USB_OTG_GCCFG_PDEN;\r
+    HAL_Delay(50U);\r
+    USBx->GCCFG |=  USB_OTG_GCCFG_SDEN;\r
+    HAL_Delay(50U);\r
+\r
+    if ((USBx->GCCFG & USB_OTG_GCCFG_SDET) == USB_OTG_GCCFG_SDET)\r
+    {\r
+      /* case Dedicated Charging Port  */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+    }\r
+    else\r
+    {\r
+      /* case Charging Downstream Port  */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+    }\r
+  }\r
+\r
+  /* Battery Charging capability discovery finished */\r
+  (void)HAL_PCDEx_DeActivateBCD(hpcd);\r
+\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+  hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
+#else\r
+  HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+}\r
+\r
+/**\r
+  * @brief  Activate BatteryCharging feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
+\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);\r
+\r
+  /* Power Down USB tranceiver  */\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);\r
+\r
+  /* Enable Battery charging */\r
+  USBx->GCCFG |= USB_OTG_GCCFG_BCDEN;\r
+\r
+  hpcd->battery_charging_active = 1U;\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Deactivate BatteryCharging feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
+\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);\r
+\r
+  /* Disable Battery charging */\r
+  USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN);\r
+\r
+  hpcd->battery_charging_active = 0U;\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+#endif /* defined (USB_OTG_FS) */\r
+#if defined (USB)\r
+/**\r
+  * @brief  Configure PMA for EP\r
+  * @param  hpcd  Device instance\r
+  * @param  ep_addr endpoint address\r
+  * @param  ep_kind endpoint Kind\r
+  *                  USB_SNG_BUF: Single Buffer used\r
+  *                  USB_DBL_BUF: Double Buffer used\r
+  * @param  pmaadress: EP address in The PMA: In case of single buffer endpoint\r
+  *                   this parameter is 16-bit value providing the address\r
+  *                   in PMA allocated to endpoint.\r
+  *                   In case of double buffer endpoint this parameter\r
+  *                   is a 32-bit value providing the endpoint buffer 0 address\r
+  *                   in the LSB part of 32-bit value and endpoint buffer 1 address\r
+  *                   in the MSB part of 32-bit value.\r
+  * @retval HAL status\r
+  */\r
+\r
+HAL_StatusTypeDef  HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,\r
+                                       uint16_t ep_addr,\r
+                                       uint16_t ep_kind,\r
+                                       uint32_t pmaadress)\r
+{\r
+  PCD_EPTypeDef *ep;\r
+\r
+  /* initialize ep structure*/\r
+  if ((0x80U & ep_addr) == 0x80U)\r
+  {\r
+    ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];\r
+  }\r
+  else\r
+  {\r
+    ep = &hpcd->OUT_ep[ep_addr];\r
+  }\r
+\r
+  /* Here we check if the endpoint is single or double Buffer*/\r
+  if (ep_kind == PCD_SNG_BUF)\r
+  {\r
+    /* Single Buffer */\r
+    ep->doublebuffer = 0U;\r
+    /* Configure the PMA */\r
+    ep->pmaadress = (uint16_t)pmaadress;\r
+  }\r
+  else /* USB_DBL_BUF */\r
+  {\r
+    /* Double Buffer Endpoint */\r
+    ep->doublebuffer = 1U;\r
+    /* Configure the PMA */\r
+    ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU);\r
+    ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16);\r
+  }\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Activate BatteryCharging feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_TypeDef *USBx = hpcd->Instance;\r
+  hpcd->battery_charging_active = 1U;\r
+\r
+  /* Enable DCD : Data Contact Detect */\r
+  USBx->BCDR &= ~(USB_BCDR_PDEN);\r
+  USBx->BCDR &= ~(USB_BCDR_SDEN);\r
+  USBx->BCDR |= USB_BCDR_DCDEN;\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Deactivate BatteryCharging feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_TypeDef *USBx = hpcd->Instance;\r
+  hpcd->battery_charging_active = 0U;\r
+\r
+  USBx->BCDR &= ~(USB_BCDR_BCDEN);\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Handle BatteryCharging Process.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_TypeDef *USBx = hpcd->Instance;\r
+  uint32_t tickstart = HAL_GetTick();\r
+\r
+  /* Wait Detect flag or a timeout is happen*/\r
+  while ((USBx->BCDR & USB_BCDR_DCDET) == 0U)\r
+  {\r
+    /* Check for the Timeout */\r
+    if ((HAL_GetTick() - tickstart) > 1000U)\r
+    {\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+\r
+      return;\r
+    }\r
+  }\r
+\r
+  HAL_Delay(200U);\r
+\r
+  /* Data Pin Contact ? Check Detect flag */\r
+  if ((USBx->BCDR & USB_BCDR_DCDET) == USB_BCDR_DCDET)\r
+  {\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+    hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
+#else\r
+    HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+  }\r
+  /* Primary detection: checks if connected to Standard Downstream Port\r
+  (without charging capability) */\r
+  USBx->BCDR &= ~(USB_BCDR_DCDEN);\r
+  HAL_Delay(50U);\r
+  USBx->BCDR |= (USB_BCDR_PDEN);\r
+  HAL_Delay(50U);\r
+\r
+  /* If Charger detect ? */\r
+  if ((USBx->BCDR & USB_BCDR_PDET) == USB_BCDR_PDET)\r
+  {\r
+    /* Start secondary detection to check connection to Charging Downstream\r
+    Port or Dedicated Charging Port */\r
+    USBx->BCDR &= ~(USB_BCDR_PDEN);\r
+    HAL_Delay(50U);\r
+    USBx->BCDR |= (USB_BCDR_SDEN);\r
+    HAL_Delay(50U);\r
+\r
+    /* If CDP ? */\r
+    if ((USBx->BCDR & USB_BCDR_SDET) == USB_BCDR_SDET)\r
+    {\r
+      /* Dedicated Downstream Port DCP */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+    }\r
+    else\r
+    {\r
+      /* Charging Downstream Port CDP */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+      hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
+#else\r
+      HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+    }\r
+  }\r
+  else /* NO */\r
+  {\r
+    /* Standard Downstream Port */\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+    hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
+#else\r
+    HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+  }\r
+\r
+  /* Battery Charging capability discovery finished Start Enumeration */\r
+  (void)HAL_PCDEx_DeActivateBCD(hpcd);\r
+#if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
+  hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
+#else\r
+  HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
+#endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
+}\r
+\r
+\r
+/**\r
+  * @brief  Activate LPM feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)\r
+{\r
+\r
+  USB_TypeDef *USBx = hpcd->Instance;\r
+  hpcd->lpm_active = 1U;\r
+  hpcd->LPM_State = LPM_L0;\r
+\r
+  USBx->LPMCSR |= USB_LPMCSR_LMPEN;\r
+  USBx->LPMCSR |= USB_LPMCSR_LPMACK;\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+/**\r
+  * @brief  Deactivate LPM feature.\r
+  * @param  hpcd PCD handle\r
+  * @retval HAL status\r
+  */\r
+HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)\r
+{\r
+  USB_TypeDef *USBx = hpcd->Instance;\r
+\r
+  hpcd->lpm_active = 0U;\r
+\r
+  USBx->LPMCSR &= ~(USB_LPMCSR_LMPEN);\r
+  USBx->LPMCSR &= ~(USB_LPMCSR_LPMACK);\r
+\r
+  return HAL_OK;\r
+}\r
+\r
+#endif /* defined (USB) */\r
+\r
+/**\r
+  * @brief  Send LPM message to user layer callback.\r
+  * @param  hpcd PCD handle\r
+  * @param  msg LPM message\r
+  * @retval HAL status\r
+  */\r
+__weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)\r
+{\r
+  /* Prevent unused argument(s) compilation warning */\r
+  UNUSED(hpcd);\r
+  UNUSED(msg);\r
+\r
+  /* NOTE : This function should not be modified, when the callback is needed,\r
+            the HAL_PCDEx_LPM_Callback could be implemented in the user file\r
+   */\r
+}\r
+\r
+/**\r
+  * @brief  Send BatteryCharging message to user layer callback.\r
+  * @param  hpcd PCD handle\r
+  * @param  msg LPM message\r
+  * @retval HAL status\r
+  */\r
+__weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)\r
+{\r
+  /* Prevent unused argument(s) compilation warning */\r
+  UNUSED(hpcd);\r
+  UNUSED(msg);\r
+\r
+  /* NOTE : This function should not be modified, when the callback is needed,\r
+            the HAL_PCDEx_BCD_Callback could be implemented in the user file\r
+   */\r
+}\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+#endif /* defined (USB) || defined (USB_OTG_FS) */\r
+#endif /* HAL_PCD_MODULE_ENABLED */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/**\r
+  * @}\r
+  */\r
+\r
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r