]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube/ST_Code/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pcd_ex.c
Make vSetupTimerInterrupt weak in the RVDS M4 MPU port to give the
[freertos] / FreeRTOS / Demo / CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube / ST_Code / Drivers / STM32L4xx_HAL_Driver / Src / stm32l4xx_hal_pcd_ex.c
1 /**\r
2   ******************************************************************************\r
3   * @file    stm32l4xx_hal_pcd_ex.c\r
4   * @author  MCD Application Team\r
5   * @brief   PCD Extended HAL module driver.\r
6   *          This file provides firmware functions to manage the following\r
7   *          functionalities of the USB Peripheral Controller:\r
8   *           + Extended features functions\r
9   *\r
10   ******************************************************************************\r
11   * @attention\r
12   *\r
13   * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.\r
14   * All rights reserved.</center></h2>\r
15   *\r
16   * This software component is licensed by ST under BSD 3-Clause license,\r
17   * the "License"; You may not use this file except in compliance with the\r
18   * License. You may obtain a copy of the License at:\r
19   *                        opensource.org/licenses/BSD-3-Clause\r
20   *\r
21   ******************************************************************************\r
22   */\r
23 \r
24 /* Includes ------------------------------------------------------------------*/\r
25 #include "stm32l4xx_hal.h"\r
26 \r
27 /** @addtogroup STM32L4xx_HAL_Driver\r
28   * @{\r
29   */\r
30 \r
31 /** @defgroup PCDEx PCDEx\r
32   * @brief PCD Extended HAL module driver\r
33   * @{\r
34   */\r
35 \r
36 #ifdef HAL_PCD_MODULE_ENABLED\r
37 \r
38 #if defined (USB) || defined (USB_OTG_FS)\r
39 /* Private types -------------------------------------------------------------*/\r
40 /* Private variables ---------------------------------------------------------*/\r
41 /* Private constants ---------------------------------------------------------*/\r
42 /* Private macros ------------------------------------------------------------*/\r
43 /* Private functions ---------------------------------------------------------*/\r
44 /* Exported functions --------------------------------------------------------*/\r
45 \r
46 /** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions\r
47   * @{\r
48   */\r
49 \r
50 /** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions\r
51   * @brief    PCDEx control functions\r
52  *\r
53 @verbatim\r
54  ===============================================================================\r
55                  ##### Extended features functions #####\r
56  ===============================================================================\r
57     [..]  This section provides functions allowing to:\r
58       (+) Update FIFO configuration\r
59 \r
60 @endverbatim\r
61   * @{\r
62   */\r
63 #if defined (USB_OTG_FS)\r
64 /**\r
65   * @brief  Set Tx FIFO\r
66   * @param  hpcd PCD handle\r
67   * @param  fifo The number of Tx fifo\r
68   * @param  size Fifo size\r
69   * @retval HAL status\r
70   */\r
71 HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)\r
72 {\r
73   uint8_t i;\r
74   uint32_t Tx_Offset;\r
75 \r
76   /*  TXn min size = 16 words. (n  : Transmit FIFO index)\r
77       When a TxFIFO is not used, the Configuration should be as follows:\r
78           case 1 :  n > m    and Txn is not used    (n,m  : Transmit FIFO indexes)\r
79          --> Txm can use the space allocated for Txn.\r
80          case2  :  n < m    and Txn is not used    (n,m  : Transmit FIFO indexes)\r
81          --> Txn should be configured with the minimum space of 16 words\r
82      The FIFO is used optimally when used TxFIFOs are allocated in the top\r
83          of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.\r
84      When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */\r
85 \r
86   Tx_Offset = hpcd->Instance->GRXFSIZ;\r
87 \r
88   if (fifo == 0U)\r
89   {\r
90     hpcd->Instance->DIEPTXF0_HNPTXFSIZ = ((uint32_t)size << 16) | Tx_Offset;\r
91   }\r
92   else\r
93   {\r
94     Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;\r
95     for (i = 0U; i < (fifo - 1U); i++)\r
96     {\r
97       Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);\r
98     }\r
99 \r
100     /* Multiply Tx_Size by 2 to get higher performance */\r
101     hpcd->Instance->DIEPTXF[fifo - 1U] = ((uint32_t)size << 16) | Tx_Offset;\r
102   }\r
103 \r
104   return HAL_OK;\r
105 }\r
106 \r
107 /**\r
108   * @brief  Set Rx FIFO\r
109   * @param  hpcd PCD handle\r
110   * @param  size Size of Rx fifo\r
111   * @retval HAL status\r
112   */\r
113 HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)\r
114 {\r
115   hpcd->Instance->GRXFSIZ = size;\r
116 \r
117   return HAL_OK;\r
118 }\r
119 \r
120 /**\r
121   * @brief  Activate LPM feature.\r
122   * @param  hpcd PCD handle\r
123   * @retval HAL status\r
124   */\r
125 HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)\r
126 {\r
127   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
128 \r
129   hpcd->lpm_active = 1U;\r
130   hpcd->LPM_State = LPM_L0;\r
131   USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM;\r
132   USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);\r
133 \r
134   return HAL_OK;\r
135 }\r
136 \r
137 /**\r
138   * @brief  Deactivate LPM feature.\r
139   * @param  hpcd PCD handle\r
140   * @retval HAL status\r
141   */\r
142 HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)\r
143 {\r
144   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
145 \r
146   hpcd->lpm_active = 0U;\r
147   USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM;\r
148   USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);\r
149 \r
150   return HAL_OK;\r
151 }\r
152 \r
153 \r
154 /**\r
155   * @brief  Handle BatteryCharging Process.\r
156   * @param  hpcd PCD handle\r
157   * @retval HAL status\r
158   */\r
159 void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)\r
160 {\r
161   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
162   uint32_t tickstart = HAL_GetTick();\r
163 \r
164   /* Enable DCD : Data Contact Detect */\r
165   USBx->GCCFG |= USB_OTG_GCCFG_DCDEN;\r
166 \r
167   /* Wait Detect flag or a timeout is happen*/\r
168   while ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == 0U)\r
169   {\r
170     /* Check for the Timeout */\r
171     if ((HAL_GetTick() - tickstart) > 1000U)\r
172     {\r
173 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
174       hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);\r
175 #else\r
176       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);\r
177 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
178 \r
179       return;\r
180     }\r
181   }\r
182 \r
183   /* Right response got */\r
184   HAL_Delay(200U);\r
185 \r
186   /* Check Detect flag*/\r
187   if ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == USB_OTG_GCCFG_DCDET)\r
188   {\r
189 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
190     hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
191 #else\r
192     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
193 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
194   }\r
195 \r
196   /*Primary detection: checks if connected to Standard Downstream Port\r
197   (without charging capability) */\r
198   USBx->GCCFG &= ~ USB_OTG_GCCFG_DCDEN;\r
199   HAL_Delay(50U);\r
200   USBx->GCCFG |=  USB_OTG_GCCFG_PDEN;\r
201   HAL_Delay(50U);\r
202 \r
203   if ((USBx->GCCFG & USB_OTG_GCCFG_PDET) == 0U)\r
204   {\r
205     /* Case of Standard Downstream Port */\r
206 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
207     hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
208 #else\r
209     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
210 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
211   }\r
212   else\r
213   {\r
214     /* start secondary detection to check connection to Charging Downstream\r
215     Port or Dedicated Charging Port */\r
216     USBx->GCCFG &= ~ USB_OTG_GCCFG_PDEN;\r
217     HAL_Delay(50U);\r
218     USBx->GCCFG |=  USB_OTG_GCCFG_SDEN;\r
219     HAL_Delay(50U);\r
220 \r
221     if ((USBx->GCCFG & USB_OTG_GCCFG_SDET) == USB_OTG_GCCFG_SDET)\r
222     {\r
223       /* case Dedicated Charging Port  */\r
224 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
225       hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
226 #else\r
227       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
228 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
229     }\r
230     else\r
231     {\r
232       /* case Charging Downstream Port  */\r
233 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
234       hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
235 #else\r
236       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
237 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
238     }\r
239   }\r
240 \r
241   /* Battery Charging capability discovery finished */\r
242   (void)HAL_PCDEx_DeActivateBCD(hpcd);\r
243 \r
244 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
245   hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
246 #else\r
247   HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
248 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
249 }\r
250 \r
251 /**\r
252   * @brief  Activate BatteryCharging feature.\r
253   * @param  hpcd PCD handle\r
254   * @retval HAL status\r
255   */\r
256 HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)\r
257 {\r
258   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
259 \r
260   USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);\r
261   USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);\r
262 \r
263   /* Power Down USB tranceiver  */\r
264   USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);\r
265 \r
266   /* Enable Battery charging */\r
267   USBx->GCCFG |= USB_OTG_GCCFG_BCDEN;\r
268 \r
269   hpcd->battery_charging_active = 1U;\r
270 \r
271   return HAL_OK;\r
272 }\r
273 \r
274 /**\r
275   * @brief  Deactivate BatteryCharging feature.\r
276   * @param  hpcd PCD handle\r
277   * @retval HAL status\r
278   */\r
279 HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)\r
280 {\r
281   USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;\r
282 \r
283   USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);\r
284   USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);\r
285 \r
286   /* Disable Battery charging */\r
287   USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN);\r
288 \r
289   hpcd->battery_charging_active = 0U;\r
290 \r
291   return HAL_OK;\r
292 }\r
293 \r
294 #endif /* defined (USB_OTG_FS) */\r
295 #if defined (USB)\r
296 /**\r
297   * @brief  Configure PMA for EP\r
298   * @param  hpcd  Device instance\r
299   * @param  ep_addr endpoint address\r
300   * @param  ep_kind endpoint Kind\r
301   *                  USB_SNG_BUF: Single Buffer used\r
302   *                  USB_DBL_BUF: Double Buffer used\r
303   * @param  pmaadress: EP address in The PMA: In case of single buffer endpoint\r
304   *                   this parameter is 16-bit value providing the address\r
305   *                   in PMA allocated to endpoint.\r
306   *                   In case of double buffer endpoint this parameter\r
307   *                   is a 32-bit value providing the endpoint buffer 0 address\r
308   *                   in the LSB part of 32-bit value and endpoint buffer 1 address\r
309   *                   in the MSB part of 32-bit value.\r
310   * @retval HAL status\r
311   */\r
312 \r
313 HAL_StatusTypeDef  HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd,\r
314                                        uint16_t ep_addr,\r
315                                        uint16_t ep_kind,\r
316                                        uint32_t pmaadress)\r
317 {\r
318   PCD_EPTypeDef *ep;\r
319 \r
320   /* initialize ep structure*/\r
321   if ((0x80U & ep_addr) == 0x80U)\r
322   {\r
323     ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];\r
324   }\r
325   else\r
326   {\r
327     ep = &hpcd->OUT_ep[ep_addr];\r
328   }\r
329 \r
330   /* Here we check if the endpoint is single or double Buffer*/\r
331   if (ep_kind == PCD_SNG_BUF)\r
332   {\r
333     /* Single Buffer */\r
334     ep->doublebuffer = 0U;\r
335     /* Configure the PMA */\r
336     ep->pmaadress = (uint16_t)pmaadress;\r
337   }\r
338   else /* USB_DBL_BUF */\r
339   {\r
340     /* Double Buffer Endpoint */\r
341     ep->doublebuffer = 1U;\r
342     /* Configure the PMA */\r
343     ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU);\r
344     ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16);\r
345   }\r
346 \r
347   return HAL_OK;\r
348 }\r
349 \r
350 /**\r
351   * @brief  Activate BatteryCharging feature.\r
352   * @param  hpcd PCD handle\r
353   * @retval HAL status\r
354   */\r
355 HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd)\r
356 {\r
357   USB_TypeDef *USBx = hpcd->Instance;\r
358   hpcd->battery_charging_active = 1U;\r
359 \r
360   /* Enable DCD : Data Contact Detect */\r
361   USBx->BCDR &= ~(USB_BCDR_PDEN);\r
362   USBx->BCDR &= ~(USB_BCDR_SDEN);\r
363   USBx->BCDR |= USB_BCDR_DCDEN;\r
364 \r
365   return HAL_OK;\r
366 }\r
367 \r
368 /**\r
369   * @brief  Deactivate BatteryCharging feature.\r
370   * @param  hpcd PCD handle\r
371   * @retval HAL status\r
372   */\r
373 HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)\r
374 {\r
375   USB_TypeDef *USBx = hpcd->Instance;\r
376   hpcd->battery_charging_active = 0U;\r
377 \r
378   USBx->BCDR &= ~(USB_BCDR_BCDEN);\r
379 \r
380   return HAL_OK;\r
381 }\r
382 \r
383 /**\r
384   * @brief  Handle BatteryCharging Process.\r
385   * @param  hpcd PCD handle\r
386   * @retval HAL status\r
387   */\r
388 void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd)\r
389 {\r
390   USB_TypeDef *USBx = hpcd->Instance;\r
391   uint32_t tickstart = HAL_GetTick();\r
392 \r
393   /* Wait Detect flag or a timeout is happen*/\r
394   while ((USBx->BCDR & USB_BCDR_DCDET) == 0U)\r
395   {\r
396     /* Check for the Timeout */\r
397     if ((HAL_GetTick() - tickstart) > 1000U)\r
398     {\r
399 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
400       hpcd->BCDCallback(hpcd, PCD_BCD_ERROR);\r
401 #else\r
402       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR);\r
403 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
404 \r
405       return;\r
406     }\r
407   }\r
408 \r
409   HAL_Delay(200U);\r
410 \r
411   /* Data Pin Contact ? Check Detect flag */\r
412   if ((USBx->BCDR & USB_BCDR_DCDET) == USB_BCDR_DCDET)\r
413   {\r
414 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
415     hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
416 #else\r
417     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION);\r
418 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
419   }\r
420   /* Primary detection: checks if connected to Standard Downstream Port\r
421   (without charging capability) */\r
422   USBx->BCDR &= ~(USB_BCDR_DCDEN);\r
423   HAL_Delay(50U);\r
424   USBx->BCDR |= (USB_BCDR_PDEN);\r
425   HAL_Delay(50U);\r
426 \r
427   /* If Charger detect ? */\r
428   if ((USBx->BCDR & USB_BCDR_PDET) == USB_BCDR_PDET)\r
429   {\r
430     /* Start secondary detection to check connection to Charging Downstream\r
431     Port or Dedicated Charging Port */\r
432     USBx->BCDR &= ~(USB_BCDR_PDEN);\r
433     HAL_Delay(50U);\r
434     USBx->BCDR |= (USB_BCDR_SDEN);\r
435     HAL_Delay(50U);\r
436 \r
437     /* If CDP ? */\r
438     if ((USBx->BCDR & USB_BCDR_SDET) == USB_BCDR_SDET)\r
439     {\r
440       /* Dedicated Downstream Port DCP */\r
441 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
442       hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
443 #else\r
444       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT);\r
445 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
446     }\r
447     else\r
448     {\r
449       /* Charging Downstream Port CDP */\r
450 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
451       hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
452 #else\r
453       HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT);\r
454 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
455     }\r
456   }\r
457   else /* NO */\r
458   {\r
459     /* Standard Downstream Port */\r
460 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
461     hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
462 #else\r
463     HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT);\r
464 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
465   }\r
466 \r
467   /* Battery Charging capability discovery finished Start Enumeration */\r
468   (void)HAL_PCDEx_DeActivateBCD(hpcd);\r
469 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)\r
470   hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
471 #else\r
472   HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED);\r
473 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */\r
474 }\r
475 \r
476 \r
477 /**\r
478   * @brief  Activate LPM feature.\r
479   * @param  hpcd PCD handle\r
480   * @retval HAL status\r
481   */\r
482 HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)\r
483 {\r
484 \r
485   USB_TypeDef *USBx = hpcd->Instance;\r
486   hpcd->lpm_active = 1U;\r
487   hpcd->LPM_State = LPM_L0;\r
488 \r
489   USBx->LPMCSR |= USB_LPMCSR_LMPEN;\r
490   USBx->LPMCSR |= USB_LPMCSR_LPMACK;\r
491 \r
492   return HAL_OK;\r
493 }\r
494 \r
495 /**\r
496   * @brief  Deactivate LPM feature.\r
497   * @param  hpcd PCD handle\r
498   * @retval HAL status\r
499   */\r
500 HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)\r
501 {\r
502   USB_TypeDef *USBx = hpcd->Instance;\r
503 \r
504   hpcd->lpm_active = 0U;\r
505 \r
506   USBx->LPMCSR &= ~(USB_LPMCSR_LMPEN);\r
507   USBx->LPMCSR &= ~(USB_LPMCSR_LPMACK);\r
508 \r
509   return HAL_OK;\r
510 }\r
511 \r
512 #endif /* defined (USB) */\r
513 \r
514 /**\r
515   * @brief  Send LPM message to user layer callback.\r
516   * @param  hpcd PCD handle\r
517   * @param  msg LPM message\r
518   * @retval HAL status\r
519   */\r
520 __weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)\r
521 {\r
522   /* Prevent unused argument(s) compilation warning */\r
523   UNUSED(hpcd);\r
524   UNUSED(msg);\r
525 \r
526   /* NOTE : This function should not be modified, when the callback is needed,\r
527             the HAL_PCDEx_LPM_Callback could be implemented in the user file\r
528    */\r
529 }\r
530 \r
531 /**\r
532   * @brief  Send BatteryCharging message to user layer callback.\r
533   * @param  hpcd PCD handle\r
534   * @param  msg LPM message\r
535   * @retval HAL status\r
536   */\r
537 __weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)\r
538 {\r
539   /* Prevent unused argument(s) compilation warning */\r
540   UNUSED(hpcd);\r
541   UNUSED(msg);\r
542 \r
543   /* NOTE : This function should not be modified, when the callback is needed,\r
544             the HAL_PCDEx_BCD_Callback could be implemented in the user file\r
545    */\r
546 }\r
547 \r
548 /**\r
549   * @}\r
550   */\r
551 \r
552 /**\r
553   * @}\r
554   */\r
555 #endif /* defined (USB) || defined (USB_OTG_FS) */\r
556 #endif /* HAL_PCD_MODULE_ENABLED */\r
557 \r
558 /**\r
559   * @}\r
560   */\r
561 \r
562 /**\r
563   * @}\r
564   */\r
565 \r
566 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r