| 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 | USBPD_SNKPowerRequest_TypeDef DPM_SNKRequestedPower; /*!< Requested Power by the sink board */
|
|---|
| 50 | USBPD_MIDB_TypeDef DPM_ManuInfoPort; /*!< Manufacturer information used for the port */
|
|---|
| 51 | USBPD_SKEDB_TypeDef DPM_SNKExtendedCapa; /*!< SNK Extended Capability */
|
|---|
| 52 | uint8_t ReservedSnkCapa[3]; /*!< Reserved bits to match with SnkCapaExt information */
|
|---|
| 53 | uint16_t ReservedManu; /*!< Reserved bits to match with Manufacturer information */
|
|---|
| 54 | } USBPD_USER_SettingsTypeDef;
|
|---|
| 55 |
|
|---|
| 56 | typedef struct
|
|---|
| 57 | {
|
|---|
| 58 | uint32_t XID; /*!< Value provided by the USB-IF assigned to the product */
|
|---|
| 59 | uint16_t VID; /*!< Vendor ID (assigned by the USB-IF) */
|
|---|
| 60 | uint16_t PID; /*!< Product ID (assigned by the manufacturer) */
|
|---|
| 61 | } USBPD_IdSettingsTypeDef;
|
|---|
| 62 | /* USER CODE BEGIN Typedef */
|
|---|
| 63 |
|
|---|
| 64 | /* USER CODE END Typedef */
|
|---|
| 65 |
|
|---|
| 66 | /* Exported define -----------------------------------------------------------*/
|
|---|
| 67 | /* USER CODE BEGIN Define */
|
|---|
| 68 |
|
|---|
| 69 | /* USER CODE END Define */
|
|---|
| 70 |
|
|---|
| 71 | /* Exported constants --------------------------------------------------------*/
|
|---|
| 72 | /* USER CODE BEGIN Constant */
|
|---|
| 73 |
|
|---|
| 74 | /* USER CODE END Constant */
|
|---|
| 75 |
|
|---|
| 76 | /* Exported macro ------------------------------------------------------------*/
|
|---|
| 77 | /* USER CODE BEGIN Macro */
|
|---|
| 78 |
|
|---|
| 79 | /* USER CODE END Macro */
|
|---|
| 80 |
|
|---|
| 81 | /* Exported variables --------------------------------------------------------*/
|
|---|
| 82 | /* USER CODE BEGIN Private_Variables */
|
|---|
| 83 |
|
|---|
| 84 | /* USER CODE END Private_Variables */
|
|---|
| 85 |
|
|---|
| 86 | /* Exported functions --------------------------------------------------------*/
|
|---|
| 87 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS
|
|---|
| 88 | * @{
|
|---|
| 89 | */
|
|---|
| 90 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP1
|
|---|
| 91 | * @{
|
|---|
| 92 | */
|
|---|
| 93 | USBPD_StatusTypeDef USBPD_DPM_UserInit(void);
|
|---|
| 94 | void USBPD_DPM_WaitForTime(uint32_t Time);
|
|---|
| 95 | void USBPD_DPM_UserExecute(void const *argument);
|
|---|
| 96 | void USBPD_DPM_UserCableDetection(uint8_t PortNum, USBPD_CAD_EVENT State);
|
|---|
| 97 | void USBPD_DPM_UserTimerCounter(uint8_t PortNum);
|
|---|
| 98 |
|
|---|
| 99 | /**
|
|---|
| 100 | * @}
|
|---|
| 101 | */
|
|---|
| 102 |
|
|---|
| 103 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP2
|
|---|
| 104 | * @{
|
|---|
| 105 | */
|
|---|
| 106 | void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal);
|
|---|
| 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 | void USBPD_DPM_SNK_EvaluateCapabilities(uint8_t PortNum, uint32_t *PtrRequestData, USBPD_CORE_PDO_Type_TypeDef *PtrPowerObjectType);
|
|---|
| 112 | uint32_t USBPD_DPM_SNK_EvaluateMatchWithSRCPDO(uint8_t PortNum, uint32_t SrcPDO, uint32_t* PtrRequestedVoltage, uint32_t* PtrRequestedPower);
|
|---|
| 113 | USBPD_StatusTypeDef USBPD_DPM_EvaluateVconnSwap(uint8_t PortNum);
|
|---|
| 114 | USBPD_StatusTypeDef USBPD_DPM_PE_VconnPwr(uint8_t PortNum, USBPD_FunctionalState State);
|
|---|
| 115 | void USBPD_DPM_EnterErrorRecovery(uint8_t PortNum);
|
|---|
| 116 | USBPD_StatusTypeDef USBPD_DPM_EvaluateDataRoleSwap(uint8_t PortNum);
|
|---|
| 117 | USBPD_FunctionalState USBPD_DPM_IsPowerReady(uint8_t PortNum, USBPD_VSAFE_StatusTypeDef Vsafe);
|
|---|
| 118 |
|
|---|
| 119 | /**
|
|---|
| 120 | * @}
|
|---|
| 121 | */
|
|---|
| 122 |
|
|---|
| 123 | /** @addtogroup USBPD_USER_EXPORTED_FUNCTIONS_GROUP3
|
|---|
| 124 | * @{
|
|---|
| 125 | */
|
|---|
| 126 | USBPD_StatusTypeDef USBPD_DPM_RequestHardReset(uint8_t PortNum);
|
|---|
| 127 | USBPD_StatusTypeDef USBPD_DPM_RequestCableReset(uint8_t PortNum);
|
|---|
| 128 | USBPD_StatusTypeDef USBPD_DPM_RequestGotoMin(uint8_t PortNum);
|
|---|
| 129 | USBPD_StatusTypeDef USBPD_DPM_RequestPing(uint8_t PortNum);
|
|---|
| 130 | USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage);
|
|---|
| 131 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapability(uint8_t PortNum);
|
|---|
| 132 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapability(uint8_t PortNum);
|
|---|
| 133 | USBPD_StatusTypeDef USBPD_DPM_RequestDataRoleSwap(uint8_t PortNum);
|
|---|
| 134 | USBPD_StatusTypeDef USBPD_DPM_RequestPowerRoleSwap(uint8_t PortNum);
|
|---|
| 135 | USBPD_StatusTypeDef USBPD_DPM_RequestVconnSwap(uint8_t PortNum);
|
|---|
| 136 | USBPD_StatusTypeDef USBPD_DPM_RequestSoftReset(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 137 | USBPD_StatusTypeDef USBPD_DPM_RequestSourceCapability(uint8_t PortNum);
|
|---|
| 138 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryIdentify(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 139 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoverySVID(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType);
|
|---|
| 140 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_DiscoveryMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
|---|
| 141 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_EnterMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
|---|
| 142 | USBPD_StatusTypeDef USBPD_DPM_RequestVDM_ExitMode(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint8_t ModeIndex);
|
|---|
| 143 | USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortStatus(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPStatus);
|
|---|
| 144 | USBPD_StatusTypeDef USBPD_DPM_RequestDisplayPortConfig(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID, uint32_t *pDPConfig);
|
|---|
| 145 | USBPD_StatusTypeDef USBPD_DPM_RequestAttention(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint16_t SVID);
|
|---|
| 146 | USBPD_StatusTypeDef USBPD_DPM_RequestAlert(uint8_t PortNum, USBPD_ADO_TypeDef Alert);
|
|---|
| 147 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSourceCapabilityExt(uint8_t PortNum);
|
|---|
| 148 | USBPD_StatusTypeDef USBPD_DPM_RequestGetSinkCapabilityExt(uint8_t PortNum);
|
|---|
| 149 | USBPD_StatusTypeDef USBPD_DPM_RequestGetManufacturerInfo(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, uint8_t* pManuInfoData);
|
|---|
| 150 | USBPD_StatusTypeDef USBPD_DPM_RequestGetStatus(uint8_t PortNum);
|
|---|
| 151 | USBPD_StatusTypeDef USBPD_DPM_RequestFastRoleSwap(uint8_t PortNum);
|
|---|
| 152 | USBPD_StatusTypeDef USBPD_DPM_RequestGetPPS_Status(uint8_t PortNum);
|
|---|
| 153 | USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryCodes(uint8_t PortNum);
|
|---|
| 154 | USBPD_StatusTypeDef USBPD_DPM_RequestGetCountryInfo(uint8_t PortNum, uint16_t CountryCode);
|
|---|
| 155 | USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryCapability(uint8_t PortNum, uint8_t *pBatteryCapRef);
|
|---|
| 156 | USBPD_StatusTypeDef USBPD_DPM_RequestGetBatteryStatus(uint8_t PortNum, uint8_t *pBatteryStatusRef);
|
|---|
| 157 | USBPD_StatusTypeDef USBPD_DPM_RequestSecurityRequest(uint8_t PortNum);
|
|---|
| 158 | /* USER CODE BEGIN Function */
|
|---|
| 159 |
|
|---|
| 160 | /* USER CODE END Function */
|
|---|
| 161 | /**
|
|---|
| 162 | * @}
|
|---|
| 163 | */
|
|---|
| 164 |
|
|---|
| 165 | /**
|
|---|
| 166 | * @}
|
|---|
| 167 | */
|
|---|
| 168 |
|
|---|
| 169 | /**
|
|---|
| 170 | * @}
|
|---|
| 171 | */
|
|---|
| 172 |
|
|---|
| 173 | /**
|
|---|
| 174 | * @}
|
|---|
| 175 | */
|
|---|
| 176 |
|
|---|
| 177 | #ifdef __cplusplus
|
|---|
| 178 | }
|
|---|
| 179 | #endif
|
|---|
| 180 |
|
|---|
| 181 | #endif /* __USBPD_DPM_USER_H_ */
|
|---|