PDStack Middleware Library 2.0
Data Structures

General Description

This section describes the data structures defined by the PDStack.

Data Structures

union  cy_pdstack_extd_hdr_t
 Union to hold the PD extended header. More...
 
struct  cy_pdstack_extd_hdr_t::EXTD_HDR_T
 Extended header broken down into respective fields. More...
 
struct  cy_stc_pdstack_pd_power_status_t
 PD port status corresponding to the Status Data Block (SSDB) See Table 6-39 of USB-PD R3 specification. More...
 
union  cy_stc_pdstack_pd_port_status_ec_t
 PD port status as reported to embedded controller. More...
 
struct  cy_stc_pdstack_pd_port_status_ec_t::PD_PORT_STAT
 Structure containing status bits. More...
 
struct  app_resp_t
 Struct to hold response to policy manager. More...
 
struct  vdm_resp_t
 Struct to hold response to policy manager. More...
 
struct  cy_stc_pdstack_dpm_pd_cmd_buf_t
 Struct to hold PD command buffer. More...
 
struct  cy_stc_pdstack_contract_t
 Structure to hold PD Contract information. More...
 
struct  cy_stc_pdstack_pd_contract_info_t
 Structure to hold PD Contract information passed with APP_EVT_PD_CONTRACT_NEGOTIATION_COMPLETE event to the application. More...
 
struct  cy_stc_pdstack_pd_packet_t
 Struct to hold a PD packet. More...
 
struct  cy_stc_pdstack_pd_packet_epr_t
 Struct to hold an EPR PD packet. More...
 
struct  cy_stc_pdstack_app_cbk_t
 Struct to hold the application interface. More...
 
struct  cy_stc_pdstack_epr_t
 Extended Power Range structure. More...
 
struct  cy_stc_pdstack_dpm_status_t
 PD Device Policy Status structure. More...
 
struct  cy_stc_pdstack_dpm_ext_status_t
 PD Device Latest Policy Status structure. More...
 
struct  cy_stc_pdstack_typec_status_t
 Type C Manager Status structure. More...
 
struct  cy_stc_pdstack_prl_cntrs_t
 Struct to hold PD protocol message IDs and flags. More...
 
struct  cy_stc_pdstack_pd_status_t
 Structure to hold protocol layer status. More...
 
struct  cy_stc_pdstack_pe_status_t
 Structure to hold the Policy Engine Status. More...
 
struct  cy_stc_pdstack_dpm_params_t
 Structure to hold Device Policy Manager Parameters. More...
 
struct  cy_stc_pdstack_rtos_context_t
 Structure to hold the RTOS interface. More...
 
struct  cy_stc_pdstack_context_t
 Structure to PDSTACK Middleware context information. More...
 
struct  cy_pd_stack_conf_t
 Struct used to fetch the PD stack configuration supported by the library that is currently in use. More...
 
struct  cy_stc_pdstack_port_cfg_t
 Structure to hold PDSTACK Middleware configuration information. More...
 
struct  cy_timer_t
 Structure encapsulating information relating to a software timer. More...
 
struct  cy_stc_sw_timer_t
 Structure encapsulating information relating to a software timer context. More...
 

Typedefs

typedef void(* cy_pdstack_pd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, uint32_t event)
 PD callback prototype. More...
 
typedef void(* cy_pdstack_dpm_pd_cmd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_resp_status_t resp, const cy_stc_pdstack_pd_packet_t *pkt_ptr)
 DPM PD command callback. More...
 
typedef void(* cy_pdstack_app_resp_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, app_resp_t *resp)
 Application response callback. More...
 
typedef void(* cy_pdstack_vdm_resp_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, vdm_resp_t *resp)
 VDM response callback. More...
 
typedef void(* cy_pdstack_pwr_ready_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext)
 Power ready callback. More...
 
typedef void(* cy_pdstack_sink_discharge_off_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext)
 Sink discharge off callback. More...
 
typedef void(* cy_pdstack_dpm_typec_cmd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_dpm_typec_cmd_resp_t resp)
 Type C command response callback. More...
 
typedef uint16_t cy_timer_id_t
 Timer ID type definition. More...
 
typedef void(* cy_cb_timer_t) (cy_timer_id_t id, void *callbackContext)
 Timer callback function. More...
 

Enumerations

