HPI Library

General Description

This section describes the HPI function prototypes.

Functions

bool Cy_Hpi_IsEcReady (cy_stc_hpi_context_t *context)
 Checks for EC initialization complete event is received. More...
 
void Cy_Hpi_SetEvent (cy_stc_hpi_context_t *context, uint8_t evtCode)
 Updates the Interrupt Status register and assert the EC_INT pin. More...
 
void Cy_Hpi_ClearEvent (cy_stc_hpi_context_t *context, uint8_t evtCode)
 Clears the Interrupt Status register and deassert the EC_INT pin. More...
 
void Cy_Hpi_UcsiRegReset (cy_stc_hpi_context_t *context)
 Clears the Status and Control register. More...
 
void Cy_Hpi_UcsiClearStatusBit (cy_stc_hpi_context_t *context, uint8_t bitIdx)
 Clears the appropriate bit_idx to '0' in the Status register. More...
 
void Cy_Hpi_UcsiSetStatusBit (cy_stc_hpi_context_t *context, uint8_t bitIdx)
 Sets appropriate bit index to '1' in the Status register. More...
 
uint8_t Cy_Hpi_GetUcsiControl (cy_stc_hpi_context_t *context)
 Gets the UCSI Control register value. More...
 
uint8_t Cy_Hpi_GetStatusBit (cy_stc_hpi_context_t *context, uint8_t bitIdx)
 Gets the UCSI Status bit. More...
 
uint8_t * Cy_Hpi_UcsiGetStatusRegAddr (cy_stc_hpi_context_t *context)
 Gets the UCSI Status register address. More...
 
uint8_t * Cy_Hpi_UcsiGetControlRegAddr (cy_stc_hpi_context_t *context)
 Gets the UCSI Control register address. More...
 
bool Cy_Hpi_IsVdmEcCtrlEnabled (cy_stc_hpi_context_t *context, uint8_t port)
 Checks if the EC control of VDMs is enabled. More...
 
bool Cy_Hpi_IsExtdMsgEcCtrlEnabled (cy_stc_hpi_context_t *context, uint8_t port)
 Checks whether the handling of extended messages by EC is enabled. More...
 
uint8_t Cy_Hpi_GetEcActiveModes (cy_stc_hpi_context_t *context, uint8_t port)
 Gets the active EC alternate modes value. More...
 
bool Cy_Hpi_QueuePdMsg (cy_stc_hpi_context_t *context, cy_en_hpi_reg_section_t section, uint8_t status, uint16_t len1, uint8_t *data1, uint16_t len2, uint8_t *data2)
 PDStack and application layers sends event and extended message notifications to the EC through the HPI registers. More...
 
void Cy_Hpi_PdEventHandler (cy_stc_hpi_context_t *context, uint8_t port, uint8_t evt, const void *data)
 Receives PD events from the stack and to update the HPI registers. More...
 
void Cy_Hpi_SendHwErrorEvent (cy_stc_hpi_context_t *context, uint8_t port, uint8_t errType)
 Notifies the EC for a system hardware access error. More...
 
void Cy_Hpi_SetHpiVersion (cy_stc_hpi_context_t *context, uint32_t hpiVers)
 Sets the HPI version info. More...
 
void Cy_Hpi_SetHpiVersionExt (cy_stc_hpi_context_t *context, uint32_t hpiVers)
 This function sets the HPI version extended information. More...
 
void Cy_Hpi_SetModeRegs (cy_stc_hpi_context_t *context, uint8_t devMode, uint8_t modeReason)
 Updates the Device and Boot modes reason in HPI registers. More...
 
void Cy_Hpi_UpdateVersions (cy_stc_hpi_context_t *context, uint8_t *blVersion, uint8_t *fw1Version, uint8_t *fw2Version)
 Updates the firmware version information in the HPI registers. More...
 
void Cy_Hpi_UpdateRegs (cy_stc_hpi_context_t *context, uint8_t section, uint8_t offset, uint8_t *data, uint8_t size)
 Updates the information in the HPI registers. More...
 
