PDStack Middleware Library
Functions

General Description

Describes the PDStack Function prototypes.

Functions

cy_en_pdstack_status_t Cy_PdStack_Dpm_Init (cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_usbpd_context_t *ptrUsbPdContext, const cy_stc_pdstack_port_cfg_t *ptrPortCfg, cy_stc_pdstack_app_cbk_t *ptrAppCbk, const cy_stc_pdstack_dpm_params_t *ptrDpmParams, cy_stc_pdutils_sw_timer_t *ptrTimerContext)
 Initializes the device policy manager with callback pointers and loads the port configuration information from the port config table. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Start (cy_stc_pdstack_context_t *ptrPdStackContext)
 Makes the specified USB Type-C port operational. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Stop (cy_stc_pdstack_context_t *ptrPdStackContext)
 Stops the port operation. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Disable (cy_stc_pdstack_context_t *ptrPdStackContext)
 Disables the PD port operation and limits it to receiving hard reset signaling. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_PrepareDeepSleep (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrDeepSleep)
 Configures the PD policy manager and Type-C manager state machines to allow the EZ-PD(TM) PMG1 device to be placed in DeepSleep. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Resume (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrResume)
 Resumes the Type-C manager and PD policy engine state machines after the EZ-PD(TM) PMG1 device has woken up from DeepSleep. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsSleepAllowed (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrSleepAllowed)
 Checks if the PD policy engine and Type-C manager state machines corresponding to the specified Type-C port are idle. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Rtos_Init (cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_pdstack_rtos_context_t *ptrRtosContext)
 Initializes the device policy manager with RTOS context details. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_AltModeInitContext (cy_stc_pdstack_context_t *ptrPdStackContext, void *ptrAltModeContext)
 Initializes the PDStack context with the alternate mode layer context details. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_HpiInitContext (cy_stc_pdstack_context_t *ptrPdStackContext, void *ptrHpiContext)
 Initializes the PDStack context with the HPI context details. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Task (cy_stc_pdstack_context_t *ptrPdStackContext)
 Runs the Type-C manager and PD policy manager tasks for the specified port. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SendPdCommand (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_dpm_pd_cmd_t cmd, cy_stc_pdstack_dpm_pd_cmd_buf_t *ptrCmdBuf, bool isResp, cy_pdstack_dpm_pd_cmd_cbk_t cmdCbk)
 Provides an interface for the application module to send PD commands. More...
 
cy_en_pdstack_status_t Cy_Pdstack_Dpm_SendPdCommandEc (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_dpm_pd_cmd_t cmd, cy_stc_pdstack_dpm_pd_cmd_buf_t *ptrCmdBuf, cy_pdstack_dpm_pd_cmd_cbk_t cmdCbk)
 Provides an interface for the HPI module to send PD commands. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SendTypecCommand (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_dpm_typec_cmd_t cmd, cy_pdstack_dpm_typec_cmd_cbk_t cmdCbk)
 Provides an interface for the application module to send commands to the Type-C connection manager. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtReset (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pd_sop_t sop)
 Resets PD protocol layer (transmit and receive) message ID counters for the specified PD packet type. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtResetRx (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pd_sop_t sop)
 Resets the PD receive message counter for the specified packet type. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_PeStop (cy_stc_pdstack_context_t *ptrPdStackContext)
 Stops the policy engine. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_Pd3SrcRpFlowControl (cy_stc_pdstack_context_t *ptrPdStackContext, bool blockSinkAms)
 Used to specify whether to keep the Rp termination at SinkTxNG or SinkTxOK while acting as a PD 3.0 source. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsIdle (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrIsIdle)
 Checks whether the Type-C/PD stack is idle. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearSolnBusy (cy_stc_pdstack_context_t *ptrPdStackContext)
 Informs the Type-C/PD stack that the solution state allows Type-C transitions. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetSolnBusy (cy_stc_pdstack_context_t *ptrPdStackContext)
 Informs the Type-C/PD stack that the solution state does not allow Type-C transitions. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetCf (cy_stc_pdstack_context_t *ptrPdStackContext, bool status)
 Sets/clears the current foldback status. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_PpsTask (cy_stc_pdstack_context_t *ptrPdStackContext)
 Monitors the PPS activity. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsRdoValid (cy_stc_pdstack_context_t *ptrPdStackContext, cy_pd_pd_do_t rdo)
 Evaluates any RDO with respect to the current source cap of the specified context. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateDisCounter (cy_stc_pdstack_context_t *ptrPdStackContext, bool clear)
 Clears the DPM to disable the requests counter. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateUsbComm (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t state)
 Updates the USB communication capable bit. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkUsbSusp (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t state)
 Updates the sink USB suspend enable bit. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBCRFaultStat (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t value)
 Sets the BCR fault bit status. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearBCRFaultStat (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t value)
 Clears the BCR fault bit status. More...
 
