From 8322634459ac602d9fbcca30e96b24ff098acb3c Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Wed, 3 May 2017 14:48:15 +0100 Subject: Platform,Silicon: Import Hisilicon D02,D03,D05 and HiKey Imported from commit efd798c1eb of https://git.linaro.org/uefi/OpenPlatformPkg.git Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Leif Lindholm --- Silicon/Hisilicon/Include/Library/I2CLib.h | 73 ++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Silicon/Hisilicon/Include/Library/I2CLib.h (limited to 'Silicon/Hisilicon/Include/Library/I2CLib.h') diff --git a/Silicon/Hisilicon/Include/Library/I2CLib.h b/Silicon/Hisilicon/Include/Library/I2CLib.h new file mode 100644 index 0000000000..36e9f5f5f6 --- /dev/null +++ b/Silicon/Hisilicon/Include/Library/I2CLib.h @@ -0,0 +1,73 @@ +/** @file +* +* Copyright (c) 2015, Hisilicon Limited. All rights reserved. +* Copyright (c) 2015, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which 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. +* +**/ + + +#ifndef _I2C_LIB_H_ +#define _I2C_LIB_H_ + +//I2C0 or I2C1 +typedef enum { + DEVICE_TYPE_SPD = 0, + DEVICE_TYPE_E2PROM, + DEVICE_TYPE_CPLD_3BYTE_OPERANDS, + DEVICE_TYPE_CPLD_4BYTE_OPERANDS +}I2C_DEVICE_TYPE; + + +typedef enum { + Normal = 0, + Fast, + SPEED_MODE_MAX +}SPEED_MODE; + + +#define I2C_PORT_MAX 10 + + + +typedef struct { + UINT32 Socket; + UINT32 Port; + I2C_DEVICE_TYPE DeviceType; + UINT32 SlaveDeviceAddress; +}I2C_DEVICE; + + +UINTN +EFIAPI +I2CInit(UINT32 Socket, UINT32 Port, SPEED_MODE SpeedMode); + +EFI_STATUS +EFIAPI +I2CWrite(I2C_DEVICE *I2cInfo, UINT16 InfoOffset, UINT32 ulLength, UINT8 *pBuf); + +EFI_STATUS +EFIAPI +I2CRead(I2C_DEVICE *I2cInfo, UINT16 InfoOffset,UINT32 ulRxLen,UINT8 *pBuf); + +EFI_STATUS +EFIAPI +I2CWriteMultiByte(I2C_DEVICE *I2cInfo, UINT32 InfoOffset, UINT32 ulLength, UINT8 *pBuf); + +EFI_STATUS +EFIAPI +I2CReadMultiByte(I2C_DEVICE *I2cInfo, UINT32 InfoOffset,UINT32 ulRxLen,UINT8 *pBuf); + +EFI_STATUS +EFIAPI +I2CSdaConfig(UINT32 Socket, UINT32 Port); + + +#endif -- cgit v1.2.3