XilinxProcessorIPLib/drivers/spi/examples/xspi_intel_flash_example.c
int SpiIntelFlashWriteStatus(XSpi *SpiPtr, u8 StatusRegister)
{
	int Status;

	/*
	 * Prepare the Write Buffer.
	 */
	WriteBuffer[BYTE1] = INTEL_COMMAND_STATUSREG_WRITE;
	WriteBuffer[BYTE2] = StatusRegister;

	/*
	 * Initiate the Transfer.
	 */
	TransferInProgress = TRUE;
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, NULL,
				INTEL_STATUS_WRITE_BYTES);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}

	/*
	 * Wait till the Transfer is complete and check if there are any errors
	 * in the transaction..
	 */
	while(TransferInProgress);
	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function writes to the Status register of the Intel Flash.
*
* @param	SpiPtr is a pointer to the instance of the Spi device.
* @param	StatusRegister is the value to be written to the status register
* 		of the flash device.
*
* @return	XST_SUCCESS if successful else XST_FAILURE.
*
* @note		The status register content is stored at the second byte pointed
*		by the ReadPtr.
*
******************************************************************************/
This function writes to the Status register of the Intel Flash.
This function writes to the Status register of the Intel Flash .
int SpiIntelFlashWriteStatus(XSpi *SpiPtr, u8 StatusRegister)
{
	int Status;
	WriteBuffer[BYTE1] = INTEL_COMMAND_STATUSREG_WRITE;
	WriteBuffer[BYTE2] = StatusRegister;
	TransferInProgress = TRUE;
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, NULL,
				INTEL_STATUS_WRITE_BYTES);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	while(TransferInProgress);
	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
int SpiIntelFlashWriteStatus ( XSpi * SpiPtr , u8 StatusRegister ) { int Status ; WriteBuffer [ BYTE1 ] = INTEL_COMMAND_STATUSREG_WRITE ; WriteBuffer [ BYTE2 ] = StatusRegister ; TransferInProgress = TRUE ; Status = XSpi_Transfer ( SpiPtr , WriteBuffer , NULL , INTEL_STATUS_WRITE_BYTES ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } while ( TransferInProgress ) ; if ( ErrorCount != 0 ) { ErrorCount = 0 ; return XST_FAILURE ; } return XST_SUCCESS ; }
This function writes to the Status register of the Intel Flash.
This function writes to the Status register of the Intel Flash .
/*
	 * Prepare the Write Buffer.
	 */ /*
	 * Initiate the Transfer.
	 */ /*
	 * Wait till the Transfer is complete and check if there are any errors
	 * in the transaction..
	 */