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