Changes for V4 ============== 1) Remove Unicode character from C source file 2) Move delete of QuarkSocPkg\QuarkNorthCluster\Binary\QuarkMicrocode from QuarkPlatformPkg commit to QuarkSocPkg commit Changes for V2 ============== 1) Sync with new APIs in SmmCpuFeaturesLib class 2) Use new generic PCI serial driver PciSioSerialDxe in MdeModulePkg 3) Remove PCI serial driver from QuarkSocPkg 4) Apply optimizations to MtrrLib from MtrrLib in UefiCpuPkg 5) Convert all UNI files to utf-8 6) Replace tabs with spaces and remove trailing spaces 7) Add License.txt Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19286 6f19259b-4bc3-4df7-8a09-765794883524
159 lines
5.6 KiB
C
159 lines
5.6 KiB
C
/** @file
|
|
|
|
Intel I2C library implementation built upon I/O library
|
|
|
|
|
|
Copyright (c) 2013-2015 Intel Corporation.
|
|
|
|
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_
|
|
|
|
#include "I2cRegs.h"
|
|
|
|
/**
|
|
|
|
The I2cWriteByte() function is a wrapper function for the WriteByte() function.
|
|
Provides a standard way to execute a standard single byte write to an IC2 device
|
|
(without accessing sub-addresses), as defined in the I2C Specification.
|
|
|
|
@param SlaveAddress The I2C slave address of the device
|
|
with which to communicate.
|
|
|
|
@param AddrMode I2C Addressing Mode: 7-bit or 10-bit address.
|
|
|
|
@param Buffer Contains the value of byte data to execute to the
|
|
I2C slave device.
|
|
|
|
|
|
@retval EFI_SUCCESS Transfer success.
|
|
@retval EFI_INVALID_PARAMETER This or Buffer pointers are invalid.
|
|
@retval EFI_TIMEOUT Timeout while waiting xfer.
|
|
@retval EFI_ABORTED Controller aborted xfer.
|
|
@retval EFI_DEVICE_ERROR Device error detected by controller.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
I2cWriteByte (
|
|
IN EFI_I2C_DEVICE_ADDRESS SlaveAddress,
|
|
IN EFI_I2C_ADDR_MODE AddrMode,
|
|
IN OUT VOID *Buffer
|
|
);
|
|
|
|
/**
|
|
|
|
The I2cReadByte() function is a wrapper function for the ReadByte() function.
|
|
Provides a standard way to execute a standard single byte read to an I2C device
|
|
(without accessing sub-addresses), as defined in the I2C Specification.
|
|
|
|
@param SlaveAddress The I2C slave address of the device
|
|
with which to communicate.
|
|
|
|
@param AddrMode I2C Addressing Mode: 7-bit or 10-bit address.
|
|
|
|
@param Buffer Contains the value of byte data read from the
|
|
I2C slave device.
|
|
|
|
|
|
@retval EFI_SUCCESS Transfer success.
|
|
@retval EFI_INVALID_PARAMETER This or Buffer pointers are invalid.
|
|
@retval EFI_TIMEOUT Timeout while waiting xfer.
|
|
@retval EFI_ABORTED Controller aborted xfer.
|
|
@retval EFI_DEVICE_ERROR Device error detected by controller.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
I2cReadByte (
|
|
IN EFI_I2C_DEVICE_ADDRESS SlaveAddress,
|
|
IN EFI_I2C_ADDR_MODE AddrMode,
|
|
IN OUT VOID *Buffer
|
|
);
|
|
|
|
/**
|
|
|
|
The I2cWriteMultipleByte() function is a wrapper function for the WriteMultipleByte()
|
|
function. Provides a standard way to execute multiple byte writes to an I2C device (e.g. when
|
|
accessing sub-addresses or writing block of data), as defined in the I2C Specification.
|
|
|
|
@param SlaveAddress The I2C slave address of the device
|
|
with which to communicate.
|
|
|
|
@param AddrMode I2C Addressing Mode: 7-bit or 10-bit address.
|
|
|
|
@param Length No. of bytes to be written.
|
|
|
|
@param Buffer Contains the value of byte to be written to the
|
|
I2C slave device.
|
|
|
|
@retval EFI_SUCCESS Transfer success.
|
|
@retval EFI_INVALID_PARAMETER This, Length or Buffer pointers are invalid.
|
|
@retval EFI_UNSUPPORTED Unsupported input param.
|
|
@retval EFI_TIMEOUT Timeout while waiting xfer.
|
|
@retval EFI_ABORTED Controller aborted xfer.
|
|
@retval EFI_DEVICE_ERROR Device error detected by controller.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
I2cWriteMultipleByte (
|
|
IN EFI_I2C_DEVICE_ADDRESS SlaveAddress,
|
|
IN EFI_I2C_ADDR_MODE AddrMode,
|
|
IN UINTN *Length,
|
|
IN OUT VOID *Buffer
|
|
);
|
|
|
|
/**
|
|
|
|
The I2cReadMultipleByte() function is a wrapper function for the ReadMultipleByte
|
|
function. Provides a standard way to execute multiple byte writes to an IC2 device
|
|
(e.g. when accessing sub-addresses or when reading block of data), as defined
|
|
in the I2C Specification (I2C combined write/read protocol).
|
|
|
|
@param SlaveAddress The I2C slave address of the device
|
|
with which to communicate.
|
|
|
|
@param AddrMode I2C Addressing Mode: 7-bit or 10-bit address.
|
|
|
|
@param WriteLength No. of bytes to be written. In this case data
|
|
written typically contains sub-address or sub-addresses
|
|
in Hi-Lo format, that need to be read (I2C combined
|
|
write/read protocol).
|
|
|
|
@param ReadLength No. of bytes to be read from I2C slave device.
|
|
need to be read.
|
|
|
|
@param Buffer Contains the value of byte data read from the
|
|
I2C slave device.
|
|
|
|
@retval EFI_SUCCESS Transfer success.
|
|
@retval EFI_INVALID_PARAMETER This, WriteLength, ReadLength or Buffer
|
|
pointers are invalid.
|
|
@retval EFI_UNSUPPORTED Unsupported input param.
|
|
@retval EFI_TIMEOUT Timeout while waiting xfer.
|
|
@retval EFI_ABORTED Controller aborted xfer.
|
|
@retval EFI_DEVICE_ERROR Device error detected by controller.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
I2cReadMultipleByte (
|
|
IN EFI_I2C_DEVICE_ADDRESS SlaveAddress,
|
|
IN EFI_I2C_ADDR_MODE AddrMode,
|
|
IN UINTN *WriteLength,
|
|
IN UINTN *ReadLength,
|
|
IN OUT VOID *Buffer
|
|
);
|
|
|
|
#endif
|