The latest development version of this page may be more current than this released 3.7.0 version.

USB Type-C Port Controller (TCPC)

Overview

TCPC (USB Type-C Port Controller) The TCPC is a device used to simplify the implementation of a USB-C system by providing the following three function:

  • VBUS and VCONN control USB Type-C: The TCPC may provide a Source device, the mechanism to control VBUS sourcing, and a Sink device, the mechanism to control VBUS sinking. A similar mechanism is provided for the control of VCONN.

  • CC control and sensing: The TCPC implements logic for controlling the CC pin pull-up and pull-down resistors. It also provides a way to sense and report what resistors are present on the CC pin.

  • Power Delivery message reception and transmission USB Power Delivery: The TCPC sends and receives messages constructed in the TCPM and places them on the CC lines.

TCPC API

The TCPC device driver functions as the liaison between the TCPC device and the application software; this is accomplished by the Zephyr’s API provided by the device driver that’s used to communicate with and control the TCPC device.

Configuration Options

Related configuration options:

API Reference

group usb_type_c

USB Type-C.

Defines

TC_V_SINK_DISCONNECT_MIN_MV

VBUS minimum for a sink disconnect detection.

See Table 4-3 VBUS Sink Characteristics

TC_V_SINK_DISCONNECT_MAX_MV

VBUS maximum for a sink disconnect detection.

See Table 4-3 VBUS Sink Characteristics

TC_T_VBUS_ON_MAX_MS

From entry to Attached.SRC until VBUS reaches the minimum vSafe5V threshold as measured at the source’s receptacle See Table 4-29 VBUS and VCONN Timing Parameters.

TC_T_VBUS_OFF_MAX_MS

From the time the Sink is detached until the Source removes VBUS and reaches vSafe0V (See USB PD).

See Table 4-29 VBUS and VCONN Timing Parameters

TC_T_VCONN_ON_MAX_MS

From the time the Source supplied VBUS in the Attached.SRC state.

See Table 4-29 VBUS and VCONN Timing Parameters

TC_T_VCONN_ON_PA_MAX_MS

From the time a Sink with accessory support enters the PoweredAccessory state until the Sink sources minimum VCONN voltage (see Table 4-5) See Table 4-29 VBUS and VCONN Timing Parameters.

TC_T_VCONN_OFF_MAX_MS

From the time that a Sink is detached or as directed until the VCONN supply is disconnected.

See Table 4-29 VBUS and VCONN Timing Parameters

TC_T_SINK_ADJ_MAX_MS

Response time for a Sink to adjust its current consumption to be in the specified range due to a change in USB Type-C Current advertisement See Table 4-29 VBUS and VCONN Timing Parameters.

TC_T_DRP_MIN_MS

The minimum period a DRP shall complete a Source to Sink and back advertisement See Table 4-30 DRP Timing Parameters.

TC_T_DRP_MAX_MS

The maximum period a DRP shall complete a Source to Sink and back advertisement See Table 4-30 DRP Timing Parameters.

TC_T_DRP_TRANSITION_MIN_MS

The minimum time a DRP shall complete transitions between Source and Sink roles during role resolution See Table 4-30 DRP Timing Parameters.

TC_T_DRP_TRANSITION_MAX_MS

The maximum time a DRP shall complete transitions between Source and Sink roles during role resolution See Table 4-30 DRP Timing Parameters.

TC_T_DRP_TRY_MIN_MS

Minimum wait time associated with the Try.SRC state.

See Table 4-30 DRP Timing Parameters

TC_T_DRP_TRY_MAX_MS

Maximum wait time associated with the Try.SRC state.

See Table 4-30 DRP Timing Parameters

TC_T_DRP_TRY_WAIT_MIN_MS

Minimum wait time associated with the Try.SNK state.

See Table 4-30 DRP Timing Parameters

TC_T_DRP_TRY_WAIT_MAX_MS

Maximum wait time associated with the Try.SNK state.

See Table 4-30 DRP Timing Parameters

TC_T_TRY_TIMEOUT_MIN_MS

Minimum timeout for transition from Try.SRC to TryWait.SNK.

See Table 4-30 DRP Timing Parameters

TC_T_TRY_TIMEOUT_MAX_MS

Maximum timeout for transition from Try.SRC to TryWait.SNK.

See Table 4-30 DRP Timing Parameters

TC_T_VPD_DETACH_MIN_MS

Minimum Time for a DRP to detect that the connected Charge-Through VCONNPowered USB Device has been detached, after VBUS has been removed.

See Table 4-30 DRP Timing Parameters

TC_T_VPD_DETACH_MAX_MS

Maximum Time for a DRP to detect that the connected Charge-Through VCONNPowered USB Device has been detached, after VBUS has been removed.

See Table 4-30 DRP Timing Parameters

TC_T_CC_DEBOUNCE_MIN_MS

Minimum time a port shall wait before it can determine it is attached See Table 4-31 CC Timing.

TC_T_CC_DEBOUNCE_MAX_MS

Maximum time a port shall wait before it can determine it is attached See Table 4-31 CC Timing.

TC_T_PD_DEBOUNCE_MIN_MS

Minimum time a Sink port shall wait before it can determine it is detached due to the potential for USB PD signaling on CC as described in the state definitions.

See Table 4-31 CC Timing

TC_T_PD_DEBOUNCE_MAX_MS

Maximum time a Sink port shall wait before it can determine it is detached due to the potential for USB PD signaling on CC as described in the state definitions.

See Table 4-31 CC Timing

TC_T_TRY_CC_DEBOUNCE_MIN_MS

Minimum Time a port shall wait before it can determine it is re-attached during the try-wait process.

See Table 4-31 CC Timing

TC_T_TRY_CC_DEBOUNCE_MAX_MS

Maximum Time a port shall wait before it can determine it is re-attached during the try-wait process.

See Table 4-31 CC Timing

TC_T_ERROR_RECOVERY_SELF_POWERED_MIN_MS

Minimum time a self-powered port shall remain in the ErrorRecovery state.

See Table 4-31 CC Timing

TC_T_ERROR_RECOVERY_SOURCE_MIN_MS

Minimum time a source shall remain in the ErrorRecovery state if it was sourcing VCONN in the previous state.

See Table 4-31 CC Timing

TC_T_RP_VALUE_CHANGE_MIN_MS

Minimum time a Sink port shall wait before it can determine there has been a change in Rp where CC is not BMC Idle or the port is unable to detect BMC Idle.

See Table 4-31 CC Timing

