From 4e5220964b7108bbc9f731b326680e865aa63560 Mon Sep 17 00:00:00 2001 From: David Wei Date: Tue, 2 Jun 2015 01:47:57 +0000 Subject: Add Sample I2C Library for Baytrail I2C Controller. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: David Wei Reviewed-by: Tim He git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17546 6f19259b-4bc3-4df7-8a09-765794883524 --- Vlv2TbltDevicePkg/Include/Library/I2CLib.h | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Vlv2TbltDevicePkg/Include/Library/I2CLib.h (limited to 'Vlv2TbltDevicePkg/Include') diff --git a/Vlv2TbltDevicePkg/Include/Library/I2CLib.h b/Vlv2TbltDevicePkg/Include/Library/I2CLib.h new file mode 100644 index 0000000000..893d88519c --- /dev/null +++ b/Vlv2TbltDevicePkg/Include/Library/I2CLib.h @@ -0,0 +1,64 @@ +/** @file + Interface Definitions for I2C Lib. + + Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +--*/ + +#include +#include + +#ifndef I2C_LIB_HEADER_H +#define I2C_LIB_HEADER_H + + +/** + Reads a Byte from I2C Device. + + @param I2cControllerIndex I2C Bus no to which the I2C device has been connected + @param SlaveAddress Device Address from which the byte value has to be read + @param Offset Offset from which the data has to be read + @param ReadBytes Number of bytes to be read + @param *ReadBuffer Address to which the value read has to be stored + + @return EFI_SUCCESS If the byte value has been successfully read + @return EFI_DEVICE_ERROR Operation Failed, Device Error +**/ +EFI_STATUS +ByteReadI2C( + IN UINT8 BusNo, + IN UINT8 SlaveAddress, + IN UINT8 Offset, + IN UINTN ReadBytes, + OUT UINT8 *ReadBuffer + ); + +/** + Writes a Byte to I2C Device. + + @param I2cControllerIndex I2C Bus no to which the I2C device has been connected + @param SlaveAddress Device Address from which the byte value has to be written + @param Offset Offset from which the data has to be written + @param WriteBytes Number of bytes to be written + @param *Byte Address to which the value written is stored + + @return EFI_SUCCESS If the byte value has been successfully read + @return EFI_DEVICE_ERROR Operation Failed, Device Error +**/ +EFI_STATUS ByteWriteI2C( + IN UINT8 BusNo, + IN UINT8 SlaveAddress, + IN UINT8 Offset, + IN UINTN WriteBytes, + IN UINT8 *WriteBuffer + ); + +#endif -- cgit v1.2.3