bool Cy_PdStack_Dpm_GetBistStmEn (cy_stc_pdstack_context_t *ptrPdStackContext)
 Gets the BIST STM enabled/disabled flag. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBistStmEn (cy_stc_pdstack_context_t *ptrPdStackContext, bool value)
 Sets the BIST STM enabled/disabled flag. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSrcCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t *ptrBuf)
 Updates the extended source capabilities for the PD port. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearFaultActive (cy_stc_pdstack_context_t *ptrPdStackContext)
 Clears the internal fault active flags. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsPrevContractValid (cy_stc_pdstack_context_t *ptrPdStackContext)
 Checks if the previous contract is valid, the previous contract may become invalid because of runtime update of the source caps. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePortConfig (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t role, uint8_t dflt_role, bool toggle_en, uint8_t try_src_snk_en)
 Allows changing the PD port configuration parameters such as port role, default port role, DRP toggle enable, and Try.Src enable at runtime. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateFrsEnable (cy_stc_pdstack_context_t *ptrPdStackContext, bool frsRxEn, bool frsTxEn)
 Allows to enable/disable the PD 3.0 FRS functionality. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearHardResetCount (cy_stc_pdstack_context_t *ptrPdStackContext)
 Clears the hard reset count. More...
 
uint16_t Cy_PdStack_Dpm_GetVbusVoltage (cy_stc_pdstack_context_t *ptrPdStackContext)
 Uses the application-provided callback to measure the current VBus voltage. More...
 
cy_en_pdstack_usb_data_sig_t Cy_PdStack_Dpm_GetCableUsbCap (cy_stc_pdstack_context_t *ptrPdStackContext)
 Retrieves the type of USB signaling supported by the Type-C cable in use. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDelaySrcCapStart (cy_stc_pdstack_context_t *ptrPdStackContext, uint16_t delay)
 Facilitates delaying the starting of source cap on Type-C attach. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetAlert (cy_stc_pdstack_context_t *ptrPdStackContext, cy_pd_pd_do_t alert_ado)
 Sets alert ADO on OCP/OVP fault. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_DowngradePdRev (cy_stc_pdstack_context_t *ptrPdStackContext)
 Allows downgrading the PD revision. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t *ptrBuf)
 Allows updating the extended sink capabilities for the PD port. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetFaultActive (cy_stc_pdstack_context_t *ptrPdStackContext)
 Sets internal flags to indicate that any fault (OVP/OCP/OTP, etc.) is active. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetChunkXferRunning (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_ams_type_t amsType)
 Sets the chunk transfer type. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SendHardReset (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t reason)
 Attempts to send USB PD hard reset to port partner. More...
 
uint32_t Cy_PdStack_Dpm_GetPdPortStatus (cy_stc_pdstack_context_t *ptrPdStackContext)
 Returns the PD port status as expected by the embedded controller. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSwapResponse (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t value)
 Updates the USB PD data role, power role, and vconn swap responses. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSrcEn (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t ppsSrcEn)
 Updates the PD port PPS Source Enable field. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSnkEn (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t ppsSnkEn)
 Updates the PD port PPS Sink Enable field. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePortStatus (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t *status_p, uint8_t offset, uint8_t byte_cnt)
 Updates the PD port status returned in response to a Get_Status command. More...
 
bool Cy_PdStack_Dpm_RefreshSrcCap (cy_stc_pdstack_context_t *ptrPdStackContext)
 Refreshes the source cap at runtime. More...
 
bool Cy_PdStack_Dpm_RefreshSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext)
 Refreshes the sink cap at runtime. More...
 
cy_pd_stack_conf_t Cy_PdStack_Dpm_GetStackConfig (cy_stc_pdstack_context_t *ptrPdStackContext)
 Retrieves the configurable switch values at runtime. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprActiveFlag (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag)
 Change the state of the EPR mode active flag. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprModeActive (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isActive)
 Checks whether the EPR mode is active. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprToSpr (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag)
 Changes the EPR to SPR indicator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprSpr (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isSpr)
 Checks whether the EPR PDO needs to limit it to SPR. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprAvsModeActive (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isActive)
 Checks whether the EPR AVS mode is active. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprAvsActiveFlag (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag)
 Change the state of the EPR AVS mode active flag. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsValidAvsReq (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t src_pdo_index, cy_pd_pd_do_t rdo)
 Evaluates the AVS RDO with respect to the selected AVS PDO. More...
 
