Enumerations

enum class TypeCPortInput : uint32_t
Name Value
kPortStateChanged 1
kTimerFired 2

Changes signaled to the Type C Port Config Channel state machine.

Defined at line 19 of file ../../src/devices/power/drivers/fusb302/typec-port-state-machine.h

enum class SinkPolicyEngineInput : int32_t
Name Value
kInitialized 1
kMessageReceived 2
kTimerFired 3

Changes signaled to the Sink Policy Engine state machine.

Defined at line 22 of file ../../src/devices/power/drivers/fusb302/pd-sink-state-machine.h

enum class TransmissionState : uint8_t
Name Value Comments
kPending 0

Waiting for GoodCRC on last transmitted message.

The message may be re-transmitted, according to the PD spec. Transmit()
must not be called in this state.

kTimedOut 1

Timed out waiting for GoodCRC on last transmitted message.

kSuccess 2

Last transmitted message was received successfully.

Tracks the acknowledgement of the last transmitted message.

Defined at line 27 of file ../../src/devices/power/drivers/fusb302/fusb302-protocol.h

enum class TypeCPortState : uint32_t
Name Value Comments
kSinkUnattached 3

Unattached.SNK

kSinkAttached 5

Attached.SNK

kSourceAttached 9

Attached.SRC

States for the Type C Port Config Channel state machine.

The states are defined in Section 4.5.2 "CC Functional and Behavioral

Requirements" in the USB Type C spec. The state values match the

corresponding sub-section numbers in Section 4.5.2.2 "Connection State

Machine Requirements".

Defined at line 30 of file ../../src/devices/power/drivers/fusb302/typec-port-state-machine.h

enum class SinkPolicyEngineState : int32_t
Name Value Comments
kStartup 1

PE_SNK_Startup, S 8.3.3.3.1

kDiscovery 2

PE_SNK_Discovery, S 8.3.3.3.2

kWaitForCapabilities 3

PE_SNK_Wait_for_Capabilities, S 8.3.3.3.3

kEvaluateCapability 4

PE_SNK_Evaluate_Capability, S 8.3.3.3.4

kSelectCapability 5

PE_SNK_Select_Capability, S 8.3.3.3.5

kTransitionSink 6

PE_SNK_Transition_Sink, S 8.3.3.3.6

kReady 7

PE_SNK_Ready, S 8.3.3.3.7

kGiveSinkCapabilities 10

PE_SNK_Give_Sink_Cap, S 8.3.3.3.10

kGetSourceCapabilities 12

PE_SNK_Get_Source_Cap, S 8.3.3.3.12

kSendSoftReset 13

PE_SNK_Send_Soft_Reset, S 8.3.3.4.2.1

kSoftReset 14

PE_SNK_Soft_Reset, S 8.3.3.4.2.2

Sink Policy Engine States. States for SinkPolicyEngineStateMachine.

The states are a subset of the Sink states listed in Table 8-80 "Policy

Engine States" in Section 8.3.3.30 "Policy Engine States" of the USB PD spec.

Defined at line 32 of file ../../src/devices/power/drivers/fusb302/pd-sink-state-machine.h

enum class GoodCrcGenerationMode : uint8_t
Name Value Comments
kSoftware 0

No hardware-accelerated GoodCRC generation is available.

In this mode, the software USB PD Protocol Layer implementation generates
GoodCRC packets and drives the hardware to transmit them.

This mode assumes that the hardware is not configured to generate any
packets. For example, the FUSB302B's AutoCRC functionality would be
disabled.

This mode has proven to be too slow when the fusb302 Fuchsia driver is used
with the FUSB302B chip on the Khadas VIM3 board. The logic may be useful in
an RTOS environment.

kTracked 1

Hardware-accelerated GoodCRC generation blocks PD packet transmission.

In this mode, the software USB PD Protocol Layer implementation waits to be
notified that the hardware-accelerated GoodCRC generation and transmission
is done, before driving the transmission of a PD packet.

Waiting ensures that all PD packets are transmitted after the GoodCRCs
acknowledging any packets that they may reply to. Waiting comes at the cost
of delaying transmissions until the hardware-accelerated GoodCRC
notifications are delivered to the driver.

kAssumed 2

Hardware-accelerated GoodCRC generation is not tracked by software.

In this mode, the software USB PD Protocol Layer implementation assumes
that hardware-accelerated GoodCRC generation is enabled, and that it
completes before the software attempts to transmit a new PD packet.

Method used to generate or track GoodCRC replies to incoming USB PD packets.

Defined at line 42 of file ../../src/devices/power/drivers/fusb302/fusb302-protocol.h

enum class SwitchBlockConfig : int8_t
Name Value Comments
kOpen 0

The CC pin is floating.

kPullUp 1

The CC pin is connected to a
<
= 2.18V (VUFPDB) current source.

The current source is used to advertise the power source capability,
following typec2.2 4.5.1.2.1 "Detecting a Valid Source-to-Sink Connection".

The current source is configured by the HOST_CUR field in the
`Control0Reg` register.

kPullDown 2

The CC pin is connected to the ground via a 5.1 Ohm (RDEVICE) resistor.

The pull-down resistor value follows Table 4-27 "Sink CC Termination (Rd)
Requirements" in typec2.2 4.11.1 "Termination Parameters".

kConnectorVoltage 3

The CC pin is connected to the VCONN source. Powers cable electronics.

Mutually exclusive configurations of the switch blocks attached to CC pins.

Rev 5 datasheet: Figure 6 "Configuration Channel Switch Functionality" on

