|
STM32G474xx HAL用户手册
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32g4xx_hal_pcd.h 00004 * @author MCD Application Team 00005 * @brief Header file of PCD HAL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2019 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32G4xx_HAL_PCD_H 00021 #define STM32G4xx_HAL_PCD_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32g4xx_ll_usb.h" 00029 00030 #if defined (USB) 00031 00032 /** @addtogroup STM32G4xx_HAL_Driver 00033 * @{ 00034 */ 00035 00036 /** @addtogroup PCD 00037 * @{ 00038 */ 00039 00040 /* Exported types ------------------------------------------------------------*/ 00041 /** @defgroup PCD_Exported_Types PCD导出类型 00042 * @{ 00043 */ 00044 00045 /** 00046 * @brief PCD状态结构体定义 00047 */ 00048 typedef enum 00049 { 00050 HAL_PCD_STATE_RESET = 0x00, 00051 HAL_PCD_STATE_READY = 0x01, 00052 HAL_PCD_STATE_ERROR = 0x02, 00053 HAL_PCD_STATE_BUSY = 0x03, 00054 HAL_PCD_STATE_TIMEOUT = 0x04 00055 } PCD_StateTypeDef; 00056 00057 /* Device LPM suspend state */ 00058 typedef enum 00059 { 00060 LPM_L0 = 0x00, /* on */ 00061 LPM_L1 = 0x01, /* LPM L1 sleep */ 00062 LPM_L2 = 0x02, /* suspend */ 00063 LPM_L3 = 0x03, /* off */ 00064 } PCD_LPM_StateTypeDef; 00065 00066 typedef enum 00067 { 00068 PCD_LPM_L0_ACTIVE = 0x00, /* on */ 00069 PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */ 00070 } PCD_LPM_MsgTypeDef; 00071 00072 typedef enum 00073 { 00074 PCD_BCD_ERROR = 0xFF, 00075 PCD_BCD_CONTACT_DETECTION = 0xFE, 00076 PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD, 00077 PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC, 00078 PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB, 00079 PCD_BCD_DISCOVERY_COMPLETED = 0x00, 00080 00081 } PCD_BCD_MsgTypeDef; 00082 00084 00086 00087 typedef USB_TypeDef PCD_TypeDef; 00088 typedef USB_CfgTypeDef PCD_InitTypeDef; 00089 typedef USB_EPTypeDef PCD_EPTypeDef; 00090 00091 00092 /** 00093 * @brief PCD句柄结构体定义 00094 */ 00095 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 00096 typedef struct __PCD_HandleTypeDef 00097 #else 00098 typedef struct 00099 #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 00100 { 00101 PCD_TypeDef *Instance; /*!< Register base address */ 00102 PCD_InitTypeDef Init; /*!< PCD required parameters */ 00103 __IO uint8_t USB_Address; /*!< USB Address */ 00104 PCD_EPTypeDef IN_ep[8]; /*!< IN endpoint parameters */ 00105 PCD_EPTypeDef OUT_ep[8]; /*!< OUT endpoint parameters */ 00106 HAL_LockTypeDef Lock; /*!< PCD peripheral status */ 00107 __IO PCD_StateTypeDef State; /*!< PCD communication state */ 00108 __IO uint32_t ErrorCode; /*!< PCD Error code */ 00109 uint32_t Setup[12]; /*!< Setup packet buffer */ 00110 PCD_LPM_StateTypeDef LPM_State; /*!< LPM State */ 00111 uint32_t BESL; 00112 00114 uint32_t lpm_active; /*!< Enable or disable the Link Power Management . 00115 This parameter can be set to ENABLE or DISABLE */ 00116 00117 uint32_t