void Cy_PdStack_Dpm_EprSnkSendKeepAliveCb (cy_timer_id_t id, void *ptrContext)
 Callbacks to initiate the Keepalive message. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkMaxMin (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, uint16_t *max_min)
 Updates the sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask)
 Update the sink PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo)
 Updates the sink PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask)
 Updates the source PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo)
 Update the source PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo)
 Updates the EPR source PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask)
 Update the EPR source PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo)
 Updates the EPR sink PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask)
 Updates the EPR sink PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkMaxMin (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, uint16_t *max_min)
 Updates the EPR sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD(TM) Configurator. More...
 
bool Cy_PdStack_Dpm_GetAutoVcsEnabled (cy_stc_pdstack_context_t *ptrPdStackContext)
 Checks whether the automatic VConn swap is enabled. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateAutoVcsEnable (cy_stc_pdstack_context_t *ptrPdStackContext, bool val)
 Enables/disables the automatic VConn swap by the PD policy engine. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateVconnRetain (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t val)
 Enables/disables the VConn retain setting. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDataReset (cy_stc_pdstack_context_t *ptrPdStackContext, bool value)
 Enables/disables the data reset support. More...
 
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateTimingParams (cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_pdstack_pd_timer_params_t *ptrPdTimerParams)
 Used to override the default values of the following PDStack timer periods: PD2 sender response timer period PD3 sender response timer period CC debounce timer period Maximum cable discovery count. More...
 
cy_stc_pdstack_context_tCy_PdStack_Dpm_GetContext (uint8_t port)
 This API returns the pointer to the cy_stc_pdstack_context_t of the given port. More...
 

Function Documentation

◆ Cy_PdStack_Dpm_Init()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Init ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_stc_usbpd_context_t *  ptrUsbPdContext,
const cy_stc_pdstack_port_cfg_t ptrPortCfg,
cy_stc_pdstack_app_cbk_t ptrAppCbk,
const cy_stc_pdstack_dpm_params_t ptrDpmParams,
cy_stc_pdutils_sw_timer_t *  ptrTimerContext 
)

Initializes the device policy manager with callback pointers and loads the port configuration information from the port config table.

This function also initializes the PD policy engine and Type-C connection manager.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrUsbPdContextUSB PD driver context pointer.
ptrPortCfgPort configuration pointer.
ptrAppCbkApplication callback function pointer.
ptrDpmParamsPointer to the DPM parameter information structure.
ptrTimerContextPointer to soft timer context structure.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.

◆ Cy_PdStack_Dpm_Start()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Start ( cy_stc_pdstack_context_t ptrPdStackContext)

Makes the specified USB Type-C port operational.

The port to be updated is specified by passing the PD stack context corresponding to it.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer is invalid. CY_PDSTACK_STAT_FAILURE if the operation fails.

◆ Cy_PdStack_Dpm_Stop()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Stop ( cy_stc_pdstack_context_t ptrPdStackContext)

Stops the port operation.

The USB PD block corresponding to the port will be disabled.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer is invalid. CY_PDSTACK_STAT_FAILURE if the operation fails.

◆ Cy_PdStack_Dpm_Disable()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Disable ( cy_stc_pdstack_context_t ptrPdStackContext)

Disables the PD port operation and limits it to receiving hard reset signaling.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer is invalid. CY_PDSTACK_STAT_FAILURE if the operation fails.

◆ Cy_PdStack_Dpm_PrepareDeepSleep()

cy_en_pdstack_status_t Cy_PdStack_Dpm_PrepareDeepSleep ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  ptrDeepSleep 
)

Configures the PD policy manager and Type-C manager state machines to allow the EZ-PD(TM) PMG1 device to be placed in DeepSleep.

If the state machines are not in a busy state, the USB PD block is configured to trigger a wake-up interrupt on any activity and the location pointed by ptrDeepSleep is set to true. If the state machines are busy, the location pointed by ptrDeepSleep is set to false to indicate that the EZ-PD(TM) PMG1 device shall not proceed into DeepSleep.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrDeepSleepOutput parameter contains true if DeepSleep is possible and configured, otherwise false.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer or the ptrDeepSleep is invalid. CY_PDSTACK_STAT_FAILURE if the operation fails.

◆ Cy_PdStack_Dpm_Resume()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Resume ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  ptrResume 
)

Resumes the Type-C manager and PD policy engine state machines after the EZ-PD(TM) PMG1 device has woken up from DeepSleep.

It needs to be called to resume the stack operation if Cy_PdStack_Dpm_PrepareDeepSleep has previously been called and returned true. This needs to be done even if the EZ-PD(TM) PMG1 device did not go into DeepSleep because of other reasons.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrResumeOutput parameter contains true if successful otherwise, false.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer or the ptrResume is invalid.

◆ Cy_PdStack_Dpm_IsSleepAllowed()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsSleepAllowed ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  ptrSleepAllowed 
)

Checks if the PD policy engine and Type-C manager state machines corresponding to the specified Type-C port are idle.

