From 2d8debe71060fae61f4073240f618fa9682c976e Mon Sep 17 00:00:00 2001 From: klu2 Date: Fri, 10 Oct 2008 08:00:29 +0000 Subject: synchronize macros SMBUS_LIB_SLAVE_ADDRESS, SMBUS_LIB_COMMAND, SMBUS_LIB_LENGTH, SMBUS_LIB_PEC, SMBUS_LIB_RESERVED with latest MdePkg specification. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6101 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Library/SmbusLib.h | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'MdePkg/Include/Library') diff --git a/MdePkg/Include/Library/SmbusLib.h b/MdePkg/Include/Library/SmbusLib.h index c59f0bb4cf..17b81b6f19 100644 --- a/MdePkg/Include/Library/SmbusLib.h +++ b/MdePkg/Include/Library/SmbusLib.h @@ -15,11 +15,6 @@ #ifndef __SMBUS_LIB__ #define __SMBUS_LIB__ -/// -/// PEC BIT is bit 22 in SMBUS address -/// -#define SMBUS_LIB_PEC_BIT (1 << 22) - /** Macro that converts SMBUS slave address, SMBUS command, SMBUS data length, and PEC to a value that can be passed to the SMBUS Library functions. @@ -41,6 +36,41 @@ (((Length) & 0x3f) << 16) \ ) +/** + Macro that returns the SMBUS Slave Address value from an SmBusAddress Parameter value. + + @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC +**/ +#define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f) + +/** + Macro that returns the SMBUS Command value from an SmBusAddress Parameter value. + + @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC +**/ +#define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff) + +/** + Macro that returns the SMBUS Data Length value from an SmBusAddress Parameter value. + + @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC +**/ +#define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f) + +/** + Macro that returns the SMBUS PEC value from an SmBusAddress Parameter value. + + @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC +**/ +#define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & BIT22) != 0)) + +/** + Macro that returns the set of reserved bits from an SmBusAddress Parameter value. + + @param SmBusAddress Address that encodes the SMBUS Slave Address, SMBUS Command, SMBUS Data Length, and PEC +**/ +#define SMBUS_LIB_RESERVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | BIT22)) + /** Executes an SMBUS quick read command. -- cgit v1.2.3