lib/sw_apps/imgsel/src/xis_i2c.c
int XIs_EepromReadData(u8 *BufferPtr, u16 ReadAddress, u16 ByteCount,
									u32 WrBfrOffset)
{
	int Status = XST_FAILURE;
	AddressType Address = ReadAddress;
	u32 Timeout = XIICPS_POLL_DEFAULT_TIMEOUT_VAL;

	/*
	 * Position the Pointer in EEPROM.
	 */
	WriteBuffer[0U] = (u8)(Address);

	Status = XIs_EepromWriteData(&IicInstance, WrBfrOffset);
	if (Status != XST_SUCCESS) {
		Status = XIS_EEPROM_WRITE_ERROR;
		goto END;
	}
	/*
	 * Receive the Data.
	 */
	Status = XIicPs_MasterRecvPolled(&IicInstance, BufferPtr,
			ByteCount, XIS_EEPROM_ADDRESS);
	if (Status != XST_SUCCESS) {
		Status = XIS_IICPS_MASTER_RECV_POLLED_ERROR;
		goto END;
	}

	/*
	 * Wait until bus is idle to start another transfer.
	 */
	while (Timeout != 0U) {
		if(XIicPs_BusIsBusy(&IicInstance) == FALSE ) {
			break;
		}
		XIs_Delay(XIS_DELAY);
		Timeout--;
		if(!Timeout) {
			Status = XIS_IICPS_TIMEOUT;
			goto END;
		}
	}

END:
	return Status;
}
/*****************************************************************************/
/**
 * This function reads data from the IIC serial EEPROM into a specified buffer.
 *
 * @param	BufferPtr contains the address of the data buffer to be filled.
 * @param	ByteCount contains the number of bytes in the buffer to be read.
 *
 * @return	XST_SUCCESS if successful else XST_FAILURE.
 *
 ******************************************************************************/
This function reads data from the IIC serial EEPROM into a specified buffer.
@param       BufferPtr contains the address of the data buffer to be filled.
@param       ByteCount contains the number of bytes in the buffer to be read.


This function reads data from the IIC serial EEPROM into a specified buffer . @param BufferPtr contains the address of the data buffer to be filled . @param ByteCount contains the number of bytes in the buffer to be read .
int XIs_EepromReadData(u8 *BufferPtr, u16 ReadAddress, u16 ByteCount,
									u32 WrBfrOffset)
{
	int Status = XST_FAILURE;
	AddressType Address = ReadAddress;
	u32 Timeout = XIICPS_POLL_DEFAULT_TIMEOUT_VAL;
	WriteBuffer[0U] = (u8)(Address);
	Status = XIs_EepromWriteData(&IicInstance, WrBfrOffset);
	if (Status != XST_SUCCESS) {
		Status = XIS_EEPROM_WRITE_ERROR;
		goto END;
	}
	Status = XIicPs_MasterRecvPolled(&IicInstance, BufferPtr,
			ByteCount, XIS_EEPROM_ADDRESS);
	if (Status != XST_SUCCESS) {
		Status = XIS_IICPS_MASTER_RECV_POLLED_ERROR;
		goto END;
	}
	while (Timeout != 0U) {
		if(XIicPs_BusIsBusy(&IicInstance) == FALSE ) {
			break;
		}
		XIs_Delay(XIS_DELAY);
		Timeout--;
		if(!Timeout) {
			Status = XIS_IICPS_TIMEOUT;
			goto END;
		}
	}
END:
	return Status;
}
int XIs_EepromReadData ( u8 * BufferPtr , u16 ReadAddress , u16 ByteCount , u32 WrBfrOffset ) { int Status = XST_FAILURE ; AddressType Address = ReadAddress ; u32 Timeout = XIICPS_POLL_DEFAULT_TIMEOUT_VAL ; WriteBuffer [ 0U ] = ( u8 ) ( Address ) ; Status = XIs_EepromWriteData ( & IicInstance , WrBfrOffset ) ; if ( Status != XST_SUCCESS ) { Status = XIS_EEPROM_WRITE_ERROR ; goto END ; } Status = XIicPs_MasterRecvPolled ( & IicInstance , BufferPtr , ByteCount , XIS_EEPROM_ADDRESS ) ; if ( Status != XST_SUCCESS ) { Status = XIS_IICPS_MASTER_RECV_POLLED_ERROR ; goto END ; } while ( Timeout != 0U ) { if ( XIicPs_BusIsBusy ( & IicInstance ) == FALSE ) { break ; } XIs_Delay ( XIS_DELAY ) ; Timeout -- ; if ( ! Timeout ) { Status = XIS_IICPS_TIMEOUT ; goto END ; } } END : return Status ; }
This function reads data from the IIC serial EEPROM into a specified buffer.
This function reads data from the IIC serial EEPROM into a specified buffer .
/*
	 * Position the Pointer in EEPROM.
	 */ /*
	 * Receive the Data.
	 */ /*
	 * Wait until bus is idle to start another transfer.
	 */