If this function indicates that the state machines are busy, DeepSleep entry using the Cy_PdStack_Dpm_PrepareDeepSleep should not be attempted.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrSleepAllowedOutput parameter contains true if possible to go into sleep mode, otherwise false.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer or the ptrSleepAllowed is invalid.

◆ Cy_PdStack_Dpm_Rtos_Init()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Rtos_Init ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_stc_pdstack_rtos_context_t ptrRtosContext 
)

Initializes the device policy manager with RTOS context details.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrRtosContextPointer to RTOS API's callback context.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.

◆ Cy_PdStack_Dpm_AltModeInitContext()

cy_en_pdstack_status_t Cy_PdStack_Dpm_AltModeInitContext ( cy_stc_pdstack_context_t ptrPdStackContext,
void *  ptrAltModeContext 
)

Initializes the PDStack context with the alternate mode layer context details.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrAltModeContextPointer to the alternate mode context.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.

◆ Cy_PdStack_Dpm_HpiInitContext()

cy_en_pdstack_status_t Cy_PdStack_Dpm_HpiInitContext ( cy_stc_pdstack_context_t ptrPdStackContext,
void *  ptrHpiContext 
)

Initializes the PDStack context with the HPI context details.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrHpiContextPointer to the HPI context.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.

◆ Cy_PdStack_Dpm_Task()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Task ( cy_stc_pdstack_context_t ptrPdStackContext)

Runs the Type-C manager and PD policy manager tasks for the specified port.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context pointer is invalid.

◆ Cy_PdStack_Dpm_SendPdCommand()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SendPdCommand ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pdstack_dpm_pd_cmd_t  cmd,
cy_stc_pdstack_dpm_pd_cmd_buf_t ptrCmdBuf,
bool  isResp,
cy_pdstack_dpm_pd_cmd_cbk_t  cmdCbk 
)

Provides an interface for the application module to send PD commands.

Parameters
ptrPdStackContextPDStack library context pointer.
cmdType of command to be initiated.
ptrCmdBufPointer to the command buffer.
isRespSet to true when the API is called to send a response to the previously received PD messages.
cmdCbkPointer to the callback function.
Returns
CY_PDSTACK_STAT_SUCCESS if the command is registered. CY_PDSTACK_STAT_CMD_FAILURE if the PD port is not ready for a command. CY_PDSTACK_STAT_BUSY if there is another pending command. CY_PDSTACK_STAT_BAD_PARAM if any of the parameters are invalid.

◆ Cy_Pdstack_Dpm_SendPdCommandEc()

cy_en_pdstack_status_t Cy_Pdstack_Dpm_SendPdCommandEc ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pdstack_dpm_pd_cmd_t  cmd,
cy_stc_pdstack_dpm_pd_cmd_buf_t ptrCmdBuf,
cy_pdstack_dpm_pd_cmd_cbk_t  cmdCbk 
)

Provides an interface for the HPI module to send PD commands.

This is meant for the HPI module wherein responses come from EC.

Parameters
ptrPdStackContextPDStack library context pointer.
cmdType of command to be initiated.
ptrCmdBufPointer to the command buffer.
cmdCbkPointer to the callback function.
Returns
CY_PDSTACK_STAT_SUCCESS if the command is registered. CY_PDSTACK_STAT_CMD_FAILURE if the PD port is not ready for a command. CY_PDSTACK_STAT_BUSY if there is another pending command. CY_PDSTACK_STAT_BAD_PARAM if any of the parameters are invalid.

◆ Cy_PdStack_Dpm_SendTypecCommand()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SendTypecCommand ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pdstack_dpm_typec_cmd_t  cmd,
cy_pdstack_dpm_typec_cmd_cbk_t  cmdCbk 
)

Provides an interface for the application module to send commands to the Type-C connection manager.

Parameters
ptrPdStackContextPDStack library context pointer.
cmdType of command to be performed.
cmdCbkPointer to the callback function.
Returns
CY_PDSTACK_STAT_SUCCESS if the command is registered. CY_PDSTACK_STAT_CMD_FAILURE if the PD port is not ready for a command. CY_PDSTACK_STAT_BUSY if there is another pending command. CY_PDSTACK_STAT_BAD_PARAM if any of the parameters are invalid.

◆ Cy_PdStack_Dpm_ProtReset()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtReset ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pd_sop_t  sop 
)

Resets PD protocol layer (transmit and receive) message ID counters for the specified PD packet type.

The message ID will be set to zero on the next PD message transmitted by the EZ-PD(TM) PMG1. Message ID checks will not be performed for the next PD message of this type which is received by the EZ-PD(TM) PMG1.

Parameters
ptrPdStackContextPDStack library context pointer.
sopPacket type (SOP, SOP', or SOP'')
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context parameter is or the sop value is invalid.

◆ Cy_PdStack_Dpm_ProtResetRx()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtResetRx ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pd_sop_t  sop 
)

