1 /** @file
2   Interface Definitions for I2C Lib.
3 
4   Copyright (c) 2004  - 2015, Intel Corporation. All rights reserved.<BR>
5 
6   This program and the accompanying materials are licensed and made available under
7   the terms and conditions of the BSD License that accompanies this distribution.
8   The full text of the license may be found at
9   http://opensource.org/licenses/bsd-license.php.
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 --*/
15 
16 #include <Uefi.h>
17 #include <Library/IoLib.h>
18 
19 #ifndef I2C_LIB_HEADER_H
20 #define I2C_LIB_HEADER_H
21 
22 
23 /**
24   Reads a Byte from I2C Device.
25 
26   @param  I2cControllerIndex   I2C Bus no to which the I2C device has been connected
27   @param  SlaveAddress         Device Address from which the byte value has to be read
28   @param  Offset               Offset from which the data has to be read
29   @param  ReadBytes            Number of bytes to be read
30   @param  *ReadBuffer          Address to which the value read has to be stored
31 
32   @return  EFI_SUCCESS       If the byte value has been successfully read
33   @return  EFI_DEVICE_ERROR  Operation Failed, Device Error
34 **/
35 EFI_STATUS
36 ByteReadI2C(
37   IN  UINT8 BusNo,
38   IN  UINT8 SlaveAddress,
39   IN  UINT8 Offset,
40   IN  UINTN ReadBytes,
41   OUT UINT8 *ReadBuffer
42   );
43 
44 /**
45   Writes a Byte to I2C Device.
46 
47   @param  I2cControllerIndex  I2C Bus no to which the I2C device has been connected
48   @param  SlaveAddress        Device Address from which the byte value has to be written
49   @param  Offset              Offset from which the data has to be written
50   @param  WriteBytes          Number of bytes to be written
51   @param  *Byte               Address to which the value written is stored
52 
53   @return  EFI_SUCCESS       If the byte value has been successfully read
54   @return  EFI_DEVICE_ERROR  Operation Failed, Device Error
55 **/
56 EFI_STATUS ByteWriteI2C(
57   IN  UINT8 BusNo,
58   IN  UINT8 SlaveAddress,
59   IN  UINT8 Offset,
60   IN  UINTN WriteBytes,
61   IN  UINT8 *WriteBuffer
62   );
63 
64 #endif
65