Exemplo n.º 1
0
**/
UINTN
InternalSmBusExec (
  IN     EFI_SMBUS_OPERATION        SmbusOperation,
  IN     UINTN                      SmBusAddress,
  IN     UINTN                      Length,
  IN OUT VOID                       *Buffer,
     OUT RETURN_STATUS              *Status        OPTIONAL
  )
{
  RETURN_STATUS             ReturnStatus;
  EFI_SMBUS_DEVICE_ADDRESS  SmbusDeviceAddress;

  SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);

  ReturnStatus = mSmbus->Execute (
                           mSmbus,
                           SmbusDeviceAddress,
                           SMBUS_LIB_COMMAND (SmBusAddress),
                           SmbusOperation,
                           SMBUS_LIB_PEC (SmBusAddress),
                           &Length,
                           Buffer
                           );
  if (Status != NULL) {
    *Status = ReturnStatus;
  }

  return Length;
}
Exemplo n.º 2
0
SmBusOnI2cQuickRead (
  IN  EFI_SMBUS_HC_PROTOCOL *This,
  IN  UINTN SmBusAddress,
  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 );

  //