Resets the PD receive message counter for the specified packet type.

This causes the stack to skip checking for a valid message ID on the next PD message of this type that is received.

Parameters
ptrPdStackContextPDStack library context pointer.
sopPacket type (SOP, SOP', or SOP'')
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context parameter or sop value is invalid.

◆ Cy_PdStack_Dpm_PeStop()

cy_en_pdstack_status_t Cy_PdStack_Dpm_PeStop ( cy_stc_pdstack_context_t ptrPdStackContext)

Stops the policy engine.

Used in a fault scenario where-in the USB PD communication needs to be stopped, but the Type-C manager needs to be active to detect detach of the faulty device.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the context parameter is invalid.

◆ Cy_PdStack_Dpm_Pd3SrcRpFlowControl()

cy_en_pdstack_status_t Cy_PdStack_Dpm_Pd3SrcRpFlowControl ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  blockSinkAms 
)

Used to specify whether to keep the Rp termination at SinkTxNG or SinkTxOK while acting as a PD 3.0 source.

The PD policy engine has a default source implementation where it changes the Rp to SinkTxNG before sending any PD messages and reverts the Rp to SinkTxOK at the end of the AMS. It can be used to speed up operations when initiating back-to-back AMS-es by preventing the Rp from being changed back to SinkTxOK after each AMS.

Parameters
ptrPdStackContextPDStack library context pointer.
blockSinkAmsIf true, Rp will be changed to SinkTxNG; if false, Rp will be changed to SinkTxOK.
Returns
CY_PDSTACK_STAT_SUCCESS if DUT is a PD 3.0 source. CY_PDSTACK_STAT_CMD_FAILURE if DUT is not a PD 3.0 source. CY_PDSTACK_STAT_BAD_PARAM if the context parameter is invalid.

◆ Cy_PdStack_Dpm_IsIdle()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsIdle ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  ptrIsIdle 
)

Checks whether the Type-C/PD stack is idle.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrIsIdleOutput parameter contains true if idle, false if any operations are pending on any port.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_ClearSolnBusy()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearSolnBusy ( cy_stc_pdstack_context_t ptrPdStackContext)

Informs the Type-C/PD stack that the solution state allows Type-C transitions.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetSolnBusy()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetSolnBusy ( cy_stc_pdstack_context_t ptrPdStackContext)

Informs the Type-C/PD stack that the solution state does not allow Type-C transitions.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetCf()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetCf ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  status 
)

Sets/clears the current foldback status.

Parameters
ptrPdStackContextPDStack library context pointer.
statusCurrent foldback status.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_PpsTask()

cy_en_pdstack_status_t Cy_PdStack_Dpm_PpsTask ( cy_stc_pdstack_context_t ptrPdStackContext)

Monitors the PPS activity.

It needs to be called periodically when in the PPS mode of operation. Because the VBUS voltage is expected to have stabilized when invoking this function, this is not handled internally and is expected to be triggered from the application layer. The recommended periodicity for this is 100 ms.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_IsRdoValid()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsRdoValid ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_pd_pd_do_t  rdo 
)

Evaluates any RDO with respect to the current source cap of the specified context.

Parameters
ptrPdStackContextPDStack library context pointer.
rdoRequests data object.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateDisCounter()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateDisCounter ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  clear 
)

Clears the DPM to disable the requests counter.

Parameters
ptrPdStackContextPDStack library context pointer.
clearTrue if the port disables request counter needs to be cleared. False if the port disables request counter needs to be incremented.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateUsbComm()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateUsbComm ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  state 
)

Updates the USB communication capable bit.

Parameters
ptrPdStackContextPDStack library context pointer.
stateNew value of the USB communication capable bit.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateSnkUsbSusp()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkUsbSusp ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  state 
)

Updates the sink USB suspend enable bit.

Parameters
ptrPdStackContextPDStack library context pointer.
stateNew value of the sink USB suspend enable bit.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if sink USB suspend is updated. CY_PDSTACK_STAT_BAD_PARAM if invalid parameters passed.

◆ Cy_PdStack_Dpm_SetBCRFaultStat()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBCRFaultStat ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  value 
)

Sets the BCR fault bit status.

Parameters
ptrPdStackContextPDStack library context pointer.
valueFault bit which needs to be set.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_ClearBCRFaultStat()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearBCRFaultStat ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  value 
)

Clears the BCR fault bit status.

Parameters
ptrPdStackContextPDStack library context pointer.
valueFault bit which needs to be cleared.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_GetBistStmEn()

bool Cy_PdStack_Dpm_GetBistStmEn ( cy_stc_pdstack_context_t ptrPdStackContext)

Gets the BIST STM enabled/disabled flag.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
True if BIST STM is enabled. False if BIST STM is disabled.

