Create release.yml
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_HAL_Driver / Inc / stm32f4xx_hal_hcd.h
blob5e97876ed90e51b903dcac0b0f39260f8d451dc9
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_hal_hcd.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 14-April-2017
7 * @brief Header file of HCD HAL module.
8 ******************************************************************************
9 * @attention
11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ******************************************************************************
36 */
38 /* Define to prevent recursive inclusion -------------------------------------*/
39 #ifndef __STM32F4xx_HAL_HCD_H
40 #define __STM32F4xx_HAL_HCD_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
46 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
47 defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
48 defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
49 defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
50 /* Includes ------------------------------------------------------------------*/
51 #include "stm32f4xx_ll_usb.h"
53 /** @addtogroup STM32F4xx_HAL_Driver
54 * @{
57 /** @addtogroup HCD
58 * @{
61 /* Exported types ------------------------------------------------------------*/
62 /** @defgroup HCD_Exported_Types HCD Exported Types
63 * @{
66 /** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition
67 * @{
69 typedef enum
71 HAL_HCD_STATE_RESET = 0x00U,
72 HAL_HCD_STATE_READY = 0x01U,
73 HAL_HCD_STATE_ERROR = 0x02U,
74 HAL_HCD_STATE_BUSY = 0x03U,
75 HAL_HCD_STATE_TIMEOUT = 0x04U
76 } HCD_StateTypeDef;
78 typedef USB_OTG_GlobalTypeDef HCD_TypeDef;
79 typedef USB_OTG_CfgTypeDef HCD_InitTypeDef;
80 typedef USB_OTG_HCTypeDef HCD_HCTypeDef ;
81 typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ;
82 typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ;
83 /**
84 * @}
87 /** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition
88 * @{
89 */
90 typedef struct
92 HCD_TypeDef *Instance; /*!< Register base address */
93 HCD_InitTypeDef Init; /*!< HCD required parameters */
94 HCD_HCTypeDef hc[15U]; /*!< Host channels parameters */
95 HAL_LockTypeDef Lock; /*!< HCD peripheral status */
96 __IO HCD_StateTypeDef State; /*!< HCD communication state */
97 void *pData; /*!< Pointer Stack Handler */
98 } HCD_HandleTypeDef;
99 /**
100 * @}
104 * @}
107 /* Exported constants --------------------------------------------------------*/
108 /** @defgroup HCD_Exported_Constants HCD Exported Constants
109 * @{
112 /** @defgroup HCD_Speed HCD Speed
113 * @{
115 #define HCD_SPEED_HIGH 0U
116 #define HCD_SPEED_LOW 2U
117 #define HCD_SPEED_FULL 3U
119 * @}
122 /** @defgroup HCD_PHY_Module HCD PHY Module
123 * @{
125 #define HCD_PHY_ULPI 1U
126 #define HCD_PHY_EMBEDDED 2U
128 * @}
132 * @}
135 /* Exported macro ------------------------------------------------------------*/
136 /** @defgroup HCD_Exported_Macros HCD Exported Macros
137 * @brief macros to handle interrupts and specific clock configurations
138 * @{
140 #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance)
141 #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance)
143 #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__))
144 #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__))
145 #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
147 #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__))
148 #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM)
149 #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM)
150 #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM)
151 #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM)
153 * @}
156 /* Exported functions --------------------------------------------------------*/
157 /** @addtogroup HCD_Exported_Functions HCD Exported Functions
158 * @{
161 /* Initialization/de-initialization functions ********************************/
162 /** @addtogroup HCD_Exported_Functions_Group1 Initialization and de-initialization functions
163 * @{
165 HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd);
166 HAL_StatusTypeDef HAL_HCD_DeInit(HCD_HandleTypeDef *hhcd);
167 HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd,
168 uint8_t ch_num,
169 uint8_t epnum,
170 uint8_t dev_address,
171 uint8_t speed,
172 uint8_t ep_type,
173 uint16_t mps);
175 HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, uint8_t ch_num);
177 void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd);
178 void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd);
180 * @}
183 /* I/O operation functions ***************************************************/
184 /** @addtogroup HCD_Exported_Functions_Group2 Input and Output operation functions
185 * @{
187 HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
188 uint8_t ch_num,
189 uint8_t direction,
190 uint8_t ep_type,
191 uint8_t token,
192 uint8_t* pbuff,
193 uint16_t length,
194 uint8_t do_ping);
196 /* Non-Blocking mode: Interrupt */
197 void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
198 void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
199 void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
200 void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
201 void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd,
202 uint8_t chnum,
203 HCD_URBStateTypeDef urb_state);
205 * @}
208 /* Peripheral Control functions **********************************************/
209 /** @addtogroup HCD_Exported_Functions_Group3 Peripheral Control functions
210 * @{
212 HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd);
213 HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd);
214 HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd);
216 * @}
219 /* Peripheral State functions ************************************************/
220 /** @addtogroup HCD_Exported_Functions_Group4 Peripheral State functions
221 * @{
223 HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd);
224 HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
225 uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum);
226 HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
227 uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd);
228 uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd);
230 * @}
234 * @}
237 /* Private macros ------------------------------------------------------------*/
238 /** @defgroup HCD_Private_Macros HCD Private Macros
239 * @{
243 * @}
247 * @}
251 * @}
253 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
254 STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx ||
255 STM32F412Vx || STM32F412Cx || defined(STM32F413xx) || defined(STM32F423xx) */
256 #ifdef __cplusplus
258 #endif
260 #endif /* __STM32F4xx_HAL_HCD_H */
262 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/