void * Cy_Hpi_GetDevAddr (cy_stc_hpi_context_t *context)
 API to fetch the base address of the HPI Device register space. More...
 
void Cy_Hpi_UpdateFwLocations (cy_stc_hpi_context_t *context, uint16_t fw1Location, uint16_t fw2Location)
 Updates the firmware location HPI registers. More...
 
bool Cy_Hpi_RegEnqueueEvent (cy_stc_hpi_context_t *context, cy_en_hpi_reg_section_t section, uint8_t status, uint16_t length, uint8_t *data)
 PDStack and application layers send event notifications to the EC through the HPI registers. More...
 
uint8_t Cy_Hpi_GetConsFetStatus (cy_stc_hpi_context_t *context, uint8_t port)
 Retrieves the current value of consumer FET Status register. More...
 
void Cy_Hpi_UpdateConsFetStatus (cy_stc_hpi_context_t *context, uint8_t port, uint8_t status)
 Updates the consumer FET status associated with a port. More...
 
uint8_t Cy_Hpi_GetPortEnable (cy_stc_hpi_context_t *context)
 Gets the Port Enable register value. More...
 
uint8_t Cy_Hpi_GetSysPwrState (cy_stc_hpi_context_t *context)
 Gets the content of the HPI System power State register. More...
 
uint8_t * Cy_Hpi_BbGetVersion (cy_stc_hpi_context_t *context)
 Gets the Billboard firmware version. More...
 
void Cy_Hpi_BbRegUpdate (cy_stc_hpi_context_t *context, uint8_t bbRegAddr, void *data)
 Updates the content of the Billboard Control register. More...
 
uint32_t Cy_Hpi_BbGetReg (cy_stc_hpi_context_t *context, uint8_t bbRegAddr)
 Gets the current content of the Billboard Control register. More...
 
void Cy_Hpi_SetUserdefWriteHandler (cy_stc_hpi_context_t *context, cy_hpi_write_cbk_t wrHandler)
 Enables handling of EC writes to the user-defined HPI register region in the application code. More...
 
bool Cy_Hpi_InitUserdefRegs (cy_stc_hpi_context_t *context, uint16_t regAddr, uint8_t size, uint8_t *data)
 Initializes the contents of the user-defined registers that are part of the HPI register space. More...
 
void Cy_Hpi_Task (cy_stc_hpi_context_t *context)
 Handles the commands from the EC through the HPI registers. More...
 
void Cy_Hpi_SetEcInterrupt (cy_stc_hpi_context_t *context, bool enable)
 Configures HPI to use the EC_INT pin for interrupt mode. More...
 
void Cy_Hpi_SendFwReadyEvent (cy_stc_hpi_context_t *context)
 Sends a firmware-ready notification through HPI to the EC. More...
 
void Cy_Hpi_SetPortEventMask (cy_stc_hpi_context_t *context, uint8_t port, uint32_t mask)
 Updates the event mask value for the specified PD port. More...
 
ATTRIBUTES_HPISS_HPI void Cy_Hpi_SetPortBcStatus (cy_stc_hpi_context_t *context, uint8_t port, uint8_t bcStatus)
 Updates the BC 1.2 connection status to the HPI interface. More...
 
void Cy_Hpi_SetFlashParams (cy_stc_hpi_context_t *context, uint32_t flashSize, uint16_t rowSize, uint16_t rowCnt, uint16_t blLastRow)
 Sets the CCG device flash parameters. More...
 
bool Cy_Hpi_IsAccessed (cy_stc_hpi_context_t *context)
 Checks for any recent HPI accesses since start up. More...
 
void Cy_Hpi_UpdatePdoChange (cy_stc_hpi_context_t *context, bool disable)
 Enables/disables PDO update through HPI. More...
 
void Cy_Hpi_Init (cy_stc_hpi_context_t *context, cy_stc_hpi_hw_config_t *ptrHwConfig, cy_stc_hpi_app_cbk_t *ptrAppCbk, void *pdPort0Ctx, void *pdPort1Ctx, uint8_t numPorts)
 Initializes the HPI library variables and registers to their default values, registers the context reference pointers, and enables the I2C interface. More...
 
