Port Class

class PortClass : public Acroname::BrainStem::EntityClass

Port Class: The Port Entity provides software control over the most basic items related to a USB Port. This includes everything from the complete enable and disable of the entire port to the individual control of specific pins. Voltage and Current measurements are also included for devices which support the Port Entity.

Public Functions

PortClass(void)

Constructor.

~PortClass(void)

Destructor.

aErr getVbusVoltage(int32_t *microvolts)

Gets the Vbus Voltage

Parameters:

microvolts – The voltage in microvolts (1 == 1e-6V) currently present on Vbus.

Returns:

Returns common entity return values

aErr getVbusCurrent(int32_t *microamps)

Gets the Vbus Current

Parameters:

microamps – The current in microamps (1 == 1e-6A) currently present on Vbus.

Returns:

Returns common entity return values

aErr getVconnVoltage(int32_t *microvolts)

Gets the Vconn Voltage

Parameters:

microvolts – The voltage in microvolts (1 == 1e-6V) currently present on Vconn.

Returns:

Returns common entity return values

aErr getVconnCurrent(int32_t *microamps)

Gets the Vconn Current

Parameters:

microamps – The current in microamps (1 == 1e-6A) currently present on Vconn.

Returns:

Returns common entity return values

aErr getPowerMode(uint8_t *powerMode)

Gets the Port Power Mode: Convenience Function of get/setPortMode

Parameters:

powerMode – The current power mode.

Returns:

Returns common entity return values

aErr setPowerMode(const uint8_t powerMode)

Sets the Port Power Mode: Convenience Function of get/setPortMode

Parameters:

powerMode – The power mode to be set.

Returns:

Returns common entity return values

aErr getEnabled(uint8_t *enable)

Gets the current enable value of the port.

Parameters:

enable – 1 = Fully enabled port; 0 = One or more disabled components.

Returns:

Returns common entity return values

aErr setEnabled(const uint8_t enable)

Enables or disables the entire port.

Parameters:

enable – 1 = Fully enable port; 0 = Fully disable port.

Returns:

Returns common entity return values

aErr getDataEnabled(uint8_t *enable)

Gets the current enable value of the data lines.: Sub-component (Data) of getEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataEnabled(const uint8_t enable)

Enables or disables the data lines. Sub-component (Data) of setEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataHSEnabled(uint8_t *enable)

Gets the current enable value of the High Speed (HS) data lines. Sub-component of getDataEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataHSEnabled(const uint8_t enable)

Enables or disables the High Speed (HS) data lines. Sub-component of setDataEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataHS1Enabled(uint8_t *enable)

Gets the current enable value of the High Speed A side (HSA) data lines.: Sub-component of getDataHSEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataHS1Enabled(const uint8_t enable)

Enables or disables the Hight Speed A side (HSA) data lines. Sub-component of setDataHSEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataHS2Enabled(uint8_t *enable)

Gets the current enable value of the High Speed B side (HSB) data lines.: Sub-component of getDataHSEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataHS2Enabled(const uint8_t enable)

Enables or disables the Hight Speed B side (HSB) data lines. Sub-component of setDataHSEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataSSEnabled(uint8_t *enable)

Gets the current enable value of the Super Speed (SS) data lines. Sub-component of getDataEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataSSEnabled(const uint8_t enable)

Enables or disables the Super Speed (SS) data lines. Sub-component of setDataEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataSS1Enabled(uint8_t *enable)

Gets the current enable value of the Super Speed A side (SSA) data lines.: Sub-component of getDataSSEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataSS1Enabled(const uint8_t enable)

Enables or disables the Super Speed (SS) data lines. Sub-component of setDataEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getDataSS2Enabled(uint8_t *enable)

Gets the current enable value of the Super Speed B side (SSB) data lines.: Sub-component of getDataSSEnabled.

Parameters:

enable – 1 = Data enabled; 0 = Data disabled.

Returns:

Returns common entity return values

aErr setDataSS2Enabled(const uint8_t enable)

Enables or disables the Super Speed B side (SSB) data lines. Sub-component of setDataSSEnabled.

Parameters:

enable – 1 = Enable data; 0 = Disable data.

Returns:

Returns common entity return values

aErr getPowerEnabled(uint8_t *enable)

Gets the current enable value of the power lines.: Sub-component (Power) of getEnabled.

Parameters:

enable – 1 = Power enabled; 0 = Power disabled.

Returns:

Returns common entity return values

aErr setPowerEnabled(const uint8_t enable)

Enables or Disables the power lines. Sub-component (Power) of setEnable.

Parameters:

enable – 1 = Enable power; 0 = Disable disable.

Returns:

Returns common entity return values

aErr getDataRole(uint8_t *dataRole)

