CAT2 Peripheral Driver Library

Functions

cy_en_usbpd_status_t Cy_USBPD_Phy_Init (cy_stc_usbpd_context_t *context, cy_cb_usbpd_phy_handle_events_t phyCbk)
 Initializes the PD phy registers and registers a callback (provided by the PD protocol state machine of the PDSTACK Middleware) which will be called when interrupts associated with the PD transceiver are received. More...
 
void Cy_USBPD_Phy_RefreshRoles (cy_stc_usbpd_context_t *context)
 Configures the PD phy based on the current power role, data role and contract status of the specified port. More...
 
bool Cy_USBPD_Phy_LoadMsg (cy_stc_usbpd_context_t *context, cy_en_pd_sop_t sop, uint8_t retries, uint8_t dobjCount, uint32_t header, bool unchunked, uint32_t *buf)
 Loads the PD message in FIFO and configures the necessary registers in preparation to sending the message out. More...
 
void Cy_USBPD_Phy_Reset_RxTx_SM (cy_stc_usbpd_context_t *context)
 Reset the PD receive and transmit state machines. More...
 
bool Cy_USBPD_Phy_SendMsg (cy_stc_usbpd_context_t *context)
 Starts the transmission of a PD message already loaded in FIFO. More...
 
cy_en_usbpd_status_t Cy_USBPD_Phy_SendBIST_Cm2 (cy_stc_usbpd_context_t *context)
 Starts transmission of BIST Carrier Mode 2. More...
 
cy_en_usbpd_status_t Cy_USBPD_Phy_AbortBIST_Cm2 (cy_stc_usbpd_context_t *context)
 Stops transmission of BIST Carrier Mode 2 pattern. More...
 
cy_en_usbpd_status_t Cy_USBPD_Phy_AbortTxMsg (cy_stc_usbpd_context_t *context)
 Stops transmission of any ongoing PD message. More...
 
cy_en_usbpd_status_t Cy_USBPD_Phy_SendReset (cy_stc_usbpd_context_t *context, cy_en_pd_sop_t sop)
 Starts transmission of a cable reset or a hard reset as requested. More...
 
void Cy_USBPD_Intr0RxTxHandler (cy_stc_usbpd_context_t *context)
 Interrupt Handler function for USBPD Transceiver and HPD interrupts. More...
 
cy_stc_pd_packet_extd_tCy_USBPD_Phy_GetRxPacket (cy_stc_usbpd_context_t *context)
 Returns the received packet. More...
 
void Cy_USBPD_Intr0Handler (cy_stc_usbpd_context_t *context)
 Interrupt Handler function for USBPD Transceiver and HPD interrupts. More...
 
bool Cy_USBPD_Phy_IsBusy (cy_stc_usbpd_context_t *context)
 Checks if the PD Phy is busy for the specified port based on passed context. More...
 
void Cy_USBPD_Phy_EnRx (cy_stc_usbpd_context_t *context)
 Enables the Phy Receiver. More...
 
void Cy_USBPD_Phy_DisRx (cy_stc_usbpd_context_t *context, uint8_t hardResetEn)
 Disables the Phy Receiver. More...
 
void Cy_USBPD_Phy_EnUnchunkedTx (cy_stc_usbpd_context_t *context)
 Enables the Phy to transmit Unchunked messages. More...
 
void Cy_USBPD_Phy_DisUnchunkedTx (cy_stc_usbpd_context_t *context)
 Disables the Phy to transmit Unchunked messages. More...
 
void Cy_USBPD_Phy_DisRxTx (cy_stc_usbpd_context_t *context)
 Disables the PD receive and transmit PHY. More...
 

Detailed Description

Function Documentation

◆ Cy_USBPD_Phy_Init()

cy_en_usbpd_status_t Cy_USBPD_Phy_Init ( cy_stc_usbpd_context_t context,
cy_cb_usbpd_phy_handle_events_t  phyCbk 
)

Initializes the PD phy registers and registers a callback (provided by the PD protocol state machine of the PDSTACK Middleware) which will be called when interrupts associated with the PD transceiver are received.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
phyCbkThe phy event handler callback.
Returns
CY_USBPD_STAT_SUCCESS if operation is successful, CY_USBPD_STAT_BAD_PARAM if the context pointer or phyCbk is invalid.

◆ Cy_USBPD_Phy_RefreshRoles()

void Cy_USBPD_Phy_RefreshRoles ( cy_stc_usbpd_context_t context)

Configures the PD phy based on the current power role, data role and contract status of the specified port.

This API does not enable the receiver.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_LoadMsg()

bool Cy_USBPD_Phy_LoadMsg ( cy_stc_usbpd_context_t context,
cy_en_pd_sop_t  sop,
uint8_t  retries,
uint8_t  dobjCount,
uint32_t  header,
bool  unchunked,
uint32_t *  buf 
)

Loads the PD message in FIFO and configures the necessary registers in preparation to sending the message out.

