XilinxProcessorIPLib/drivers/qspipsu/examples/xqspipsu_generic_nand_flash_polled_example.c
int FlashIsNotBusy(XQspiPsu *QspiPsuPtr)
{
	u8 FlashStatus[1];
	u8 WriteBfrPtr[2];
	int Status = XST_FAILURE;

	WriteBfrPtr[COMMAND_OFFSET] = StatusCmd;
	WriteBfrPtr[ADDRESS_1_OFFSET] = STATUS_REG_3;

	while (1) {
		FlashMsg[0].TxBfrPtr = WriteBfrPtr;
		FlashMsg[0].RxBfrPtr = NULL;
		FlashMsg[0].ByteCount = 2;
		FlashMsg[0].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
		FlashMsg[0].Flags = XQSPIPSU_MSG_FLAG_TX;

		FlashMsg[1].TxBfrPtr = NULL;
		FlashMsg[1].RxBfrPtr = FlashStatus;
		FlashMsg[1].ByteCount = 1;
		FlashMsg[1].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
		FlashMsg[1].Flags = XQSPIPSU_MSG_FLAG_RX;

		Status = XQspiPsu_PolledTransfer(QspiPsuPtr, FlashMsg, 2);
		if (Status != XST_SUCCESS) {
			return Status;
		}

		if ((FlashStatus[0] & 0x01) == 0x00) {
			return XST_SUCCESS;
		}
	}
}
/*****************************************************************************/
/**
 *
 * This API is to get flash status.
 *
 * @param	QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
 *
 * @return	XST_SUCCESS if successful, else XST_FAILURE.
 *
 * @note	This API can only be used for one flash at a time.
 *
 ******************************************************************************/
This API is to get flash status.
@param       QspiPsuPtr is a pointer to the QSPIPSU driver component to use.



@note        This API can only be used for one flash at a time.
This API is to get flash status . @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use . @note This API can only be used for one flash at a time .
int FlashIsNotBusy(XQspiPsu *QspiPsuPtr)
{
	u8 FlashStatus[1];
	u8 WriteBfrPtr[2];
	int Status = XST_FAILURE;
	WriteBfrPtr[COMMAND_OFFSET] = StatusCmd;
	WriteBfrPtr[ADDRESS_1_OFFSET] = STATUS_REG_3;
	while (1) {
		FlashMsg[0].TxBfrPtr = WriteBfrPtr;
		FlashMsg[0].RxBfrPtr = NULL;
		FlashMsg[0].ByteCount = 2;
		FlashMsg[0].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
		FlashMsg[0].Flags = XQSPIPSU_MSG_FLAG_TX;
		FlashMsg[1].TxBfrPtr = NULL;
		FlashMsg[1].RxBfrPtr = FlashStatus;
		FlashMsg[1].ByteCount = 1;
		FlashMsg[1].BusWidth = XQSPIPSU_SELECT_MODE_SPI;
		FlashMsg[1].Flags = XQSPIPSU_MSG_FLAG_RX;
		Status = XQspiPsu_PolledTransfer(QspiPsuPtr, FlashMsg, 2);
		if (Status != XST_SUCCESS) {
			return Status;
		}
		if ((FlashStatus[0] & 0x01) == 0x00) {
			return XST_SUCCESS;
		}
	}
}
int FlashIsNotBusy ( XQspiPsu * QspiPsuPtr ) { u8 FlashStatus [ 1 ] ; u8 WriteBfrPtr [ 2 ] ; int Status = XST_FAILURE ; WriteBfrPtr [ COMMAND_OFFSET ] = StatusCmd ; WriteBfrPtr [ ADDRESS_1_OFFSET ] = STATUS_REG_3 ; while ( 1 ) { FlashMsg [ 0 ] . TxBfrPtr = WriteBfrPtr ; FlashMsg [ 0 ] . RxBfrPtr = NULL ; FlashMsg [ 0 ] . ByteCount = 2 ; FlashMsg [ 0 ] . BusWidth = XQSPIPSU_SELECT_MODE_SPI ; FlashMsg [ 0 ] . Flags = XQSPIPSU_MSG_FLAG_TX ; FlashMsg [ 1 ] . TxBfrPtr = NULL ; FlashMsg [ 1 ] . RxBfrPtr = FlashStatus ; FlashMsg [ 1 ] . ByteCount = 1 ; FlashMsg [ 1 ] . BusWidth = XQSPIPSU_SELECT_MODE_SPI ; FlashMsg [ 1 ] . Flags = XQSPIPSU_MSG_FLAG_RX ; Status = XQspiPsu_PolledTransfer ( QspiPsuPtr , FlashMsg , 2 ) ; if ( Status != XST_SUCCESS ) { return Status ; } if ( ( FlashStatus [ 0 ] & 0x01 ) == 0x00 ) { return XST_SUCCESS ; } } }
This API is to get flash status.
This API is to get flash status .