void Cy_Hpi_Deinit (cy_stc_hpi_context_t *context)
 Deinitializes the HPI interface. More...
 
bool Cy_Hpi_SleepAllowed (cy_stc_hpi_context_t *context)
 Checks if the CCG device enters Deep Sleep mode. More...
 
bool Cy_Hpi_Sleep (cy_stc_hpi_context_t *context)
 Checks whether the I2C interface is idle so that the CCG device can enter into Deep Sleep mode. More...
 
bool Cy_Hpi_UcsiInitContext (cy_stc_hpi_context_t *ptrHpiContext, void *ptrUcsiContext)
 Registers the UCSI context pointer to the HPI context. More...
 
void Cy_Hpi_I2cInterruptHandler (cy_stc_hpi_context_t *ptrHpiContext)
 Handles I2C hardware interrupts. More...
 
void Cy_Hpi_SetResetCount (cy_stc_hpi_context_t *context, uint32_t count)
 Writes the WDT reset count value to a device-specific register. More...
 
void Cy_Hpi_SendPfEvent (cy_stc_hpi_context_t *ptrHpiContext, uint8_t port, uint8_t evtType)
 Notifies EC about platform-specific events, if mask is enabled. More...
 
void Cy_Hpi_EnqueuePdPktMsgEvent (cy_stc_hpi_context_t *context, uint8_t port, cy_stc_pd_packet_extd_t *ptrPdPkt, cy_en_hpi_response_t eventType, uint32_t maskBit)
 Enqueues HPI events or PD msgs from PDStack. More...
 
void Cy_Hpi_InitSromParams (bool pdEn, bool pdCmdEn, bool ucsiEn, bool dualAppEn, const uint32_t *ptrHpiDevMask, const uint32_t *ptrHpiPortMask)
 Initializes the HPI parameters required for HPI lib variant support. More...
 
const uint32_t * Cy_Hpi_GetDevRegRespMskPtr (void)
 This function returns the address of the HPI Device register response mask array which defines whether the register/cmd access is enabled or disabled. More...
 
const uint32_t * Cy_Hpi_GetPortRegRespMskPtr (void)
 This function returns the address of the HPI Port register response mask array which defines whether the register/cmd access is enabled or disabled. More...
 

Function Documentation

◆ Cy_Hpi_IsEcReady()

bool Cy_Hpi_IsEcReady ( cy_stc_hpi_context_t context)

Checks for EC initialization complete event is received.

This function is used by the application to check the EC has sent the EC initialization complete event notification.

Parameters
contextHPI library context pointer.
Returns
Returns true if EC init is received, false otherwise.

◆ Cy_Hpi_SetEvent()

void Cy_Hpi_SetEvent ( cy_stc_hpi_context_t context,
uint8_t  evtCode 
)

Updates the Interrupt Status register and assert the EC_INT pin.

Parameters
contextHPI library context pointer.
evtCodeSet the event code.
Returns
None.

◆ Cy_Hpi_ClearEvent()

void Cy_Hpi_ClearEvent ( cy_stc_hpi_context_t context,
uint8_t  evtCode 
)

Clears the Interrupt Status register and deassert the EC_INT pin.

Parameters
contextHPI library context pointer.
evtCodeClears the event code.
Returns
None.

◆ Cy_Hpi_UcsiRegReset()

void Cy_Hpi_UcsiRegReset ( cy_stc_hpi_context_t context)

Clears the Status and Control register.

Parameters
contextHPI library context pointer.
Returns
None.

Clears the Status and Control register.

◆ Cy_Hpi_UcsiClearStatusBit()

void Cy_Hpi_UcsiClearStatusBit ( cy_stc_hpi_context_t context,
uint8_t  bitIdx 
)

Clears the appropriate bit_idx to '0' in the Status register.

Parameters
contextHPI library context pointer.
bitIdxClears the bit index.
Returns
None.

Clears the appropriate bit_idx to '0' in the Status register.

◆ Cy_Hpi_UcsiSetStatusBit()

void Cy_Hpi_UcsiSetStatusBit ( cy_stc_hpi_context_t context,
uint8_t  bitIdx 
)

