@return The actual number of bytes that are executed for this operation. **/ 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;
// 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; I2cRequest.OperationCount = 1; I2cRequest.Operation [ 0 ].Flags = I2C_FLAG_SMBUS_OPERATION | I2C_FLAG_READ; I2cRequest.Operation [ 0 ].Buffer = NULL; I2cRequest.Operation [ 0 ].LengthInBytes = 0; // // Initiate a synchronous request. // I2cMaster = SMBus->I2cMaster;