◆ Cy_PdStack_Dpm_SetBistStmEn()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBistStmEn ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  value 
)

Sets the BIST STM enabled/disabled flag.

Parameters
ptrPdStackContextPDStack library context pointer.
valueValue to be set. Set true to enable and false to disable.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateExtSrcCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSrcCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t *  ptrBuf 
)

Updates the extended source capabilities for the PD port.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrBufPointer to a buffer containing extended source capabilities data.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_ClearFaultActive()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearFaultActive ( cy_stc_pdstack_context_t ptrPdStackContext)

Clears the internal fault active flags.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_IsPrevContractValid()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsPrevContractValid ( cy_stc_pdstack_context_t ptrPdStackContext)

Checks if the previous contract is valid, the previous contract may become invalid because of runtime update of the source caps.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the previous contract is valid. CY_PDSTACK_STAT_FAILURE if the previous contract is invalid.

◆ Cy_PdStack_Dpm_UpdatePortConfig()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePortConfig ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  role,
uint8_t  dflt_role,
bool  toggle_en,
uint8_t  try_src_snk_en 
)

Allows changing the PD port configuration parameters such as port role, default port role, DRP toggle enable, and Try.Src enable at runtime.

These changes are allowed while the corresponding PD port is disabled.

Parameters
ptrPdStackContextPDStack library context pointer.
roleNew port role selection (0 = Sink, 1 = Source, 2 = Dua-role).
dflt_roleNew default port role selection (0 = Sink, 1 = Source).
toggle_enNew value for DRP toggle enable flag.
try_src_snk_enNew value for Try.SRC/ TRY.SNK enable flag (0 = Both Try.SRC and TRY.SNK are disabled, 1 = Try.SRC is enabled, 2 = TRY.SNK is enabled).
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid. CY_PDSTACK_STAT_FAILURE if the port is not disabled.

◆ Cy_PdStack_Dpm_UpdateFrsEnable()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateFrsEnable ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  frsRxEn,
bool  frsTxEn 
)

Allows to enable/disable the PD 3.0 FRS functionality.

Parameters
ptrPdStackContextPDStack library context pointer.
frsRxEnWhether FRS receive is to be enabled.
frsTxEnWhether FRS transmit is to be enabled.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid. CY_PDSTACK_STAT_FAILURE if the port is not disabled.

◆ Cy_PdStack_Dpm_ClearHardResetCount()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearHardResetCount ( cy_stc_pdstack_context_t ptrPdStackContext)

Clears the hard reset count.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_GetVbusVoltage()

uint16_t Cy_PdStack_Dpm_GetVbusVoltage ( cy_stc_pdstack_context_t ptrPdStackContext)

Uses the application-provided callback to measure the current VBus voltage.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
VBus voltage in mV units.

◆ Cy_PdStack_Dpm_GetCableUsbCap()

cy_en_pdstack_usb_data_sig_t Cy_PdStack_Dpm_GetCableUsbCap ( cy_stc_pdstack_context_t ptrPdStackContext)

Retrieves the type of USB signaling supported by the Type-C cable in use.

The information is calculated based on the cable VDO responses obtained from the cable marker.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
USB data signaling supported by the cable marker if known, CY_PDSTACK_USB_SIG_UNKNOWN otherwise.

◆ Cy_PdStack_Dpm_SetDelaySrcCapStart()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDelaySrcCapStart ( cy_stc_pdstack_context_t ptrPdStackContext,
uint16_t  delay 
)

Facilitates delaying the starting of source cap on Type-C attach.

Applicable only when the cable is not present.

Parameters
ptrPdStackContextPDStack library context pointer.
delayDelay in ms.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetAlert()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetAlert ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_pd_pd_do_t  alert_ado 
)

Sets alert ADO on OCP/OVP fault.

Stack automatically sends an alert after explicit contract when alert ADO is non-zero. After the alert is sent or detach happens; alert ADO will be cleared automatically by the stack.

Parameters
ptrPdStackContextPDStack library context pointer.
alert_adoAlert augmented data object.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_DowngradePdRev()

cy_en_pdstack_status_t Cy_PdStack_Dpm_DowngradePdRev ( cy_stc_pdstack_context_t ptrPdStackContext)

Allows downgrading the PD revision.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateExtSnkCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSnkCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t *  ptrBuf 
)

Allows updating the extended sink capabilities for the PD port.

Parameters
ptrPdStackContextPDStack library context pointer.
ptrBufPointer to a buffer containing extended sink capabilities data.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetFaultActive()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetFaultActive ( cy_stc_pdstack_context_t ptrPdStackContext)

Sets internal flags to indicate that any fault (OVP/OCP/OTP, etc.) is active.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetChunkXferRunning()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetChunkXferRunning ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_en_pdstack_ams_type_t  amsType 
)