TC_T_RP_VALUE_CHANGE_MAX_MS

Maximum time a Sink port shall wait before it can determine there has been a change in Rp where CC is not BMC Idle or the port is unable to detect BMC Idle.

See Table 4-31 CC Timing

TC_T_SRC_DISCONNECT_MIN_MS

Minimum time a Source shall detect the SRC.Open state.

The Source should detect the SRC.Open state as quickly as practical. See Table 4-31 CC Timing

TC_T_SRC_DISCONNECT_MAX_MS

Maximum time a Source shall detect the SRC.Open state.

The Source should detect the SRC.Open state as quickly as practical. See Table 4-31 CC Timing

TC_T_NO_TOGGLE_CONNECT_MIN_MS

Minimum time to detect connection when neither Port Partner is toggling.

See Table 4-31 CC Timing

TC_T_NO_TOGGLE_CONNECT_MAX_MS

Maximum time to detect connection when neither Port Partner is toggling.

See Table 4-31 CC Timing

TC_T_ONE_PORT_TOGGLE_CONNECT_MIN_MS

Minimum time to detect connection when one Port Partner is toggling 0ms … dcSRC.DRP max * tDRP max + 2 * tNoToggleConnect).

See Table 4-31 CC Timing

TC_T_ONE_PORT_TOGGLE_CONNECT_MAX_MS

Maximum time to detect connection when one Port Partner is toggling 0ms … dcSRC.DRP max * tDRP max + 2 * tNoToggleConnect).

See Table 4-31 CC Timing

TC_T_TWO_PORT_TOGGLE_CONNECT_MIN_MS

Minimum time to detect connection when both Port Partners are toggling (0ms … 5 * tDRP max + 2 * tNoToggleConnect).

See Table 4-31 CC Timing

TC_T_TWO_PORT_TOGGLE_CONNECT_MAX_MS

Maximum time to detect connection when both Port Partners are toggling (0ms … 5 * tDRP max + 2 * tNoToggleConnect).

See Table 4-31 CC Timing

TC_T_VPDCTDD_MIN_US

Minimum time for a Charge-Through VCONN-Powered USB Device to detect that the Charge-Through source has disconnected from CC after VBUS has been removed, transition to CTUnattached.VPD, and re-apply its Rp termination advertising 3.0 A on the host port CC.

See Table 4-31 CC Timing

TC_T_VPDCTDD_MAX_MS

Maximum time for a Charge-Through VCONN-Powered USB Device to detect that the Charge-Through source has disconnected from CC after VBUS has been removed, transition to CTUnattached.VPD, and re-apply its Rp termination advertising 3.0 A on the host port CC.

See Table 4-31 CC Timing

TC_T_VPDDISABLE_MIN_MS

Minimum time for a Charge-Through VCONN-Powered USB Device shall remain in CTDisabled.VPD state.

See Table 4-31 CC Timing

Enums

enum tc_cc_voltage_state

CC Voltage status.

Values:

enumerator TC_CC_VOLT_OPEN = 0

No port partner connection.

enumerator TC_CC_VOLT_RA = 1

Port partner is applying Ra.

enumerator TC_CC_VOLT_RD = 2

Port partner is applying Rd.

enumerator TC_CC_VOLT_RP_DEF = 5

Port partner is applying Rp (0.5A)

enumerator TC_CC_VOLT_RP_1A5 = 6
enumerator TC_CC_VOLT_RP_3A0 = 7

Port partner is applying Rp (3.0A)

enum tc_vbus_level

VBUS level voltages.

Values:

enumerator TC_VBUS_SAFE0V = 0

VBUS is less than vSafe0V max.

enumerator TC_VBUS_PRESENT = 1

VBUS is at least vSafe5V min.

enumerator TC_VBUS_REMOVED = 2

VBUS is less than vSinkDisconnect max.

enum tc_rp_value

Pull-Up resistor values.

Values:

enumerator TC_RP_USB = 0

Pull-Up resistor for a current of 900mA.

enumerator TC_RP_1A5 = 1

Pull-Up resistor for a current of 1.5A.

enumerator TC_RP_3A0 = 2

Pull-Up resistor for a current of 3.0A.

enumerator TC_RP_RESERVED = 3

No Pull-Up resistor is applied.

enum tc_cc_pull

CC pull resistors.

Values:

enumerator TC_CC_RA = 0

Ra Pull-Down resistor.

enumerator TC_CC_RP = 1

Rp Pull-Up resistor.

enumerator TC_CC_RD = 2

Rd Pull-Down resistor.

enumerator TC_CC_OPEN = 3

No CC resistor.

enumerator TC_RA_RD = 4

Ra and Rd Pull-Down resistor.

enum tc_cable_plug

Cable plug.

See 6.2.1.1.7 Cable Plug. Only applies to SOP’ and SOP”. Replaced by pd_power_role for SOP packets.

Values:

enumerator PD_PLUG_FROM_DFP_UFP = 0
enumerator PD_PLUG_FROM_CABLE_VPD = 1
enum tc_power_role

Power Delivery Power Role.

Values:

enumerator TC_ROLE_SINK = 0

Power role is a sink.

enumerator TC_ROLE_SOURCE = 1

Power role is a source.

enum tc_data_role

Power Delivery Data Role.

Values:

enumerator TC_ROLE_UFP = 0

Data role is an Upstream Facing Port.

enumerator TC_ROLE_DFP = 1

Data role is a Downstream Facing Port.

enumerator TC_ROLE_DISCONNECTED = 2

Port is disconnected.

enum tc_cc_polarity

Polarity of the CC lines.

Values:

enumerator TC_POLARITY_CC1 = 0

Use CC1 IO for Power Delivery communication.

enumerator TC_POLARITY_CC2 = 1

Use CC2 IO for Power Delivery communication.

enum tc_cc_states

Possible port partner connections based on CC line states.

Values:

enumerator TC_CC_NONE = 0

No port partner attached.

enumerator TC_CC_UFP_NONE = 1

From DFP perspective.

No UFP accessory connected

enumerator TC_CC_UFP_AUDIO_ACC = 2

UFP Audio accessory connected.

enumerator TC_CC_UFP_DEBUG_ACC = 3

UFP Debug accessory connected.

enumerator TC_CC_UFP_ATTACHED = 4

Plain UFP attached.

enumerator TC_CC_DFP_ATTACHED = 5

From UFP perspective.

Plain DFP attached

enumerator TC_CC_DFP_DEBUG_ACC = 6