Sets appropriate bit index to '1' in the Status register.

Parameters
contextHPI library context pointer.
bitIdxSets the bit index.
Returns
None.

Sets appropriate bit index to '1' in the Status register.

◆ Cy_Hpi_GetUcsiControl()

uint8_t Cy_Hpi_GetUcsiControl ( cy_stc_hpi_context_t context)

Gets the UCSI Control register value.

Parameters
contextHPI library context pointer.
Returns
UCSI control HPI register value.

Gets the UCSI Control register value.

Returns
The UCSI Control HPI register value.

◆ Cy_Hpi_GetStatusBit()

uint8_t Cy_Hpi_GetStatusBit ( cy_stc_hpi_context_t context,
uint8_t  bitIdx 
)

Gets the UCSI Status bit.

Parameters
contextHPI library context pointer.
bitIdxStatus bit index.
Returns
UCSI status bit value.

Gets the UCSI Status bit.

Returns
The UCSI Status bit value.

◆ Cy_Hpi_UcsiGetStatusRegAddr()

uint8_t* Cy_Hpi_UcsiGetStatusRegAddr ( cy_stc_hpi_context_t context)

Gets the UCSI Status register address.

Parameters
contextHPI library context pointer.
Returns
Address of the UCSI Status register.

◆ Cy_Hpi_UcsiGetControlRegAddr()

uint8_t* Cy_Hpi_UcsiGetControlRegAddr ( cy_stc_hpi_context_t context)

Gets the UCSI Control register address.

Parameters
contextHPI library context pointer.
Returns
Address of the UCSI Control register.

◆ Cy_Hpi_IsVdmEcCtrlEnabled()

bool Cy_Hpi_IsVdmEcCtrlEnabled ( cy_stc_hpi_context_t context,
uint8_t  port 
)

Checks if the EC control of VDMs is enabled.

Parameters
contextHPI library context pointer.
portUSB PD port to check the configuration.
Returns
true - If EC control is enabled, false otherwise.

◆ Cy_Hpi_IsExtdMsgEcCtrlEnabled()

bool Cy_Hpi_IsExtdMsgEcCtrlEnabled ( cy_stc_hpi_context_t context,
uint8_t  port 
)

Checks whether the handling of extended messages by EC is enabled.

If not, the CCG firmware will automatically responds with a NOT_SUPPORTED messages.

Parameters
contextHPI library context pointer.
portUSB PD port to check the configuration.
Returns
true - If EC control is enabled, false otherwise.

◆ Cy_Hpi_GetEcActiveModes()

uint8_t Cy_Hpi_GetEcActiveModes ( cy_stc_hpi_context_t context,
uint8_t  port 
)

Gets the active EC alternate modes value.

Parameters
contextHPI library context pointer.
portUSB PD to check the configuration.
Returns
The active EC modes setting programmed by EC.

◆ Cy_Hpi_QueuePdMsg()

bool Cy_Hpi_QueuePdMsg ( cy_stc_hpi_context_t context,
cy_en_hpi_reg_section_t  section,
uint8_t  status,
uint16_t  len1,
uint8_t *  data1,
uint16_t  len2,
uint8_t *  data2 
)

PDStack and application layers sends event and extended message notifications to the EC through the HPI registers.

Note that only responses without associated data is sent through the Response register for the HPI_REG_SECTION_DEV section. If any additional response data is required, use the user-defined registers or the response register associated with CY_HPI_REG_SECTION_PORT_0 or CY_HPI_REG_SECTION_PORT_1.

Parameters
contextHPI library context pointer.
sectionReports the event through the register section.
statusThe event code to be stored into the Response register.
len1Length of the data associated with the event.
data1Pointer to buffer containing data associated with the event.
len2PD message data length in bytes.
data2Pointer to buffer containing PD message data.
Returns
true - If the event queue has space for the event. false - If there is an overflow.

◆ Cy_Hpi_PdEventHandler()

void Cy_Hpi_PdEventHandler ( cy_stc_hpi_context_t context,
uint8_t  port,
uint8_t  evt,
const void *  data 
)

