XilinxProcessorIPLib/drivers/iicps/examples/xiicps_eeprom_intr_example.c
static int EepromReadData(XIicPs *IicInstance, u8 *BufferPtr, u16 ByteCount)
{
	int Status;
	AddressType Address = EEPROM_START_ADDRESS;
	int WrBfrOffset;

	/*
	 * Position the Pointer in EEPROM.
	 */
	if (PageSize == PAGE_SIZE_16) {
		WriteBuffer[0] = (u8) (Address);
		WrBfrOffset = 1;
	} else {
		WriteBuffer[0] = (u8) (Address >> 8);
		WriteBuffer[1] = (u8) (Address);
		WrBfrOffset = 2;
	}

	Status = EepromWriteData(IicInstance, WrBfrOffset);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	ReceiveComplete = FALSE;

	/*
	 * Receive the Data.
	 */
	XIicPs_MasterRecv(IicInstance, BufferPtr,
			   ByteCount, EepromSlvAddr);

	while (ReceiveComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}

	/*
	 * Wait until bus is idle to start another transfer.
	 */
	while (XIicPs_BusIsBusy(IicInstance));

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
* 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.
*
* @note		None.
*
******************************************************************************/
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 .
static int EepromReadData(XIicPs *IicInstance, u8 *BufferPtr, u16 ByteCount)
{
	int Status;
	AddressType Address = EEPROM_START_ADDRESS;
	int WrBfrOffset;
	if (PageSize == PAGE_SIZE_16) {
		WriteBuffer[0] = (u8) (Address);
		WrBfrOffset = 1;
	} else {
		WriteBuffer[0] = (u8) (Address >> 8);
		WriteBuffer[1] = (u8) (Address);
		WrBfrOffset = 2;
	}
	Status = EepromWriteData(IicInstance, WrBfrOffset);
	if (Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	ReceiveComplete = FALSE;
	XIicPs_MasterRecv(IicInstance, BufferPtr,
			   ByteCount, EepromSlvAddr);
	while (ReceiveComplete == FALSE) {
		if (0 != TotalErrorCount) {
			return XST_FAILURE;
		}
	}
	while (XIicPs_BusIsBusy(IicInstance));
	return XST_SUCCESS;
}
static int EepromReadData ( XIicPs * IicInstance , u8 * BufferPtr , u16 ByteCount ) { int Status ; AddressType Address = EEPROM_START_ADDRESS ; int WrBfrOffset ; if ( PageSize == PAGE_SIZE_16 ) { WriteBuffer [ 0 ] = ( u8 ) ( Address ) ; WrBfrOffset = 1 ; } else { WriteBuffer [ 0 ] = ( u8 ) ( Address >> 8 ) ; WriteBuffer [ 1 ] = ( u8 ) ( Address ) ; WrBfrOffset = 2 ; } Status = EepromWriteData ( IicInstance , WrBfrOffset ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } ReceiveComplete = FALSE ; XIicPs_MasterRecv ( IicInstance , BufferPtr , ByteCount , EepromSlvAddr ) ; while ( ReceiveComplete == FALSE ) { if ( 0 != TotalErrorCount ) { return XST_FAILURE ; } } while ( XIicPs_BusIsBusy ( IicInstance ) ) ; return XST_SUCCESS ; }
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.
	 */