enum  cy_en_pdstack_pwr_led_t {
  CY_PDSTACK_LED_OFF = 0UL,
  CY_PDSTACK_LED_ON,
  CY_PDSTACK_LED_BLINKING,
  CY_PDSTACK_LED_BREATHING
}
 Enum of the Power LED States.
 
enum  typec_fsm_evt_t {
  CY_PDSTACK_TYPEC_FSM_EVT_ERR_RECOVERY = 0,
  CY_PDSTACK_TYPEC_FSM_EVT_ENTRY,
  CY_PDSTACK_TYPEC_FSM_EVT_DETACH,
  CY_PDSTACK_TYPEC_FSM_EVT_ATTACH,
  CY_PDSTACK_TYPEC_FSM_EVT_PWR_RDY,
  CY_PDSTACK_TYPEC_FSM_EVT_TIMEOUT1,
  CY_PDSTACK_TYPEC_FSM_EVT_TIMEOUT2,
  CY_PDSTACK_TYPEC_FSM_EVT_DPM_COMMAND,
  CY_PDSTACK_TYPEC_FSM_MAX_EVTS
}
 Enum to hold TypeC events id.
 

Typedef Documentation

◆ cy_pdstack_pd_cbk_t

typedef void(* cy_pdstack_pd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, uint32_t event)

PD callback prototype.

This is a stack internal callback function used by the USB-PD Protocol layer to send events to the Policy Engine. The events notified correspond to Policy Engine events such as HARD RESET or SOFT RESET received.

Parameters
ptrPdStackContextPdStack Library Context pointer.
Typeof event being notified.

◆ cy_pdstack_dpm_pd_cmd_cbk_t

typedef void(* cy_pdstack_dpm_pd_cmd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_resp_status_t resp, const cy_stc_pdstack_pd_packet_t *pkt_ptr)

DPM PD command callback.

This is the type of callback function used by the Policy Engine to report results of a command to the application layer.

Parameters
portPD port index.
respResponse code.
pkt_ptrPointer to any PD packet associated with the response.

◆ cy_pdstack_app_resp_cbk_t

typedef void(* cy_pdstack_app_resp_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, app_resp_t *resp)

Application response callback.

This is the type of callback used by the stack to receive application level responses associated with a PD message such as a SWAP request.

Parameters
portPD port index.
respPointer to the structure holding response information.

◆ cy_pdstack_vdm_resp_cbk_t

typedef void(* cy_pdstack_vdm_resp_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, vdm_resp_t *resp)

VDM response callback.

This is the type of callback used by the stack to receive application level responses to a VDM received from the port partner or cable marker.

Parameters
portPD port index.
respPointer to structure holding response information.

◆ cy_pdstack_pwr_ready_cbk_t

typedef void(* cy_pdstack_pwr_ready_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext)

Power ready callback.

Type of callback used by the stack to receive notification from the power source/sink hardware manager that the requested power transition has been completed.

Parameters
portPD port index.

◆ cy_pdstack_sink_discharge_off_cbk_t

typedef void(* cy_pdstack_sink_discharge_off_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext)

Sink discharge off callback.

Callback type used by the stack to receive notification that the sink discharge circuit has been turned off.

Parameters
portPD port index.

◆ cy_pdstack_dpm_typec_cmd_cbk_t

typedef void(* cy_pdstack_dpm_typec_cmd_cbk_t) (struct cy_stc_pdstack_context *ptrPdStackContext, cy_en_pdstack_dpm_typec_cmd_resp_t resp)

Type C command response callback.

Type of callback used by the stack to report results of a dpm_typec_command API call to the application layer.

Parameters
portPD port index.
respResponse code.

◆ cy_timer_id_t

Timer ID type definition.

This type definition is used to identify software timer objects. The timer ID needs to be unique for each soft timer instance and need to be maintained in the application. To maintain uniqueness, the following timer ID allocation rule is expected to be followed.

  • PD and Type-C stack (Port-0) : 0 - 31 : 32 timers
  • PD and Type-C stack (Port-1) : 32 - 63 : 32 timers
  • Base application stack (Port-0) : 64 - 191 : 128 timers
  • Base application stack (Port-1) : 192 - 319 : 128 timers
  • Solution (project directory) : 324 - 387 : 63 timers

◆ cy_cb_timer_t

cy_cb_timer_t

Timer callback function.

This callback function is invoked on timer expiry and should be treated as interrupt.