Receives PD events from the stack and to update the HPI registers.

Parameters
contextHPI library context pointer.
portPD port corresponding to the event.
evtEvent is notified.
dataData associated with the event. This is an opaque pointer that needs to be de-referenced based on event type.
Returns
None.

◆ Cy_Hpi_SendHwErrorEvent()

void Cy_Hpi_SendHwErrorEvent ( cy_stc_hpi_context_t context,
uint8_t  port,
uint8_t  errType 
)

Notifies the EC for a system hardware access error.

Parameters
contextHPI library context pointer.
portPD port index.
errTypeDetects the type of error.
Returns
None.

◆ Cy_Hpi_SetHpiVersion()

void Cy_Hpi_SetHpiVersion ( cy_stc_hpi_context_t context,
uint32_t  hpiVers 
)

Sets the HPI version info.

Parameters
contextHPI library context pointer.
hpiVersHPI version information.
Returns
None.

◆ Cy_Hpi_SetHpiVersionExt()

void Cy_Hpi_SetHpiVersionExt ( cy_stc_hpi_context_t context,
uint32_t  hpiVers 
)

This function sets the HPI version extended information.

Parameters
contextHPI Library context pointer.
hpiVersHPI version information.
Returns
None.

◆ Cy_Hpi_SetModeRegs()

void Cy_Hpi_SetModeRegs ( cy_stc_hpi_context_t context,
uint8_t  devMode,
uint8_t  modeReason 
)

Updates the Device and Boot modes reason in HPI registers.

Parameters
contextHPI library context pointer.
devModeSets the value into the Device mode register.
modeReasonSets the value into the Boot mode reason register.
Returns
None.

◆ Cy_Hpi_UpdateVersions()

void Cy_Hpi_UpdateVersions ( cy_stc_hpi_context_t context,
uint8_t *  blVersion,
uint8_t *  fw1Version,
uint8_t *  fw2Version 
)

Updates the firmware version information in the HPI registers.

Parameters
contextHPI library context pointer.
blVersionBuffer contains the Bootloader version information.
fw1VersionBuffer contains the firmware-1 version information.
fw2VersionBuffer contains the firmware-2 version information.
Returns
None.

◆ Cy_Hpi_UpdateRegs()

void Cy_Hpi_UpdateRegs ( cy_stc_hpi_context_t context,
uint8_t  section,
uint8_t  offset,
uint8_t *  data,
uint8_t  size 
)

Updates the information in the HPI registers.

Parameters
contextHPI library context pointer.
sectionHPI register section (DEV/PORT-0/PORT-1).
offsetHPI Device register offset.
dataBuffer contains the data to be written.
sizeWrite the number of bytes of data.
Returns
None.

◆ Cy_Hpi_GetDevAddr()

void* Cy_Hpi_GetDevAddr ( cy_stc_hpi_context_t context)

API to fetch the base address of the HPI Device register space.

Parameters
contextHPI library context pointer.
Returns
Pointer of the device register base address.

◆ Cy_Hpi_UpdateFwLocations()

void Cy_Hpi_UpdateFwLocations ( cy_stc_hpi_context_t context,
uint16_t  fw1Location,
uint16_t  fw2Location 
)

Updates the firmware location HPI registers.

Parameters
contextHPI library context pointer.
fw1LocationFlash row where FW1 is located.
fw2LocationFlash row where FW2 is located.
Returns
None.

◆ Cy_Hpi_RegEnqueueEvent()

bool Cy_Hpi_RegEnqueueEvent ( cy_stc_hpi_context_t context,
cy_en_hpi_reg_section_t  section,
uint8_t  status,
uint16_t  length,
uint8_t *  data 
)

PDStack and application layers send event notifications to the EC through the HPI registers.

Note that only responses without associated data can be sent through the Response register for the HPI_REG_SECTION_DEV section. If any additional response data is required, use the user-defined registers or the response register associated with CY_HPI_REG_SECTION_PORT_0 or CY_HPI_REG_SECTION_PORT_1.

