Port Class

class PortClass

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()

Constructors.

~PortClass()

Destructor.

!PortClass ()

Finalizer.

void init (BrainStem2CLI::ModuleClass^ module, const unsigned char index)

Initializes the class. Should only be called when manually creating classes.

Parameters:
  • pModule – The module.

  • index – The cmdPORT index to be addressed.

aErr getVbusVoltage(int %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(int %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(int %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(int %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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(unsigned int %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 unsigned int 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(unsigned int %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(unsigned char %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(unsigned int %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 unsigned int 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(unsigned int %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(unsigned int %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 unsigned int 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(unsigned char %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 unsigned char 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(unsigned int %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(int %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(unsigned int %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 unsigned int 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(unsigned char %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 unsigned char 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(unsigned char %buffer, const unsigned int bufLength, unsigned int %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(unsigned char %buffer, const unsigned int 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(unsigned char %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 unsigned char 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(unsigned char %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 unsigned char 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(int %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)

Reset the Vbus Accumulated Power

Returns:

Returns common entity return values

aErr getVconnAccumulatedPower(int %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)

Reset the Vconn Accumulated Power

Returns:

Returns common entity return values

aErr setHSBoost(const unsigned char 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(unsigned char %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