XilinxProcessorIPLib/drivers/spi/examples/xspi_eeprom_example.c
void EepromRead(XSpi *SpiPtr, u16 Address, int ByteCount, EepromBuffer Buffer)
{
	/*
	 * Setup the write command with the specified address and data for the
	 * EEPROM
	 */
	Buffer[COMMAND_OFFSET]     = READ_CMD;
	Buffer[ADDRESS_MSB_OFFSET] = (u8)((Address & 0xFF00) >> 8);
	Buffer[ADDRESS_LSB_OFFSET] = (u8)(Address & 0x00FF);

	/*
	 * Send the read command to the EEPROM to read the specified number
	 * of bytes from the EEPROM, send the read command and address and
	 * receive the specified number of bytes of data in the data buffer
	 */
	TransferInProgress = TRUE;

	XSpi_Transfer(SpiPtr, Buffer, &Buffer[DATA_OFFSET],
				ByteCount + OVERHEAD_SIZE);

	/*
	 * Wait for the transfer on the SPI bus to be complete before proceeding
	 */
	while (TransferInProgress);
}
/******************************************************************************/
/**
*
* This function reads from the Microchip serial EEPROM connected to the
* SPI interface.
*
* @param 	SpiPtr is a pointer to the SPI driver component to use.
* @param 	Address contains the address to read data from in the EEPROM.
* @param 	ByteCount contains the number of bytes to read.
* @param 	Buffer is a buffer to read the data into.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function reads from the Microchip serial EEPROM connected to the
SPI interface.
This function reads from the Microchip serial EEPROM connected to the SPI interface .
void EepromRead(XSpi *SpiPtr, u16 Address, int ByteCount, EepromBuffer Buffer)
{
	Buffer[COMMAND_OFFSET]     = READ_CMD;
	Buffer[ADDRESS_MSB_OFFSET] = (u8)((Address & 0xFF00) >> 8);
	Buffer[ADDRESS_LSB_OFFSET] = (u8)(Address & 0x00FF);
	TransferInProgress = TRUE;
	XSpi_Transfer(SpiPtr, Buffer, &Buffer[DATA_OFFSET],
				ByteCount + OVERHEAD_SIZE);
	while (TransferInProgress);
}
void EepromRead ( XSpi * SpiPtr , u16 Address , int ByteCount , EepromBuffer Buffer ) { Buffer [ COMMAND_OFFSET ] = READ_CMD ; Buffer [ ADDRESS_MSB_OFFSET ] = ( u8 ) ( ( Address & 0xFF00 ) >> 8 ) ; Buffer [ ADDRESS_LSB_OFFSET ] = ( u8 ) ( Address & 0x00FF ) ; TransferInProgress = TRUE ; XSpi_Transfer ( SpiPtr , Buffer , & Buffer [ DATA_OFFSET ] , ByteCount + OVERHEAD_SIZE ) ; while ( TransferInProgress ) ; }
This function reads from the Microchip serial EEPROM connected to the
SPI interface.
This function reads from the Microchip serial EEPROM connected to the SPI interface .
/*
	 * Setup the write command with the specified address and data for the
	 * EEPROM
	 */ /*
	 * Send the read command to the EEPROM to read the specified number
	 * of bytes from the EEPROM, send the read command and address and
	 * receive the specified number of bytes of data in the data buffer
	 */ /*
	 * Wait for the transfer on the SPI bus to be complete before proceeding
	 */