Parameters
contextHPI library context pointer.
sectionReports the event through the register section.
statusStores the event code into the response register.
lengthLength of the data associated with the event.
dataPointer to buffer containing data associated with the event.
Returns
true - If the event queue has space for the event. false - If there is an overflow.

◆ Cy_Hpi_GetConsFetStatus()

uint8_t Cy_Hpi_GetConsFetStatus ( cy_stc_hpi_context_t context,
uint8_t  port 
)

Retrieves the current value of consumer FET Status register.

Parameters
contextHPI library context pointer.
portPort for which consumer FET status is to be retrieved.
Returns
Current value of the consumer FET Status register.

◆ Cy_Hpi_UpdateConsFetStatus()

void Cy_Hpi_UpdateConsFetStatus ( cy_stc_hpi_context_t context,
uint8_t  port,
uint8_t  status 
)

Updates the consumer FET status associated with a port.

Parameters
contextHPI library context pointer.
portPort on which FET status has to be updated.
statusStores the new value in the register.
Returns
None.

◆ Cy_Hpi_GetPortEnable()

uint8_t Cy_Hpi_GetPortEnable ( cy_stc_hpi_context_t context)

Gets the Port Enable register value.

Parameters
contextHPI library context pointer.
Returns
The Port Enable HPI register value.

◆ Cy_Hpi_GetSysPwrState()

uint8_t Cy_Hpi_GetSysPwrState ( cy_stc_hpi_context_t context)

Gets the content of the HPI System power State register.

Parameters
contextHPI library context pointer.
Returns
The 8-bit unsigned content of the HPI syspwr_state register.

◆ Cy_Hpi_BbGetVersion()

uint8_t* Cy_Hpi_BbGetVersion ( cy_stc_hpi_context_t context)

Gets the Billboard firmware version.

Parameters
contextHPI library context pointer.
Returns
Pointer to firmware version buffer.

◆ Cy_Hpi_BbRegUpdate()

void Cy_Hpi_BbRegUpdate ( cy_stc_hpi_context_t context,
uint8_t  bbRegAddr,
void *  data 
)

Updates the content of the Billboard Control register.

Parameters
contextHPI library context pointer.
bbRegAddrBillboard related register address.
dataRegister write data pointer.
Returns
None.

◆ Cy_Hpi_BbGetReg()

uint32_t Cy_Hpi_BbGetReg ( cy_stc_hpi_context_t context,
uint8_t  bbRegAddr 
)

Gets the current content of the Billboard Control register.

Parameters
contextHPI library context pointer.
bbRegAddrBillboard related register address.
Returns
Data of selected Billboard related register.

◆ Cy_Hpi_SetUserdefWriteHandler()

void Cy_Hpi_SetUserdefWriteHandler ( cy_stc_hpi_context_t context,
cy_hpi_write_cbk_t  wrHandler 
)

Enables handling of EC writes to the user-defined HPI register region in the application code.

Parameters
contextHPI library context pointer.
wrHandlerPointer to function that handles the received HPI writes.
Returns
None.

◆ Cy_Hpi_InitUserdefRegs()

bool Cy_Hpi_InitUserdefRegs ( cy_stc_hpi_context_t context,
uint16_t  regAddr,
uint8_t  size,
uint8_t *  data 
)

Initializes the contents of the user-defined registers that are part of the HPI register space.

Parameters
contextHPI library context pointer.
regAddrUpdates the base address of registers and stores it in the user-defined address region.
sizeNumber of registers to be updated. The upper limit should not exceed the user- defined address region.
dataBuffer contains the data to be copied into HPI registers.
Returns
Returns true if the operation is successful, otherwise false if the input parameters are not valid.

◆ Cy_Hpi_Task()

void Cy_Hpi_Task ( cy_stc_hpi_context_t context)

Handles the commands from the EC through the HPI registers.

HPI writes from the EC are handled in interrupt context and any associated work is queued to be handled by this function. The Cy_Hpi_Task is expected to be called periodically from the main task loop of the firmware application.

Parameters
contextHPI library context pointer.
Returns
None.

◆ Cy_Hpi_SetEcInterrupt()

void Cy_Hpi_SetEcInterrupt ( cy_stc_hpi_context_t context,
bool  enable 
)