DFP debug accessory connected.

group usb_type_c_port_controller_api

USB Type-C Port Controller API.

Since

3.1

Version

0.1.0

Typedefs

typedef int (*tcpc_vconn_control_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
typedef int (*tcpc_vconn_discharge_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
typedef void (*tcpc_alert_handler_cb_t)(const struct device *dev, void *data, enum tcpc_alert alert)

Enums

enum tcpc_alert

TCPC Alert bits.

Values:

enumerator TCPC_ALERT_CC_STATUS

CC status changed.

enumerator TCPC_ALERT_POWER_STATUS

Power status changed.

enumerator TCPC_ALERT_MSG_STATUS

Receive Buffer register changed.

enumerator TCPC_ALERT_HARD_RESET_RECEIVED

Received Hard Reset message.

enumerator TCPC_ALERT_TRANSMIT_MSG_FAILED

SOP* message transmission not successful.

enumerator TCPC_ALERT_TRANSMIT_MSG_DISCARDED

Reset or SOP* message transmission not sent due to an incoming receive message.

enumerator TCPC_ALERT_TRANSMIT_MSG_SUCCESS

Reset or SOP* message transmission successful.

enumerator TCPC_ALERT_VBUS_ALARM_HI

A high-voltage alarm has occurred.

enumerator TCPC_ALERT_VBUS_ALARM_LO

A low-voltage alarm has occurred.

enumerator TCPC_ALERT_FAULT_STATUS

A fault has occurred.

Read the FAULT_STATUS register

enumerator TCPC_ALERT_RX_BUFFER_OVERFLOW

TCPC RX buffer has overflowed.

enumerator TCPC_ALERT_VBUS_SNK_DISCONNECT

The TCPC in Attached.SNK state has detected a sink disconnect.

enumerator TCPC_ALERT_BEGINNING_MSG_STATUS

Receive buffer register changed.

enumerator TCPC_ALERT_EXTENDED_STATUS

Extended status changed.

enumerator TCPC_ALERT_EXTENDED

An extended interrupt event has occurred.

Read the alert_extended register

enumerator TCPC_ALERT_VENDOR_DEFINED

A vendor defined alert has been detected.

enum tcpc_status_reg

TCPC Status register.

Values:

enumerator TCPC_CC_STATUS

The CC Status register.

enumerator TCPC_POWER_STATUS

The Power Status register.

enumerator TCPC_FAULT_STATUS

The Fault Status register.

enumerator TCPC_EXTENDED_STATUS

The Extended Status register.

enumerator TCPC_EXTENDED_ALERT_STATUS

The Extended Alert Status register.

enumerator TCPC_VENDOR_DEFINED_STATUS

The Vendor Defined Status register.

Functions

static inline int tcpc_is_cc_rp(enum tc_cc_voltage_state cc)

Returns whether the sink has detected a Rp resistor on the other side.

static inline int tcpc_is_cc_open(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if both CC lines are completely open.

static inline int tcpc_is_cc_snk_dbg_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if we detect the port partner is a snk debug accessory.

static inline int tcpc_is_cc_src_dbg_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if we detect the port partner is a src debug accessory.

static inline int tcpc_is_cc_audio_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if the port partner is an audio accessory.

static inline int tcpc_is_cc_at_least_one_rd(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if the port partner is presenting at least one Rd.

static inline int tcpc_is_cc_only_one_rd(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)

Returns true if the port partner is presenting Rd on only one CC line.

static inline int tcpc_init(const struct device *dev)

Initializes the TCPC.

Parameters:
  • dev – Runtime device structure

Return values:
  • 0 – on success

  • -EIO – on failure

  • -EAGAIN – if initialization should be postponed

static inline int tcpc_get_cc(const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2)

Reads the status of the CC lines.

Parameters:
  • dev – Runtime device structure

  • cc1 – A pointer where the CC1 status is written

  • cc2 – A pointer where the CC2 status is written

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_select_rp_value(const struct device *dev, enum tc_rp_value rp)

Sets the value of CC pull up resistor used when operating as a Source.

Parameters:
  • dev – Runtime device structure

  • rp – Value of the Pull-Up Resistor.

Return values:
  • 0 – on success

  • -ENOSYS

  • -EIO – on failure

static inline int tcpc_get_rp_value(const struct device *dev, enum tc_rp_value *rp)

Gets the value of the CC pull up resistor used when operating as a Source.

Parameters:
  • dev – Runtime device structure

  • rp – pointer where the value of the Pull-Up Resistor is stored

Return values:
  • 0 – on success

  • -ENOSYS

  • -EIO – on failure

static inline int tcpc_set_cc(const struct device *dev, enum tc_cc_pull pull)

Sets the CC pull resistor and sets the role as either Source or Sink.

Parameters:
  • dev – Runtime device structure

  • pull – The pull resistor to set

Return values:
  • 0 – on success

  • -EIO – on failure

static inline void tcpc_set_vconn_cb(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb)

Sets a callback that can enable or disable VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC.

The callback is called in the tcpc_set_vconn function if vconn_cb isn’t NULL

Parameters:
  • dev – Runtime device structure

  • vconn_cb – pointer to the callback function that controls vconn

static inline void tcpc_set_vconn_discharge_cb(const struct device *dev, tcpc_vconn_discharge_cb_t cb)

Sets a callback that can enable or discharge VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC.

The callback is called in the tcpc_vconn_discharge function if cb isn’t NULL

Parameters:
  • dev – Runtime device structure

  • cb – pointer to the callback function that discharges vconn

static inline int tcpc_vconn_discharge(const struct device *dev, bool enable)

Discharges VCONN.

This function uses the TCPC to discharge VCONN if possible or calls the callback function set by tcpc_set_vconn_cb

Parameters:
  • dev – Runtime device structure

  • enable – VCONN discharge is enabled when true, it’s disabled

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_vconn(const struct device *dev, bool enable)

Enables or disables VCONN.

This function uses the TCPC to measure VCONN if possible or calls the callback function set by tcpc_set_vconn_cb

Parameters:
  • dev – Runtime device structure

  • enable – VCONN is enabled when true, it’s disabled

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_roles(const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role)

Sets the Power and Data Role of the PD message header.

This function only needs to be called once per data / power role change

Parameters:
  • dev – Runtime device structure

  • power_role – current power role

  • data_role – current data role

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_get_rx_pending_msg(const struct device *dev, struct pd_msg *buf)

Retrieves the Power Delivery message from the TCPC.

If buf is NULL, then only the status is returned, where 0 means there is a message pending and -ENODATA means there is no pending message.

Parameters:
  • dev – Runtime device structure

  • buf – pointer where the pd_buf pointer is written, NULL if only checking the status

Return values:
  • Greater – or equal to 0 is the number of bytes received if buf parameter is provided

  • 0 – if there is a message pending and buf parameter is NULL

  • -EIO – on failure

  • -ENODATA – if no message is pending

static inline int tcpc_set_rx_enable(const struct device *dev, bool enable)

Enables the reception of SOP* message types.

Parameters:
  • dev – Runtime device structure

  • enable – Enable Power Delivery when true, else it’s disabled

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_cc_polarity(const struct device *dev, enum tc_cc_polarity polarity)

Sets the polarity of the CC lines.

Parameters:
  • dev – Runtime device structure

  • polarity – Polarity of the cc line

Return values:
  • 0 – on success

  • -EIO – on failure

static inline int tcpc_transmit_data(const struct device *dev, struct pd_msg *msg)

Transmits a Power Delivery message.

Parameters:
  • dev – Runtime device structure

  • msg – Power Delivery message to transmit

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_dump_std_reg(const struct device *dev)

Dump a set of TCPC registers.

Parameters:
  • dev – Runtime device structure

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_alert_handler_cb(const struct device *dev, tcpc_alert_handler_cb_t handler, void *data)

Sets the alert function that’s called when an interrupt is triggered due to an alert bit.

Calling this function enables the particular alert bit

Parameters:
  • dev – Runtime device structure

  • handler – The callback function called when the bit is set

  • data – user data passed to the callback

Return values:
  • 0 – on success

  • -EINVAL – on failure

static inline int tcpc_get_status_register(const struct device *dev, enum tcpc_status_reg reg, int32_t *status)

Gets a status register.

Parameters:
  • dev – Runtime device structure

  • reg – The status register to read

  • status – Pointer where the status is stored

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_clear_status_register(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)

Clears a TCPC status register.

Parameters:
  • dev – Runtime device structure

  • reg – The status register to read

  • mask – A bit mask of the status register to clear. A status bit is cleared when it’s set to 1.

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_mask_status_register(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)

Sets the mask of a TCPC status register.

Parameters:
  • dev – Runtime device structure

  • reg – The status register to read

  • mask – A bit mask of the status register to mask. The status bit is masked if it’s 0, else it’s unmasked.

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_debug_accessory(const struct device *dev, bool enable)

Manual control of TCPC DebugAccessory control.

Parameters:
  • dev – Runtime device structure

  • enable – Enable Debug Accessory when true, else it’s disabled

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_debug_detach(const struct device *dev)

Detach from a debug connection.

Parameters:
  • dev – Runtime device structure

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_drp_toggle(const struct device *dev, bool enable)

Enable TCPC auto dual role toggle.

Parameters:
  • dev – Runtime device structure

  • enable – Auto dual role toggle is active when true, else it’s disabled

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_get_snk_ctrl(const struct device *dev)

Queries the current sinking state of the TCPC.

Parameters:
  • dev – Runtime device structure

Return values:
  • true – if sinking power

  • false – if not sinking power

  • -ENOSYS – if not implemented

static inline int tcpc_set_snk_ctrl(const struct device *dev, bool enable)

Set the VBUS sinking state of the TCPC.

Parameters:
  • dev – Runtime device structure

  • enable – True if sinking should be enabled, false if disabled

Return values:
  • 0 – on success

  • -ENOSYS – if not implemented

static inline int tcpc_get_src_ctrl(const struct device *dev)

Queries the current sourcing state of the TCPC.

Parameters:
  • dev – Runtime device structure

Return values:
  • true – if sourcing power

  • false – if not sourcing power

  • -ENOSYS – if not implemented

static inline int tcpc_set_src_ctrl(const struct device *dev, bool enable)

Set the VBUS sourcing state of the TCPC.

Parameters:
  • dev – Runtime device structure

  • enable – True if sourcing should be enabled, false if disabled

Return values:
  • 0 – on success

  • -ENOSYS – if not implemented

static inline int tcpc_set_bist_test_mode(const struct device *dev, bool enable)

Controls the BIST Mode of the TCPC.

It disables RX alerts while the mode is active.

Parameters:
  • dev – Runtime device structure

  • enable – The TCPC enters BIST TEST Mode when true

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_get_chip_info(const struct device *dev, struct tcpc_chip_info *chip_info)

Gets the TCPC firmware version.

Parameters:
  • dev – Runtime device structure

  • chip_info – Pointer to TCPC chip info where the version is stored

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_set_low_power_mode(const struct device *dev, bool enable)

Instructs the TCPC to enter or exit low power mode.

Parameters:
  • dev – Runtime device structure

  • enable – The TCPC enters low power mode when true, else it exits it

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

static inline int tcpc_sop_prime_enable(const struct device *dev, bool enable)

Enables the reception of SOP Prime messages.

Parameters:
  • dev – Runtime device structure

  • enable – Can receive SOP Prime messages when true, else it can not

Return values:
  • 0 – on success

  • -EIO – on failure

  • -ENOSYS – if not implemented

struct tcpc_chip_info
#include <usbc_tcpc.h>

TCPC Chip Information.

Public Members

uint16_t vendor_id

Vendor Id.

uint16_t product_id

Product Id.

uint16_t device_id

Device Id.

uint64_t fw_version_number

Firmware version number.

uint8_t min_req_fw_version_string[8]

Minimum Required firmware version string.

uint64_t min_req_fw_version_number

Minimum Required firmware version number.

struct tcpc_driver_api
#include <usbc_tcpc.h>
group usb_power_delivery

USB Power Delivery.

USB PD 3.1 Rev 1.6, Table 6-70 Counter Parameters

PD_N_CAPS_COUNT

The CapsCounter is used to count the number of Source_Capabilities Messages which have been sent by a Source at power up or after a Hard Reset.

Parameter Name: nCapsCounter

PD_N_HARD_RESET_COUNT

The HardResetCounter is used to retry the Hard Reset whenever there is no response from the remote device (see Section 6.6.6) Parameter Name: nHardResetCounter.

USB PD 3.1 Rev 1.6, Table 6-68 Time Values

PD_T_NO_RESPONSE_MIN_MS

The NoResponseTimer is used by the Policy Engine in a Source to determine that its Port Partner is not responding after a Hard Reset.

Parameter Name: tNoResponseTimer

PD_T_NO_RESPONSE_MAX_MS

The NoResponseTimer is used by the Policy Engine in a Source to determine that its Port Partner is not responding after a Hard Reset.

Parameter Name: tNoResponseTimer

PD_T_PS_HARD_RESET_MIN_MS

Min time the Source waits to ensure that the Sink has had sufficient time to process Hard Reset Signaling before turning off its power supply to VBUS Parameter Name: tPSHardReset.

PD_T_PS_HARD_RESET_MAX_MS

Max time the Source waits to ensure that the Sink has had sufficient time to process Hard Reset Signaling before turning off its power supply to VBUS Parameter Name: tPSHardReset.

PD_T_SINK_TX_MIN_MS

Minimum time a Source waits after changing Rp from SinkTxOk to SinkTxNG before initiating an AMS by sending a Message.

Parameter Name: tSinkTx

PD_T_SINK_TX_MAX_MS

Maximum time a Source waits after changing Rp from SinkTxOk to SinkTxNG before initiating an AMS by sending a Message.

Parameter Name: tSinkTx

PD_T_TYPEC_SEND_SOURCE_CAP_MIN_MS

Minimum time a source shall wait before sending a Source_Capabilities message while the following is true: 1) The Port is Attached.

2) The Source is not in an active connection with a PD Sink Port. Parameter Name: tTypeCSendSourceCap

PD_T_TYPEC_SEND_SOURCE_CAP_MAX_MS

Maximum time a source shall wait before sending a Source_Capabilities message while the following is true: 1) The Port is Attached.

2) The Source is not in an active connection with a PD Sink Port. Parameter Name: tTypeCSendSourceCap