Sets the chunk transfer type.

This should be called after the response of a chunk is received inform the stack that chunked transfer has not been completed.

Parameters
ptrPdStackContextPDStack library context pointer.
amsTypeType of PD atomic message sequence that is running.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SendHardReset()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SendHardReset ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  reason 
)

Attempts to send USB PD hard reset to port partner.

Parameters
ptrPdStackContextPDStack library context pointer.
reasonReason for the hard reset. Used for internal status tracking only.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_GetPdPortStatus()

uint32_t Cy_PdStack_Dpm_GetPdPortStatus ( cy_stc_pdstack_context_t ptrPdStackContext)

Returns the PD port status as expected by the embedded controller.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
PD port status in the format expected by the embedded controller.

◆ Cy_PdStack_Dpm_UpdateSwapResponse()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSwapResponse ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  value 
)

Updates the USB PD data role, power role, and vconn swap responses.

Parameters
ptrPdStackContextPDStack library context pointer.
valueNew swap response.
Returns
cy_en_pdstack_status_t CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_FAILURE if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdatePpsSrcEn()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSrcEn ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  ppsSrcEn 
)

Updates the PD port PPS Source Enable field.

Parameters
ptrPdStackContextPDStack library context pointer.
ppsSrcEnwhether to enable PPS Source or not.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdatePpsSnkEn()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSnkEn ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  ppsSnkEn 
)

Updates the PD port PPS Sink Enable field.

Parameters
ptrPdStackContextPDStack library context pointer.
ppsSnkEnwhether to enable PPS Sink or not.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdatePortStatus()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePortStatus ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t *  status_p,
uint8_t  offset,
uint8_t  byte_cnt 
)

Updates the PD port status returned in response to a Get_Status command.

Parameters
ptrPdStackContextPDStack library context pointer.
status_pPointer to a buffer containing the port status.
offsetNumber of bytes of offset to be applied while updating the status.
byte_cntNumber of bytes of status to be updated.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_RefreshSrcCap()

bool Cy_PdStack_Dpm_RefreshSrcCap ( cy_stc_pdstack_context_t ptrPdStackContext)

Refreshes the source cap at runtime.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
Returns true if the operation is successful otherwise, false.

◆ Cy_PdStack_Dpm_RefreshSnkCap()

bool Cy_PdStack_Dpm_RefreshSnkCap ( cy_stc_pdstack_context_t ptrPdStackContext)

Refreshes the sink cap at runtime.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
Returns true if the operation is successful otherwise, false.

◆ Cy_PdStack_Dpm_GetStackConfig()

cy_pd_stack_conf_t Cy_PdStack_Dpm_GetStackConfig ( cy_stc_pdstack_context_t ptrPdStackContext)

Retrieves the configurable switch values at runtime.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
Structure indicating the current stack configuration.

◆ Cy_PdStack_Dpm_ChangeEprActiveFlag()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprActiveFlag ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  flag 
)

Change the state of the EPR mode active flag.

Parameters
ptrPdStackContextPDStack library context pointer.
flagSets/resets the EPR active flag.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_IsEprModeActive()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprModeActive ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  isActive 
)

Checks whether the EPR mode is active.

Parameters
ptrPdStackContextPDStack library context pointer.
isActiveState of the EPR flag.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_ChangeEprToSpr()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprToSpr ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  flag 
)

Changes the EPR to SPR indicator.

Parameters
ptrPdStackContextPDstack library context pointer.
flagSets/resets the EPR flag to limit the PDO index.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_IsEprSpr()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprSpr ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  isSpr 
)

Checks whether the EPR PDO needs to limit it to SPR.

Parameters
ptrPdStackContextPDStack library context pointer.
isSprContains true if eval PDO needs to limit PDO count to SPR otherwise, false.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_IsEprAvsModeActive()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprAvsModeActive ( cy_stc_pdstack_context_t ptrPdStackContext,
bool *  isActive 
)

Checks whether the EPR AVS mode is active.

Parameters
ptrPdStackContextPDStack library context pointer.
isActiveState of the EPR flag.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_ChangeEprAvsActiveFlag()

cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprAvsActiveFlag ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  flag 
)

Change the state of the EPR AVS mode active flag.

Parameters
ptrPdStackContextPDStack library context pointer.
flagSets/resets the EPR AVS active flag.
Returns
cy_en_pdstack_status_t

◆ Cy_PdStack_Dpm_IsValidAvsReq()

cy_en_pdstack_status_t Cy_PdStack_Dpm_IsValidAvsReq ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  src_pdo_index,
cy_pd_pd_do_t  rdo 
)

Evaluates the AVS RDO with respect to the selected AVS PDO.

