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