Defines

PD_MAX_EXTENDED_MSG_LEGACY_LEN

Maximum length of a non-Extended Message in bytes.

See Table 6-75 Value Parameters Parameter Name: MaxExtendedMsgLegacyLen

PD_MAX_EXTENDED_MSG_LEN

Maximum length of an Extended Message in bytes.

See Table 6-75 Value Parameters Parameter Name: MaxExtendedMsgLen

PD_MAX_EXTENDED_MSG_CHUNK_LEN

Maximum length of a Chunked Message in bytes.

When one of both Port Partners do not support Extended Messages of Data Size greater than PD_MAX_EXTENDED_MSG_LEGACY_LEN then the Protocol Layer supports a Chunking mechanism to break larger Messages into smaller Chunks of size PD_MAX_EXTENDED_MSG_CHUNK_LEN. See Table 6-75 Value Parameters Parameter Name: MaxExtendedMsgChunkLen

PD_T_TYPEC_SINK_WAIT_CAP_MIN_MS

Minimum time a sink shall wait for a Source_Capabilities message before sending a Hard Reset See Table 6-61 Time Values Parameter Name: tTypeCSinkWaitCap.

PD_T_TYPEC_SINK_WAIT_CAP_MAX_MS

Minimum time a sink shall wait for a Source_Capabilities message before sending a Hard Reset See Table 6-61 Time Values Parameter Name: tTypeCSinkWaitCap.