Configures HPI to use the EC_INT pin for interrupt mode.

Parameters
contextHPI library context pointer.
enableChecks to enable or disable interrupt mode.
Returns
None.

◆ Cy_Hpi_SendFwReadyEvent()

void Cy_Hpi_SendFwReadyEvent ( cy_stc_hpi_context_t context)

Sends a firmware-ready notification through HPI to the EC.

This event is sent to the EC to indicate that the device is out of reset and has a loaded firmware.

Parameters
contextHPI library context pointer.
Returns
None.

◆ Cy_Hpi_SetPortEventMask()

void Cy_Hpi_SetPortEventMask ( cy_stc_hpi_context_t context,
uint8_t  port,
uint32_t  mask 
)

Updates the event mask value for the specified PD port.

Parameters
contextHPI library context pointer.
portPD port index.
maskEvent mask value to be set.
Returns
None.

◆ Cy_Hpi_SetPortBcStatus()

ATTRIBUTES_HPISS_HPI void Cy_Hpi_SetPortBcStatus ( cy_stc_hpi_context_t context,
uint8_t  port,
uint8_t  bcStatus 
)

Updates the BC 1.2 connection status to the HPI interface.

Parameters
contextHPI Library Context pointer.
portPD port index.
bcStatusBC 1.2 status.
Returns
None.

◆ Cy_Hpi_SetFlashParams()

void Cy_Hpi_SetFlashParams ( cy_stc_hpi_context_t context,
uint32_t  flashSize,
uint16_t  rowSize,
uint16_t  rowCnt,
uint16_t  blLastRow 
)

Sets the CCG device flash parameters.

These values are used for the device status reporting and firmware update implementation.

Parameters
contextHPI library context pointer.
flashSizeTotal device flash size in bytes.
rowSizeSize of each flash row in bytes.
rowCntNumber of flash rows on the device.
blLastRowLast flash row assigned to Bootloader.
Returns
None.

◆ Cy_Hpi_IsAccessed()

bool Cy_Hpi_IsAccessed ( cy_stc_hpi_context_t context)

Checks for any recent HPI accesses since start up.

Parameters
contextHPI library context pointer.
Returns
Returns true if any HPI read/write access has occurred. Otherwise, false if HPI is not accessed.

◆ Cy_Hpi_UpdatePdoChange()

void Cy_Hpi_UpdatePdoChange ( cy_stc_hpi_context_t context,
bool  disable 
)

Enables/disables PDO update through HPI.

Parameters
contextHPI library context pointer.
disableChecks if the PDO update is disabled.
Returns
None.

◆ Cy_Hpi_Init()

void Cy_Hpi_Init ( cy_stc_hpi_context_t context,
cy_stc_hpi_hw_config_t ptrHwConfig,
cy_stc_hpi_app_cbk_t ptrAppCbk,
void *  pdPort0Ctx,
void *  pdPort1Ctx,
uint8_t  numPorts 
)

Initializes the HPI library variables and registers to their default values, registers the context reference pointers, and enables the I2C interface.

Parameters
contextHPI library context pointer.
ptrHwConfigHPI hardware configuration pointer.
ptrAppCbkHPI application-specific callback structure pointer.
pdPort0CtxPointer to the PDStack port0 context structure.
pdPort1CtxPointer to the PDStack port1 context structure.
numPortsNumber of PD ports supported by DUT.
Returns
None.

◆ Cy_Hpi_Deinit()

void Cy_Hpi_Deinit ( cy_stc_hpi_context_t context)

Deinitializes the HPI interface.

This is used in applications where the HPI master (Billboard controller) in the system can be powered off under control of the CCG device.

Parameters
contextHPI library context pointer.
Returns
None.

◆ Cy_Hpi_SleepAllowed()

bool Cy_Hpi_SleepAllowed ( cy_stc_hpi_context_t context)

Checks if the CCG device enters Deep Sleep mode.

Parameters
contextHPI library context pointer.
Returns
true - If switches to Deep Sleep. false- If the operation failed.

◆ Cy_Hpi_Sleep()

