]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h
Import BaseMemoryLibMmx;
[mirror_edk2.git] / MdePkg / Library / DxeSmbusLib / InternalSmbusLib.h
CommitLineData
dd51a993 1/** @file\r
2Internal header file for Smbus library.\r
3\r
4Copyright (c) 2006, Intel Corporation<BR>\r
5All rights reserved. This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13\r
14**/\r
15\r
16#ifndef __INTERNAL_SMBUS_LIB_H\r
17#define __INTERNAL_SMBUS_LIB_H\r
18\r
19#include <IndustryStandard/Smbus.h>\r
20\r
21#define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)\r
22#define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)\r
23#define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)\r
24#define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))\r
25#define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))\r
26\r
27//\r
28// Declaration for internal functions\r
29//\r
30/**\r
31 Executes an SMBus operation to an SMBus controller. \r
32\r
33 This function provides a standard way to execute Smbus script\r
34 as defined in the SmBus Specification. The data can either be of\r
35 the Length byte, word, or a block of data.\r
36\r
37 @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to\r
38 execute the SMBus transactions.\r
39 @param SmBusAddress Address that encodes the SMBUS Slave Address,\r
40 SMBUS Command, SMBUS Data Length, and PEC.\r
41 @param Length Signifies the number of bytes that this operation will do. The maximum number of\r
42 bytes can be revision specific and operation specific.\r
43 @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations\r
44 require this argument. The length of this buffer is identified by Length.\r
45 @param Status Return status for the executed command.\r
46 This is an optional parameter and may be NULL.\r
47\r
48 @return The actual number of bytes that are executed for this operation.\r
49\r
50**/\r
51UINTN\r
52InternalSmBusExec (\r
53 IN EFI_SMBUS_OPERATION SmbusOperation,\r
54 IN UINTN SmBusAddress,\r
55 IN UINTN Length,\r
56 IN OUT VOID *Buffer,\r
57 OUT RETURN_STATUS *Status OPTIONAL\r
58 );\r
59\r
60#endif\r