PD_V_SAFE_0V_MAX_MV

VBUS maximum safe operating voltage at “zero volts”.

See Table 7-24 Common Source/Sink Electrical Parameters Parameter Name: vSafe0V

PD_V_SAFE_5V_MIN_MV

VBUS minimum safe operating voltage at 5V.

See Table 7-24 Common Source/Sink Electrical Parameters Parameter Name: vSafe5V

PD_T_SAFE_0V_MAX_MS

Time to reach PD_V_SAFE_0V_MV max in milliseconds.

See Table 7-24 Common Source/Sink Electrical Parameters Parameter Name: tSafe0V

PD_T_SAFE_5V_MAX_MS

Time to reach PD_V_SAFE_5V_MV max in milliseconds.

See Table 7-24 Common Source/Sink Electrical Parameters Parameter Name: tSafe5V

PD_T_TX_TIMEOUT_MS

Time to wait for TCPC to complete transmit.

PD_T_HARD_RESET_COMPLETE_MIN_MS

Minimum time a Hard Reset must complete.

See Table 6-68 Time Values

PD_T_HARD_RESET_COMPLETE_MAX_MS

Maximum time a Hard Reset must complete.

See Table 6-68 Time Values

PD_T_SENDER_RESPONSE_MIN_MS

Minimum time a response must be sent from a Port Partner See Table 6-68 Time Values.

PD_T_SENDER_RESPONSE_NOM_MS

Nomiminal time a response must be sent from a Port Partner See Table 6-68 Time Values.

PD_T_SENDER_RESPONSE_MAX_MS

Maximum time a response must be sent from a Port Partner See Table 6-68 Time Values.

PD_T_SPR_PS_TRANSITION_MIN_MS

Minimum SPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_SPR_PS_TRANSITION_NOM_MS

Nominal SPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_SPR_PS_TRANSITION_MAX_MS

Maximum SPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_EPR_PS_TRANSITION_MIN_MS

Minimum EPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_EPR_PS_TRANSITION_NOM_MS

Nominal EPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_EPR_PS_TRANSITION_MAX_MS

Maximum EPR Mode time for a power supply to transition to a new level See Table 6-68 Time Values.

PD_T_SINK_REQUEST_MIN_MS

Minimum time to wait before sending another request after receiving a Wait message See Table 6-68 Time Values.

PD_T_CHUNKING_NOT_SUPPORTED_MIN_MS

Minimum time to wait before sending a Not_Supported message after receiving a Chunked message See Table 6-68 Time Values.

PD_T_CHUNKING_NOT_SUPPORTED_NOM_MS

Nominal time to wait before sending a Not_Supported message after receiving a Chunked message See Table 6-68 Time Values.

PD_T_CHUNKING_NOT_SUPPORTED_MAX_MS

Maximum time to wait before sending a Not_Supported message after receiving a Chunked message See Table 6-68 Time Values.

PD_CONVERT_BYTES_TO_PD_HEADER_COUNT(c)

Convert bytes to PD Header data object count, where a data object is 4-bytes.

Parameters:
  • c – number of bytes to convert

PD_CONVERT_PD_HEADER_COUNT_TO_BYTES(c)

Convert PD Header data object count to bytes.

Parameters:
  • c – number of PD Header data objects

SINK_TX_OK

Collision avoidance Rp values in REV 3.0 Sink Transmit “OK”.

SINK_TX_NG

Collision avoidance Rp values in REV 3.0 Sink Transmit “NO GO”.

