PCDEx control functions.
More...
PCDEx control functions.
===============================================================================
##### Extended features functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Update FIFO configuration
◆ HAL_PCDEx_ActivateBCD()
Activate BatteryCharging feature.
- Parameters
-
- Return values
-
Definition at line 256 of file stm32l4xx_hal_pcd_ex.c.
258 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
260 USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);
261 USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);
264 USBx->GCCFG &= ~(USB_OTG_GCCFG_PWRDWN);
267 USBx->GCCFG |= USB_OTG_GCCFG_BCDEN;
269 hpcd->battery_charging_active = 1U;
◆ HAL_PCDEx_ActivateLPM()
Activate LPM feature.
- Parameters
-
- Return values
-
Definition at line 125 of file stm32l4xx_hal_pcd_ex.c.
127 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
129 hpcd->lpm_active = 1U;
131 USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM;
132 USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
◆ HAL_PCDEx_BCD_Callback()
Send BatteryCharging message to user layer callback.
- Parameters
-
| hpcd | PCD handle |
| msg | LPM message |
- Return values
-
Definition at line 537 of file stm32l4xx_hal_pcd_ex.c.
◆ HAL_PCDEx_BCD_VBUSDetect()
Handle BatteryCharging Process.
- Parameters
-
- Return values
-
Definition at line 159 of file stm32l4xx_hal_pcd_ex.c.
161 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
165 USBx->GCCFG |= USB_OTG_GCCFG_DCDEN;
168 while ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == 0U)
173 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 187 if ((USBx->GCCFG & USB_OTG_GCCFG_DCDET) == USB_OTG_GCCFG_DCDET)
189 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 198 USBx->GCCFG &= ~ USB_OTG_GCCFG_DCDEN;
200 USBx->GCCFG |= USB_OTG_GCCFG_PDEN;
203 if ((USBx->GCCFG & USB_OTG_GCCFG_PDET) == 0U)
206 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 216 USBx->GCCFG &= ~ USB_OTG_GCCFG_PDEN;
218 USBx->GCCFG |= USB_OTG_GCCFG_SDEN;
221 if ((USBx->GCCFG & USB_OTG_GCCFG_SDET) == USB_OTG_GCCFG_SDET)
224 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 233 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 244 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U)
void HAL_Delay(uint32_t Delay)
This function provides minimum delay (in milliseconds) based on variable incremented.
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd)
Deactivate BatteryCharging feature.
void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg)
Send BatteryCharging message to user layer callback.
◆ HAL_PCDEx_DeActivateBCD()
Deactivate BatteryCharging feature.
- Parameters
-
- Return values
-
Definition at line 279 of file stm32l4xx_hal_pcd_ex.c.
281 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
283 USBx->GCCFG &= ~(USB_OTG_GCCFG_SDEN);
284 USBx->GCCFG &= ~(USB_OTG_GCCFG_PDEN);
287 USBx->GCCFG &= ~(USB_OTG_GCCFG_BCDEN);
289 hpcd->battery_charging_active = 0U;
◆ HAL_PCDEx_DeActivateLPM()
Deactivate LPM feature.
- Parameters
-
- Return values
-
Definition at line 142 of file stm32l4xx_hal_pcd_ex.c.
144 USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
146 hpcd->lpm_active = 0U;
147 USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM;
148 USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL);
◆ HAL_PCDEx_LPM_Callback()
Send LPM message to user layer callback.
- Parameters
-
| hpcd | PCD handle |
| msg | LPM message |
- Return values
-
Definition at line 520 of file stm32l4xx_hal_pcd_ex.c.
◆ HAL_PCDEx_PMAConfig()
| HAL_StatusTypeDef HAL_PCDEx_PMAConfig |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint16_t |
ep_addr, |
|
|
uint16_t |
ep_kind, |
|
|
uint32_t |
pmaadress |
|
) |
| |
Configure PMA for EP.
- Parameters
-
| hpcd | Device instance |
| ep_addr | endpoint address |
| ep_kind | endpoint Kind USB_SNG_BUF: Single Buffer used USB_DBL_BUF: Double Buffer used |
| pmaadress | EP address in The PMA: In case of single buffer endpoint this parameter is 16-bit value providing the address in PMA allocated to endpoint. In case of double buffer endpoint this parameter is a 32-bit value providing the endpoint buffer 0 address in the LSB part of 32-bit value and endpoint buffer 1 address in the MSB part of 32-bit value. |
- Return values
-
Definition at line 313 of file stm32l4xx_hal_pcd_ex.c.
321 if ((0x80U & ep_addr) == 0x80U)
323 ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK];
327 ep = &hpcd->OUT_ep[ep_addr];
331 if (ep_kind == PCD_SNG_BUF)
334 ep->doublebuffer = 0U;
336 ep->pmaadress = (uint16_t)pmaadress;
341 ep->doublebuffer = 1U;
343 ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU);
344 ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16);
◆ HAL_PCDEx_SetRxFiFo()
Set Rx FIFO.
- Parameters
-
| hpcd | PCD handle |
| size | Size of Rx fifo |
- Return values
-
Definition at line 113 of file stm32l4xx_hal_pcd_ex.c.
115 hpcd->Instance->GRXFSIZ = size;
◆ HAL_PCDEx_SetTxFiFo()
| HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
fifo, |
|
|
uint16_t |
size |
|
) |
| |
Set Tx FIFO.
- Parameters
-
| hpcd | PCD handle |
| fifo | The number of Tx fifo |
| size | Fifo size |
- Return values
-
Definition at line 71 of file stm32l4xx_hal_pcd_ex.c.
86 Tx_Offset = hpcd->Instance->GRXFSIZ;
90 hpcd->Instance->DIEPTXF0_HNPTXFSIZ = ((uint32_t)size << 16) | Tx_Offset;
94 Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;
95 for (i = 0U; i < (fifo - 1U); i++)
97 Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);
101 hpcd->Instance->DIEPTXF[fifo - 1U] = ((uint32_t)size << 16) | Tx_Offset;