page 6, Figure 3 "Functional Block Diagram" on page 3, Table 10 "Type-C CC

Switch" on page 15.

Defined at line 140 of file ../../src/devices/power/drivers/fusb302/registers.h

enum class Fusb302RoleDetectionMode : int8_t
Name Value Comments
kReserved 0b00 --
kDualPowerRole 0b01

DPR (Dual-Power-Role) toggles between advertising a Source and Sink.

This is a partial implementation of the DRP (Dual Power Role) toggling
functionality in the Type C spec. According to Table 10 in the Rev 5
datasheet, a power detection cycle consists of advertising as a Sink
for ~45 ms (tTOG1) and advertising as a Source for ~30 ms (tTOG2). The
tDIS description mentions that a full "toggle" cycle takes tTOG1 + tTOG2.

kSinkOnly 0b10

Advertise Sink capabilities, check for attached Source.

This is a partial implementation of the state machine in Figure 4-13
"Connection State Diagram: Sink" in the USB Type C spec.

kSourceOnly 0b11

Advertise Source capabilities, check for attached Sink.

This is a partial implementation of the state machine in Figure 4-12
"Connection State Diagram: Source" in the USB Type C spec.

Values for `mode`.

Defined at line 433 of file ../../src/devices/power/drivers/fusb302/registers.h

enum class PowerRoleDetectionState
Name Value Comments
kDetecting 0b000

Power role detection process still running

kSourceOnCC1 0b001

Power Source, Configuration Channel is on CC1

kSourceOnCC2 0b010

Power Source, Configuration Channel is on CC2

kSinkOnCC1 0b101

Power Sink, Configuration Channel is on CC1

kSinkOnCC2 0b110

Power Sink, Configuration Channel is on CC2

kAudioAccessory 0b111

Audio Accessory found, no Configuration Channel

The reported state of the power role detection hardware logic.

Values are obtained from the `togss` field in the

`Status1AReg` register

Defined at line 807 of file ../../src/devices/power/drivers/fusb302/registers.h

enum class FixedComparatorResult
Name Value Comments
kRa 0b00

The voltage threshold for rA. Below 200 mV.

kStandardUsbRd 0b01

The voltage threshold for rD and Standard USB power rP. 200 mV - 660 mV.

kTypeC1500mARd 0b10

The voltage threshold for rD and Type C 1.5A power rP. 660 mV - 1,230 mV.

kTypeC3000mARd 0b11

The voltage threshold for rD and Type C 3.0A power rP. Above 1,230 mV.

When this level is reported, Table 5 in the Rev 5 datasheet recommends
using the variable comparator in the measure block to confirm that the CC
voltage is below 2.05 V.

CC pin voltage, as reported by the fixed comparators in the measure block.

The fixed comparators can distinguish between the Sink terminations in

typec2.2 4.11.3 "Voltage Parameters", Table 4.38 "Voltage on Sink CC pins

(Multiple Source Current Announcements)".

Rev 5 datasheet: Table 37 on page 27, field BC_LVL[1:0]

Defined at line 933 of file ../../src/devices/power/drivers/fusb302/registers.h

enum class ReceiveTokenType : uint8_t
Name Value Comments
kSop 0b111

SOP (Source
<
-> Sink messages)

kSopPrime 0b110

SOP' (VCONN Source
<
-> Cable Plug messages)

kSopDoublePrime 0b101

SOP" (VCONN Source
<
-> Cable Plug messages)

kSopPrimeDebug 0b100

SOP' Debug - not specified

kSopDoublePrimeDebug 0b011

SOP" Debug - not specified

kUndocumented 0b000

Undocumented token

Receive fifo tokens decoded by FifosReg::AsReceiveTokenType().

Rev 5 datasheet: Table 42 page 28

Defined at line 1121 of file ../../src/devices/power/drivers/fusb302/registers.h

Records

Functions

  • const char * SwitchBlockConfigToString (SwitchBlockConfig config)

    Descriptor for logging and debugging.

    Defined at line 11 of file ../../src/devices/power/drivers/fusb302/registers.cc

  • const char * Fusb302RoleDetectionModeToString (Fusb302RoleDetectionMode mode)

    Descriptor for logging and debugging.

    Defined at line 26 of file ../../src/devices/power/drivers/fusb302/registers.cc

  • usb_pd::ConfigChannelPinSwitch WiredCcPinFromPowerRoleDetectionState (PowerRoleDetectionState state)

    Defined at line 1385 of file ../../src/devices/power/drivers/fusb302/registers.h

  • usb_pd::PowerRole PowerRoleFromDetectionState (PowerRoleDetectionState state)

    `state` must be one of the states that has a Configuration Channel.

    Defined at line 1398 of file ../../src/devices/power/drivers/fusb302/registers.h

  • const char * PowerRoleDetectionStateToString (PowerRoleDetectionState state)

    Descriptor for logging and debugging.

    Defined at line 42 of file ../../src/devices/power/drivers/fusb302/registers.cc

  • usb_pd::ConfigChannelTermination ConfigChannelTerminationFromFixedComparatorResult (FixedComparatorResult result)

    Best-effort mapping from fixed comparator outcomes.

    A result of `kRp3000mA` means "anything above 1,230 mV" and should be

    supplemented by an upper bound check.

    Defined at line 1407 of file ../../src/devices/power/drivers/fusb302/registers.h

  • const char * ReceiveTokenTypeToString (ReceiveTokenType receive_token_type)

    Descriptor for logging and debugging.

    Defined at line 60 of file ../../src/devices/power/drivers/fusb302/registers.cc