This section describes the PDStack Function Prototypes.
Functions | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Init (cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_usbpd_context_t *ptrUsbPdContext, const cy_stc_pdstack_port_cfg_t *ptrPortCfg, cy_stc_pdstack_app_cbk_t *ptrAppCbk, const cy_stc_pdstack_dpm_params_t *ptrDpmParams, cy_stc_sw_timer_t *ptrTimerContext) |
This function initializes the device policy manager with callback pointers and loads the port configuration information from the port config table. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Start (cy_stc_pdstack_context_t *ptrPdStackContext) |
This function makes the specified USB Type-C port operational. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Stop (cy_stc_pdstack_context_t *ptrPdStackContext) |
This function stops the port operation. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Disable (cy_stc_pdstack_context_t *ptrPdStackContext) |
This function disables the PD port operation and limits it to receiving hard reset signalling. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_PrepareDeepSleep (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrDeepSleep) |
This function configures the PD policy manager and Type-C manager state machines to allow the PMG1 device to be placed in deep sleep. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Resume (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrResume) |
This function resumes the Type-C manager and PD policy engine state machines after the PMG1 device has woken up from deep sleep. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsSleepAllowed (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrSleepAllowed) |
This function checks if the PD policy engine and Type-C manager state machines corresponding to the specified Type-C port are idle. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Rtos_Init (cy_stc_pdstack_context_t *ptrPdStackContext, cy_stc_pdstack_rtos_context_t *ptrRtosContext) |
This function initializes the device policy manager with RTOS context details. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Task (cy_stc_pdstack_context_t *ptrPdStackContext) |
This function runs the Type-C manager and PD policy manager tasks for the specified port. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_SendPdCommand (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_dpm_pd_cmd_t cmd, cy_stc_pdstack_dpm_pd_cmd_buf_t *ptrCmdBuf, bool isResp, cy_pdstack_dpm_pd_cmd_cbk_t cmdCbk) |
This function provides an interface for the application module to send PD commands. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_SendTypecCommand (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pdstack_dpm_typec_cmd_t cmd, cy_pdstack_dpm_typec_cmd_cbk_t cmdCbk) |
This function provides an interface for the application module to send commands to the Type-C connection manager. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_ProtReset (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pd_sop_t sop) |
This function resets PD protocol layer (transmit and receive) message ID counters for the specified PD packet type. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_ProtResetRx (cy_stc_pdstack_context_t *ptrPdStackContext, cy_en_pd_sop_t sop) |
This function resets the PD receive message counter for the specified packet type. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_PeStop (cy_stc_pdstack_context_t *ptrPdStackContext) |
This function stops the policy engine. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_Pd3SrcRpFlowControl (cy_stc_pdstack_context_t *ptrPdStackContext, bool blockSinkAms) |
This function is used to specify whether we should keep the Rp termination at SinkTxNG or SinkTxOK while acting as a PD 3.0 source. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsIdle (cy_stc_pdstack_context_t *ptrPdStackContext, bool *ptrIsIdle) |
Function to check whether the Type-C/PD stack is idle. More... | |
void | Cy_PdStack_Dpm_ClearSolnBusy (cy_stc_pdstack_context_t *ptrPdStackContext) |
Function to inform the Type-C/PD stack that the solution state allows Type-C transitions. More... | |
void | Cy_PdStack_Dpm_SetSolnBusy (cy_stc_pdstack_context_t *ptrPdStackContext) |
Function to inform the Type-C/PD stack that the solution state does not allow Type-C transitions. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_ChangeEprActiveFlag (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag) |
Function to change state of EPR mode active flag. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsEprModeActive (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isActive) |
Function to check whether EPR mode is active. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_ChangeEprToSpr (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag) |
Function changes the EPR to SPR indicator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsEprSpr (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isSpr) |
Function checks whether the EPR pdo needs to limit it to SPR. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsEprAvsModeActive (cy_stc_pdstack_context_t *ptrPdStackContext, bool *isActive) |
Function to check whether EPR AVS mode is active. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_ChangeEprAvsActiveFlag (cy_stc_pdstack_context_t *ptrPdStackContext, bool flag) |
Function to change state of EPR AVS mode active flag. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_IsValidAvsReq (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t src_pdo_index, cy_pd_pd_do_t rdo) |
Function to change state of EPR AVS mode active flag. More... | |
void | Cy_PdStack_Dpm_EprSnkSendKeepAliveCb (cy_timer_id_t id, void *ptrContext) |
Function callback to initiate Keep Alive message. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateSnkMaxMin (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, uint16_t *max_min) |
Function to update the sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateSnkCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask) |
Function to update the sink PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo) |
Function to update the sink PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateSrcCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask) |
Function to update the source PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateSrcCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo) |
Function to update the source PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateEprSnkCap (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t count, cy_pd_pd_do_t *pdo) |
Function to update the EPR sink PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
cy_en_pdstack_status_t | Cy_PdStack_Dpm_UpdateEprSnkCapMask (cy_stc_pdstack_context_t *ptrPdStackContext, uint8_t mask) |
Function to update the EPR sink PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator. More... | |
void | cy_sw_timer_init (cy_stc_sw_timer_t *context, uint32_t sysClkFreq) |
This function initializes the software timer module. More... | |
bool | cy_sw_timer_start (cy_stc_sw_timer_t *context, void *callbackContext, cy_timer_id_t id, uint16_t period, cy_cb_timer_t cb) |
Start a specific soft timer. More... | |
bool | cy_sw_timer_start_wocb (cy_stc_sw_timer_t *context, cy_timer_id_t id, uint16_t period) |
Start a specific soft timer without providing a callback for expiry notification. More... | |
void | cy_sw_timer_stop (cy_stc_sw_timer_t *context, cy_timer_id_t id) |
Stop a soft timer which is currently running. More... | |
bool | cy_sw_timer_is_running (cy_stc_sw_timer_t *context, cy_timer_id_t id) |
Check whether the specified soft timer is currently running. More... | |
bool | cy_sw_timer_range_enabled (cy_stc_sw_timer_t *context, cy_timer_id_t low, cy_timer_id_t high) |
Check whether the any of the soft timers in the specified range are currently running. More... | |
uint16_t | cy_sw_timer_get_count (cy_stc_sw_timer_t *context, cy_timer_id_t id) |
Returns the time (in ms) remaining for timer expiration. More... | |
void | cy_sw_timer_stop_all (cy_stc_sw_timer_t *context) |
Stops all active soft timers. More... | |
void | cy_sw_timer_stop_range (cy_stc_sw_timer_t *context, cy_timer_id_t start, cy_timer_id_t end) |
This function stops all soft timers with ids in the specified range. More... | |
uint8_t | cy_sw_timer_num_active (cy_stc_sw_timer_t *context) |
Returns number of active timers. More... | |
void | cy_sw_timer_enter_sleep (cy_stc_sw_timer_t *context) |
This function prepares the timer module and the hardware timer for entering device deep sleep. More... | |
void | cy_sw_timer_interrupt_handler (cy_stc_sw_timer_t *context) |
This function implements the interrupt handler callback used by the Soft Timer module, and is expected to be called by the application whenever the appropriate SysTick or WDT interrupt is received. More... | |
uint16_t | cy_sw_timer_get_multiplier (cy_stc_sw_timer_t *context) |
This function retrieves the number of low frequency (LF) clock ticks required per ms. More... | |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Init | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
cy_stc_usbpd_context_t * | ptrUsbPdContext, | ||
const cy_stc_pdstack_port_cfg_t * | ptrPortCfg, | ||
cy_stc_pdstack_app_cbk_t * | ptrAppCbk, | ||
const cy_stc_pdstack_dpm_params_t * | ptrDpmParams, | ||
cy_stc_sw_timer_t * | ptrTimerContext | ||
) |
This function 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.
ptrPdStackContext | PdStack Library Context pointer. |
ptrUsbPdContext | UsbPd Driver Context pointer. |
ptrPortCfg | Port Configuration pointer. |
ptrAppCbk | Application callback function pointer. |
ptrDpmParams | Pointer to the DPM parameter information structure. |
ptrTimerContext | Pointer to soft timer context structure. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Start | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
This function makes the specified USB Type-C port operational.
The port to be updated is specified by passing the PD Stack context corresponding to it.
ptrPdStackContext | PdStack Library Context pointer. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Stop | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
This function stops the port operation.
The USBPD block corresponding to the port will be disabled.
ptrPdStackContext | PdStack Library Context pointer. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Disable | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
This function disables the PD port operation and limits it to receiving hard reset signalling.
ptrPdStackContext | PdStack Library Context pointer. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_PrepareDeepSleep | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | ptrDeepSleep | ||
) |
This function configures the PD policy manager and Type-C manager state machines to allow the PMG1 device to be placed in deep sleep.
If the state machines are not in a busy state, the USBPD 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 PMG1 device shall not proceed into deep sleep.
ptrPdStackContext | PdStack Library Context pointer. |
ptrDeepSleep | Output parameter contains true if deepsleep is possible and configured, otherwise false |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Resume | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | ptrResume | ||
) |
This function resumes the Type-C manager and PD policy engine state machines after the PMG1 device has woken up from deep sleep.
This function 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 PMG1 device did not actually go into deep sleep due to other reasons.
ptrPdStackContext | PdStack Library Context pointer. |
ptrResume | Output parameter contains true if successful otherwise false |
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsSleepAllowed | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | ptrSleepAllowed | ||
) |
This function 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, deep sleep entry using the Cy_PdStack_Dpm_PrepareDeepSleep should not be attempted.
ptrPdStackContext | PdStack Library Context pointer. |
ptrSleepAllowed | Output parameter contains true if possible to go into sleep mode, otherwise false |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Rtos_Init | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
cy_stc_pdstack_rtos_context_t * | ptrRtosContext | ||
) |
This function initializes the device policy manager with RTOS context details.
ptrPdStackContext | PdStack Library Context pointer. |
ptrRtosContext | Pointer to RTOS API's callback context |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Task | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
This function runs the Type-C manager and PD policy manager tasks for the specified port.
ptrPdStackContext | PdStack Library Context pointer. |
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 | ||
) |
This function provides an interface for the application module to send PD commands.
ptrPdStackContext | PdStack Library Context pointer. |
cmd | Type of command to be initiated. |
ptrCmdBuf | Pointer to the command buffer. |
isResp | Set to true when the API is called to send a response to previously received PD messages. |
cmdCbk | Pointer to the callback function. |
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 | ||
) |
This function provides an interface for the application module to send commands to the Type-C connection manager.
ptrPdStackContext | PdStack Library Context pointer. |
cmd | Type of command to be performed. |
cmdCbk | Pointer to the callback function. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtReset | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
cy_en_pd_sop_t | sop | ||
) |
This function 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 PMG1. Message ID checks will not be performed for the next PD message of this type which is received by PMG1.
ptrPdStackContext | PdStack Library Context pointer. |
sop | Packet type (SOP, SOP' or SOP'') |
cy_en_pdstack_status_t Cy_PdStack_Dpm_ProtResetRx | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
cy_en_pd_sop_t | sop | ||
) |
This function resets the PD receive message counter for the specified packet type.
This will cause the stack to skip checking for valid message ID on the next PD message of this type which is received.
ptrPdStackContext | PdStack Library Context pointer. |
sop | Packet type (SOP, SOP' or SOP'') |
cy_en_pdstack_status_t Cy_PdStack_Dpm_PeStop | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
This function stops the policy engine.
Used in a fault scenario where-in the USBPD communication needs to be stopped, but the Type-C manager needs to be active in order to detect detach of the faulty device.
ptrPdStackContext | PdStack Library Context pointer. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_Pd3SrcRpFlowControl | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool | blockSinkAms | ||
) |
This function is used to specify whether we should 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. This function can be used to speed up operation when initiating back-to-back AMS-es by preventing the Rp from being changed back to SinkTxOK after each AMS.
ptrPdStackContext | PdStack Library Context pointer. |
blockSinkAms | If true, Rp will be changed to SinkTxNG; if false, Rp will be changed to SinkTxOK. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsIdle | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | ptrIsIdle | ||
) |
Function to check whether the Type-C/PD stack is idle.
ptrPdStackContext | PdStack Library Context pointer. |
ptrIsIdle | Output parameter contains true if idle, false if any operations are pending on any port. |
void Cy_PdStack_Dpm_ClearSolnBusy | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
Function to inform the Type-C/PD stack that the solution state allows Type-C transitions.
ptrPdStackContext | PdStack Library Context pointer. |
void Cy_PdStack_Dpm_SetSolnBusy | ( | cy_stc_pdstack_context_t * | ptrPdStackContext | ) |
Function to inform the Type-C/PD stack that the solution state does not allow Type-C transitions.
ptrPdStackContext | PdStack Library Context pointer. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprActiveFlag | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool | flag | ||
) |
Function to change state of EPR mode active flag.
ptrPdStackContext | PdStack Library Context pointer. |
flag | sets/resets EPR active flag. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprModeActive | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | isActive | ||
) |
Function to check whether EPR mode is active.
ptrPdStackContext | PdStack Library Context pointer. |
isActive | State of EPR flag |
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprToSpr | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool | flag | ||
) |
Function changes the EPR to SPR indicator.
ptrPdStackContext | PdStack Library Context pointer. |
flag | sets/resets EPR flag to limit PDO index. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprSpr | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | isSpr | ||
) |
Function checks whether the EPR pdo needs to limit it to SPR.
ptrPdStackContext | PdStack Library Context pointer. |
isSpr | Will contain true if eval pdo needs to limit pdo count to SPR otherwise false |
cy_en_pdstack_status_t Cy_PdStack_Dpm_IsEprAvsModeActive | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool * | isActive | ||
) |
Function to check whether EPR AVS mode is active.
ptrPdStackContext | PdStack Library Context pointer. |
isActive | State of EPR flag |
cy_en_pdstack_status_t Cy_PdStack_Dpm_ChangeEprAvsActiveFlag | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
bool | flag | ||
) |
Function to change state of EPR AVS mode active flag.
ptrPdStackContext | PdStack Library Context pointer. |
flag | sets/resets EPR AVS active flag. |
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 to change state of EPR AVS mode active flag.
ptrPdStackContext | PdStack Library Context pointer. |
src_pdo_index | SRC PDO index. |
rdo | Request Data Object received from port partner. |
void Cy_PdStack_Dpm_EprSnkSendKeepAliveCb | ( | cy_timer_id_t | id, |
void * | ptrContext | ||
) |
Function callback to initiate Keep Alive message.
id | Timer index |
ptrContext | Callback context |
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkMaxMin | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
uint8_t | count, | ||
uint16_t * | max_min | ||
) |
Function to update the sink max/min current/power at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
count | Number of PDOs |
max_min | Pointer to max/min current/power array. |
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSnkCapMask | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
uint8_t | mask | ||
) |
Function to update the sink PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
mask | PDO mask |
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 to update the sink PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
count | Number of PDOs |
pdo | Pointer to the PDO array |
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateSrcCapMask | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
uint8_t | mask | ||
) |
Function to update the source PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
mask | PDO Mask |
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 to update the source PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
count | Number of PDOs |
pdo | Pointer to the PDO array |
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 to update the EPR sink PDOs at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
count | Number of PDOs |
pdo | Pointer to the PDO array |
cy_en_pdstack_status_t Cy_PdStack_Dpm_UpdateEprSnkCapMask | ( | cy_stc_pdstack_context_t * | ptrPdStackContext, |
uint8_t | mask | ||
) |
Function to update the EPR sink PDO mask at runtime thereby overriding the generated configuration by EZ-PD Configurator.
ptrPdStackContext | PdStack Library Context pointer. |
mask | PDO Mask |
void cy_sw_timer_init | ( | cy_stc_sw_timer_t * | context, |
uint32_t | sysClkFreq | ||
) |
This function initializes the software timer module.
This function initializes the data structures for timer management and enables the hardware timer used for the soft timer implementation.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
sysClkFreq | SysClk frequency in MHz. This value is used to calibrate the watchdog timer. |
bool cy_sw_timer_start | ( | cy_stc_sw_timer_t * | context, |
void * | callbackContext, | ||
cy_timer_id_t | id, | ||
uint16_t | period, | ||
cy_cb_timer_t | cb | ||
) |
Start a specific soft timer.
All soft timers are one-shot timers which will run until the specified period has elapsed. The timer expiration callback will be called at the end of the period, if one is provided.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
callbackContext | Pointer to the caller context. |
id | Unique timer id |
period | Timer period in milliseconds. |
cb | Timer expiration callback. Can be NULL. |
All soft timers are one-shot timers which will run until the specified period has elapsed. The timer expiration callback will be called at the end of the period, if one is provided.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
callbackContext | Pointer to the caller context |
id | Unique timer id |
period | Timer period in milliseconds. |
cb | Timer expiration callback. Can be NULL. |
bool cy_sw_timer_start_wocb | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | id, | ||
uint16_t | period | ||
) |
Start a specific soft timer without providing a callback for expiry notification.
The status of the timer (running or not) can be checked using the cy_sw_timer_is_running API.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
period | Timer period in milliseconds. |
Start a specific soft timer without providing a callback for expiry notification.
All soft timers are one-shot timers which will run until the specified period has elapsed.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
period | Timer period in milliseconds. |
void cy_sw_timer_stop | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | id | ||
) |
Stop a soft timer which is currently running.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
bool cy_sw_timer_is_running | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | id | ||
) |
Check whether the specified soft timer is currently running.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
bool cy_sw_timer_range_enabled | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | low, | ||
cy_timer_id_t | high | ||
) |
Check whether the any of the soft timers in the specified range are currently running.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
low | Lowest soft timer ID to be checked. |
high | Highest soft timer ID to be checked. |
Check whether the any of the soft timers in the specified range are currently running.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
low | Lowest soft timer ID to be checked. |
high | Highest soft timer ID to be checked. |
uint16_t cy_sw_timer_get_count | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | id | ||
) |
Returns the time (in ms) remaining for timer expiration.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
Returns the time (in ms) remaining for timer expiration.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
id | Unique timer id |
void cy_sw_timer_stop_all | ( | cy_stc_sw_timer_t * | context | ) |
Stops all active soft timers.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
Stops all active soft timers.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure.. |
void cy_sw_timer_stop_range | ( | cy_stc_sw_timer_t * | context, |
cy_timer_id_t | start, | ||
cy_timer_id_t | end | ||
) |
This function stops all soft timers with ids in the specified range.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
start | Starting timer ID. The value is inclusive. |
end | Ending timer ID. The value is inclusive. |
uint8_t cy_sw_timer_num_active | ( | cy_stc_sw_timer_t * | context | ) |
Returns number of active timers.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
void cy_sw_timer_enter_sleep | ( | cy_stc_sw_timer_t * | context | ) |
This function prepares the timer module and the hardware timer for entering device deep sleep.
This must be called prior to entering deep sleep mode.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
void cy_sw_timer_interrupt_handler | ( | cy_stc_sw_timer_t * | context | ) |
This function implements the interrupt handler callback used by the Soft Timer module, and is expected to be called by the application whenever the appropriate SysTick or WDT interrupt is received.
This function scans all running timer instances and decrements their count as appropriate. If any of the timers has expired, it is stopped, de-allocated and the corresponding callback called (if not NULL). The timer can be restarted from the callback function if so desired.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
This function implements the interrupt handler callback used by the Soft Timer module, and is expected to be called by the application whenever the appropriate SysTick or WDT interrupt is received.
The ISR scans all running instances and decrements the count appropriately.
Timer ISR is called every 1ms (if not using Tickless implementation) or configured period if using tickless implementation. If there is any soft timer ON, in the ISR all active timer instances are decremented and then checked for timeouts. In case of timeout the timer is stopped and de-allocated. In case, a timer needs to be re-started, it can be done from the callback. On timer expire events are also raised here for various modules.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
uint16_t cy_sw_timer_get_multiplier | ( | cy_stc_sw_timer_t * | context | ) |
This function retrieves the number of low frequency (LF) clock ticks required per ms.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |
This function retrieves the number of low frequency (LF) clock ticks required per ms.
context | The pointer to the context structure cy_stc_sw_timer_t allocated by the user. The structure is used during the SW Timer operation for internal configuration and data retention. The user must not modify anything in this structure. |