bool Cy_Hpi_Sleep ( cy_stc_hpi_context_t context)

Checks whether the I2C interface is idle so that the CCG device can enter into Deep Sleep mode.

It also enables an I2C address match as a wake up trigger from Deep Sleep mode. Call the Cy_Hpi_SleepAllowed before calling this function.

Parameters
contextHPI library context pointer.
Returns
true - If the HPI interface is ready for Sleep. false - If operation failed.

◆ Cy_Hpi_UcsiInitContext()

bool Cy_Hpi_UcsiInitContext ( cy_stc_hpi_context_t ptrHpiContext,
void *  ptrUcsiContext 
)

Registers the UCSI context pointer to the HPI context.

Parameters
ptrHpiContextHPI library context pointer.
ptrUcsiContextA void pointer of UCSI context pointer.
Returns
true - If the arguments are valid. false - If the arguments are not valid.

◆ Cy_Hpi_I2cInterruptHandler()

void Cy_Hpi_I2cInterruptHandler ( cy_stc_hpi_context_t ptrHpiContext)

Handles I2C hardware interrupts.

It must be called by the interrupt handler.

Parameters
ptrHpiContextHPI library context pointer.
Returns
None.

◆ Cy_Hpi_SetResetCount()

void Cy_Hpi_SetResetCount ( cy_stc_hpi_context_t context,
uint32_t  count 
)

Writes the WDT reset count value to a device-specific register.

Parameters
contextHPI library context pointer.
countWDT reset count value.
Returns
None.

◆ Cy_Hpi_SendPfEvent()

void Cy_Hpi_SendPfEvent ( cy_stc_hpi_context_t ptrHpiContext,
uint8_t  port,
uint8_t  evtType 
)

Notifies EC about platform-specific events, if mask is enabled.

Parameters
ptrHpiContextHPI library context pointer.
portPD port index.
evtTypeEvent type.
Returns
None.

◆ Cy_Hpi_EnqueuePdPktMsgEvent()

void Cy_Hpi_EnqueuePdPktMsgEvent ( cy_stc_hpi_context_t context,
uint8_t  port,
cy_stc_pd_packet_extd_t *  ptrPdPkt,
cy_en_hpi_response_t  eventType,
uint32_t  maskBit 
)

Enqueues HPI events or PD msgs from PDStack.

Parameters
contextHPI library context pointer.
portPD port index.
ptrPdPktPointer to the PD Pkt.
eventTypeEvent type.
maskBitMask bit controls the reporting of HPI events.
Returns
None.

◆ Cy_Hpi_InitSromParams()

void Cy_Hpi_InitSromParams ( bool  pdEn,
bool  pdCmdEn,
bool  ucsiEn,
bool  dualAppEn,
const uint32_t *  ptrHpiDevMask,
const uint32_t *  ptrHpiPortMask 
)

Initializes the HPI parameters required for HPI lib variant support.

Parameters
pdEntrue - If PD is enabled otherwise false.
pdCmdEntrue - If PD commands are enabled otherwise false.
ucsiEntrue - If UCSI is enabled otherwise false.
dualAppEntrue - If dual-app mode is enabled, otherwise false.
ptrHpiDevMaskHPI device register map to identify if the access is enabled or disabled for register/cmd.
ptrHpiPortMaskHPI Port register map to identify if the access is enabled or disabled for register/cmd.
Returns
None.
Note
This function is applicable for ROM-based code examples.

◆ Cy_Hpi_GetDevRegRespMskPtr()

const uint32_t* Cy_Hpi_GetDevRegRespMskPtr ( void  )

This function returns the address of the HPI Device register response mask array which defines whether the register/cmd access is enabled or disabled.

Returns
Address of the HPI Device register response mask array.
Note
This function is applicable only for ROM-based code examples.

◆ Cy_Hpi_GetPortRegRespMskPtr()

const uint32_t* Cy_Hpi_GetPortRegRespMskPtr ( void  )

This function returns the address of the HPI Port register response mask array which defines whether the register/cmd access is enabled or disabled.

Returns
Address of the HPI Port register response mask array.
Note
This function is applicable only for ROM-based code examples.