Gets the Port Data Role.

Parameters:

dataRole – The data role to be set. See datasheet for details.

Returns:

Returns common entity return values

aErr getVconnEnabled(uint8_t *enable)

Gets the current enable value of the Vconn lines.: Sub-component (Vconn) of getEnabled.

Parameters:

enable – 1 = Vconn enabled; 0 = Vconn disabled.

Returns:

Returns common entity return values

aErr setVconnEnabled(const uint8_t enable)

Enables or disables the Vconn lines. Sub-component (Vconn) of setEnabled.

Parameters:

enable – 1 = Enable Vconn lines; 0 = Disable Vconn lines.

Returns:

Returns common entity return values

aErr getVconn1Enabled(uint8_t *enable)

Gets the current enable value of the Vconn1 lines. Sub-component of getVconnEnabled.

Parameters:

enable – 1 = Vconn1 enabled; 0 = Vconn1 disabled.

Returns:

Returns common entity return values

aErr setVconn1Enabled(const uint8_t enable)

Enables or disables the Vconn1 lines. Sub-component of setVconnEnabled.

Parameters:

enable – 1 = Enable Vconn1 lines; 0 = Disable Vconn1 lines.

Returns:

Returns common entity return values

aErr getVconn2Enabled(uint8_t *enable)

Gets the current enable value of the Vconn2 lines. Sub-component of getVconnEnabled.

Parameters:

enable – 1 = Vconn2 enabled; 0 = Vconn2 disabled.

Returns:

Returns common entity return values

aErr setVconn2Enabled(const uint8_t enable)

Enables or disables the Vconn2 lines. Sub-component of setVconnEnabled.

Parameters:

enable – 1 = Enable Vconn2 lines; 0 = Disable Vconn2 lines.

Returns:

Returns common entity return values

aErr getCCEnabled(uint8_t *enable)

Gets the current enable value of the CC lines.: Sub-component (CC) of getEnabled.

Parameters:

enable – 1 = CC enabled; 0 = CC disabled.

Returns:

Returns common entity return values

aErr setCCEnabled(const uint8_t enable)

Enables or disables the CC lines. Sub-component (CC) of setEnabled.

Parameters:

enable – 1 = Enable CC lines; 0 = Disable CC lines.

Returns:

Returns common entity return values

aErr getCC1Enabled(uint8_t *enable)

Gets the current enable value of the CC1 lines. Sub-component of getCCEnabled.

Parameters:

enable – 1 = CC1 enabled; 0 = CC1 disabled.

Returns:

Returns common entity return values

aErr setCC1Enabled(const uint8_t enable)

Enables or disables the CC1 lines. Sub-component of setCCEnabled.

Parameters:

enable – 1 = Enable CC1 lines; 0 = Disable CC1 lines.

Returns:

Returns common entity return values

aErr getCC2Enabled(uint8_t *enable)

Gets the current enable value of the CC2 lines. Sub-component of getCCEnabled.

Parameters:

enable – 1 = CC2 enabled; 0 = CC2 disabled.

Returns:

Returns common entity return values

aErr setCC2Enabled(const uint8_t enable)

Enables or disables the CC2 lines. Sub-component of setCCEnabled.

Parameters:

enable – 1 = Enable CC2 lines; 0 = Disable CC2 lines.

Returns:

Returns common entity return values

aErr getVoltageSetpoint(uint32_t *value)

Gets the current voltage setpoint value for the port.

Parameters:

value – the voltage setpoint of the port in uV.

Returns:

Returns common entity return values

aErr setVoltageSetpoint(const uint32_t value)

Sets the current voltage setpoint value for the port.

Parameters:

value – the voltage setpoint of the port in uV.

Returns:

Returns common entity return values

aErr getState(uint32_t *state)

A bit mapped representation of the current state of the port. Reflects what he port IS which may differ from what was requested.

Parameters:

state – Variable to be filled with the current state.

aErr getDataSpeed(uint8_t *speed)

Gets the speed of the enumerated device.

Parameters:

speed – Bit mapped value representing the devices speed. See product datasheet for details.

Returns:

Returns common entity return values

aErr getMode(uint32_t *mode)

Gets current mode of the port

Parameters:

mode – Bit mapped value representing the ports mode. See product datasheet for details.

Returns:

Returns common entity return values

aErr setMode(const uint32_t mode)

Sets the mode of the port

Parameters:

mode – Port mode to be set. See product datasheet for details.

Returns:

Returns common entity return values

aErr getErrors(uint32_t *errors)

Returns any errors that are present on the port. Calling this function will clear the current errors. If the error persists it will be set again.

Parameters:

errors – Bit mapped field representing the current errors of the ports

Returns:

Returns common entity return values

