| 1 | /* USER CODE BEGIN Header */
|
|---|
| 2 | /**
|
|---|
| 3 | ******************************************************************************
|
|---|
| 4 | * @file usbpd_dpm_user.h
|
|---|
| 5 | * @author MCD Application Team
|
|---|
| 6 | * @brief Header file for usbpd_dpm_user.c file
|
|---|
| 7 | ******************************************************************************
|
|---|
| 8 | * @attention
|
|---|
| 9 | *
|
|---|
| 10 | * Copyright (c) 2026 STMicroelectronics.
|
|---|
| 11 | * All rights reserved.
|
|---|
| 12 | *
|
|---|
| 13 | * This software is licensed under terms that can be found in the LICENSE file
|
|---|
| 14 | * in the root directory of this software component.
|
|---|
| 15 | * If no LICENSE file comes with this software, it is provided AS-IS.
|
|---|
| 16 | *
|
|---|
| 17 | ******************************************************************************
|
|---|
| 18 | */
|
|---|
| 19 | /* USER CODE END Header */
|
|---|
| 20 |
|
|---|
| 21 | #ifndef __USBPD_DPM_USER_H_
|
|---|
| 22 | #define __USBPD_DPM_USER_H_
|
|---|
| 23 |
|
|---|
| 24 | #ifdef __cplusplus
|
|---|
| 25 | extern "C" {
|
|---|
| 26 | #endif
|
|---|
| 27 |
|
|---|
| 28 | /* Includes ------------------------------------------------------------------*/
|
|---|
| 29 | /* USER CODE BEGIN Include */
|
|---|
| 30 |
|
|---|
| 31 | /* USER CODE END Include */
|
|---|
| 32 |
|
|---|
| 33 | /** @addtogroup STM32_USBPD_APPLICATION
|
|---|
| 34 | * @{
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | /** @addtogroup STM32_USBPD_APPLICATION_DPM_USER
|
|---|
| 38 | * @{
|
|---|
| 39 | */
|
|---|
| 40 |
|
|---|
| 41 | /* Exported typedef ----------------------------------------------------------*/
|
|---|
| 42 | typedef struct
|
|---|
| 43 | {
|
|---|
| 44 | uint32_t PE_DataSwap : 1U; /*!< support data swap */
|
|---|
| 45 | uint32_t PE_VconnSwap : 1U; /*!< support VCONN swap */
|
|---|
| 46 | uint32_t PE_DR_Swap_To_DFP : 1U; /*!< If supported, DR Swap to DFP can be accepted or not by the user else directly rejected */
|
|---|
| 47 | uint32_t PE_DR_Swap_To_UFP : 1U; /*!< If supported, DR Swap to UFP can be accepted or not by the user else directly rejected */
|
|---|
| 48 | uint32_t Reserved1 :28U; /*!< Reserved bits */
|
|---|
| 49 | uint32_t Reserved_ReqPower[6]; /*!< Reserved bits to match with Resquested power information */
|
|---|
| 50 | USBPD_MIDB_TypeDef DPM_ManuInfoPort; /*!< Manufacturer information used for the port */
|
|---|
| 51 | uint32_t ReservedSnkCapa[6]; /*!< Reserved bits to match with SnkCapaExt information */
|
|---|
| 52 | uint16_t ReservedManu; /*!< Reserved bits to match with Manufacturer information */
|
|---|
| 53 | } USBPD_USER_SettingsTypeDef;
|
|---|
| 54 |
|
|---|
| 55 | typedef struct
|
|---|
| 56 | {
|
|---|
| 57 | uint32_t XID; /*!< Value provided by the USB-IF assigned to the product */
|
|---|
| 58 | uint16_t VID; /*!< Vendor ID (assigned by the USB-IF) */
|
|---|
| 59 | uint16_t PID; /*!< Product ID (assigned by the manufacturer) */
|
|---|
| 60 | } USBPD_IdSettingsTypeDef;
|
|---|
| 61 | /* USER CODE BEGIN Typedef */
|
|---|
| 62 |
|
|---|
| 63 | /* USER CODE END Typedef */
|
|---|
| 64 |
|
|---|
| 65 | /* Exported define -----------------------------------------------------------*/
|
|---|
| 66 | /* USER CODE BEGIN Define */
|
|---|
| 67 |
|
|---|
| 68 | /* USER CODE END Define */
|
|---|
| 69 |
|
|---|
| 70 | /* Exported constants --------------------------------------------------------*/
|
|---|
| 71 | /* USER CODE BEGIN Constant */
|
|---|
| 72 |
|
|---|
| 73 | /* USER CODE END Constant */
|
|---|
| 74 |
|
|---|
| 75 | /* Exported macro ------------------------------------------------------------*/
|
|---|
| 76 | /* USER CODE BEGIN Macro */
|
|---|
| 77 |
|
|---|
| 78 | /* USER CODE END Macro */
|
|---|
| 79 |
|
|---|
| 80 | /* Exported variables --------------------------------------------------------*/
|
|---|
| 81 | /* USER CODE BEGIN Private_Variables */
|
|---|
| 82 |
|
|---|
| 83 | /* USER CODE END Private_Variables */
|
|---|
| 84 |
|
|---|
| 85 | /* Exported functions --------------------------------------------------------*/
|
|---|
| 86 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS
|
|---|
| 87 | * @{
|
|---|
| 88 | */
|
|---|
| 89 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP1
|
|---|
| 90 | * @{
|
|---|
| 91 | */
|
|---|
| 92 | USBPD_StatusTypeDef USBPD_DPM_UserInit(void);
|
|---|
| 93 | void USBPD_DPM_WaitForTime(uint32_t Time);
|
|---|
| 94 | void USBPD_DPM_UserExecute(void const *argument);
|
|---|
| 95 | void USBPD_DPM_UserCableDetection(uint8_t PortNum, USBPD_CAD_EVENT State);
|
|---|
| 96 | void USBPD_DPM_UserTimerCounter(uint8_t PortNum);
|
|---|
| 97 |
|
|---|
| 98 | /**
|
|---|
| 99 | * @}
|
|---|
| 100 | */
|
|---|
| 101 |
|
|---|
| 102 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP2
|
|---|
| 103 | * @{
|
|---|
| 104 | */
|
|---|
| 105 | void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal);
|
|---|
| 106 | USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum);
|
|---|
| 107 | void USBPD_DPM_HardReset(uint8_t PortNum, USBPD_PortPowerRole_TypeDef CurrentRole, USBPD_HR_Status_TypeDef Status);
|
|---|
| 108 | void USBPD_DPM_ExtendedMessageReceived(uint8_t PortNum, USBPD_ExtendedMsg_TypeDef MsgType, uint8_t *ptrData, uint16_t DataSize);
|
|---|
| 109 | void USBPD_DPM_GetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t *Size);
|
|---|
| 110 | void USBPD_DPM_SetDataInfo(uint8_t PortNum, USBPD_CORE_DataInfoType_TypeDef DataId , uint8_t *Ptr, uint32_t Size);
|
|---|
| 111 | USBPD_StatusTypeDef USBPD_DPM_EvaluateRequest(uint8_t PortNum, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObject);
|
|---|
| 112 | USBPD_StatusTypeDef USBPD_DPM_EvaluateVconnSwap(uint8_t PortNum);
|
|---|
| 113 | USBPD_StatusTypeDef USBPD_DPM_PE_VconnPwr(uint8_t PortNum, USBPD_FunctionalState State);
|
|---|
| 114 | void USBPD_DPM_EnterErrorRecovery(uint8_t PortNum);
|
|---|
| 115 | USBPD_StatusTypeDef USBPD_DPM_EvaluateDataRoleSwap(uint8_t PortNum);
|
|---|
| 116 | USBPD_FunctionalState USBPD_DPM_IsPowerReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe);
|
|---|
| 117 |
|
|---|
| 118 | /**
|
|---|
| 119 | * @}
|
|---|
| 120 | */
|
|---|
| 121 |
|
|---|
| 122 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP3
|
|---|
| 123 | * @{
|
|---|
| 124 | */
|
|---|
| 125 | USBPD_StatusTypeDef USBPD_DPM_RequestHardReset(uint8_t PortNum);
|
|---|
| 126 | USBPD_StatusTypeDef USBPD_DPM_RequestCableReset(uint8_t PortNum);
|
|---|
| 127 | USBPD_StatusTypeDef USBPD_DPM_RequestGotoMin(uint8_t PortNum);
|
|---|
| 128 | USBPD_StatusTypeDef USBPD_DPM_RequestPing(uint8_t PortNum);
|
|---|
| 129 | USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage);
|
|---|
| 130 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapability(uint8_t PortNum);
|
|---|
| 131 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapability(uint8_t PortNum);
|
|---|
| 132 | USBPD_StatusTypeDef USBPD_DPM_RequestDataRoleSwap(uint8_t PortNum);
|
|---|
| 133 | USBPD_StatusTypeDef USBPD_DPM_RequestPowerRoleSwap(uint8_t PortNum);
|
|---|
| 134 | USBPD_StatusTypeDef USBPD_DPM_RequestVconnSwap(uint8_t PortNum);
|
|---|
| 135 | USBPD_StatusTypeDef USBPD_DPM_RequestSoftReset(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 136 | USBPD_StatusTypeDef USBPD_DPM_RequestSourceCapability(uint8_t PortNum);
|
|---|
| 137 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryIdentify(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 138 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoverySVID(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 139 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
|---|
| 140 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_EnterMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
|---|
| 141 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_ExitMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
|---|
| 142 | USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortStatus(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPStatus);
|
|---|
| 143 | USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortConfig(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPConfig);
|
|---|
| 144 | USBPD_StatusTypeDef USBPD_DPM_RequestAttention(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
|---|
| 145 | USBPD_StatusTypeDef USBPD_DPM_RequestAlert(uint8_t PortNum, USBPD_ADO_TypeDef Alert);
|
|---|
| 146 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapabilityExt(uint8_t PortNum);
|
|---|
| 147 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapabilityExt(uint8_t PortNum);
|
|---|
| 148 | USBPD_StatusTypeDef USBPD_DPM_RequestGetManufacturerInfo(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint8_t* pManuInfoData);
|
|---|
| 149 | USBPD_StatusTypeDef USBPD_DPM_RequestGetStatus(uint8_t PortNum);
|
|---|
| 150 | USBPD_StatusTypeDef USBPD_DPM_RequestFastRoleSwap(uint8_t PortNum);
|
|---|
| 151 | USBPD_StatusTypeDef USBPD_DPM_RequestGetPPS_Status(uint8_t PortNum);
|
|---|
| 152 | USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryCodes(uint8_t PortNum);
|
|---|
| 153 | USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryInfo(uint8_t PortNum, uint16_t CountryCode);
|
|---|
| 154 | USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryCapability(uint8_t PortNum, uint8_t *pBatteryCapRef);
|
|---|
| 155 | USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryStatus(uint8_t PortNum, uint8_t *pBatteryStatusRef);
|
|---|
| 156 | USBPD_StatusTypeDef USBPD_DPM_RequestSecurityRequest(uint8_t PortNum);
|
|---|
| 157 | /* USER CODE BEGIN Function */
|
|---|
| 158 |
|
|---|
| 159 | /* USER CODE END Function */
|
|---|
| 160 | /**
|
|---|
| 161 | * @}
|
|---|
| 162 | */
|
|---|
| 163 |
|
|---|
| 164 | /**
|
|---|
| 165 | * @}
|
|---|
| 166 | */
|
|---|
| 167 |
|
|---|
| 168 | /**
|
|---|
| 169 | * @}
|
|---|
| 170 | */
|
|---|
| 171 |
|
|---|
| 172 | /**
|
|---|
| 173 | * @}
|
|---|
| 174 | */
|
|---|
| 175 |
|
|---|
| 176 | #ifdef __cplusplus
|
|---|
| 177 | }
|
|---|
| 178 | #endif
|
|---|
| 179 |
|
|---|
| 180 | #endif /* __USBPD_DPM_USER_H_ */
|
|---|