Skip to content
Permalink
d7d4e94f08
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 1770 lines (1682 sloc) 62.9 KB
/***************************************************************************//**
* \file cy_pdstack_dpm.h
* \version 3.20
*
* Header file of Device Policy Manager of the PDStack middleware.
*
********************************************************************************
* \copyright
* Copyright 2021-2024, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_PDSTACK_DPM_H)
#define CY_PDSTACK_DPM_H
#include "cy_pdstack_common.h"
/*******************************************************************************
* Type definitions
*******************************************************************************/
/**
* \addtogroup group_pdstack_functions
* \{
*/
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Init
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrUsbPdContext
* USB PD driver context pointer.
*
* \param ptrPortCfg
* Port configuration pointer.
*
* \param ptrAppCbk
* Application callback function pointer.
*
* \param ptrDpmParams
* Pointer to the DPM parameter information structure.
*
* \param ptrTimerContext
* Pointer to soft timer context structure.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_Init(
/* Pointer to the pdstack context. Initialized as a part of this function. */
cy_stc_pdstack_context_t *ptrPdStackContext,
/* This is required because the PDStack middleware calls to the USB PD PDL. */
cy_stc_usbpd_context_t *ptrUsbPdContext,
/* Pointer to the port config structure - generated by the EZ-PD(TM) Configurator. */
const cy_stc_pdstack_port_cfg_t *ptrPortCfg,
/* Pointer to the application callbacks. */
cy_stc_pdstack_app_cbk_t* ptrAppCbk,
/* Pointer to the DPM Params. */
const cy_stc_pdstack_dpm_params_t *ptrDpmParams,
/* Pointer to soft timer context. */
cy_stc_pdutils_sw_timer_t *ptrTimerContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Start
****************************************************************************//**
*
* Makes the specified USB Type-C port operational. The port to be
* updated is specified by passing the PD stack context corresponding to it.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_Start(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Stop
****************************************************************************//**
*
* Stops the port operation. The USB PD block corresponding to the
* port will be disabled.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_Stop(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Disable
****************************************************************************//**
*
* Disables the PD port operation and limits it to receiving hard
* reset signaling.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_Disable(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_PrepareDeepSleep
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrDeepSleep
* Output parameter contains true if DeepSleep is possible and configured,
* otherwise false.
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_PrepareDeepSleep(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *ptrDeepSleep);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Resume
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrResume
* Output parameter contains true if successful otherwise, false.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the context pointer or the ptrResume is
* invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_Resume(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *ptrResume);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsSleepAllowed
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrSleepAllowed
* Output parameter contains true if possible to go into sleep mode, otherwise
* false.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the context pointer or the ptrSleepAllowed is
* invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsSleepAllowed(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *ptrSleepAllowed);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Rtos_Init
****************************************************************************//**
*
* Initializes the device policy manager with RTOS context details.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrRtosContext
* Pointer to RTOS API's callback context.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_Rtos_Init(
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_stc_pdstack_rtos_context_t *ptrRtosContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_AltModeInitContext
****************************************************************************//**
*
* Initializes the PDStack context with the alternate mode layer
* context details.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrAltModeContext
* Pointer to the alternate mode context.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_AltModeInitContext (
cy_stc_pdstack_context_t *ptrPdStackContext,
void *ptrAltModeContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_HpiInitContext
****************************************************************************//**
*
* Initializes the PDStack context with the HPI context details.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrHpiContext
* Pointer to the HPI context.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the input parameters are not valid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_HpiInitContext (
cy_stc_pdstack_context_t *ptrPdStackContext,
void *ptrHpiContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Task
****************************************************************************//**
*
* Runs the Type-C manager and PD policy manager tasks for the
* specified port.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the context pointer is invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_Task(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SendPdCommand
****************************************************************************//**
*
* Provides an interface for the application module to send PD commands.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param cmd
* Type of command to be initiated.
*
* \param ptrCmdBuf
* Pointer to the command buffer.
*
* \param isResp
* Set to true when the API is called to send a response to the previously received PD messages.
*
* \param cmdCbk
* Pointer to the callback function.
*
* \return
* 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_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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SendPdCommandEc
****************************************************************************//**
*
* Provides an interface for the HPI module to
* send PD commands. This is meant for the HPI module wherein responses come from EC.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param cmd
* Type of command to be initiated.
*
* \param ptrCmdBuf
* Pointer to the command buffer.
*
* \param cmdCbk
* Pointer to the callback function.
*
* \return
* 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_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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SendTypecCommand
****************************************************************************//**
*
* Provides an interface for the application module to send commands
* to the Type-C connection manager.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param cmd
* Type of command to be performed.
*
* \param cmdCbk
* Pointer to the callback function.
*
* \return
* 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_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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ProtReset
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param sop
* Packet type (SOP, SOP', or SOP'')
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_ProtReset(
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_en_pd_sop_t sop);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ProtResetRx
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param sop
* Packet type (SOP, SOP', or SOP'')
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the context parameter or sop value is invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtResetRx(
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_en_pd_sop_t sop);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_PeStop
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the context parameter is invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_PeStop(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_Pd3SrcRpFlowControl
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param blockSinkAms
* If true, Rp will be changed to SinkTxNG; if false, Rp will be changed to SinkTxOK.
*
* \return
* 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_en_pdstack_status_t Cy_PdStack_Dpm_Pd3SrcRpFlowControl(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool blockSinkAms);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsIdle
****************************************************************************//**
*
* Checks whether the Type-C/PD stack is idle.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrIsIdle
* Output parameter contains true if idle, false if any operations are pending
* on any port.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsIdle(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *ptrIsIdle);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ClearSolnBusy
****************************************************************************//**
*
* Informs the Type-C/PD stack that the solution state
* allows Type-C transitions.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearSolnBusy(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ClearSolnBusy
****************************************************************************//**
*
* Informs the Type-C/PD stack that the solution state does not
* allow Type-C transitions.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetSolnBusy(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetCf
****************************************************************************//**
*
* Sets/clears the current foldback status.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param status
* Current foldback status.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetCf (
cy_stc_pdstack_context_t *ptrPdStackContext,
bool status);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_PpsTask
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_PpsTask (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsRdoValid
****************************************************************************//**
*
* Evaluates any RDO with respect to the current source cap of the specified context.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param rdo
* Requests data object.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsRdoValid (
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_pd_pd_do_t rdo);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateDisCounter
****************************************************************************//**
*
* Clears the DPM to disable the requests counter.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param clear
* True if the port disables request counter needs to be cleared.
* False if the port disables request counter needs to be incremented.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateDisCounter (
cy_stc_pdstack_context_t *ptrPdStackContext,
bool clear);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateUsbComm
****************************************************************************//**
*
* Updates the USB communication capable bit.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param state
* New value of the USB communication capable bit.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateUsbComm (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t state);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSnkUsbSusp
****************************************************************************//**
*
* Updates the sink USB suspend enable bit.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param state
* New value of the sink USB suspend enable bit.
*
* \return
* \ref 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_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkUsbSusp (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t state);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetBCRFaultStat
****************************************************************************//**
*
* Sets the BCR fault bit status.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param value
* Fault bit which needs to be set.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBCRFaultStat (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t value);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ClearBCRFaultStat
****************************************************************************//**
*
* Clears the BCR fault bit status.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param value
* Fault bit which needs to be cleared.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearBCRFaultStat (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t value);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetBistStmEn
****************************************************************************//**
*
* Gets the BIST STM enabled/disabled flag.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* True if BIST STM is enabled.
* False if BIST STM is disabled.
*
*******************************************************************************/
bool Cy_PdStack_Dpm_GetBistStmEn (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetBistStmEn
****************************************************************************//**
*
* Sets the BIST STM enabled/disabled flag.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param value
* Value to be set. Set true to enable and false to disable.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetBistStmEn (
cy_stc_pdstack_context_t *ptrPdStackContext,
bool value);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateExtSrcCap
****************************************************************************//**
*
* Updates the extended source capabilities for the PD port.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrBuf
* Pointer to a buffer containing extended source capabilities data.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSrcCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t *ptrBuf);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ClearFaultActive
****************************************************************************//**
*
* Clears the internal fault active flags.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearFaultActive (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsPrevContractValid
****************************************************************************//**
*
* Checks if the previous contract is valid, the previous contract may
* become invalid because of runtime update of the source caps.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* \ref 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_en_pdstack_status_t Cy_PdStack_Dpm_IsPrevContractValid (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdatePortConfig
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param role
* New port role selection (0 = Sink, 1 = Source, 2 = Dua-role).
*
* \param dflt_role
* New default port role selection (0 = Sink, 1 = Source).
*
* \param toggle_en
* New value for DRP toggle enable flag.
*
* \param try_src_snk_en
* New 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).
*
* \return
* \ref 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_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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateFrsEnable
****************************************************************************//**
*
* Allows to enable/disable the PD 3.0 FRS functionality.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param frsRxEn
* Whether FRS receive is to be enabled.
*
* \param frsTxEn
* Whether FRS transmit is to be enabled.
*
* \return
* \ref 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_en_pdstack_status_t Cy_PdStack_Dpm_UpdateFrsEnable (
cy_stc_pdstack_context_t *ptrPdStackContext,
bool frsRxEn,
bool frsTxEn);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ClearHardResetCount
****************************************************************************//**
*
* Clears the hard reset count.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ClearHardResetCount (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetVbusVoltage
****************************************************************************//**
*
* Uses the application-provided callback to measure the current
* VBus voltage.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* VBus voltage in mV units.
*
*******************************************************************************/
uint16_t Cy_PdStack_Dpm_GetVbusVoltage (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetCableUsbCap
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* USB data signaling supported by the cable marker if known, CY_PDSTACK_USB_SIG_UNKNOWN
* otherwise.
*
*******************************************************************************/
cy_en_pdstack_usb_data_sig_t Cy_PdStack_Dpm_GetCableUsbCap (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetDelaySrcCapStart
****************************************************************************//**
*
* Facilitates delaying the starting of source cap on Type-C attach.
* Applicable only when the cable is not present.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param delay
* Delay in ms.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDelaySrcCapStart (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint16_t delay);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetAlert
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param alert_ado
* Alert augmented data object.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetAlert (
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_pd_pd_do_t alert_ado);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_DowngradePdRev
****************************************************************************//**
*
* Allows downgrading the PD revision.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* \ref cy_en_pdstack_status_t
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_DowngradePdRev (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateExtSnkCap
****************************************************************************//**
*
* Allows updating the extended sink capabilities for the PD port.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrBuf
* Pointer to a buffer containing extended sink capabilities data.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateExtSnkCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t *ptrBuf);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetFaultActive
****************************************************************************//**
*
* Sets internal flags to indicate that any fault (OVP/OCP/OTP, etc.) is active.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetFaultActive (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetChunkXferRunning
****************************************************************************//**
*
* 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.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param amsType
* Type of PD atomic message sequence that is running.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetChunkXferRunning (
cy_stc_pdstack_context_t *ptrPdStackContext,
cy_en_pdstack_ams_type_t amsType);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SendHardReset
****************************************************************************//**
*
* Attempts to send USB PD hard reset to port partner.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param reason
* Reason for the hard reset. Used for internal status tracking only.
*
* \return
* \ref cy_en_pdstack_status_t
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SendHardReset (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t reason);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetPdPortStatus
****************************************************************************//**
*
* Returns the PD port status as expected by the embedded controller.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* PD port status in the format expected by the embedded controller.
*
*******************************************************************************/
uint32_t Cy_PdStack_Dpm_GetPdPortStatus(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSwapResponse
****************************************************************************//**
*
* Updates the USB PD data role, power role, and vconn swap responses.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param value
* New swap response.
*
* \return
* \ref cy_en_pdstack_status_t
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_FAILURE if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSwapResponse(
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t value);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdatePpsSrcEn
****************************************************************************//**
*
* Updates the PD port PPS Source Enable field.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ppsSrcEn
* whether to enable PPS Source or not.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSrcEn(
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t ppsSrcEn);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdatePpsSnkEn
****************************************************************************//**
*
* Updates the PD port PPS Sink Enable field.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ppsSnkEn
* whether to enable PPS Sink or not.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdatePpsSnkEn(
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t ppsSnkEn);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdatePortStatus
****************************************************************************//**
*
* Updates the PD port status returned in response to a Get_Status command.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param status_p
* Pointer to a buffer containing the port status.
*
* \param offset
* Number of bytes of offset to be applied while updating the status.
*
* \param byte_cnt
* Number of bytes of status to be updated.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_RefreshSrcCap
****************************************************************************//**
*
* Refreshes the source cap at runtime.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* Returns true if the operation is successful otherwise, false.
*
*******************************************************************************/
bool Cy_PdStack_Dpm_RefreshSrcCap (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_RefreshSnkCap
****************************************************************************//**
*
* Refreshes the sink cap at runtime.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* Returns true if the operation is successful otherwise, false.
*
*******************************************************************************/
bool Cy_PdStack_Dpm_RefreshSnkCap (
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetStackConfig
****************************************************************************//**
*
* Retrieves the configurable switch values at runtime.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* Structure indicating the current stack configuration.
*
*******************************************************************************/
cy_pd_stack_conf_t Cy_PdStack_Dpm_GetStackConfig(
cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ChangeEprActiveFlag
****************************************************************************//**
*
* Change the state of the EPR mode active flag.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param flag
* Sets/resets the EPR active flag.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprActiveFlag(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool flag);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsEprModeActive
****************************************************************************//**
*
* Checks whether the EPR mode is active.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param isActive
* State of the EPR flag.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprModeActive(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *isActive);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ChangeEprToSpr
****************************************************************************//**
*
* Changes the EPR to SPR indicator.
*
* \param ptrPdStackContext
* PDstack library context pointer.
*
* \param flag
* Sets/resets the EPR flag to limit the PDO index.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprToSpr(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool flag);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsEprSpr
****************************************************************************//**
*
* Checks whether the EPR PDO needs to limit it to SPR.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param isSpr
* Contains true if eval PDO needs to limit PDO count to SPR otherwise, false.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprSpr(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *isSpr);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsEprAvsActive
****************************************************************************//**
*
* Checks whether the EPR AVS mode is active.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param isActive
* State of the EPR flag.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprAvsModeActive(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool *isActive);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_ChangeEprActiveFlag
****************************************************************************//**
*
* Change the state of the EPR AVS mode active flag.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param flag
* Sets/resets the EPR AVS active flag.
*
* \return
* cy_en_pdstack_status_t
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprAvsActiveFlag(
cy_stc_pdstack_context_t *ptrPdStackContext,
bool flag);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_IsValidAvsReq
****************************************************************************//**
*
* Evaluates the AVS RDO with respect to the selected AVS PDO.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param src_pdo_index
* SRC PDO index.
*
* \param rdo
* Requests data object received from the port partner.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
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);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_EprSnkSendKeepAliveCb
****************************************************************************//**
*
* Callbacks to initiate the Keepalive message.
*
* \param id
* Timer index.
*
* \param ptrContext
* Callback context.
*
* \return
* None.
*
*******************************************************************************/
void Cy_PdStack_Dpm_EprSnkSendKeepAliveCb (
cy_timer_id_t id,
void *ptrContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSnkMaxMin
****************************************************************************//**
*
* Updates the sink max/min current/power at runtime thereby overriding
* the generated configuration by EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param max_min
* Pointer to max/min current/power array.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkMaxMin (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
uint16_t* max_min);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSnkCapMask
****************************************************************************//**
*
* Update the sink PDO mask at runtime thereby overriding the
* generated configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param mask
* PDO mask.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCapMask (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t mask);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSnkCap
****************************************************************************//**
*
* Updates the sink PDOs at runtime thereby overriding the generated
* configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PSStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param pdo
* Pointer to the PDO array.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
cy_pd_pd_do_t* pdo);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSrcCapMask
****************************************************************************//**
*
* Updates the source PDO mask at runtime thereby overriding the
* generated configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param mask
* PDO mask.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful,
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCapMask (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t mask);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateSrcCap
****************************************************************************//**
*
* Update the source PDOs at runtime thereby overriding the generated
* configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param pdo
* Pointer to the PDO array.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
cy_pd_pd_do_t* pdo);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateEprSrcCap
****************************************************************************//**
*
* Updates the EPR source PDOs at runtime thereby overriding the generated
* configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param pdo
* Pointer to the PDO array
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
cy_pd_pd_do_t* pdo);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateEprSrcCapMask
****************************************************************************//**
*
* Update the EPR source PDO mask at runtime thereby overriding the
* generated configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param mask
* PDO mask.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSrcCapMask (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t mask);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateEprSnkCap
****************************************************************************//**
*
* Updates the EPR sink PDOs at runtime thereby overriding the generated
* configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param pdo
* Pointer to the PDO array.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCap (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
cy_pd_pd_do_t* pdo);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateEprSnkCapMask
****************************************************************************//**
*
* Updates the EPR sink PDO mask at runtime thereby overriding the
* generated configuration by the EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param mask
* PDO mask.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCapMask (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t mask);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateEprSnkMaxMin
****************************************************************************//**
*
* Updates the EPR sink max/min current/power at runtime thereby overriding the
* generated configuration by EZ-PD(TM) Configurator.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param count
* Number of PDOs.
*
* \param max_min
* Pointer to max/min current/power array.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkMaxMin (
cy_stc_pdstack_context_t *ptrPdStackContext,
uint8_t count,
uint16_t* max_min);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetAutoVcsEnabled
****************************************************************************//**
*
* Checks whether the automatic VConn swap is enabled.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \return
* True if the automatic VConn swap by the stack is enabled.
*
*******************************************************************************/
bool Cy_PdStack_Dpm_GetAutoVcsEnabled(cy_stc_pdstack_context_t *ptrPdStackContext);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateAutoVcsEnable
****************************************************************************//**
*
* Enables/disables the automatic VConn swap by the PD policy engine.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param val
* Whether to enable the automatic VConn swap.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateAutoVcsEnable(cy_stc_pdstack_context_t *ptrPdStackContext, bool val);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateVconnRetain
****************************************************************************//**
*
* Enables/disables the VConn retain setting.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param val
* Whether to enable the VConn retain setting.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateVconnRetain(cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t val);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_SetDataReset
****************************************************************************//**
*
* Enables/disables the data reset support.
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param value
* True - Enable data reset support.
* False - Disable data reset support.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_SetDataReset(cy_stc_pdstack_context_t *ptrPdStackContext, bool value);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_UpdateTimingParams
****************************************************************************//**
*
* 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:
* \ref CY_PD_2_SENDER_RESPONSE_TIMER_PERIOD
* \ref CY_PD_3_SENDER_RESPONSE_TIMER_PERIOD
* \ref CY_PD_TYPEC_CC_DEBOUNCE_TIMER_PERIOD
* \ref CY_PD_TYPEC_ERROR_RECOVERY_TIMER_PERIOD
*
* \param ptrPdStackContext
* PDStack library context pointer.
*
* \param ptrPdTimerParams
* Pointer to PD timer structure containing new timer periods to be used.
*
* \return
* CY_PDSTACK_STAT_SUCCESS if the operation is successful.
* CY_PDSTACK_STAT_BAD_PARAM if the parameters are invalid.
*
*******************************************************************************/
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateTimingParams(cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_pdstack_pd_timer_params_t *ptrPdTimerParams);
/*******************************************************************************
* Function name: Cy_PdStack_Dpm_GetContext
****************************************************************************//**
*
* This API returns the pointer to the \ref cy_stc_pdstack_context_t of the
* given port. This API should be called after \ref Cy_PdStack_Dpm_Init () has
* been called.
*
* \param port
* The selected port.
*
* \return
* Pointer to the PDStack context for a given port.
* NULL if the port is invalid
*
*******************************************************************************/
cy_stc_pdstack_context_t* Cy_PdStack_Dpm_GetContext(uint8_t port);
/** \} group_pdstack_functions */
#endif /* CY_PDSTACK_DPM_H */
/* [] END OF FILE */