Esempio n. 1
0
  OUT RETURN_STATUS *Status OPTIONAL
  )
{
  EFI_I2C_REQUEST_PACKET I2cRequest;
  EFI_I2C_MASTER_PROTOCOL * I2cMaster;
  RETURN_STATUS I2cStatus;
  UINTN SlaveAddress;
  SMBUS_CONTEXT * SMBus;

  //
  //  Validate the parameters
  //
  ASSERT ( !SMBUS_LIB_PEC ( SmBusAddress ));
  ASSERT ( 0 == SMBUS_LIB_COMMAND ( SmBusAddress ));
  ASSERT ( 0 == SMBUS_LIB_LENGTH ( SmBusAddress ));
  ASSERT ( 0 == SMBUS_LIB_RESERVED ( SmBusAddress ));

  //
  //  Get the context
  //
  SMBus = SMBUS_CONTEXT_FROM_PROTOCOL ( This );

  //
  //  Get the slave address
  //
  SlaveAddress = SMBUS_LIB_SLAVE_ADDRESS ( SmBusAddress );

  //
  //  Build a ping (read) request
  //
  I2cRequest.Timeout = 0;
Esempio n. 2
0
                          SMBUS Command, SMBUS Data Length, and PEC.
  @param  Status          Return status for the executed command.
                          This is an optional parameter and may be NULL.

**/
VOID
EFIAPI
SmBusQuickRead (
  IN  UINTN                     SmBusAddress,
  OUT RETURN_STATUS             *Status       OPTIONAL
  )
{
  ASSERT (!SMBUS_LIB_PEC (SmBusAddress));
  ASSERT (SMBUS_LIB_COMMAND (SmBusAddress)   == 0);
  ASSERT (SMBUS_LIB_LENGTH (SmBusAddress)    == 0);
  ASSERT (SMBUS_LIB_RESERVED (SmBusAddress)  == 0);

  InternalSmBusExec (EfiSmbusQuickRead, SmBusAddress, 0, NULL, Status);
}

/**
  Executes an SMBUS quick write command.

  Executes an SMBUS quick write command on the SMBUS device specified by SmBusAddress.
  Only the SMBUS slave address field of SmBusAddress is required.
  If Status is not NULL, then the status of the executed command is returned in Status.
  If PEC is set in SmBusAddress, then ASSERT().
  If Command in SmBusAddress is not zero, then ASSERT().
  If Length in SmBusAddress is not zero, then ASSERT().
  If any reserved bits of SmBusAddress are set, then ASSERT().