PD_GET_EXT_HEADER(c)

Used to get extended header from the first 32-bit word of the message.

Parameters:
  • c – first 32-bit word of the message

PDO_MAX_DATA_OBJECTS

PDO - Power Data Object RDO - Request Data Object.

Maximum number of 32-bit data objects sent in a single request

PD_CONVERT_MA_TO_FIXED_PDO_CURRENT(c)

Convert milliamps to Fixed PDO Current in 10mA units.

Parameters:
  • c – Current in milliamps

PD_CONVERT_MV_TO_FIXED_PDO_VOLTAGE(v)

Convert millivolts to Fixed PDO Voltage in 50mV units.

Parameters:
  • v – Voltage in millivolts

PD_CONVERT_FIXED_PDO_CURRENT_TO_MA(c)

Convert a Fixed PDO Current from 10mA units to milliamps.

Parameters:
  • c – Fixed PDO current in 10mA units.

PD_CONVERT_FIXED_PDO_VOLTAGE_TO_MV(v)

Convert a Fixed PDO Voltage from 50mV units to millivolts.

Used for converting pd_fixed_supply_pdo_source.voltage and pd_fixed_supply_pdo_sink.voltage

Parameters:
  • v – Fixed PDO voltage in 50mV units.

PD_CONVERT_MA_TO_VARIABLE_PDO_CURRENT(c)

Convert milliamps to Variable PDO Current in 10ma units.

Parameters:
  • c – Current in milliamps

PD_CONVERT_MV_TO_VARIABLE_PDO_VOLTAGE(v)

Convert millivolts to Variable PDO Voltage in 50mV units.

Parameters:
  • v – Voltage in millivolts

PD_CONVERT_VARIABLE_PDO_CURRENT_TO_MA(c)

Convert a Variable PDO Current from 10mA units to milliamps.

Parameters:
  • c – Variable PDO current in 10mA units.

PD_CONVERT_VARIABLE_PDO_VOLTAGE_TO_MV(v)

Convert a Variable PDO Voltage from 50mV units to millivolts.

Parameters:
  • v – Variable PDO voltage in 50mV units.

PD_CONVERT_MW_TO_BATTERY_PDO_POWER(c)

Convert milliwatts to Battery PDO Power in 250mW units.

Parameters:
  • c – Power in milliwatts

PD_CONVERT_MV_TO_BATTERY_PDO_VOLTAGE(v)

Convert milliwatts to Battery PDO Voltage in 50mV units.

Parameters:
  • v – Voltage in millivolts

PD_CONVERT_BATTERY_PDO_POWER_TO_MW(c)

Convert a Battery PDO Power from 250mW units to milliwatts.

Parameters:
  • c – Power in 250mW units.

PD_CONVERT_BATTERY_PDO_VOLTAGE_TO_MV(v)

Convert a Battery PDO Voltage from 50mV units to millivolts.

Parameters:
  • v – Voltage in 50mV units.

PD_CONVERT_MA_TO_AUGMENTED_PDO_CURRENT(c)

Convert milliamps to Augmented PDO Current in 50mA units.

Parameters:
  • c – Current in milliamps

PD_CONVERT_MV_TO_AUGMENTED_PDO_VOLTAGE(v)

Convert millivolts to Augmented PDO Voltage in 100mV units.

Parameters:
  • v – Voltage in millivolts

PD_CONVERT_AUGMENTED_PDO_CURRENT_TO_MA(c)

Convert an Augmented PDO Current from 50mA units to milliamps.

Parameters:
  • c – Augmented PDO current in 50mA units.

PD_CONVERT_AUGMENTED_PDO_VOLTAGE_TO_MV(v)

Convert an Augmented PDO Voltage from 100mV units to millivolts.

Parameters:
  • v – Augmented PDO voltage in 100mV units.

NUM_SOP_STAR_TYPES

Number of valid Transmit Types.

Enums

enum pdo_type

Power Data Object Type Table 6-7 Power Data Object.

Values:

enumerator PDO_FIXED = 0

Fixed supply (Vmin = Vmax)

enumerator PDO_BATTERY = 1

Battery.

enumerator PDO_VARIABLE = 2

Variable Supply (non-Battery)

enumerator PDO_AUGMENTED = 3

Augmented Power Data Object (APDO)

enum pd_frs_type

Fast Role Swap Required for USB Type-C current.

Values:

enumerator FRS_NOT_SUPPORTED

Fast Swap not supported.

enumerator FRS_DEFAULT_USB_POWER

Default USB Power.

enumerator FRS_1P5A_5V

1.5A @ 5V

enumerator FRS_3P0A_5V

3.0A @ 5V

enum pd_rev_type

Protocol revision.

Values:

enumerator PD_REV10 = 0

PD revision 1.0.

enumerator PD_REV20 = 1

PD revision 2.0.

enumerator PD_REV30 = 2

PD revision 3.0.

enum pd_packet_type

Power Delivery packet type See USB Type-C Port Controller Interface Specification, Revision 2.0, Version 1.2, Table 4-38 TRANSMIT Register Definition.

Values:

enumerator PD_PACKET_SOP = 0

Port Partner message.

enumerator PD_PACKET_SOP_PRIME = 1

Cable Plug message.

enumerator PD_PACKET_PRIME_PRIME = 2

Cable Plug message far end.

enumerator PD_PACKET_DEBUG_PRIME = 3

Currently undefined in the PD specification.

enumerator PD_PACKET_DEBUG_PRIME_PRIME = 4

Currently undefined in the PD specification.

enumerator PD_PACKET_TX_HARD_RESET = 5

Hard Reset message to the Port Partner.

enumerator PD_PACKET_CABLE_RESET = 6

Cable Reset message to the Cable.

enumerator PD_PACKET_TX_BIST_MODE_2 = 7

BIST_MODE_2 message to the Port Partner.

enumerator PD_PACKET_MSG_INVALID = 0xf

USED ONLY FOR RECEPTION OF UNKNOWN MSG TYPES.

enum pd_ctrl_msg_type

Control Message type See Table 6-5 Control Message Types.

Values:

enumerator PD_CTRL_GOOD_CRC = 1

0 Reserved

GoodCRC Message

enumerator PD_CTRL_GOTO_MIN = 2

GotoMin Message.

enumerator PD_CTRL_ACCEPT = 3

Accept Message.

enumerator PD_CTRL_REJECT = 4

Reject Message.

enumerator PD_CTRL_PING = 5