The actual message sending has to be triggered by calling Cy_USBPD_Phy_SendMsg().

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
sopSOP Type.
retriesNumber of retries.
dobjCountNo of data objects(each 32 bit) in data.
headerPD Header in lower 16 bits and optional unchunked extended header in upper 16 bits.
unchunkedUnchunked message if true.
bufPointer to message. Message buffer is a DWORD array that holds the data associated with data and extended data messages.
Returns
Returns true if successful, false otherwise.

◆ Cy_USBPD_Phy_Reset_RxTx_SM()

void Cy_USBPD_Phy_Reset_RxTx_SM ( cy_stc_usbpd_context_t context)

Reset the PD receive and transmit state machines.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_SendMsg()

bool Cy_USBPD_Phy_SendMsg ( cy_stc_usbpd_context_t context)

Starts the transmission of a PD message already loaded in FIFO.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Returns true if successful, false otherwise.

◆ Cy_USBPD_Phy_SendBIST_Cm2()

cy_en_usbpd_status_t Cy_USBPD_Phy_SendBIST_Cm2 ( cy_stc_usbpd_context_t context)

Starts transmission of BIST Carrier Mode 2.

Once this API returns successfully, the PHY continues to send the CM2 pattern until Cy_USBPD_Phy_AbortBIST_Cm2() is called.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
CY_USBPD_STAT_SUCCESS if operation is successful, CY_USBPD_STAT_BAD_PARAM if the context pointer is invalid.

◆ Cy_USBPD_Phy_AbortBIST_Cm2()

cy_en_usbpd_status_t Cy_USBPD_Phy_AbortBIST_Cm2 ( cy_stc_usbpd_context_t context)

Stops transmission of BIST Carrier Mode 2 pattern.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
CY_USBPD_STAT_SUCCESS if operation is successful, CY_USBPD_STAT_BAD_PARAM if the context pointer is invalid.

◆ Cy_USBPD_Phy_AbortTxMsg()

cy_en_usbpd_status_t Cy_USBPD_Phy_AbortTxMsg ( cy_stc_usbpd_context_t context)

Stops transmission of any ongoing PD message.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
CY_USBPD_STAT_SUCCESS if operation is successful, CY_USBPD_STAT_BAD_PARAM if the context pointer is invalid.

◆ Cy_USBPD_Phy_SendReset()

cy_en_usbpd_status_t Cy_USBPD_Phy_SendReset ( cy_stc_usbpd_context_t context,
cy_en_pd_sop_t  sop 
)

Starts transmission of a cable reset or a hard reset as requested.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
sopSOP Type.
Returns
CY_USBPD_STAT_SUCCESS if operation is successful, CY_USBPD_STAT_BAD_PARAM if the context pointer is invalid. CY_USBPD_STAT_BUSY if the USBPD operation is still in progress

◆ Cy_USBPD_Intr0RxTxHandler()

void Cy_USBPD_Intr0RxTxHandler ( cy_stc_usbpd_context_t context)

Interrupt Handler function for USBPD Transceiver and HPD interrupts.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_GetRxPacket()

cy_stc_pd_packet_extd_t* Cy_USBPD_Phy_GetRxPacket ( cy_stc_usbpd_context_t context)

Returns the received packet.

Since the interrupt handlers uses the same buffer to receive all incoming messages, the caller of this function needs to copy the data out before a new message is received.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
cy_stc_pd_packet_extd_t received PD message.

◆ Cy_USBPD_Intr0Handler()

void Cy_USBPD_Intr0Handler ( cy_stc_usbpd_context_t context)

Interrupt Handler function for USBPD Transceiver and HPD interrupts.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_IsBusy()

bool Cy_USBPD_Phy_IsBusy ( cy_stc_usbpd_context_t context)

Checks if the PD Phy is busy for the specified port based on passed context.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
Returns true if busy, otherwise false.

◆ Cy_USBPD_Phy_EnRx()

void Cy_USBPD_Phy_EnRx ( cy_stc_usbpd_context_t context)

Enables the Phy Receiver.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_DisRx()

void Cy_USBPD_Phy_DisRx ( cy_stc_usbpd_context_t context,
uint8_t  hardResetEn 
)

Disables the Phy Receiver.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
hardResetEnReceiver completely disabled if 0, Hard Reset can be received if set to 1.

◆ Cy_USBPD_Phy_EnUnchunkedTx()

void Cy_USBPD_Phy_EnUnchunkedTx ( cy_stc_usbpd_context_t context)

Enables the Phy to transmit Unchunked messages.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_DisUnchunkedTx()

void Cy_USBPD_Phy_DisUnchunkedTx ( cy_stc_usbpd_context_t context)

Disables the Phy to transmit Unchunked messages.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None

◆ Cy_USBPD_Phy_DisRxTx()

void Cy_USBPD_Phy_DisRxTx ( cy_stc_usbpd_context_t context)

Disables the PD receive and transmit PHY.

Parameters
contextThe pointer to the context structure cy_stc_usbpd_context_t allocated by the user. The structure is used during the USBPD operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
None