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)
183#define __HAL_HCD_SET_HC_CSPLT(chnum) (USBx_HC(chnum)->HCSPLT |= USB_OTG_HCSPLT_COMPLSPLT)
184#define __HAL_HCD_CLEAR_HC_CSPLT(chnum) (USBx_HC(chnum)->HCSPLT &= ~USB_OTG_HCSPLT_COMPLSPLT)
185#define __HAL_HCD_CLEAR_HC_SSPLT(chnum) (USBx_HC(chnum)->HCSPLT &= ~USB_OTG_HCSPLT_SPLITEN)
202 uint8_t epnum, uint8_t dev_address,
203 uint8_t speed, uint8_t ep_type, uint16_t mps);
206void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd);
207void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd);
209#if (USE_HAL_HCD_REGISTER_CALLBACKS == 1U)
217 HAL_HCD_SOF_CB_ID = 0x01,
218 HAL_HCD_CONNECT_CB_ID = 0x02,
219 HAL_HCD_DISCONNECT_CB_ID = 0x03,
220 HAL_HCD_PORT_ENABLED_CB_ID = 0x04,
221 HAL_HCD_PORT_DISABLED_CB_ID = 0x05,
223 HAL_HCD_MSPINIT_CB_ID = 0x06,
224 HAL_HCD_MSPDEINIT_CB_ID = 0x07
226} HAL_HCD_CallbackIDTypeDef;
237typedef void (*pHCD_CallbackTypeDef)(HCD_HandleTypeDef *hhcd);
238typedef void (*pHCD_HC_NotifyURBChangeCallbackTypeDef)(HCD_HandleTypeDef *hhcd,
240 HCD_URBStateTypeDef urb_state);
246 HAL_HCD_CallbackIDTypeDef CallbackID,
247 pHCD_CallbackTypeDef pCallback);
250 HAL_HCD_CallbackIDTypeDef CallbackID);
252HAL_StatusTypeDef HAL_HCD_RegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd,
253 pHCD_HC_NotifyURBChangeCallbackTypeDef pCallback);
255HAL_StatusTypeDef HAL_HCD_UnRegisterHC_NotifyURBChangeCallback(HCD_HandleTypeDef *hhcd);
265HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd, uint8_t ch_num,
266 uint8_t direction, uint8_t ep_type,
267 uint8_t token, uint8_t *pbuff,
268 uint16_t length, uint8_t do_ping);
271 uint8_t addr, uint8_t PortNbr);
273HAL_StatusTypeDef HAL_HCD_HC_ClearHubInfo(HCD_HandleTypeDef *hhcd, uint8_t ch_num);
276void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
277void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
278void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
279void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
280void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd);
281void HAL_HCD_PortDisabled_Callback(HCD_HandleTypeDef *hhcd);
282void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum,
283 HCD_URBStateTypeDef urb_state);
303HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef
const *hhcd);
304HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef
const *hhcd, uint8_t chnum);
305HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef
const *hhcd, uint8_t chnum);
306uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef
const *hhcd, uint8_t chnum);
307uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd);
308uint32_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