Enumerations
enum PowerSupplyType
| Name | Value |
|---|---|
| kFixedSupply | 0b00 |
| kBattery | 0b01 |
| kVariableSupply | 0b10 |
| kAugmentedPowerDataObject | 0b11 |
Power supply type
usbpd3.1 6.4.1 "Capabilities Message", Table 6-7 "Power Data Object"
Defined at line 24 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-objects.h
enum ControlMessageType
| Name | Value |
|---|---|
| kGoodCrc | 0b0'0001 |
| kGoToMinimumOperatingCurrent | 0b0'0010 |
| kAccept | 0b0'0011 |
| kReject | 0b0'0100 |
| kPing | 0b0'0101 |
| kPowerSupplyReady | 0b0'0110 |
| kGetSourceCapabilities | 0b0'0111 |
| kGetSinkCapabilities | 0b0'1000 |
| kDataRoleSwap | 0b0'1001 |
| kPowerRoleSwap | 0b0'1010 |
| kVconnSourceSwap | 0b0'1011 |
| kWait | 0b0'1100 |
| kSoftReset | 0b0'1101 |
| kDataReset | 0b0'1110 |
| kDataResetComplete | 0b0'1111 |
| kNotSupported | 0b1'0000 |
| kGetExtendedSourceCapabilities | 0b1'0001 |
| kGetStatus | 0b1'0010 |
| kFastRoleSwap | 0b1'0011 |
| kGetProgrammablePowerSupplyStatus | 0b1'0100 |
| kGetCountryCodes | 0b1'0101 |
| kGetExtendedSinkCapabilities | 0b1'0110 |
| kGetSourceInfo | 0b1'0111 |
| kGetMaximumPdSpecRevision | 0b1'1000 |
Message type codes for messages with no data objects and no extended flag.
Each message type is described in a sub-section of usbpd3.1 6.3. The
sub-section number matches the message type's code.
usbpd3.1 6.3 "Control Message", Table 6-5 "Control Message Types"
Defined at line 25 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
enum PowerRole
| Name | Value |
|---|---|
| kSink | 0 |
| kSource | 1 |
Type-safe selector for a USB power role.
The values match usbpd3.1 6.2.1.1.4 "Port Power Role". So, instances can be
bit-copied into PD message headers.
Defined at line 29 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum SpecRevision
| Name | Value |
|---|---|
| kRev1 | 0b00 |
| kRev2 | 0b01 |
| kRev3 | 0b10 |
Specification Revision
The values match usbpd3.1 6.2.1.1.5 "Specification Revision". So, instances
can be bit-copied into PD message headers.
Defined at line 41 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum DataRole
| Name | Value |
|---|---|
| kUpstreamFacingPort | 0 |
| kDownstreamFacingPort | 1 |
Type-safe selector for a USB data role.
The values match usbpd3.1 6.2.1.1.6 "Port Data Role". So, instances can be
bit-copied into PD message headers.
Defined at line 51 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum DataMessageType
| Name | Value |
|---|---|
| kSourceCapabilities | 0b0'0001 |
| kRequestPower | 0b0'0010 |
| kBuiltInSelfTest | 0b0'0011 |
| kSinkCapabilities | 0b0'0100 |
| kBatteryStatus | 0b0'0101 |
| kAlert | 0b0'0110 |
| kGetCountryInfo | 0b0'0111 |
| kEnterUsb | 0b0'1000 |
| kExtendedPowerRangeRequest | 0b0'1001 |
| kExtendedPowerRangeMode | 0b0'1010 |
| kSourceInfo | 0b0'1011 |
| kMaximumPdSpecRevision | 0b0'1100 |
| kVendorDefined | 0b0'1111 |
Message type codes for messages with data objects and no extended flag.
usbpd3.1 6.4 "Data Message", Table 6-6 "Data Message Types"
Defined at line 57 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
enum ConfigChannelPinId
| Name | Value |
|---|---|
| kCc1 | 1 |
| kCc2 | 2 |
Type-safe selector for one of the two CC (Configuration Channel) pins.
The Configuration Channel is introduced in usbpd3.1 2.1 "Introduction", and
its role is summarized in usbpd3.1 2.3 "Configuration Process".
Defined at line 63 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum ConfigChannelPinSwitch
| Name | Value |
|---|---|
| kNone | 0 |
| kCc1 | 1 |
| kCc2 | 2 |
State of a switch that can either point to a CC pin or be open.
See `ConfigChannelPinId` for a description of the CC (Configuration Channel)
pins.
Defined at line 75 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum PeakCurrentSupport
| Name | Value |
|---|---|
| kNoOverload | 0b00 |
| kOverloadLevel1 | 0b01 |
| kOverloadLevel2 | 0b10 |
| kOverloadLevel3 | 0b11 |
A fixed power source's ability to briefly exceed the operating current.
usbpd3.1 measures the Source's ability to handle spikes of three maximum
durations (1ms / 2ms / 10ms) out of a 20ms duty cycle. In all cases, the
current consumption over an entire duty cycle must still match the source's
operating current. So, a spike must be compensated by lower current
consumption during the rest of the duty cycle.
usbpd3.1 6.4.1.2.2.8 "Peak Current"
Defined at line 75 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-objects.h
enum ConfigChannelTermination
| Name | Value |
|---|---|
| kUnknown | 0 |
| kOpen | 1 |
| kRa | 2 |
| kRd | 3 |
| kRpStandardUsb | 4 |
| kRp1500mA | 5 |
| kRp3000mA | 6 |
Measured voltage of a CC pin.
The voltage ranges are specified in typec2.2 4.11.3 "Voltage Parameters".
Defined at line 87 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
enum MessageType
| Name | Value |
|---|---|
| kGoodCrc | static_cast<uint8_t>(ControlMessageType::kGoodCrc) |
| kGoToMinimumOperatingCurrent | static_cast<uint8_t>(ControlMessageType::kGoToMinimumOperatingCurrent) |
| kAccept | static_cast<uint8_t>(ControlMessageType::kAccept) |
| kReject | static_cast<uint8_t>(ControlMessageType::kReject) |
| kPing | static_cast<uint8_t>(ControlMessageType::kPing) |
| kPowerSupplyReady | static_cast<uint8_t>(ControlMessageType::kPowerSupplyReady) |
| kGetSourceCapabilities | static_cast<uint8_t>(ControlMessageType::kGetSourceCapabilities) |
| kGetSinkCapabilities | static_cast<uint8_t>(ControlMessageType::kGetSinkCapabilities) |
| kDataRoleSwap | static_cast<uint8_t>(ControlMessageType::kDataRoleSwap) |
| kPowerRoleSwap | static_cast<uint8_t>(ControlMessageType::kPowerRoleSwap) |
| kVconnSourceSwap | static_cast<uint8_t>(ControlMessageType::kVconnSourceSwap) |
| kWait | static_cast<uint8_t>(ControlMessageType::kWait) |
| kSoftReset | static_cast<uint8_t>(ControlMessageType::kSoftReset) |
| kDataReset | static_cast<uint8_t>(ControlMessageType::kDataReset) |
| kDataResetComplete | static_cast<uint8_t>(ControlMessageType::kDataResetComplete) |
| kNotSupported | static_cast<uint8_t>(ControlMessageType::kNotSupported) |
| kGetExtendedSourceCapabilities | static_cast<uint8_t>(ControlMessageType::kGetExtendedSourceCapabilities) |
| kGetStatus | static_cast<uint8_t>(ControlMessageType::kGetStatus) |
| kFastRoleSwap | static_cast<uint8_t>(ControlMessageType::kFastRoleSwap) |
| kGetProgrammablePowerSupplyStatus | static_cast<uint8_t>(ControlMessageType::kGetProgrammablePowerSupplyStatus) |
| kGetCountryCodes | static_cast<uint8_t>(ControlMessageType::kGetCountryCodes) |
| kGetExtendedSinkCapabilities | static_cast<uint8_t>(ControlMessageType::kGetExtendedSinkCapabilities) |
| kGetSourceInfo | static_cast<uint8_t>(ControlMessageType::kGetSourceInfo) |
| kGetMaximumPdSpecRevision | static_cast<uint8_t>(ControlMessageType::kGetMaximumPdSpecRevision) |
| kSourceCapabilities | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kSourceCapabilities) |
| kRequestPower | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kRequestPower) |
| kBuiltInSelfTest | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kBuiltInSelfTest) |
| kSinkCapabilities | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kSinkCapabilities) |
| kBatteryStatus | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kBatteryStatus) |
| kAlert | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kAlert) |
| kGetCountryInfo | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kGetCountryInfo) |
| kEnterUsb | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kEnterUsb) |
| kExtendedPowerRangeRequest | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kExtendedPowerRangeRequest) |
| kExtendedPowerRangeMode | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kExtendedPowerRangeMode) |
| kSourceInfo | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kSourceInfo) |
| kMaximumPdSpecRevision | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kMaximumPdSpecRevision) |
| kVendorDefined | kMessageTypeDataBit | static_cast<uint8_t>(DataMessageType::kVendorDefined) |
Message type codes for messages with data objects and no extended flag.
This is effectively a hand-rolled sum type (like std::variant) of
`ControlMessageType` and `DataMessageType`. The discriminant (the type is of
the variant value) is stored in the kMessageTypeDataBit`. Values are
allocated such that they easily map (via `kMessageTypeUsbPdValueMask`) to the
bit patterns used in USB PD message headers.
usbpd3.1 6.4 "Data Message", Table 6-6 "Data Message Types"
Defined at line 91 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
enum FastSwapCurrentRequirement
| Name | Value |
|---|---|
| kNotSupported | 0b00 |
| kDefaultUsb | 0b01 |
| k1500mA | 0b10 |
| k3000mA | 0b11 |
Values for `fast_swap_current_requirement` in SinkFixedPowerSupplyData.
usbpd3.1 6.4.1.3.1 "Sink Fixed Supply Power Data Object", sub-table inside
the "Fast Role Swap required USB Type-C Current" row
Defined at line 382 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-objects.h
Records
-
class BatteryPowerRequestData -
class BatteryPowerSupplyData -
class FixedPowerSupplyData -
class FixedVariableSupplyPowerRequestData -
class Header -
class Message -
class MessageId -
class PowerData -
class PowerRequestData -
class SinkFixedPowerSupplyData -
class SinkPolicy -
class SinkPolicyInfo -
class VariablePowerSupplyData
Functions
-
const char * PowerRoleToString (PowerRole power_role)Descriptor for logging and debugging.
Defined at line 14 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.cc
-
const char * DataRoleToString (DataRole data_role)Descriptor for logging and debugging.
Defined at line 25 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.cc
-
const char * ConfigChannelPinIdToString (ConfigChannelPinId pin_id)Descriptor for logging and debugging.
Defined at line 36 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.cc
-
const char * ConfigChannelPinSwitchToString (ConfigChannelPinSwitch cc_switch)Descriptor for logging and debugging.
Defined at line 47 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.cc
-
const char * ConfigChannelTerminationToString (ConfigChannelTermination termination)Descriptor for logging and debugging.
Defined at line 61 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.cc
-
const char * MessageTypeToString (MessageType type)Descriptor for logging and debugging.
Defined at line 9 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.cc
-
ConfigChannelPinId ConfigChannelPinIdFromInverse (ConfigChannelPinId id)Inverts a ConfigChannelPinId.
Defined at line 109 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
-
ConfigChannelPinId ConfigChannelPinIdFromSwitch (ConfigChannelPinSwitch cc_switch)`cc_switch` must not be `kNone`.
Defined at line 114 of file ../../src/devices/power/drivers/fusb302/usb-pd-defs.h
-
bool IsDataMessageType (MessageType type)Defined at line 141 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
MessageType MessageTypeFromDataMessageType (DataMessageType type)Defined at line 144 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
MessageType MessageTypeFromControlMessageType (ControlMessageType type)Defined at line 147 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
DataMessageType DataMessageTypeFromMessageType (MessageType type)Defined at line 150 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
ControlMessageType ControlMessageTypeFromMessageType (MessageType type)Defined at line 154 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
const char * ControlMessageTypeToString (ControlMessageType type)Descriptor for logging and debugging.
Defined at line 163 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h
-
const char * DataMessageTypeToString (DataMessageType type)Descriptor for logging and debugging.
Defined at line 167 of file ../../src/devices/power/drivers/fusb302/usb-pd-message-type.h