XilinxProcessorIPLib/drivers/spi/examples/xspi_stm_flash_example.c
int SpiStmFlashGetStatus(XSpi *SpiPtr)
{
	int Status;

	/*
	 * Prepare the Write Buffer.
	 */
	WriteBuffer[BYTE1] = STM_COMMAND_STATUSREG_READ;

	/*
	 * Initiate the Transfer.
	 */
	TransferInProgress = TRUE;
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, ReadBuffer,
						STM_STATUS_READ_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 reads the Status register of the STM Flash.
*
* @param	SpiPtr is a pointer to the instance of the Spi device.
*
* @return	XST_SUCCESS if successful else XST_FAILURE.
*
* @note		The status register content is stored at the second byte pointed
*		by the ReadBuffer.
*
******************************************************************************/
This function reads the Status register of the STM Flash.
This function reads the Status register of the STM Flash .
int SpiStmFlashGetStatus(XSpi *SpiPtr)
{
	int Status;
	WriteBuffer[BYTE1] = STM_COMMAND_STATUSREG_READ;
	TransferInProgress = TRUE;
	Status = XSpi_Transfer(SpiPtr, WriteBuffer, ReadBuffer,
						STM_STATUS_READ_BYTES);
	if(Status != XST_SUCCESS) {
		return XST_FAILURE;
	}
	while(TransferInProgress);
	if(ErrorCount != 0) {
		ErrorCount = 0;
		return XST_FAILURE;
	}
	return XST_SUCCESS;
}
int SpiStmFlashGetStatus ( XSpi * SpiPtr ) { int Status ; WriteBuffer [ BYTE1 ] = STM_COMMAND_STATUSREG_READ ; TransferInProgress = TRUE ; Status = XSpi_Transfer ( SpiPtr , WriteBuffer , ReadBuffer , STM_STATUS_READ_BYTES ) ; if ( Status != XST_SUCCESS ) { return XST_FAILURE ; } while ( TransferInProgress ) ; if ( ErrorCount != 0 ) { ErrorCount = 0 ; return XST_FAILURE ; } return XST_SUCCESS ; }
This function reads the Status register of the STM Flash.
This function reads the Status register of the STM Flash .
/*
	 * Prepare the Write Buffer.
	 */ /*
	 * Initiate the Transfer.
	 */ /*
	 * Wait till the Transfer is complete and check if there are any errors
	 * in the transaction..
	 */