Ping Message.

enumerator PD_CTRL_PS_RDY = 6

PS_RDY Message.

enumerator PD_CTRL_GET_SOURCE_CAP = 7

Get_Source_Cap Message.

enumerator PD_CTRL_GET_SINK_CAP = 8

Get_Sink_Cap Message.

enumerator PD_CTRL_DR_SWAP = 9

DR_Swap Message.

enumerator PD_CTRL_PR_SWAP = 10

PR_Swap Message.

enumerator PD_CTRL_VCONN_SWAP = 11

VCONN_Swap Message.

enumerator PD_CTRL_WAIT = 12

Wait Message.

enumerator PD_CTRL_SOFT_RESET = 13

Soft Reset Message.

enumerator PD_CTRL_DATA_RESET = 14

Used for REV 3.0.

Data_Reset Message

enumerator PD_CTRL_DATA_RESET_COMPLETE = 15

Data_Reset_Complete Message.

enumerator PD_CTRL_NOT_SUPPORTED = 16

Not_Supported Message.

enumerator PD_CTRL_GET_SOURCE_CAP_EXT = 17

Get_Source_Cap_Extended Message.

enumerator PD_CTRL_GET_STATUS = 18

Get_Status Message.

enumerator PD_CTRL_FR_SWAP = 19

FR_Swap Message.

enumerator PD_CTRL_GET_PPS_STATUS = 20

Get_PPS_Status Message.

enumerator PD_CTRL_GET_COUNTRY_CODES = 21

Get_Country_Codes Message.

enumerator PD_CTRL_GET_SINK_CAP_EXT = 22

Get_Sink_Cap_Extended Message.

enum pd_data_msg_type

Data message type See Table 6-6 Data Message Types.

Values:

enumerator PD_DATA_SOURCE_CAP = 1

0 Reserved

Source_Capabilities Message

enumerator PD_DATA_REQUEST = 2

Request Message.

enumerator PD_DATA_BIST = 3

BIST Message.

enumerator PD_DATA_SINK_CAP = 4

Sink Capabilities Message.

enumerator PD_DATA_BATTERY_STATUS = 5

5-14 Reserved for REV 2.0

enumerator PD_DATA_ALERT = 6

Alert Message.

enumerator PD_DATA_GET_COUNTRY_INFO = 7

Get Country Info Message.

enumerator PD_DATA_ENTER_USB = 8

8-14 Reserved for REV 3.0

Enter USB message

enumerator PD_DATA_VENDOR_DEF = 15

Vendor Defined Message.

enum pd_ext_msg_type

Extended message type for REV 3.0 See Table 6-48 Extended Message Types.

Values:

enumerator PD_EXT_SOURCE_CAP = 1

0 Reserved

Source_Capabilities_Extended Message

enumerator PD_EXT_STATUS = 2

Status Message.

enumerator PD_EXT_GET_BATTERY_CAP = 3

Get_Battery_Cap Message.

enumerator PD_EXT_GET_BATTERY_STATUS = 4

Get_Battery_Status Message.

enumerator PD_EXT_BATTERY_CAP = 5

Battery_Capabilities Message.

enumerator PD_EXT_GET_MANUFACTURER_INFO = 6

Get_Manufacturer_Info Message.

enumerator PD_EXT_MANUFACTURER_INFO = 7

Manufacturer_Info Message.

enumerator PD_EXT_SECURITY_REQUEST = 8

Security_Request Message.

enumerator PD_EXT_SECURITY_RESPONSE = 9

Security_Response Message.

enumerator PD_EXT_FIRMWARE_UPDATE_REQUEST = 10

Firmware_Update_Request Message.

enumerator PD_EXT_FIRMWARE_UPDATE_RESPONSE = 11

Firmware_Update_Response Message.

enumerator PD_EXT_PPS_STATUS = 12

PPS_Status Message.

enumerator PD_EXT_COUNTRY_INFO = 13

Country_Codes Message.

enumerator PD_EXT_COUNTRY_CODES = 14

Country_Info Message.

enum usbpd_cc_pin

Active PD CC pin.

Values:

enumerator USBPD_CC_PIN_1 = 0

PD is active on CC1.

enumerator USBPD_CC_PIN_2 = 1

PD is active on CC2.

union pd_header
#include <usbc_pd.h>

Build a PD message header See Table 6-1 Message Header.

Public Members

uint16_t message_type

Type of message.

uint16_t port_data_role

Port Data role.

uint16_t specification_revision

Specification Revision.

uint16_t port_power_role

Port Power Role.

uint16_t message_id

Message ID.

uint16_t number_of_data_objects

Number of Data Objects.

uint16_t extended

Extended Message.

struct pd_header.[anonymous] [anonymous]
uint16_t raw_value
union pd_ext_header
#include <usbc_pd.h>

Build an extended message header See Table 6-3 Extended Message Header.

Public Members

uint16_t data_size

Number of total bytes in data block.

uint16_t reserved0

Reserved.

uint16_t request_chunk

1 for a chunked message, else 0

uint16_t chunk_number

Chunk number when chkd = 1, else 0.

uint16_t chunked

1 for chunked messages

struct pd_ext_header.[anonymous] [anonymous]
uint16_t raw_value

Raw PD Ext Header value.

union pd_fixed_supply_pdo_source
#include <usbc_pd.h>

Create a Fixed Supply PDO Source value See Table 6-9 Fixed Supply PDO - Source.

Public Members

uint32_t max_current

Maximum Current in 10mA units.

uint32_t voltage

Voltage in 50mV units.

uint32_t peak_current

Peak Current.

uint32_t reserved0

Reserved – Shall be set to zero.

uint32_t unchunked_ext_msg_supported

Unchunked Extended Messages Supported.

uint32_t dual_role_data

Dual-Role Data.

uint32_t usb_comms_capable

USB Communications Capable.

uint32_t unconstrained_power

Unconstrained Power.

uint32_t usb_suspend_supported

USB Suspend Supported.

uint32_t dual_role_power

Dual-Role Power.

enum pdo_type type

Fixed supply.

SET TO PDO_FIXED

struct pd_fixed_supply_pdo_source.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_fixed_supply_pdo_sink
#include <usbc_pd.h>

Create a Fixed Supply PDO Sink value See Table 6-14 Fixed Supply PDO - Sink.

Public Members

uint32_t operational_current

Operational Current in 10mA units.

uint32_t voltage

Voltage in 50mV units.

uint32_t reserved0

Reserved – Shall be set to zero.