Parameters
ptrPdStackContextPDStack library context pointer.
src_pdo_indexSRC PDO index.
rdoRequests data object received from the port partner.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_EprSnkSendKeepAliveCb()

void Cy_PdStack_Dpm_EprSnkSendKeepAliveCb ( cy_timer_id_t  id,
void *  ptrContext 
)

Callbacks to initiate the Keepalive message.

Parameters
idTimer index.
ptrContextCallback context.
Returns
None.

◆ Cy_PdStack_Dpm_UpdateSnkMaxMin()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkMaxMin ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
uint16_t *  max_min 
)

Updates the sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
countNumber of PDOs.
max_minPointer to max/min current/power array.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateSnkCapMask()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCapMask ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  mask 
)

Update the sink PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
maskPDO mask.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateSnkCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
cy_pd_pd_do_t *  pdo 
)

Updates the sink PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPSStack library context pointer.
countNumber of PDOs.
pdoPointer to the PDO array.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateSrcCapMask()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCapMask ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  mask 
)

Updates the source PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
maskPDO mask.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful, CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateSrcCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
cy_pd_pd_do_t *  pdo 
)

Update the source PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
countNumber of PDOs.
pdoPointer to the PDO array.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateEprSrcCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
cy_pd_pd_do_t *  pdo 
)

Updates the EPR source PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
countNumber of PDOs.
pdoPointer to the PDO array
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateEprSrcCapMask()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCapMask ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  mask 
)

Update the EPR source PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
maskPDO mask.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateEprSnkCap()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCap ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
cy_pd_pd_do_t *  pdo 
)

Updates the EPR sink PDOs at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
countNumber of PDOs.
pdoPointer to the PDO array.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateEprSnkCapMask()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCapMask ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  mask 
)

Updates the EPR sink PDO mask at runtime thereby overriding the generated configuration by the EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
maskPDO mask.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateEprSnkMaxMin()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkMaxMin ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  count,
uint16_t *  max_min 
)

Updates the EPR sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD(TM) Configurator.

Parameters
ptrPdStackContextPDStack library context pointer.
countNumber of PDOs.
max_minPointer to max/min current/power array.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_GetAutoVcsEnabled()

bool Cy_PdStack_Dpm_GetAutoVcsEnabled ( cy_stc_pdstack_context_t ptrPdStackContext)

Checks whether the automatic VConn swap is enabled.

Parameters
ptrPdStackContextPDStack library context pointer.
Returns
True if the automatic VConn swap by the stack is enabled.

◆ Cy_PdStack_Dpm_UpdateAutoVcsEnable()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateAutoVcsEnable ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  val 
)

Enables/disables the automatic VConn swap by the PD policy engine.

Parameters
ptrPdStackContextPDStack library context pointer.
valWhether to enable the automatic VConn swap.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateVconnRetain()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateVconnRetain ( cy_stc_pdstack_context_t ptrPdStackContext,
uint8_t  val 
)

Enables/disables the VConn retain setting.

Parameters
ptrPdStackContextPDStack library context pointer.
valWhether to enable the VConn retain setting.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_SetDataReset()

cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDataReset ( cy_stc_pdstack_context_t ptrPdStackContext,
bool  value 
)

Enables/disables the data reset support.

Parameters
ptrPdStackContextPDStack library context pointer.
valueTrue - Enable data reset support. False - Disable data reset support.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_UpdateTimingParams()

cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateTimingParams ( cy_stc_pdstack_context_t ptrPdStackContext,
cy_stc_pdstack_pd_timer_params_t ptrPdTimerParams 
)

Used to override the default values of the following PDStack timer periods: PD2 sender response timer period PD3 sender response timer period CC debounce timer period Maximum cable discovery count.

The default values for PD2 sender response timer period, PD3 sender response timer period, CC debounce timer period, and error recovery delay is initialized with the following values: CY_PD_2_SENDER_RESPONSE_TIMER_PERIOD CY_PD_3_SENDER_RESPONSE_TIMER_PERIOD CY_PD_TYPEC_CC_DEBOUNCE_TIMER_PERIOD CY_PD_TYPEC_ERROR_RECOVERY_TIMER_PERIOD

Parameters
ptrPdStackContextPDStack library context pointer.
ptrPdTimerParamsPointer to PD timer structure containing new timer periods to be used.
Returns
CY_PDSTACK_STAT_SUCCESS if the operation is successful. CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.

◆ Cy_PdStack_Dpm_GetContext()

cy_stc_pdstack_context_t* Cy_PdStack_Dpm_GetContext ( uint8_t  port)

This API returns the pointer to the cy_stc_pdstack_context_t of the given port.

This API should be called after Cy_PdStack_Dpm_Init () has been called.

Parameters
portThe selected port.
Returns
Pointer to the PDStack context for a given port. NULL if the port is invalid