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