STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
stm32f7xx_hal_pcd_ex.c
Go to the documentation of this file.
1 
42 /* Includes ------------------------------------------------------------------*/
43 #include "stm32f7xx_hal.h"
44 
53 #ifdef HAL_PCD_MODULE_ENABLED
54 
55 /* Private types -------------------------------------------------------------*/
56 /* Private variables ---------------------------------------------------------*/
57 /* Private constants ---------------------------------------------------------*/
58 /* Private macros ------------------------------------------------------------*/
59 /* Private functions ---------------------------------------------------------*/
60 /* Exported functions --------------------------------------------------------*/
61 
87 HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)
88 {
89  uint8_t i = 0;
90  uint32_t Tx_Offset = 0;
91 
92  /* TXn min size = 16 words. (n : Transmit FIFO index)
93  When a TxFIFO is not used, the Configuration should be as follows:
94  case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes)
95  --> Txm can use the space allocated for Txn.
96  case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes)
97  --> Txn should be configured with the minimum space of 16 words
98  The FIFO is used optimally when used TxFIFOs are allocated in the top
99  of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
100  When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */
101 
102  Tx_Offset = hpcd->Instance->GRXFSIZ;
103 
104  if(fifo == 0)
105  {
106  hpcd->Instance->DIEPTXF0_HNPTXFSIZ = (uint32_t)(((uint32_t)size << 16) | Tx_Offset);
107  }
108  else
109  {
110  Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16;
111  for (i = 0; i < (fifo - 1); i++)
112  {
113  Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16);
114  }
115 
116  /* Multiply Tx_Size by 2 to get higher performance */
117  hpcd->Instance->DIEPTXF[fifo - 1] = (uint32_t)(((uint32_t)size << 16) | Tx_Offset);
118  }
119 
120  return HAL_OK;
121 }
122 
130 {
131  hpcd->Instance->GRXFSIZ = size;
132 
133  return HAL_OK;
134 }
135 
142 {
143  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
144 
145  hpcd->lpm_active = ENABLE;
146  hpcd->LPM_State = LPM_L0;
149 
150  return HAL_OK;
151 }
152 
159 {
160  USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
161 
162  hpcd->lpm_active = DISABLE;
165 
166  return HAL_OK;
167 }
168 
176 {
177  /* Prevent unused argument(s) compilation warning */
178  UNUSED(hpcd);
179  UNUSED(msg);
180 
181  /* NOTE : This function Should not be modified, when the callback is needed,
182  the HAL_PCDEx_LPM_Callback could be implemented in the user file
183  */
184 }
185 
194 #endif /* HAL_PCD_MODULE_ENABLED */
195 
203 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
__IO uint32_t DIEPTXF[0x0F]
Definition: stm32f745xx.h:1000
HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size)
HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd)
HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd)
#define USB_OTG_GLPMCFG_LPMEN
Definition: stm32f745xx.h:8514
PCD_TypeDef * Instance
#define USB_OTG_GINTMSK_LPMINTM
Definition: stm32f745xx.h:8341
__IO uint32_t GLPMCFG
Definition: stm32f745xx.h:994
USB_OTG_Core_Registers.
Definition: stm32f745xx.h:974
This file contains all the functions prototypes for the HAL module driver.
__IO uint32_t GINTMSK
Definition: stm32f745xx.h:982
PCD_LPM_StateTypeDef LPM_State
#define UNUSED(x)
PCD Handle Structure definition.
#define USB_OTG_GLPMCFG_LPMACK
Definition: stm32f745xx.h:8515
PCD_HandleTypeDef hpcd
Definition: usbd_conf.c:55
__IO uint32_t GRXFSIZ
Definition: stm32f745xx.h:985
void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
HAL_StatusTypeDef
HAL Status structures definition.
HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size)
PCD_LPM_MsgTypeDef
#define USB_OTG_GLPMCFG_ENBESL
Definition: stm32f745xx.h:8528
__IO uint32_t DIEPTXF0_HNPTXFSIZ
Definition: stm32f745xx.h:986