aErr getCurrentLimit(uint32_t *limit)

Gets the current limit of the port.

Parameters:

limit – Variable to be filled with the limit in microAmps (uA).

Returns:

Returns common entity return values

aErr setCurrentLimit(const uint32_t limit)

Sets the current limit of the port.

Parameters:

limit – Current limit to be applied in microAmps (uA).

Returns:

Returns common entity return values

aErr getCurrentLimitMode(uint8_t *mode)

Gets the current limit mode. The mode determines how the port will react to an over current condition.

Parameters:

mode – Variable to be filled with an enumerated representation of the current limit mode. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr setCurrentLimitMode(const uint8_t mode)

Sets the current limit mode. The mode determines how the port will react to an over current condition.

Parameters:

mode – An enumerated representation of the current limit mode. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr getAvailablePower(uint32_t *power)

Gets the current available power. This value is determined by the power manager which is responsible for budgeting the systems available power envelope.

Parameters:

power – Variable to be filled with the available power in milli-watts (mW).

Returns:

Returns common entity return values

aErr getAllocatedPower(int32_t *power)

Gets the currently allocated power This value is determined by the power manager which is responsible for budgeting the systems available power envelope.

Parameters:

power – Variable to be filled with the allocated power in milli-watts (mW).

Returns:

Returns common entity return values

aErr getPowerLimit(uint32_t *limit)

Gets the user defined power limit for the port.

Parameters:

limit – Variable to be filled with the power limit in milli-watts (mW).

Returns:

Returns common entity return values

aErr setPowerLimit(const uint32_t limit)

Sets a user defined power limit for the port.

Parameters:

limit – Power limit to be applied in milli-watts (mW).

Returns:

Returns common entity return values

aErr getPowerLimitMode(uint8_t *mode)

Gets the power limit mode. The mode determines how the port will react to an over power condition.

Parameters:

mode – Variable to be filled with an enumerated representation of the power limit mode. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr setPowerLimitMode(const uint8_t mode)

Sets the power limit mode. The mode determines how the port will react to an over power condition.

Parameters:

mode – An enumerated representation of the power limit mode to be applied Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr getName(uint8_t *buffer, const size_t bufLength, size_t *unloadedLength)

Gets a user defined name of the port. Helpful for identifying ports/devices in a static environment.

Parameters:
  • buffer – pointer to the start of a c style buffer to be filled

  • bufLength – Length of the buffer to be filed

  • unloadedLength – Length that was actually received and filled.

Returns:

Returns common entity return values

aErr setName(uint8_t *buffer, const size_t bufLength)

Sets a user defined name of the port. Helpful for identifying ports/devices in a static environment.

Parameters:
  • buffer – Pointer to the start of a c style buffer to be transferred.

  • bufLength – Length of the buffer to be transferred.

Returns:

Returns common entity return values

aErr getDataHSRoutingBehavior(uint8_t *mode)

Gets the HighSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode – Variable to be filled with an enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr setDataHSRoutingBehavior(const uint8_t mode)

Sets the HighSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode – An enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr getDataSSRoutingBehavior(uint8_t *mode)

Gets the SuperSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode – Variable to be filled with an enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr setDataSSRoutingBehavior(const uint8_t mode)

Sets the SuperSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode – An enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr getVbusAccumulatedPower(int32_t *milliwatthours)

Gets the Vbus Accumulated Power

Parameters:

milliwatthours – The accumuled power on Vbus in milliwatt-hours.

Returns:

Returns common entity return values

aErr resetVbusAccumulatedPower(void)

Resets the Vbus Accumulated Power to zero.

Returns:

Returns common entity return values

aErr getVconnAccumulatedPower(int32_t *milliwatthours)

Gets the Vconn Accumulated Power

Parameters:

milliwatthours – The accumuled power on Vconn in milliwatt-hours.

Returns:

Returns common entity return values

aErr resetVconnAccumulatedPower(void)

Resets the Vconn Accumulated Power to zero.

Returns:

Returns common entity return values

aErr setHSBoost(const uint8_t boost)

Sets the ports USB 2.0 High Speed Boost Settings The setting determines how much additional drive the USB 2.0 signal will have in High Speed mode.

Parameters:

boost – An enumerated representation of the boost range. Available value are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr getHSBoost(uint8_t *boost)

Gets the ports USB 2.0 High Speed Boost Settings The setting determines how much additional drive the USB 2.0 signal will have in High Speed mode.

Parameters:

boost – An enumerated representation of the boost range. Available modes are product specific. See the reference documentation.

Returns:

Returns common entity return values

aErr resetEntityToFactoryDefaults(void)

Resets the PortClass Entity to it factory default configuration.

Returns:

Returns common entity return values