enum pd_frs_type frs_required

Fast Role Swap required USB Type-C Current.

uint32_t dual_role_data

Dual-Role Data.

uint32_t usb_comms_capable

USB Communications Capable.

uint32_t unconstrained_power

Unconstrained Power.

uint32_t higher_capability

Higher Capability.

uint32_t dual_role_power

Dual-Role Power.

enum pdo_type type

Fixed supply.

SET TO PDO_FIXED

struct pd_fixed_supply_pdo_sink.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_variable_supply_pdo_source
#include <usbc_pd.h>

Create a Variable Supply PDO Source value See Table 6-11 Variable Supply (non-Battery) PDO - Source.

Public Members

uint32_t max_current

Maximum Current in 10mA units.

uint32_t min_voltage

Minimum Voltage in 50mV units.

uint32_t max_voltage

Maximum Voltage in 50mV units.

enum pdo_type type

Variable supply.

SET TO PDO_VARIABLE

struct pd_variable_supply_pdo_source.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_variable_supply_pdo_sink
#include <usbc_pd.h>

Create a Variable Supply PDO Sink value See Table 6-15 Variable Supply (non-Battery) PDO - Sink.

Public Members

uint32_t operational_current

operational Current in 10mA units

uint32_t min_voltage

Minimum Voltage in 50mV units.

uint32_t max_voltage

Maximum Voltage in 50mV units.

enum pdo_type type

Variable supply.

SET TO PDO_VARIABLE

struct pd_variable_supply_pdo_sink.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_battery_supply_pdo_source
#include <usbc_pd.h>

Create a Battery Supply PDO Source value See Table 6-12 Battery Supply PDO - Source.

Public Members

uint32_t max_power

Maximum Allowable Power in 250mW units.

uint32_t min_voltage

Minimum Voltage in 50mV units.

uint32_t max_voltage

Maximum Voltage in 50mV units.

enum pdo_type type

Battery supply.

SET TO PDO_BATTERY

struct pd_battery_supply_pdo_source.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_battery_supply_pdo_sink
#include <usbc_pd.h>

Create a Battery Supply PDO Sink value See Table 6-16 Battery Supply PDO - Sink.

Public Members

uint32_t operational_power

Operational Power in 250mW units.

uint32_t min_voltage

Minimum Voltage in 50mV units.

uint32_t max_voltage

Maximum Voltage in 50mV units.

enum pdo_type type

Battery supply.

SET TO PDO_BATTERY

struct pd_battery_supply_pdo_sink.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_augmented_supply_pdo_source
#include <usbc_pd.h>

Create Augmented Supply PDO Source value See Table 6-13 Programmable Power Supply APDO - Source.

Public Members

uint32_t max_current

Maximum Current in 50mA increments.

uint32_t reserved0

Reserved – Shall be set to zero.

uint32_t min_voltage

Minimum Voltage in 100mV increments.

uint32_t reserved1

Reserved – Shall be set to zero.

uint32_t max_voltage

Maximum Voltage in 100mV increments.

uint32_t reserved2

Reserved – Shall be set to zero.

uint32_t pps_power_limited

PPS Power Limited.

uint32_t reserved3

00b – Programmable Power Supply 01b…11b - Reserved, Shall Not be used Setting as reserved because it defaults to 0 when not set.

enum pdo_type type

Augmented Power Data Object (APDO).

SET TO PDO_AUGMENTED

struct pd_augmented_supply_pdo_source.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_augmented_supply_pdo_sink
#include <usbc_pd.h>

Create Augmented Supply PDO Sink value See Table 6-17 Programmable Power Supply APDO - Sink.

Public Members

uint32_t max_current

Maximum Current in 50mA increments.

uint32_t reserved0

Reserved – Shall be set to zero.

uint32_t min_voltage

Minimum Voltage in 100mV increments.

uint32_t reserved1

Reserved – Shall be set to zero.

uint32_t max_voltage

Maximum Voltage in 100mV increments.

uint32_t reserved2

Reserved – Shall be set to zero.

uint32_t reserved3

00b – Programmable Power Supply 01b…11b - Reserved, Shall Not be used Setting as reserved because it defaults to 0 when not set.

enum pdo_type type

Augmented Power Data Object (APDO).

SET TO PDO_AUGMENTED

struct pd_augmented_supply_pdo_sink.[anonymous] [anonymous]
uint32_t raw_value

Raw PDO value.

union pd_rdo
#include <usbc_pd.h>

The Request Data Object (RDO) Shall be returned by the Sink making a request for power.

See Section 6.4.2 Request Message

Public Members

uint32_t min_or_max_operating_current

Operating Current 10mA units NOTE: If Give Back Flag is zero, this field is the Maximum Operating Current.

If Give Back Flag is one, this field is the Minimum Operating Current.

uint32_t operating_current

Operating current in 10mA units.

Operating Current 50mA units.

uint32_t reserved0

Reserved - Shall be set to zero.

uint32_t unchunked_ext_msg_supported

Unchunked Extended Messages Supported.

uint32_t no_usb_suspend

No USB Suspend.

uint32_t usb_comm_capable

USB Communications Capable.

uint32_t cap_mismatch

Capability Mismatch.

uint32_t giveback

Give Back Flag.

uint32_t object_pos

Object Position (000b is Reserved and Shall Not be used)

uint32_t reserved1

Reserved - Shall be set to zero.

struct pd_rdo.[anonymous] fixed

Create a Fixed RDO value See Table 6-19 Fixed and Variable Request Data Object.

struct pd_rdo.[anonymous] variable

Create a Variable RDO value See Table 6-19 Fixed and Variable Request Data Object.

uint32_t min_operating_power

Minimum Operating Power in 250mW units.

uint32_t operating_power

Operating power in 250mW units.

struct pd_rdo.[anonymous] battery

Create a Battery RDO value See Table 6-20 Battery Request Data Object.

uint32_t output_voltage

Output Voltage in 20mV units.

uint32_t reserved2

Reserved - Shall be set to zero.

uint32_t reserved3

Reserved - Shall be set to zero.

struct pd_rdo.[anonymous] augmented

Create an Augmented RDO value See Table 6-22 Programmable Request Data Object.

uint32_t raw_value

Raw RDO value.

struct pd_msg
#include <usbc_pd.h>

Power Delivery message.

Public Members

enum pd_packet_type type

Type of this packet.

union pd_header header

Header of this message.

uint32_t len

Length of bytes in data.

uint8_t data[260]

Message data.