20#ifndef STM32H7xx_HAL_HCD_H
21#define STM32H7xx_HAL_HCD_H
30#if defined (USB_OTG_FS) || defined (USB_OTG_HS)
51 HAL_HCD_STATE_RESET = 0x00,
52 HAL_HCD_STATE_READY = 0x01,
53 HAL_HCD_STATE_ERROR = 0x02,
54 HAL_HCD_STATE_BUSY = 0x03,
55 HAL_HCD_STATE_TIMEOUT = 0x04
59typedef USB_OTG_CfgTypeDef HCD_InitTypeDef;
60typedef USB_OTG_HCTypeDef HCD_HCTypeDef;
61typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef;
62typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef;
71#if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
72typedef struct __HCD_HandleTypeDef
77 HCD_TypeDef *Instance;
81 __IO HCD_StateTypeDef State;
82 __IO uint32_t ErrorCode;
84#if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
85 void (* SOFCallback)(
struct __HCD_HandleTypeDef *hhcd);
86 void (* ConnectCallback)(
struct __HCD_HandleTypeDef *hhcd);
87 void (* DisconnectCallback)(
struct __HCD_HandleTypeDef *hhcd);
88 void (* PortEnabledCallback)(
struct __HCD_HandleTypeDef *hhcd);
89 void (* PortDisabledCallback)(
struct __HCD_HandleTypeDef *hhcd);
90 void (* HC_NotifyURBChangeCallback)(
struct __HCD_HandleTypeDef *hhcd, uint8_t chnum,
91 HCD_URBStateTypeDef urb_state);
93 void (* MspInitCallback)(
struct __HCD_HandleTypeDef *hhcd);
94 void (* MspDeInitCallback)(
struct __HCD_HandleTypeDef *hhcd);
115#define HCD_SPEED_HIGH USBH_HS_SPEED
116#define HCD_SPEED_FULL USBH_FSLS_SPEED
117#define HCD_SPEED_LOW USBH_FSLS_SPEED
126#define HCD_DEVICE_SPEED_HIGH 0U
127#define HCD_DEVICE_SPEED_FULL 1U
128#define HCD_DEVICE_SPEED_LOW 2U
137#define HCD_PHY_ULPI 1U
138#define HCD_PHY_EMBEDDED 2U
148#if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
149#define HAL_HCD_ERROR_INVALID_CALLBACK (0x00000010U)
166#define __HAL_HCD_ENABLE(__HANDLE__) (void)USB_EnableGlobalInt ((__HANDLE__)->Instance)
167#define __HAL_HCD_DISABLE(__HANDLE__) (void)USB_DisableGlobalInt ((__HANDLE__)->Instance)
169#define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance)\
170 & (__INTERRUPT__)) == (__INTERRUPT__))
172#define __HAL_HCD_GET_CH_FLAG(__HANDLE__, __chnum__, __INTERRUPT__) \
173 ((USB_ReadChInterrupts((__HANDLE__)->Instance, (__chnum__)) & (__INTERRUPT__)) == (__INTERRUPT__))
175#define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__))
176#define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
178#define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__))
179#define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM)
180#define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM)
181#define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM)
182#define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM)
199 uint8_t epnum, uint8_t dev_address,
200 uint8_t speed, uint8_t ep_type, uint16_t mps);
203void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd);
204void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd);
206#if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
214 HAL_HCD_SOF_CB_ID = 0x01,
215 HAL_HCD_CONNECT_CB_ID = 0x02,
216 HAL_HCD_DISCONNECT_CB_ID = 0x03,
217 HAL_HCD_PORT_ENABLED_CB_ID = 0x04,
218 HAL_HCD_PORT_DISABLED_CB_ID = 0x05,
220 HAL_HCD_MSPINIT_CB_ID = 0x06,
221 HAL_HCD_MSPDEINIT_CB_ID = 0x07
223} HAL_HCD_CallbackIDTypeDef;
234typedef void (*pHCD_CallbackTypeDef)(HCD_HandleTypeDef *hhcd);
235typedef void (*pHCD_HC_NotifyURBChangeCallbackTypeDef)(HCD_HandleTypeDef *hhcd,
237 HCD_URBStateTypeDef urb_state);
243 HAL_HCD_CallbackIDTypeDef CallbackID,
244 pHCD_CallbackTypeDef pCallback);
247 HAL_HCD_CallbackIDTypeDef CallbackID);
249HAL_StatusTypeDef HAL_HCD_RegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd,
250 pHCD_HC_NotifyURBChangeCallbackTypeDef pCallback);
252HAL_StatusTypeDef HAL_HCD_UnRegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd);
262HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, uint8_t ch_num,
263 uint8_t direction, uint8_t ep_type,
264 uint8_t token, uint8_t *pbuff,
265 uint16_t length, uint8_t do_ping);
268void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
269void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
270void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
271void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
272void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd);
273void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd);
274void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum,
275 HCD_URBStateTypeDef urb_state);
295HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd);
296HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
297HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
298uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum);
299uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd);
300uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd);
#define __IO
Definition: core_cm4.h:239
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of USB Low Layer HAL module.
USB_OTG_Core_Registers.
Definition: stm32h723xx.h:1761